Skip to content

Chapter 2: Code Missing Under "Implementing a Swift Protocol" #1

@ccocchiaro

Description

@ccocchiaro

In Chapter 2 (page 38 of the Extreme Mobile PDF) under "Implementing a Swift Protocol", the code sample should include defining the protocol as well as implementing it. The downloaded code itself is correct, only the book contains the oversight:

import UIKit

protocol DisplayableViewController {
    func instantiateRootViewController(configuration: Dictionary<String, Any>) -> UIViewController
}

public class RecordingsProtocol: DisplayableViewController {
    public init() {}
    
    public func instantiateRootViewController() -> UIViewController {
        let storyboard = UIStoryboard(name: "RecordingsUI", bundle: Bundle(for: RecordingsTVC.self))
        let vc = storyboard.instantiateViewController(withIdentifier: "RecordingsNC")
        return vc
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions