Skip to content

Commit

Permalink
Merge pull request futurice#54 from erwald/update-for-swift-3
Browse files Browse the repository at this point in the history
Update for Swift 3
  • Loading branch information
erwald authored Feb 10, 2017
2 parents ff4cf78 + 23f708f commit a64d023
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ If you override `updateConstraints` in a custom view, you should explicitly stat

Swift:
```swift
override class func requiresConstraintBasedLayout() -> Bool {
override class var requiresConstraintBasedLayout: Bool {
return true
}
```
Expand All @@ -294,7 +294,7 @@ Use dependency injection, i.e. pass any required objects in as parameters, inste

Swift:
```swift
let fooViewController = FooViewController(viewModel: fooViewModel)
let fooViewController = FooViewController(withViewModel: fooViewModel)
```

Objective-C:
Expand All @@ -314,17 +314,17 @@ Whether it means kicking off a backend request or deserializing a large file fro
If you're using [ReactiveCocoa][reactivecocoa-github], `SignalProducer` is a natural choice for the return type. For instance, fetching gigs for a given artist would yield the following signature:
Swift + RAC 3:
Swift + ReactiveSwift:
```swift
func fetchGigsForArtist(artist: Artist) -> SignalProducer<[Gig], NSError> {
//
func fetchGigs(for artist: Artist) -> SignalProducer<[Gig], Error> {
// ...
}
```

ObjectiveC + RAC 2:
ObjectiveC + ReactiveObjC:
```objective-c
- (RACSignal *)fetchGigsForArtist:(Artist *)artist {
//
- (RACSignal<NSArray<Gig *> *> *)fetchGigsForArtist:(Artist *)artist {
// ...
}
```

Expand Down Expand Up @@ -400,31 +400,31 @@ class FooViewController : UIViewController, FoobarDelegate {

override func viewDidLoad() {
super.viewDidLoad()
//
// ...
}

// MARK: Layout

private func makeViewConstraints() {
//
// ...
}

// MARK: User Interaction

func foobarButtonTapped() {
//
// ...
}

// MARK: FoobarDelegate

func foobar(foobar: Foobar didSomethingWithFoo foo: Foo) {
//
func foobar(foobar: Foobar, didSomethingWithFoo foo: Foo) {
// ...
}

// MARK: Additional Helpers

private func displayNameForFoo(foo: Foo) {
//
// ...
}

}
Expand Down Expand Up @@ -539,8 +539,8 @@ A good practice is to create a slim helper class, e.g. `AnalyticsHelper`, that h

```swift

func pushAddItemEventWithItem(item: Item, editMode: EditMode) {
let editModeString = nameForEditMode(editMode)
func pushAddItemEvent(with item: Item, editMode: EditMode) {
let editModeString = name(for: editMode)

pushToDataLayer([
"event": "addItem",
Expand Down

0 comments on commit a64d023

Please sign in to comment.