Untitled
unknown
swift
2 years ago
1.0 kB
10
Indexable
//
// 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)
}Editor is loading...
Leave a Comment