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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.