Creating Empty Applications for iOS in XCode6
Helpful resource:
http://stackoverflow.com/questions/25783282/how-to-create-an-empty-application-in-xcode-6-without-storyboard

@theartofmadeline

titsay
macklin celebrini has autism

â
Monterey Bay Aquarium
YOU ARE THE REASON
will byers stan first human second
Noah Kahan
The Stonewall Inn
Fai_Ryy
Sweet Seals For You, Always
NASA
EXPECTATIONS

oozey mess

Origami Around
Cosimo Galluzzi
sheepfilms
RMH

bliss lane

seen from United States

seen from TĂźrkiye
seen from Russia
seen from Spain
seen from T1
seen from United States

seen from United States

seen from United Kingdom
seen from Georgia

seen from Canada
seen from Haiti
seen from Zambia
seen from Singapore
seen from Saudi Arabia
seen from Malaysia

seen from Ecuador
seen from Cameroon
seen from Croatia

seen from France
seen from United States
@beginner-ios-development
Creating Empty Applications for iOS in XCode6
Helpful resource:
http://stackoverflow.com/questions/25783282/how-to-create-an-empty-application-in-xcode-6-without-storyboard

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch ⢠No registration required ⢠HD streaming
OAuth 2
Good resource on how OAuth 2 works:
 http://www.quora.com/How-does-OAuth-2-0-work
 Summary of best answer:
 In order for Site A to access User Xâs information on Site B, the following steps occur:
1. Site A registers User X with Site B. Site A obtains a Secret and an ID.
2. User X tells Site A to access Site B. User X is sent to Site B; Site B is informed to give Site A permission to specific information.
3. Site B redirects User X to Site A. Site B also provides User X an Authorization Code.
4. Site A sends its Authorization Code and Secret to Site B in return for a Security Token.
5. On behalf of User X, Site A makes requests to Site B. Requests bundle the Security Token along with requests.
Separation of Concerns
Model-View-Controller is a great example of separation of concerns. Within computer science, separation of concerns is a design principle that advocates separating a program into distinct sections; each section then addresses one concern, which is information that affects the code of a computer program. You achieve separation of concerns â i.e., modularity â by encapsulating information inside a section of code. By achieving separation of concerns, you simplify development and maintenance; you can also re-use individual sections of code, and independently update sections without contagion issues; the details of one section can be opaque to another.
Clearing Instagram Cookies
The code below would clear Instagram cookies:
-(void) clearInstagramCookies { for (NSHTTPCookie *cookie in [[NSHTTPCookieStorage sharedHTTPCookie Storage] cookies]) { NSRange domainRange = [cookie.domain rangeOfString:@"instagram.com"]; if(domainRange.location != NSNotFound) { [[NSHTTPCookieStorage shared HTTPCookie Storage] deleteCookie:cookie]; } } }
Note that NSHTTPCookieStorage (the so-called "cookie jar") stores and manages web site cookies, which are represented as NSHTTPCookie objects.
Encapsulation
In object-oriented programming, objects interact with one another by sending messages to each other. All an object knows about another object is the objectâs interface; i.e., all object A knows about object B its interface. Object Aâs data and logic is hidden from other objects, as is Object Bâs. The interface âencapsulatesâ the objectâs code and data. A userâs object is then isolated from any implementation changes; that is, a user of Object B would be isolated from any implementation changes in Object B, as long as the interface remains the same. As another example, if we send the explode message to Object B, it doesnât matter to us as a user how the developer implemented the code to handle the explode message. All we need to know is the correct protocol for interacting with Object B.Â

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch ⢠No registration required ⢠HD streaming
Basic Swift Functions
Basic functions in Swift are also fairly intuitive. As an example:
func favoriteSaramagoNovel() {
        println(âThe last days of Ricardo Reisâ)
}
//Output would look like:
// The last days of Ricardo Reis
 Now letâs try it by passing a parameter with no default value
func favoriteSaramagoNovel(novel: String) {
   println("My favorite Saramago novel is \(novel).")
}
favoriteSaramagoNovel("Blindness")
//Output would look like this assuming favoriteSaramagoNovel(âBlindnessâ):
//My favorite Saramago novel is Blindness
 We can leverage tuples to compound multiple values and return more than one piece of data. As an example:
