Untitled
unknown
swift
7 months ago
1.0 kB
3
Indexable
Never
// // AppEntity.swift // ShoppingList // // Created by Marco on 14/03/24. // /// An abstract app entity (an high level model which is used by the business/app domain logic and presentation layer) protocol AppEntity {} // MARK: - Adapter /// An app entity which can be translated to and from a foreign data model (low level model) protocol ForeignModelAdapter: AppEntity { associatedtype ForeignModel /// Returns a new entity which has been filled with data from the specified foreign model /// - Parameter from: the foreign model from which the data of the new app entity is filled /// - Returns: A new app entity representing the same informations in the foreign model passed as argument static func newEntity(from: ForeignModel) -> Self /// Fills the existing foreign model passed by argument with the same information that this entity holds /// - Parameter to: The model to be adapted (filled) with this model's data func adaptExistingForeignModel(_ model: inout ForeignModel) }
Leave a Comment