One thought on “Extract Class Refactoring in Swift”

  1. Hi Andy, Great video! I myself love OOP with Swift =)
    Refactoring is a next book that I am gonna read.

    As a guy with a passion about SOLID, I would add that it would be good idea couple Person to an abstraction of Name, like to a protocol:

    protocol IName {
    var firstName: String? { get }
    }

    As you said we can have names for many different things, like for a cat, and we want be able to make them custom.

    struct PersonName: IName {
    var firstName: String?
    var middleName: String?
    var lastName: String?
    }

    struct CatName: IName {
    var firstName: String?
    }

    And maybe somewhere we would want to manage all names in one place, like showing them in tableView. It would be more flexible to to use abstractions.

    What do you think ?

Leave a Reply

Your email address will not be published. Required fields are marked *