Bridge layer

In this example, the data in the data access layer and the application layer will have only one small difference. The difference will be when a player is retrieved, the information about that team will be retrieved with it and will be a part of the player's data structure. Let's see how to define the team and the player in the bridge layer. Let's start off by defining the Team type because it is needed within the Player type:

struct Team { 
  var teamId: Int64?  
  var city: String?  
  var nickName:String? 
  var abbreviation:String? 
} 

Value types are being used for the data structures in this example. When we use value types for data structures such as this, we need to remember that changes to these types are only persisted in the scope ...

Get Swift 4 Protocol-Oriented Programming - Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.