func favoriteMovies(name: String = âBlade 2â)Â -> (Int, String) {
        let rottenTomatoRating = 99
        let movieTitle = âMy favorite vampire movie is â + name
        return (rottenTomatoesRating, movieTitle)
}
Putting this to use:
func favoriteMovieName(name: String = "Blade 2") -> (Int, String) {
   let rottenTomatoRating = 99
   let movieTitle = "My favorite vampire movie is " + name
   return (rottenTomatoRating, movieTitle)
}
let (ratingFromTomato, movieName) = favoriteMovieName()
println("My favorite vampire movie is \("movieName") and its Rotten Tomatoes rating is \("ratingFromTomato"). I hope they show it at Doc Films!")
Arrays, Dictionaries, & Iteration in Swift vs. Objective-C
Dictionaries and arrays are very easy to specify in Swift. For example, vs. Objective-C
Objective C (Arrays)
NSMutableArray *favoriteDrinks = [NSMutableArray arrayWithArray:@[@âGunpowder teaâ, @âCoconut waterâ]];
Swift:
var *favoriteDrinks = [âGunpowder teaâ, âCoconut waterâ]
Note that arrays in Objective-C can include all types of objects; arrays in Swift usually include like-type items.
Objective C (Dictionaries):
NSMutableDictionary *quantifiedSelf = [NSMutableDictionary dictionaryWithDictionary:@{@âWristbandâ: @âFitbitâ, @âAlarmâ:Â @âLightboxâ}];Â
Swift (Dictionaries):
let quantifiedSelf = [âWristbandâ: âFitbitâ, âAlarmâ : âLightboxâ]
If we were to iterate over the above array in Objective-C, it would look like:
NSMutableDictionary *quantifiedSelf = [NSMutableDictionary
for (NSString *key in quantifiedSelf) {
           NSLog(@The quantified self item %@ is %@.â, key, quantifiedSelf[key]);
Output from above would be:
// The quantified self item Wristband is Fitbit.
// The quantified self item Alarm is Lightbox.
In Swift, it would like:
let quantifiedSelf = [âWristbandâ: âFitbitâ, âAlarmâ : âLightboxâ]
for (item, nameOfItem) in quantifiedSelf {
           println(âThe quantified self item \(item) is \(nameOfItem).â)
}
 // The output is:
 // The quantified self item Wristband is Fitbit.
// The quantified self item Alarm is Lightbox.
Swift Variables & String Interpolation
In Swift, creating properties and setting default values for them is very easy. For example:
 let excellentBreakfast = âCorned beef hashâ
var myFavoriteChicagoHotel = âThe Peninsulaâ
Note that let is used for immutable variables; var is used for variables that could change (though Iâm not sure the above is a great example). The type of each variable is inferred by Swift based on the specified default values. Classes do not need to be specified. That said, if you choose not to specify a default value, you do need to declare what class the variable belongs to, for example:
let whitStillmanMovieTitle : String
 String interpolation in Swift is also fairly straightforward. For example
let googleShares = 1000
let restaurant = âHot Dougsâ
let sentence = âI cashed in all \(googleShares) shares of Google stock to build up a huge inventory of pickled meats from \(restaurant).â
If we wanted to spend some of the money from our share redemption on Bubble tea, we might change things slightly:
let googleShares = 1000
var restaurant = âHot Dougsâ
restaurant += â and Joy Yee.â
let sentence = âI cashed in all \(googleShares) shares of Google stock to build up a huge inventory of pickled meats and bubble tea from \(restaurant).â
Swift Functions and Tuples
Functions in swift resemble methods in Objective-C. However, they can also do the following:
A functionâs parameters can have default values
Functions can return more than one value using Tuples. As an example, in Objective-C, you can only return one variable from a method, i.e.:
-(NSString *) scifiWriterFirstName
In Swift, you can create a Tuple, and group multiple values into one variable:
let fullScifiWriterName = (âNealâ, âStephensonâ)
The above tuple â fullScifiWriterName â could be returned from a method, but would contain two separate values. Note that tuples arenât restricted by type, and could contain a variety of types. For example:
let goodRestaurants = (âMasaâ, 1847, âDonâs Bogamâ)
Functions are objects, and they can be passed along to other functions
Note that functions are not required to be part of a specific class.
Further Notes on KVO
Setting up an observer of a property is a three-step process:Â
1. Determine whether your problem is one where key-value observing could be beneficial; a good example is a situation where an object needs to be notified when there are changes to a specific property in another object. An example from the Apple Docs is a PersonObject wanting to know when the @property int accountBalance changes on BankObject.
2. In order for KVO to work, the PersonObject has to register as an observer of the BankObjectâs accountBalance property. It does so by sending an addObserver:forKeyPath:options:context message, in code:
[bankInstance addObserver:personInstance forKeyPath:@âaccountbalanceâ options:NSKeyValueObservingOptionNew context:NULL];
The code above generates a connection between the two objects â not between the two closes.
3. In order to respond to change notifications, the observer has to implement the observeValueForKeyPath:ofObject:change:context: method. In code:
-(void) observeValueForKeyPath:(NSString *)keyPathofObject:(id)object change:(NSDictionary *)change context:(void *)context {
//custom implementation; call the superclassâs implementation if the superclass implements it
}
The above method is invoked when the value of an observed property is changed in a KVO-compliant manner, or if a key upon which it depends is changed. For instance:
[bankInstance setAccountBalance:50]; would result in BankObject automatically notifying PersonObject of a chance in the Account Balance property. The PersonObject would then react accordingly based on the custom method defined above.

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch ⢠No registration required ⢠HD streaming
A Brief Primer on Auto Layout (Part I)
A Brief Primer on Auto Layout (Part I)
Auto Layout is based on the Cassowary constraint-solving toolkit. Per the Cassowary SourceForge project page:
âThe Cassowary incremental constraint solving toolkit efficiently solves systems of linear equations and inequalities. Constraints may be either requirements or preferences. Re-solving the system happens rapidly, supporting UI applications.â
User interfaces naturally generate inequality and equality relationships; the Cassowary allows for a rules-based system that lets developers describe relationships between views using constraints. The constraints are rules that define how one viewâs layouts are set and/or limited in relation to another viewâs layouts.
By defining these relationships, AutoLayout can, for example:
-Â Â Â Â Â Â Match one viewâs size to another viewâs size; for example, they will always remain the same height or width
-Â Â Â Â Â Â Center a view in a superview; even if the superview reshapes, the view remains centered within it
-Â Â Â Â Â Â Offset a pair of items by a constant padding
You use constraints to describe the view layout. Constraints define how things relate to one another, and how they can be laid out. For example, you might say, âalways line up this series of items in a vertical rowâ, or, âthis item will resize itself to match the width of that itemâ.
Constraints belong to the NSLayoutConstraint class. The class specifies relationships between view attributes â items like height, width, positions, and centers â using both equalities and greater or less than equal relations. It is required that constraints be both satisfiable and sufficient. In order for constraint satisfaction to occur, the rule must make sense individually and as part of a whole â i.e., a valid rule that plays part of a larger whole. As an example, a view canât be both above another view and below it. Rules need to be consistent. In addition, rules also need to be specific enough and/or sufficient; for example, you want to provide a well-defined size and position for a view so they arenât scattered all over the user interface.
Constraints themselves use a constrained geometric vocabulary. There are attributes â which are the ânounsâ that describe the position within a viewâs alignment rectangle, and there are âverbsâ, which describe how the attributes compare to each other. In a simple view rectangle, the attributes would include: 1) left (minimum X), 2) right (maximum X), 3) top (minimum Y), 4) bottom (maximum Y), 5) width, 6) height, 7) CenterX (the X-axis center of the viewâs alignment rectangle), 8) CenterY (the Y-axis center of the viewâs alignment rectangle), and 9) baseline, which is the alignment rectangleâs baseline, which is typically specified as a fixed offset above its bottom attribute. Relations, on the other  hand, compare values. There are three relations that set equality or set lower and upper bounds for comparison: 1) NSLayoutRelationLessThanOrEqual (for less-than-or-equal inequality), 2) NSLayoutRelationalEquality (test for equality), and 3) NSLayoutRelationGreaterThanOrEqual (for greater-than-or-equal-to-inequality).
Table Views
Table views are user interface objects that present data in a scrollable list of multiple rows that may be divided into specific sections. Generally, table views are used for the following purposes:
 1. Navigate hierarchically structured data
