"!"s... var userSession: UserSession! var applicationID: String! func viewDidLoad() { super.viewDidLoad() self.userSession.foo() } } "Building Fabric.app in Swift" - Javier Soto. April 2016 21
where SectionType.AssociatedTableRowType == RowType, SectionType: Equatable, RowType: Equatable>: NSObject, UITableViewDataSource "Building Fabric.app in Swift" - Javier Soto. April 2016 34
NoIssues case ErrorLoadingIssues case ProjectIssue(Issue) } return GenericTableViewDataSource( tableView: tableView, tableViewData: observableProperty, // Observable<Elements> computeSections: { elements in ... }, /// Pure function from `Elements` to `[SectionType]` configureRow: { row, indexPath in ... } /// Function from `RowType` to `UITableViewCell` ) "Building Fabric.app in Swift" - Javier Soto. April 2016 35
let session = UserSession.currentUserSession if let session = session session { session.requestApplications()... } // or... session!.requestApplications()... } "Building Fabric.app in Swift" - Javier Soto. April 2016 41
class ApplicationListViewModel { init(fabricAPI: AuthenticatedFabricAPI) } public final class AuthenticatedFabricAPI { public init(authResponse: AuthResponse) } public final class AuthResponse { let accessToken: String } "Building Fabric.app in Swift" - Javier Soto. April 2016 42
} final class ApplicationListViewModel { var applications: DataLoadState<[Application]> = .Loading } "Building Fabric.app in Swift" - Javier Soto. April 2016 45
String public let name: String public let bundleIdentifier: String public static func decode(j: [String: AnyObject]) -> Application? { guard let ID = j["id"] as? String, let name = j["name"] as? String, let bundleIdentifier = j["identifier"] as? String else { return nil } return Application( ID: ID, name: name, bundleIdentifier: bundleIdentifier ) } } "Building Fabric.app in Swift" - Javier Soto. April 2016 48
{ /// This will even fail to compile if it's not the right cell static let nibResource = R.nib.myTableViewCell } tableView.registerReusableNibCell(MyTableViewCell) let cell = MyTableViewCell.dequeueFromTableView(tableView, indexPath) let image = R.image.imageName "Building Fabric.app in Swift" - Javier Soto. April 2016 55