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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <Bucket | |
| type = "2" | |
| version = "2.0"> | |
| <Breakpoints> | |
| <!-- All Exceptions --> | |
| <BreakpointProxy | |
| BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint"> | |
| <BreakpointContent |
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
| ###################### | |
| # Options | |
| ###################### | |
| REVEAL_ARCHIVE_IN_FINDER=false | |
| FRAMEWORK_NAME="${PROJECT_NAME}" | |
| SIMULATOR_LIBRARY_PATH="${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${FRAMEWORK_NAME}.framework" |
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
| // | |
| // CoreDataController.swift | |
| // | |
| // Created by Keith Harrison http://useyourloaf.com | |
| // Copyright (c) 2017 Keith Harrison. All rights reserved. | |
| // | |
| // Redistribution and use in source and binary forms, with or without | |
| // modification, are permitted provided that the following conditions are met: | |
| // | |
| // 1. Redistributions of source code must retain the above copyright |
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 UIKit | |
| protocol NibLoadable where Self: UIView { | |
| static func viewFromNib() -> Self | |
| } | |
| extension NibLoadable { | |
| static func viewFromNib() -> Self { | |
| let nibName = String(describing: self) | |
| guard let view = Bundle.main.loadNibNamed(nibName, owner: nil, options: nil)?.first as? Self else { |
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
| @propertyWrapper | |
| struct Atomic<Value> { | |
| private var value: Value | |
| private let lock = NSLock() | |
| init(wrappedValue value: Value) { | |
| self.value = value | |
| } |
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
| struct Theme { | |
| enum `Type` { | |
| case light | |
| case dark | |
| } | |
| let type: Type | |
| let colors: ColorPalette | |
| } |
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
| extension Theme { | |
| static let light = Theme(type: .light, colors: .light) | |
| static let dark = Theme(type: .dark, colors: .dark) | |
| } |
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 Themeable: class { | |
| func apply(theme: Theme) | |
| } |
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 ThemeProvider { | |
| static let shared = ThemeProvider() | |
| var theme: Theme { | |
| didSet { | |
| UserDefaults.standard.set(theme == .dark, forKey: "isDark") | |
| notifyObservers() | |
| } | |
| } | |
| private var observers: NSHashTable<AnyObject> = NSHashTable.weakObjects() |
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 MoviesTableViewController: UITableViewController { | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| themeProvider.register(observer: self) | |
| } | |
| } | |
| extension MoviesTableViewController: Themeable { | |
| func apply(theme: Theme) { |