I used to write Models in swift projects in separate files and that what I usually see in others projects, but wouldn't be easier to put them in one file? I want to know which is the best practice and why we supposed to follow? here an example of separating them:
User.swift
import Foundation
class User: NSObject {
var name: String?
var email: String?
var id: String?
}
Post.swift
class Post: NSObject {
var id: String?
var type: String?
var imageUrl: String?
var caption: String?
}