code that is maintained by someone other than the original author. Code that has no tests. Code that can be rewritten using better programming techniques or languages
Extract DMs in a more generic way 5) Create the Swift clients and return the DMs 1) Rename the Obj-C models 2) Create the Swift models & Domain Models 3) Create initializers of DMs from Obj-C + Swift models DMs Migration Steps 6) Use DMs throughout the codebase
DMs 7) Extract DMs in a more generic way 5) Create the Swift clients and return the DMs 1) Rename the Obj-C models 2) Create the Swift models & Domain Models 3) Create initializers of DMs from Obj-C + Swift models 6) Use DMs throughout the codebase
Create new Swift clients and return the DMs 1) Rename the Obj-C models 2) Create the Swift models & Domain Models 3) Create initializers of DMs from Obj-C + Swift models Migration Steps 7) Extract DMs in a more generic way 6) Use DMs throughout the codebase
String? let price: Double let manufacturer: String let imageUrl: String? let reviewsScore: Float } : Decodable { enum SwiftModel { } extension SwiftModel { } SwiftModel.Product Swift Model
String let review: String? let price: Double let manufacturer: String let imageUrl: String? let reviewsScore: Float } enum Domain { } extension SwiftModel { } extension Domain { } SwiftModel.Product struct Product let productId: Int let name: String let review: String? let price: Double let manufacturer: String let imageUrl: String? let reviewsScore: Float } : Decodable Swift Model Domain.Product
Create new Swift clients and return the DMs 1) Rename the Obj-C models 2) Create the Swift models & Domain Models 3) Create initializers of DMs from Obj-C + Swift models Migration Steps 7) Extract DMs in a more generic way 6) Use DMs throughout the codebase
Create new Swift clients and return the DMs 1) Rename the Obj-C models 2) Create the Swift models & Domain Models 3) Create initializers of DMs from Obj-C + Swift models Migration Steps 7) Extract DMs in a more generic way 6) Use DMs throughout the codebase
Create new Swift clients and return the DMs 1) Rename the Obj-C models 2) Create the Swift models & Domain Models 3) Create initializers of DMs from Obj-C + Swift models Migration Steps 7) Extract DMs in a more generic way 6) Use DMs throughout the codebase
result in switch result { case .success(let products): completion(.success(products case .failure(let error): completion(.failure(error)) } } } )) @escaping (Result<[SwiftModel.Product], NSError>) -> Void) {
Create new Swift clients and return the DMs models 1) Rename the Obj-C models 2) Create the Swift models & Domain Models 3) Create initializers of DMs from Obj-C + Swift models Migration Steps 7) Extract DMs in a more generic way 6) Use DMs throughout the codebase
{ struct Product { let productId: Int let name: String let review: String? let price: Double let manufacturer: String let imageUrl: String? let reviewsScore: Float } var shop: Shop? struct Shop { let shopId: Int let shopName: String } var product = products[0] product.shop = shop } SwiftModel.Shop // Old Client var shop: Domain.Shop? OldShopApiClient.shared().getShop(nil) { shop, error in if (error) { // handle error } shop = Domain.Shop(model: shop) } func getProductsAndShop() { // New Client var products: [Domain.Product] = [] ProductsSwiftClient.shared().fetchProducts { response in switch response { case .success(let prods): products = prods.map { Domain.Product(model: $0) } case .failure(let error): print("error") } } OldShop }
Extract DMs in a more generic way 5) Create new Swift clients and return the DMs 1) Rename the Obj-C models 2) Create the Swift models & Domain Models 3) Create initializers of DMs from Obj-C + Swift models Migration Steps 6) Use DMs throughout the codebase