This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Person.h | |
@interface Person : NSObject | |
@property (nonatomic, copy) NSString* firstName; | |
@property (nonatomic, copy) NSString* lastName; | |
@property (nonatomic, copy) NSString* middleInitial; | |
@property (nonatomic, copy) NSString* title; | |
- (instancetype)initWithFirstName:(NSString*)firstName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "Person.h" | |
@implementation Person | |
- (instancetype)init { | |
return [self initWithFirstName:@"First" lastName:@"Last"]; | |
} | |
- (instancetype)initWithFirstName:(NSString*)firstName | |
lastName:(NSString*)lastName { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person: NSObject { | |
let firstName: String | |
let lastName: String | |
let middleInitial: String | |
let title: String | |
init(firstName: String = "First", lastName: String = "Last", | |
middleInitial: String = "", title: String = "") { | |
self.firstName = firstName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person: NSObject { | |
let firstName: String | |
let lastName: String | |
let middleInitial: String | |
let title: String | |
init(firstName: String, lastName: String, | |
middleInitial: String = "", title: String = "") { | |
self.firstName = firstName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person: NSObject { | |
let firstName: String | |
let lastName: String | |
let middleInitial: String | |
let title: String | |
convenience init(fullName: String) { | |
let nameComponents = fullName.componentsSeparatedByString(" ") | |
var firstName = "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person: NSObject { | |
var firstName = "First" | |
var lastName = "Last" | |
var middleInitial = "" | |
var title = "" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class ViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
saveUserDefaults() | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import NotificationCenter | |
class TodayViewController: UIViewController, NCWidgetProviding { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
self.preferredContentSize = CGSizeMake(320, 180); | |
println("Title: \(titleFromSharedDefaults())") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
public class Book: NSObject, NSCoding { | |
public let title: String! | |
public let author: String! | |
public init(title: String, author: String) { | |
self.title = title | |
self.author = author |
OlderNewer