Skip to content

Instantly share code, notes, and snippets.

💭
🏔🏃‍♂️

Rui Peres RuiAAPeres

View GitHub Profile
View Flow_example.swift
public extension UIViewController {
var modalFlow: Flow {
return ModalFlow(self)
}
var navigationFlow: Flow {
guard let navigationController = self.navigationController else { return modalFlow }
return NavigationFlow(navigationController)
}
}
View phase3.swift
import Foundation
precedencegroup PipePrecedence {
associativity: left
higherThan: AssignmentPrecedence
}
infix operator |> : PipePrecedence
public func |> <T, U>(x: T, f: (T) -> U) -> U {
View phase2.swift
import Foundation
enum Result<T> {
case success(T)
case failure(String)
func map<U>(_ f: (T) -> U) -> Result<U> {
switch self {
case .success(let x): return .success(x |> f)
case .failure(let e): return .failure(e)
View phase1.swift
import Foundation
"4 5 + 3 +"
func calculator(_ input: String) -> Double {
return input |> split |> reversePolishNotation
}
func reversePolishNotation(_ input: [String]) -> Double {
var stack: [Double] = []
View foo.swift
struct MyModelDTO {
let property1: Type1
let property2: Type2
}
extension MyModelDTO {
init(model: MyModel_CoreData) {
self.init(property1: model.property1, property2: model.property2)
}
}
View bah.swift
class MyModel: NSObject {
var property1: Type1!
var property2: Type2!
}
View gist:07a8f3459532bbb952b1dd480ec0913c
Process: Xcode [3786]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 8.3 (12169)
Build Info: IDEFrameworks-12169000000000000~2
App Item ID: 497799835
App External ID: 821487965
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Xcode [3786]
View gist:35226980b977a8f93fea42519049303a
Process: Xcode [2788]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 8.3 (12169)
Build Info: IDEFrameworks-12169000000000000~2
App Item ID: 497799835
App External ID: 821487965
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Xcode [2788]
View gist:55f176c1a695e929db92e179e9946281
Process: Xcode [91355]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 8.3 (12169)
Build Info: IDEFrameworks-12169000000000000~2
App Item ID: 497799835
App External ID: 821487965
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Xcode [91355]
View gist:a6b4ee7c4b2f370359b34c0de25d36c2
Process: Xcode [50680]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 8.3 (12169)
Build Info: IDEFrameworks-12169000000000000~2
App Item ID: 497799835
App External ID: 821487965
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Xcode [50680]
You can’t perform that action at this time.