git rebase origin/master
- Review difference of local and remote branch:
git log HEAD..origin/master
import Foundation | |
import XCTest | |
protocol AutoEquatable: Equatable {} | |
extension AutoEquatable { | |
static func ==(lhs: Self, rhs: Self) -> Bool { | |
var lhsDump = String() | |
dump(lhs, to: &lhsDump) |
import Foundation | |
protocol JSONSerializable { | |
func toJSON() throws -> Any? | |
} | |
enum CouldNotSerializeError: Error { | |
case noImplementation(source: Any, type: String) | |
case undefinedKey(source: Any, type: String) | |
} |
func benchmark(block: () -> Void) -> TimeInterval { | |
let startTime = CFAbsoluteTimeGetCurrent() | |
block() | |
let endTime = CFAbsoluteTimeGetCurrent() | |
let totalTime = endTime - startTime | |
return totalTime | |
} |
final class ReadWriteLock { | |
private var rwlock: pthread_rwlock_t = { | |
var rwlock = pthread_rwlock_t() | |
pthread_rwlock_init(&rwlock, nil) | |
return rwlock | |
}() | |
func writeLock() { | |
pthread_rwlock_wrlock(&rwlock) | |
} |
git rebase origin/master
git log HEAD..origin/master
protocol Command { | |
func execute() | |
} | |
struct InitializeThirdPartiesCommand: Command { | |
func execute() { | |
// Third parties are initialized here | |
} | |
} |
// MARK: - Builder | |
final class StartupCommandsBuilder { | |
private var window: UIWindow! | |
func setKeyWindow(_ window: UIWindow) -> StartupCommandsBuilder { | |
self.window = window | |
return self | |
} |
enum AppDelegateFactory { | |
static func makeDefault() -> AppDelegateType { | |
return CompositeAppDelegate(appDelegates: [PushNotificationsAppDelegate(), StartupConfiguratorAppDelegate(), ThirdPartiesConfiguratorAppDelegate()]) | |
} | |
} | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? |
typealias AppDelegateType = UIResponder & UIApplicationDelegate | |
class CompositeAppDelegate: AppDelegateType { | |
private let appDelegates: [AppDelegateType] | |
init(appDelegates: [AppDelegateType]) { | |
self.appDelegates = appDelegates | |
} | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
let mediator = AppLifecycleMediator.makeDefaultMediator() | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
return true | |
} | |
} |