Skip to main content

Tuple splat syntax is deprecated

About 2 minSwiftArticle(s)bloghackingwithswift.comswiftswift-2.2

Tuple splat syntax is deprecated 관련

HACKING WITH SWIFT

What's new in Swift?

Tuple splat syntax is deprecated | Changes in Swift 2.2

Tuple splat syntax is deprecated

Available from Swift 2.2

Another feature that has been deprecated is one that has been part of Swift since 2010 (yes, years before it launched). It's been named "the tuple splat", and not many people were using it. It's partly for that reason – although mainly because it introduces all sorts of ambiguities when reading code – that this syntax is being deprecated.

In case you were curious – and let's face it, you probably are – here's an example of tuple splat syntax in action:

func describePerson(name: String, age: Int) {
    print("\(name) is \(age) years old")
}

let person = ("Taylor Swift", age: 26)
describePerson(person)

But remember: don't grow too fond of your new knowledge, because tuple splats are deprecated in Swift 2.2 and will be removed entirely in a later version.

Other changes in Swift 2.2…
++ and -- are deprecated | Changes in Swift

++ and -- are deprecated
Traditional C-style for loops are deprecated | Changes in Swift

Traditional C-style for loops are deprecated
Comparing tuples | Changes in Swift

Comparing tuples
More keywords can be used as argument labels | Changes in Swift

More keywords can be used as argument labels
Variable parameters have been deprecated | Changes in Swift

Variable parameters have been deprecated
Renamed debug identifiers: line, function, file | Changes in Swift

Renamed debug identifiers: line, function, file
Stringified selectors are deprecated | Changes in Swift

Stringified selectors are deprecated
Compile-time Swift version checking | Changes in Swift

Compile-time Swift version checking

Download Swift 2.2 playgroundopen in new window


이찬희 (MarkiiimarK)
Never Stop Learning.