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 P { | |
| init() | |
| } | |
| struct AAA : P { | |
| } | |
| struct BBB<T: P> { | |
| let a : Int = 0 |
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 | |
| ComparisonResult.orderedAscending.rawValue // -1 | |
| ComparisonResult.orderedSame.rawValue // 0 | |
| ComparisonResult.orderedDescending.rawValue // 1 | |
| "1.0.0".compare("1.0.1", options: .numeric, range: nil, locale: nil).rawValue // -1 (orderedAscending) | |
| "1.0.0".compare("1.0.0", options: .numeric, range: nil, locale: nil).rawValue // 0 (orderedSame) | |
| "1.0.0".compare("0.9.9", options: .numeric, range: nil, locale: nil).rawValue // 1 (orderedDescending) |
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
| // print Apple Device List (https://developer.apple.com/account/ios/device/iphone) on Chrome Developer Console | |
| Array.from({length: $("tr").filter((i,o)=>/^[0-9]+$/.test(o.id)).length}, (v, k) => k).forEach(j=>{var i=j+1;setTimeout(()=>{;$("tr#"+i).click()},100*i);setTimeout(()=>{console.log(""+i+",", ["dd.name","dd.model","dd.deviceNumber"].map((s)=>'"'+$('tr#'+i+'+tr').find(s).text()+'"').join())},50+100*i);}) |
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 | |
| // "".hexData.hexString // | |
| // "01".hexData.hexString // 01 | |
| // "ab".hexData.hexString // ab | |
| // "abff 99".hexData.hexString // abff99 | |
| // "abff\n99".hexData.hexString // abff99 | |
| // "abzff 99".hexData.hexString // ab | |
| // "abf ff 99".hexData.hexString // ab | |
| // "abf".hexData.hexString // ab |
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 | |
| @UIApplicationMain | |
| class AppDelegate: UIResponder, UIApplicationDelegate { | |
| var window: UIWindow? | |
| func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
| let vc = ViewController() |
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 Tappable : class { | |
| } | |
| extension Tappable where Self : NSObject { | |
| func tap(@noescape function: (Self) -> ()) -> Self { | |
| function(self) | |
| return self |
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 | |
| /** | |
| closureでUIViewの初期化処理をあたえられるための拡張 | |
| @noescapeをつけているのでclosureの中でselfをつける必要はない | |
| ex.) | |
| ``` | |
| override func viewDidLoad() { |
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 ObservableType { | |
| /** | |
| throttleFirst | |
| RxJava reference | |
| http://reactivex.io/RxJava/javadoc/rx/Observable.html#throttleFirst(long,%20java.util.concurrent.TimeUnit,%20rx.Scheduler) | |
| */ | |
| func throttleFirst(time: RxTimeInterval, scheduler: SchedulerType) -> Observable<E> { | |
| let s = self.share() |
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 Observable { | |
| /** | |
| example: | |
| Observable<String>.of("1", "a", "3", "4") | |
| .flatMap { Int($0) } | |
| .subscribeNext { print("\($0)") } | |
| result: | |
| 1 | |
| 3 | |
| 4 |
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
| // | |
| // UIViewController+ScrollWhenShowKeyboard.swift | |
| // | |
| // | |
| import UIKit | |
| import RxSwift | |
| import RxCocoa | |
| extension UIViewController { |
NewerOlder