2. Present an indexed list of items
3. Display detailed information and controls clustered by group
4. Present a list of options for user selection
 Table views consist of only one column that allows for vertical scrolling. The table view has rows in each section. Each section can have a header or a footer that will display text or an image. UIKit framework identifies rows and sections through an index number. The index numbers for sections range from 0 to n-1 from the top of a table view to the bottom element; rows are numbered from 0 to n-1 within a section. Table views can themselves have their own headers and footer, distinct from a section header and footer. Table headers show up above the first row of the first section; table footers show up after the last row of the last section.
 A table view itself is an instance of the UITableViewClass. It is set as one of two styles â plain or grouped. Plain table views are unbroken lists; grouped tables have distinct sections. Table views have a datasource and might have delegates. Data sources provide â you guessed it, the data that is used to fill in the sections and rows of the table view. The data source mediates between the appâs data model (i.e., the model objects) and the table view. Delegate objects are used to further customize appearance and behavior. The data source and delegate are often the same object, which is usually a custom subclass of UITableViewController. The data source adopts the UITableViewDataSource protocol. UITableViewDataSource has two required methods, the tableView:numberOfRowsInSection: method that tells the table view how many rows to display in each section, and the tableView:cellForRowAtIndexPath: method, which provides the cell to display for each row in the table. The delegate adopts the UITableViewDelegate protocol, which has no required methods. The protocol declares methods that allow the delegate to modify visual elements of the table view, manage selections within the table view, and support editing of individual rows in the table view.
 Visible rows within a table view are drawn using cells, which are UITableViewCell objects. Cells are views that can display text, images, or other content. They can also have background views for normal and selected states. UIKit defiens four standard cell styles â each with its own layout of the three default content elements: main label, detail label, and image.
 When a user taps on a row, the delegate of the table view is made aware via message. The delegate is passed the index of the row and the section that the row is located in; it then uses this information to locate the corresponding item in the appâs model. The item will be either an intermediate level in a hierarchy of data or a âleaf nodeâ in a hierarchy.
 In addition, you can enter editing mode in a table view in which a user can insert or delete rows, or relocate them in a table. When users try to insert, delete, or reorder rows, the table view will send a sequence of messages to its data source and delegate so it can manage these operations.Â
