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
// | |
// NBResponderChainUtilities.h | |
// | |
// Created by Nicolas @ bou.io on 19/04/13. | |
// | |
#import <UIKit/UIKit.h> | |
@interface UIView (NBResponderChainUtilities) | |
- (UIView*) nb_firstResponder; // Recurse into subviews to find one that responds YES to -isFirstResponder |
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
ACTION = build | |
AD_HOC_CODE_SIGNING_ALLOWED = NO | |
ALTERNATE_GROUP = staff | |
ALTERNATE_MODE = u+w,go-w,a+rX | |
ALTERNATE_OWNER = grantdavis | |
ALWAYS_SEARCH_USER_PATHS = NO | |
ALWAYS_USE_SEPARATE_HEADERMAPS = YES | |
APPLE_INTERNAL_DEVELOPER_DIR = /AppleInternal/Developer | |
APPLE_INTERNAL_DIR = /AppleInternal | |
APPLE_INTERNAL_DOCUMENTATION_DIR = /AppleInternal/Documentation |
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
// | |
// MetalVideoRenderer.swift | |
// RTEVideoEditor | |
// | |
// Created by weidong fu on 2020/1/1. | |
// Copyright © 2020 Free. All rights reserved. | |
// | |
import UIKit | |
import AVFoundation |
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 LoginViewController { | |
private let userSession: UserSession | |
init(_ userSession: UserSession) { | |
self.userSession = userSession | |
} | |
func login(_ userName: String, password: String) { | |
userSession.login(userName, password) | |
} |
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 LoginViewController { | |
var userSession: UserSession? | |
func login(_ userName: String, password: String) { | |
userSesson?.login(userName, password) | |
} | |
} |
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
typealias Login = (_ name: String, _ password: String) -> Void | |
class LoginViewController { | |
func login(_ login: Login, name: String, password: String) { | |
... | |
login(name, password) | |
... | |
} | |
} |
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 UserSession { | |
static let shared: UserSession | |
} | |
Class LoginViewController { | |
func login(_ name: String, password: String) { | |
... | |
UserSession.shared.login(name, password) | |
... |
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 ServiceLocator { | |
func register(_ service: Service, for type: ServiceType) | |
func resolve(_ type: ServiceType) | |
} | |
ServiceLocator.shared.register(UserSession(), type: UserService.self) | |
Struct UserService: 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
class LoginViewController { | |
private let userSession: UserSession | |
init(_ userSession: UserSession = UserSession()) { | |
self.userSession = userSession | |
} | |
} | |
let vc = LoginViewController() | |
let vc = LoginViewController(userSession) |
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 Swinject | |
public typealias DIContainer = Container | |
public final class AnyInitializer { | |
private let resolve:(_ container: DIContainer) -> Any | |
public init<D1, D2, T>(_ function: @escaping (D1, D2) -> T) { | |
resolve = { container in | |
let d1: D1 = container.resolve(D1.self)! |
OlderNewer