Listing 15.23 no longer compiles in Xcode 10.3

The last line of Listing 15.23 gives the error “Partial application of ‘mutating’ method is not allowed”:

import Cocoa

struct Person {
    var firstName = "Matt"
    var lastName = "Mathias"
    
    mutating func changeTo(firstName:String, lastName:String) {
        self.firstName = firstName
        self.lastName = lastName
    }
}

var p = Person()
let changeName = Person.changeTo

Same error encountered in Xcode Version 11.1

Try changing struct to class:

class Person: CustomStringConvertible {
    var firstName = "Matt"
    var lastName  = "Mathias"
    
    func changeTo (firstName:String, lastName:String) {
        self.firstName = firstName
        self.lastName = lastName
    }
    
    var description : String {
        return "\(firstName) \(lastName)"
    }
}

var p = Person()
var changeName = Person.changeTo

print (p)
changeName (p) ("Jibber", "Jabber")
print (p)