Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
176 lines (156 sloc) 5.84 KB
// 2015-04-17 update: this is made obsolete by Swift 1.2 `if let` with
// multiple optionals.
//
// This is how I try to deal with deserialization of JSON objects
// with multiple properties using [SwiftyJSON][] (read: without going
// full [Argo][]).
//
// This code is generated by `unwrapped_generator.swift`.
//
// [SwiftyJSON]: https://github.com/SwiftyJSON/SwiftyJSON
// [Argo]: https://github.com/thoughtbot/Argo
//
func unwrapped<T1, T2>(x1: T1?, x2: @autoclosure () -> T2?) -> (T1, T2)? {
if let x1 = x1 {
if let x2 = x2() {
return (x1, x2)
}
}
return nil
}
func unwrapped<T1, T2, T3>(x1: T1?, x2: @autoclosure () -> T2?, x3: @autoclosure () -> T3?) -> (T1, T2, T3)? {
if let x1 = x1 {
if let x2 = x2() {
if let x3 = x3() {
return (x1, x2, x3)
}
}
}
return nil
}
func unwrapped<T1, T2, T3, T4>(x1: T1?, x2: @autoclosure () -> T2?, x3: @autoclosure () -> T3?, x4: @autoclosure () -> T4?) -> (T1, T2, T3, T4)? {
if let x1 = x1 {
if let x2 = x2() {
if let x3 = x3() {
if let x4 = x4() {
return (x1, x2, x3, x4)
}
}
}
}
return nil
}
func unwrapped<T1, T2, T3, T4, T5>(x1: T1?, x2: @autoclosure () -> T2?, x3: @autoclosure () -> T3?, x4: @autoclosure () -> T4?, x5: @autoclosure () -> T5?) -> (T1, T2, T3, T4, T5)? {
if let x1 = x1 {
if let x2 = x2() {
if let x3 = x3() {
if let x4 = x4() {
if let x5 = x5() {
return (x1, x2, x3, x4, x5)
}
}
}
}
}
return nil
}
func unwrapped<T1, T2, T3, T4, T5, T6>(x1: T1?, x2: @autoclosure () -> T2?, x3: @autoclosure () -> T3?, x4: @autoclosure () -> T4?, x5: @autoclosure () -> T5?, x6: @autoclosure () -> T6?) -> (T1, T2, T3, T4, T5, T6)? {
if let x1 = x1 {
if let x2 = x2() {
if let x3 = x3() {
if let x4 = x4() {
if let x5 = x5() {
if let x6 = x6() {
return (x1, x2, x3, x4, x5, x6)
}
}
}
}
}
}
return nil
}
func unwrapped<T1, T2, T3, T4, T5, T6, T7>(x1: T1?, x2: @autoclosure () -> T2?, x3: @autoclosure () -> T3?, x4: @autoclosure () -> T4?, x5: @autoclosure () -> T5?, x6: @autoclosure () -> T6?, x7: @autoclosure () -> T7?) -> (T1, T2, T3, T4, T5, T6, T7)? {
if let x1 = x1 {
if let x2 = x2() {
if let x3 = x3() {
if let x4 = x4() {
if let x5 = x5() {
if let x6 = x6() {
if let x7 = x7() {
return (x1, x2, x3, x4, x5, x6, x7)
}
}
}
}
}
}
}
return nil
}
func unwrapped<T1, T2, T3, T4, T5, T6, T7, T8>(x1: T1?, x2: @autoclosure () -> T2?, x3: @autoclosure () -> T3?, x4: @autoclosure () -> T4?, x5: @autoclosure () -> T5?, x6: @autoclosure () -> T6?, x7: @autoclosure () -> T7?, x8: @autoclosure () -> T8?) -> (T1, T2, T3, T4, T5, T6, T7, T8)? {
if let x1 = x1 {
if let x2 = x2() {
if let x3 = x3() {
if let x4 = x4() {
if let x5 = x5() {
if let x6 = x6() {
if let x7 = x7() {
if let x8 = x8() {
return (x1, x2, x3, x4, x5, x6, x7, x8)
}
}
}
}
}
}
}
}
return nil
}
func unwrapped<T1, T2, T3, T4, T5, T6, T7, T8, T9>(x1: T1?, x2: @autoclosure () -> T2?, x3: @autoclosure () -> T3?, x4: @autoclosure () -> T4?, x5: @autoclosure () -> T5?, x6: @autoclosure () -> T6?, x7: @autoclosure () -> T7?, x8: @autoclosure () -> T8?, x9: @autoclosure () -> T9?) -> (T1, T2, T3, T4, T5, T6, T7, T8, T9)? {
if let x1 = x1 {
if let x2 = x2() {
if let x3 = x3() {
if let x4 = x4() {
if let x5 = x5() {
if let x6 = x6() {
if let x7 = x7() {
if let x8 = x8() {
if let x9 = x9() {
return (x1, x2, x3, x4, x5, x6, x7, x8, x9)
}
}
}
}
}
}
}
}
}
return nil
}
func unwrapped<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(x1: T1?, x2: @autoclosure () -> T2?, x3: @autoclosure () -> T3?, x4: @autoclosure () -> T4?, x5: @autoclosure () -> T5?, x6: @autoclosure () -> T6?, x7: @autoclosure () -> T7?, x8: @autoclosure () -> T8?, x9: @autoclosure () -> T9?, x10: @autoclosure () -> T10?) -> (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)? {
if let x1 = x1 {
if let x2 = x2() {
if let x3 = x3() {
if let x4 = x4() {
if let x5 = x5() {
if let x6 = x6() {
if let x7 = x7() {
if let x8 = x8() {
if let x9 = x9() {
if let x10 = x10() {
return (x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)
}
}
}
}
}
}
}
}
}
}
return nil
}