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 ProtocolA {} | |
protocol ProtocolB: ProtocolA {} | |
protocol ProtocolC { | |
func act() | |
} | |
protocol ProtocolD { | |
typealias V | |
func act() | |
} |
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
func z_map<S : SequenceType, T>(source: S, transform: (S.Generator.Element) -> T?) -> [T] { | |
// easy, right? =) | |
return reduce(source, []) { r, i in map( transform(i) ) { r + [$0] } ?? r } | |
} |
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 | |
struct MainScene { | |
let vc: UIViewController | |
let nc: UINavigationController | |
init(vc: UIViewController) { | |
self.vc = vc | |
self.nc = UINavigationController(rootViewController: vc) | |
} | |
} |
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 HasTitle { | |
var ht_title: String {get set} | |
} | |
extension UIBarButtonItem: HasTitle { | |
var ht_title: String { | |
get { | |
return self.title ?? "" | |
} | |
set { |
NewerOlder