Skip to content

Instantly share code, notes, and snippets.

import UIKit
open class MovieListFetcherViewController: UIViewController {
// MARK: - Variables
public var movieStore = MovieStore.shared
private let listController = ListViewController()
public var endpoint: Endpoint = .nowPlaying {
didSet {
import UIKit
open class SegmentedViewController: UIViewController {
public private(set) var selectedViewControllerIndex = 0
// MARK: - Public variables
/// List of ViewControllers. View Controller Titles are used as segment titles.
public var items = [UIViewController]() {
import UIKit
open class MovieFetcherViewController: UIViewController {
// MARK: - Variables
public var movieStore = MovieStore.shared
private let listController = ListViewController()
// MARK: - Lifecycle
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
window = UIWindow(frame: UIScreen.main.bounds)
window?.backgroundColor = UIColor.white
window?.makeKeyAndVisible()
extension Movie: Listable {
private static let dateFormatter: DateFormatter = {
let formatter = DateFormatter()
formatter.dateStyle = .medium
formatter.timeStyle = .none
return formatter
}()
public var firstText: String {
return title
import PlaygroundSupport
import UIKit
@testable import MVCMovieInfoFramework
NSSetUncaughtExceptionHandler { exception in
print("💥 Exception thrown: \(exception)")
}
PlaygroundPage.current.needsIndefiniteExecution = true
import UIKit
open class ImageWithFourLabelCell: UITableViewCell {
public let layout = ImageWithFourLabelView()
// MARK: - Lifecycle
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
import PlaygroundSupport
import UIKit
@testable import MVCMovieInfoFramework
open class ImageWithFourLabelView: UIView {
// MARK: - Variables
private let horizontalStackView = UIStackView()
private let verticalStackView = UIStackView()
import Foundation
public protocol DataFetching {
func fetchData(url: URL, completion: @escaping (Data?, Error?) -> Void)
}
extension DataFetching {
public func fetchData(url: URL, completion: @escaping (Data?, Error?) -> Void) {
let session = URLSession.shared
import UIKit
public class DownloadImageView: UIImageView, DataFetching {
// MARK: - Variables
public var placeHolder: UIImage?
public var url: URL? {
didSet {