Using a real artsy example from today.
Creating a follow button on a view controller for different types of objects Artist, Profile, Gene
Needs: networking Needs: layout Needs: interface changes based on networking
| protocol CanBark { | |
| func bark() -> String | |
| } | |
| class Animal { | |
| func animalType() -> String { | |
| return "Animal" | |
| } | |
| } |
| import Foundation | |
| /// An abstract class that makes building simple asynchronous operations easy. | |
| /// Subclasses must implement `execute()` to perform any work and call | |
| /// `finish()` when they are done. All `NSOperation` work will be handled | |
| /// automatically. | |
| open class AsynchronousOperation: Operation { | |
| // MARK: - Properties |
| let nArray : NSArray = ["1", "2", "3"] | |
| nArray.enumerateObjectsUsingBlock {(obj, index, stop) in | |
| println("Object \(obj) Index \(index)") | |
| if index == 1 { | |
| stop.withUnsafePointer { $0.memory = true } | |
| } | |
| } |
| extension Array { | |
| func first() -> Element? { | |
| if isEmpty { | |
| return nil | |
| } | |
| return self[0] | |
| } | |
| func last() -> Element? { |
| // Example: | |
| // | |
| // Widont makes the last space non-breaking | |
| // so you don't end up with one word on its | |
| // own. | |
| // | |
| // Widont makes the last space non-breaking | |
| // so you don't end up with one word on | |
| // its own. | |
| // |
| + (NSAttributedString *)artsyBodyTextAttributedStringFromHTML:(NSString *)HTML withFont:(UIFont *)font | |
| { | |
| NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init]; | |
| style.lineHeightMultiple = 1.2; | |
| style.paragraphSpacing = font.pointSize * .5; | |
| NSDictionary *textParams = @{ | |
| NSFontAttributeName : font, | |
| NSParagraphStyleAttributeName : style, |
| sys_rb_usr=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr | |
| sdk_rb_usr=`xcode-select -p`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr | |
| sudo cp -r $sdk_rb_usr/include $sys_rb_usr/include |
Generate the list yourself:
$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
$ grep UI_APPEARANCE_SELECTOR ./* | \
sed 's/NS_AVAILABLE_IOS(.*)//g' | \
sed 's/NS_DEPRECATED_IOS(.*)//g' | \
sed 's/API_AVAILABLE(.*)//g' | \
sed 's/API_UNAVAILABLE(.*)//g' | \
sed 's/UI_APPEARANCE_SELECTOR//g' | \