Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UIKit
- struct Model {
- private init() {}
- }
- extension Model {
- static let defaultName = "anyone"
- static let defaultPassword = "Awesome"
- struct Account {
- let username: String
- let password: String
- }
- }
- struct API {
- private init() {}
- }
- extension API {
- struct Account {
- static func getFromServer() -> Model.Account {
- // Do something here
- return Model.Account(username: Model.defaultName, password: Model.defaultPassword)
- }
- }
- }
- // How to use
- struct DoSomething {
- var account: Model.Account = API.Account.getFromServer()
- }
Add Comment
Please, Sign In to add comment