This file contains 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 UINavigationController { | |
override open var childForStatusBarStyle: UIViewController? { | |
return topViewController | |
} | |
} | |
extension UITabBarController { | |
override open var childForStatusBarStyle: UIViewController? { | |
return selectedViewController | |
} |
This file contains 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 UISplitViewController { | |
open override var childForStatusBarStyle: UIViewController? { | |
return viewControllers.first | |
} | |
} | |
extension UITabBarController { | |
open override var childForStatusBarStyle: UIViewController? { | |
return selectedViewController | |
} |
This file contains 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 UICollectionViewCell { | |
static let reuseID = String(describing: self) | |
static let nib = UINib(nibName: String(describing: self), bundle: nil) | |
} |
This file contains 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
final class PersistentStack { | |
private let storeUrl: URL | |
private let modelUrl: URL | |
private lazy var managedObjectModel: NSManagedObjectModel = { | |
guard let model = NSManagedObjectModel(contentsOf: modelUrl) else { | |
fatalError("Cannot find model file with URL: \(modelUrl)") | |
} | |
return model |
This file contains 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
enum CountryCode: String { | |
case us = "USA" | |
case zh = "China" | |
case fr = "France" | |
case ru = "Russia" | |
var locale: Locale { | |
let identifier: String |
This file contains 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 CalendarDelegate: class { | |
func calendar(_ calendar: Calendar, willDisplay year: Int) | |
func calendar(_ calendar: Calendar, didSelect date: Date) | |
func calendarShouldChangeYear(_ calendar: Calendar) -> Bool | |
} | |
protocol CalendarDataSource { | |
func calendar(_ calendar: Calendar, eventsFor date: Date) -> [String] |
This file contains 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 | |
typealias BehaviorClosure = (_ viewController: UIViewController) -> () | |
protocol ViewControllerLifecycleBehavior { | |
func afterLoading(_ viewController: UIViewController) | |
func beforeAppearing(_ viewController: UIViewController) | |
func afterAppearing(_ viewController: UIViewController) |
This file contains 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
var ordersList: Order? { | |
didSet { | |
var fullLabelAddressFromAndStatusLabel = "" | |
var fullLabelAddressToAndStatusLabel = "" | |
var statusStringLengthFrom = 0 | |
var statusStringLengthTo = 0 | |
orderFirstTimeLabel.text = "" | |
orderSecondTimeLabel.text = "" | |
This file contains 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 UIColor { | |
public convenience init?(hex: String) { | |
let r, g, b, a: CGFloat | |
if hex.hasPrefix("#") { | |
let start = hex.index(hex.startIndex, offsetBy: 1) | |
let hexColor = String(hex[start...]) | |
if hexColor.count == 8 { | |
let scanner = Scanner(string: hexColor) |
This file contains 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 ServiceLocating { | |
func getService<T>() -> T? | |
} | |
final class ServiceLocator: ServiceLocating { | |
private lazy var services: Dictionary<String, Any> = [:] | |
private func typeName(some: Any) -> String { | |
return (some is Any.Type) ? | |
"\(some)" : "\(type(of: some))" |
OlderNewer