Design Pattern in Swift 3