This file contains hidden or 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
protocol Service {} | |
class RealService: Service {} | |
class Client { | |
let service: Service | |
init() { | |
service = RealService() | |
} | |
} |
This file contains hidden or 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
protocol Service {} | |
class RealService: Service {} | |
class Client { | |
let service: Service | |
init(service: Service) { | |
self.service = service | |
} | |
} |
This file contains hidden or 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 Foundation | |
import XCTest | |
////////////////////////////////////////////////////////////////////// | |
// Preferences | |
protocol UserDefaults { | |
func stringForKey(key: String) -> String | |
} |
This file contains hidden or 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 ViewController: UIViewController { | |
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { | |
if segue.identifier == PhotoDetailViewControllerIdentifier { | |
if let viewController = segue.destinationViewController as? PhotoDetailViewController { | |
viewController.photo = Photo() | |
} | |
} | |
} | |
} |
This file contains hidden or 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 ViewController: UIViewController { | |
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { | |
if segue.identifier == PhotoDetailViewControllerIdentifier, | |
let viewController = segue.destinationViewController as? PhotoDetailViewController { | |
viewController.photo = Photo() | |
} | |
} | |
} |
This file contains hidden or 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 PhotoDetailViewController2: UIViewController { | |
let photo: Photo | |
init(photo: Photo) { | |
self.photo = photo | |
super.init(nibName: "PhotoDetailViewController2", bundle: nil) | |
} | |
required init?(coder: NSCoder) { | |
fatalError("init(coder:) is not supported") |
This file contains hidden or 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 ViewController2: UIViewController { | |
func showDetailWithPhoto(photo: Photo) { | |
showViewController(PhotoDetailViewController2(photo: photo), sender: self) | |
} | |
} |
This file contains hidden or 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 PhotoDetailViewController: UIViewController { | |
var photo: Photo! | |
} |
This file contains hidden or 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 CoreData | |
import UIKit | |
struct Photo {} | |
class PhotoDetailViewController: UIViewController { | |
var photo: Photo! | |
var context: NSManagedObjectContext! | |
} |
This file contains hidden or 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 Wireframe { | |
let navigationController: UINavigationController | |
let viewControllerFactory: ViewControllerFactory | |
init(navigationController: UINavigationController, viewControllerFactory: ViewControllerFactory) { | |
self.navigationController = navigationController | |
self.viewControllerFactory = viewControllerFactory | |
} | |
func presentPhotoDetailsWithPhoto(photo: Photo) { |