From 1a3ff8cfe5b69f480b44161b68056479c0d96a02 Mon Sep 17 00:00:00 2001 From: Eimantas Vaiciunas Date: Mon, 10 Aug 2015 12:18:29 +0300 Subject: [PATCH 1/7] Update the intro and ToC --- README.md | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index abe2a36..64dbebd 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,24 @@ #iOS Programming FAQ -This FAQ originated because I noticed a lot of questions were getting repeated on [/r/iosprogramming](https://reddit.com/r/iosprogramming) so I've decided to write short and sweet answers to all the common questions here. This is a curated list, and I am actively looking for contributions for both questions and answers, so please submit pull requests. - -* [Basics](#basics) -* [Prerequisites](#prerequisites) -* [Tools](#tools) -* [SDK](#sdk) -* [Common tasks](#common-tasks) -* [Language](#language) - * [Should I learn Objective-C or Swift first?](#should-i-learn-objective-c-or-swift-first) -* [Cloud and web](#cloud-and-web) -* [Design](#design) -* [Community](#community) -* [Third party code](#third-party-code) -* [The App Store](#the-app-store) -* [Contracting and Employment](#contracting-and-employment) +This FAQ has been forked from [this repository](https://github.com/programmingthomas/FAQ). So giving the credit where credit is due - thanks u/ProgrammingThomas! + +This FAQ should receive occasional updates from [its own repository](https://github.com/riosprogramming/FAQ). So feel free to create pull requests to update/expand this FAQ. + +Table Of Contents + +* Basics +* Prerequisites +* Tools +* SDK +* Common tasks +* Language + * Should I learn Objective-C or Swift first? +* Cloud and web +* Design +* Community +* Third party code +* The App Store +* Contracting and Employment ##Basics From f12b5c19aebd848dfb90eaa3f30c4712e0d48eb3 Mon Sep 17 00:00:00 2001 From: Eimantas Vaiciunas Date: Mon, 10 Aug 2015 12:19:31 +0300 Subject: [PATCH 2/7] Remove unanswered questions Also remove request for 3rd party job listing sites --- README.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/README.md b/README.md index 64dbebd..96c906d 100644 --- a/README.md +++ b/README.md @@ -483,9 +483,3 @@ If there is a copyright issue (i.e. they're purporting to be you, or they've lit * [Core Inituition Job Board](http://jobs.coreint.org) * [iOS Dev Weekly](http://iosdevweekly.com) lists jobs listings in its mailing list * [Stack Overflow Job Board](http://careers.stackoverflow.com/) - -**If you've found a job somewhere else that you think should be listed here, pleased add a pull request/issue** - -###I have an amazing idea for an app. Where can I hire a developer? - -###I've written a great app but I don't do design. Where can I hire a designer? From a7828c104a64e0c8a0143f894f312b2bce2e5612 Mon Sep 17 00:00:00 2001 From: Eimantas Vaiciunas Date: Mon, 10 Aug 2015 12:22:15 +0300 Subject: [PATCH 3/7] Update code formatting (thanks u/ThePantsThief) --- README.md | 159 ++++++++++++++++++++++++++---------------------------- 1 file changed, 77 insertions(+), 82 deletions(-) diff --git a/README.md b/README.md index 96c906d..9cd1def 100644 --- a/README.md +++ b/README.md @@ -145,58 +145,56 @@ Here's a [great list of stats about iOS versions](https://david-smith.org/iosver You'll need to use [UIAppearance](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIAppearance_Protocol/): -```objc -//AppDelegate.m -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - // Override point for customization after application launch. - UIFont * avenir = [UIFont fontWithName:@"Avenir" size:[UIFont systemFontSize]]; - [[UILabel appearance] setFont:avenir]; - [[UINavigationBar appearance] setTitleTextAttributes:@{NSFontAttributeName: avenir}]; - //You'll need to do this for other classes that display text - return YES; -} -``` + + // AppDelegate.m + - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. + UIFont * avenir = [UIFont fontWithName:@"Avenir" size:[UIFont systemFontSize]]; + [[UILabel appearance] setFont:avenir]; + [[UINavigationBar appearance] setTitleTextAttributes:@{NSFontAttributeName: avenir}]; + //You'll need to do this for other classes that display text + return YES; + } ###How can I request some JSON from the web? -```objc -//Standard library JSON request to http://httpbin.org - -NSURLSession * session = [NSURLSession sharedSession]; - -//Prepare the request -NSURL * url = [NSURL URLWithString:@"http://httpbin.org/get"]; -NSURLRequest * request = [NSURLRequest requestWithURL:url]; - -//Prepare the data task -NSURLSessionDataTask * dataTask = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { - //This block will be executed on the main thread once the data task has completed - //Status Code is HTTP 200 OK - //You have to cast to NSHTTPURLResponse, a subclass of NSURLResponse, to get the status code - if ([(NSHTTPURLResponse*)response statusCode] == 200) { - NSDictionary * json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil]; - NSLog(@"%@", json); - //The JSON is parsed into standard Cocoa classes such as NSArray, NSDictionary, NSString and NSNumber: - NSLog(@"The requested URL was %@", json[@"url"]); - } -}]; -//Begin the task -[dataTask resume]; -``` + //Standard library JSON request to http://httpbin.org + + NSURLSession * session = [NSURLSession sharedSession]; + + //Prepare the request + NSURL * url = [NSURL URLWithString:@"http://httpbin.org/get"]; + NSURLRequest * request = [NSURLRequest requestWithURL:url]; + + //Prepare the data task + NSURLSessionDataTask * dataTask = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { + //This block will be executed on the main thread once the data task has completed + //Status Code is HTTP 200 OK + //You have to cast to NSHTTPURLResponse, a subclass of NSURLResponse, to get the status code + if ([(NSHTTPURLResponse*)response statusCode] == 200) { + NSDictionary * json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil]; + NSLog(@"%@", json); + //The JSON is parsed into standard Cocoa classes such as NSArray, NSDictionary, NSString and NSNumber: + NSLog(@"The requested URL was %@", json[@"url"]); + } + }]; + + //Begin the task + [dataTask resume]; `NSURLSession` was introduced in iOS 7 and OS X Mavericks. It provides a reasonably easy way to do concurrent network requests, however you may wish to use [AFNetworking](https://github.com/AFNetworking/AFNetworking) instead as this can reduce the amount of code you have to write: -```objc -AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; -[manager GET:@"http://httpbin.org/get" parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) { - //Response object is an NSDictionary, like in the previous example - NSLog(@"JSON: %@", responseObject); -} failure:^(AFHTTPRequestOperation *operation, NSError *error) { - //Handle the error case - NSLog(@"Error: %@", error); -}]; -``` + + AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; + [manager GET:@"http://httpbin.org/get" parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) { + // Response object is an NSDictionary, like in the previous example + NSLog(@"JSON: %@", responseObject); + } failure:^(AFHTTPRequestOperation *operation, NSError *error) { + //Handle the error case + NSLog(@"Error: %@", error); + }]; + ###I want to build a client app for web service X. How do I get started? @@ -258,21 +256,19 @@ Objective-C doesn't support namespaces, so all classes are prefixed with the fra Methods that begin with a `+` are static class methods and are not tied to a particular instance of a class. Class methods are used as: -```objc -//UIView method declaration -+ (void)animateWithDuration:(NSTimeInterval)duration animations:(void(^)(void))animations; -//Is used as: -[UIView animateWithDuration:x animations:^{ /* Animations go here */}]; -``` + + // UIView method declaration + + (void)animateWithDuration:(NSTimeInterval)duration animations:(void(^)(void))animations; + // Is used as: + [UIView animateWithDuration:x animations:^{ /* Animations go here */}]; Methods that begin with a `-` are instance methods, and are related to a single instance of a class: -```objc -//UIView method declaration: -- (void)addSubview:(UIView*)subview; -//Is used as: -[someViewInstance addSubview:someSubview]; -``` + + // UIView method declaration: + - (void)addSubview:(UIView*)subview; + // Is used as: + [someViewInstance addSubview:someSubview]; The same feature exists in Swift, however the syntax is a little less bizarre. All instance methods just use `func` whereas all static class methods use `class func`. @@ -282,43 +278,42 @@ Unlike many other object-oriented programming languages Objective-C has a dynami Xcode provides a template for extensions, but here is a basic implementation of a map function for `NSArray`: -```objc -//NSArray+FAQ.h -@interface NSArray (FAQ) + // NSArray+FAQ.h + + @interface NSArray (FAQ) -/** - @param mapper An Objective-C block which maps objects in the original array to objects in the new array - @return An array of mapped objects -*/ -- (NSArray*)faq_map:(id(^)(id))mapper; + /** + @param mapper An Objective-C block which maps objects in the original array to objects in the new array + @return An array of mapped objects + */ + - (NSArray*)faq_map:(id(^)(id))mapper; -@end + @end -//NSArray+FAQ.m + // NSArray+FAQ.m -@implementation NSArray (FAQ) + @implementation NSArray (FAQ) -- (NSArray*)faq_map:(id (^)(id))mapper { - NSMutableArray * array = [NSMutableArray arrayWithCapacity:self.count]; - for (id object in self) { - [array addObject:mapper(object)]; + - (NSArray*)faq_map:(id (^)(id))mapper { + NSMutableArray * array = [NSMutableArray arrayWithCapacity:self.count]; + for (id object in self) { + [array addObject:mapper(object)]; + } + return array; } - return array; -} -@end + @end -//Usage: + //Usage: -#import "NSArray+FAQ.h" + #import "NSArray+FAQ.h" -NSArray * numbers = @[@1, @2, @3, @4]; -NSArray * strings = [numbers faq_map:^id(id object) { - return [object stringValue]; -}]; + NSArray * numbers = @[@1, @2, @3, @4]; + NSArray * strings = [numbers faq_map:^id(id object) { + return [object stringValue]; + }]; -``` Apple recommends that if you are writing your own extension methods that you use three letter prefixes (like with class names) so that you avoid clashing with other methods. ###Can I write an app for the Apple Watch in Objective-C? From c5d71725ef6e165e851ac6430706522adeb3054b Mon Sep 17 00:00:00 2001 From: Eimantas Vaiciunas Date: Mon, 10 Aug 2015 12:22:28 +0300 Subject: [PATCH 4/7] Probabably a white-space fix --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9cd1def..de8555f 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Table Of Contents ##Basics -The most valuable source of information available to iOS Developers is [Apple's Developer Library](https://developer.apple.com/library/ios/navigation/). This contains thousands of documents explaining every single function in the SDK, hundreds of sample applications and several years of WWDC videos. If you've got a problem, this should always be the first place that you should look. +The most valuable source of information available to iOS Developers is [Apple's Developer Library](https://developer.apple.com/library/ios/navigation/). This contains thousands of documents explaining every single function in the SDK, hundreds of sample applications and several years of WWDC videos. If you've got a problem, this should always be the first place that you should look. ##Prerequisites @@ -356,7 +356,7 @@ The [Human Interface Guidelines](https://developer.apple.com/library/prerelease/ ###Any tips for good design? -* Justify every pixel of your UI - is a control essential for most people? +* Justify every pixel of your UI - is a control essential for most people? * Is this interaction obvious? A lot of apps use really interesting combinations of swipes, pinches and taps but make sure that your users will know how to use them. * Use Auto Layout and size classes. These make it a lot simpler to handle the 5 different screen sizes (iPhone 3.5", iPhone 4", iPhone 4.7", iPhone 5.5", iPad) than writing your layout code manually @@ -413,7 +413,7 @@ If you *really* want to do everything in code, Apple has a [guide here](https:// ###Where can I find great third party code? -[CocoaPods](http://cocoapods.org). CocoaPods is a dependency manager used by Apple developers that makes it really easy to integrate open source code into your iOS or OS X app. Several sites, such as [Cocoa Controls](https://www.cocoacontrols.com/platforms/ios/controls?cocoapods=t) keep track of these. +[CocoaPods](http://cocoapods.org). CocoaPods is a dependency manager used by Apple developers that makes it really easy to integrate open source code into your iOS or OS X app. Several sites, such as [Cocoa Controls](https://www.cocoacontrols.com/platforms/ios/controls?cocoapods=t) keep track of these. ###Should I use CocoaPods/third party code? From 80e33842e8c48f1127912be70d4edddacdbd4ea3 Mon Sep 17 00:00:00 2001 From: Eimantas Date: Fri, 14 Aug 2015 11:47:34 +0300 Subject: [PATCH 5/7] Remove ToC ToC is redundant since the reddit's wiki engine generates it based on found headers. --- README.md | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/README.md b/README.md index de8555f..31bc93c 100644 --- a/README.md +++ b/README.md @@ -4,22 +4,6 @@ This FAQ has been forked from [this repository](https://github.com/programmingth This FAQ should receive occasional updates from [its own repository](https://github.com/riosprogramming/FAQ). So feel free to create pull requests to update/expand this FAQ. -Table Of Contents - -* Basics -* Prerequisites -* Tools -* SDK -* Common tasks -* Language - * Should I learn Objective-C or Swift first? -* Cloud and web -* Design -* Community -* Third party code -* The App Store -* Contracting and Employment - ##Basics The most valuable source of information available to iOS Developers is [Apple's Developer Library](https://developer.apple.com/library/ios/navigation/). This contains thousands of documents explaining every single function in the SDK, hundreds of sample applications and several years of WWDC videos. If you've got a problem, this should always be the first place that you should look. From 504922f5603323f88482230c674e618d8295211e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eimantas=20Vai=C4=8Di=C5=ABnas?= Date: Wed, 13 Jan 2016 08:51:21 +0200 Subject: [PATCH 6/7] Made FAQ more iOS version agnostic --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 31bc93c..8bc61a0 100644 --- a/README.md +++ b/README.md @@ -113,9 +113,9 @@ Third party options * [Big Nerd Ranch](https://www.bignerdranch.com) * [/r/iosprogramming](https://reddit.com/r/iosprogramming) -###Do I need to support iOS 6? +###Do I need to support iOS version X? -No. Currently around 90% of all iOS devices are on iOS 7 or higher, and by Spring 2015 it will likely be a similar figure for iOS 8. You'll miss out on using the latest APIs and you'll likely have to write a lot of additional code in order to properly support iOS 6. The only major reason to support versions earlier than iOS 7 is if you are developing for a specific audience (such as schools) that may have older devices (such as the iPad 1). +Apple's recommended way of support for iOS is current and previous versions. So at any given time you should target at most two major iOS versions. Here's a [great list of stats about iOS versions](https://david-smith.org/iosversionstats/). From f7356c0d6778a98e78ac2675b4fbd1331bf68406 Mon Sep 17 00:00:00 2001 From: Oliver Judge Date: Thu, 25 Feb 2016 14:32:01 +0000 Subject: [PATCH 7/7] Added Under The Radar --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8bc61a0..382268a 100644 --- a/README.md +++ b/README.md @@ -383,6 +383,7 @@ If you *really* want to do everything in code, Apple has a [guide here](https:// * [The Record](http://therecord.co) * [Release Notes](http://releasenotes.tv) * [Springboard](http://springboardshow.com) (finished?) +* [Under The Radar](https://www.relay.fm/radar) ####Apple and technology general