Skip to content

Instantly share code, notes, and snippets.

@RuiAAPeres
Created April 15, 2017 20:06
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RuiAAPeres/640c1bb3f005edfe9f1980cd8849eb57 to your computer and use it in GitHub Desktop.
Save RuiAAPeres/640c1bb3f005edfe9f1980cd8849eb57 to your computer and use it in GitHub Desktop.
struct MyModelDTO {
let property1: Type1
let property2: Type2
}
extension MyModelDTO {
init(model: MyModel_CoreData) {
self.init(property1: model.property1, property2: model.property2)
}
}
class MyModel_CoreData: NSManagedObject {
@NSManaged var property1: Type1
@NSManaged var property2: Type2
}
@Czajnikowski
Copy link

Hi @RuiAAPeres, what's the meaning behind a DTO suffix?

@RuiAAPeres
Copy link
Author

DTO means Data Transfer Object (as you probably know). I use the suffix when in situations where the naming of the entity is not entirely clear that it's just a dumb struct carrying data.

@Czajnikowski
Copy link

Makes sense 👍 Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment