swift-functions


Swift 5.2: Object References as Functions in Swift

Here’s a Swift language feature that you may not have noticed when it arrived in Swift 5.2. The following syntax can now be made legal: let p = Person(firstName: “Matt”, lastName: “Neuburg”) let s = p() print(s) // Matt Wait, what just happened? I treated an instance as a function, and it worked (in the …

Swift 5.2: Object References as Functions in Swift Read More »