Visual Formatting Strings
Visual formatting strings let you draw an outline of your views by utilizing keyboard characters. Take a look at this sample code:
 ```
[self.contentView addconstraints:[NSLayoutConstraint constraintsWithVisualFormat:@âH:|[_someImageView]|â options:kNilOptions metrics:nil views:viewDictionary]];
```Â
Visual format strings should begin with H: (horizontal) or V: (vertical).  | represents the superview, and [oneView] represents one view. By setting the above to H:|[_someImageView]| we are stating that _someImageView should exactly match the width of its superview.
Introspection
Introspection is a feature of the Objective C runtime. Introspection allows an object to answer questions about itself. As an example, NSObject has a method named respondsToSelector:. It looks like the following:
-(BOOL)respondsToSelector:(SEL)aSelector;
It takes as an argument a selector (the name of a method). It returns a value of YES if the object implements the method; it returns the value NO if the object does not implement the method. Thus, using respondsToSelector: provides an example of introspection as a feature of the Objective C runtime.
Key-Value Observing
Key-Value Observing allows you to receive a notification when a particular property of an object is adjusted or changed. As an example, you might tell a Thomas Pink shirt object, "I want you to watch your pattern property. When that property changes, send me a notification". So, when a setPattern: method gets called, we will get a message from the Thomas Pink shirt object saying, "My pattern has a new value."Â
When we add ourselves as an object's observer, we specify that property we are observing - in this case, the pattern property. We can also specify some options - for example, we might want the Thomas Pink shirt object to tell us the old and/or new value of the property when we get notified that a change has been made.Â

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch ⢠No registration required ⢠HD streaming
Designated Initializers
A class has only one designated initializer method. If the class contains other initializers, then the implementation of the other initializers has to either directly or indirectly call the designated initializer.Â
When you set up a class and the designated initializer has a different name than the designated initializer of its superclass, you should note this in the header file.Â
UITableViewCell
Quick fix for Chapter 31 iTahDoodle App in Big Nerd Ranch Objective C Programming Guide:
In the code, you enter:
[self.taskTable registerClass:[UITableViewCell class] forCellReuseIdentifier:@"Cell"];
Later in the app in the table view management section, make sure that when you call the UITableViewCell method you use capital "C" in cell:
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPathÂ
{
// To improve performance, this method first checks for an existing cell object that we can reuse; if there isn't one, then a new cell is created
UITableViewCell *c = [self.taskTable dequeueReusableCellWithIdentifier:@"Cell"];
This will fix any SIGABRT errors you may encounter when adding a task.