-
-
Save susieyy/ca18fe34127194ebd7284ec85f5271f2 to your computer and use it in GitHub Desktop.
#swtws
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum ProfileDisplayType { | |
case mine | |
case other(userId :Int) | |
var title: String { | |
switch self { | |
case .mine: return "My profile" | |
case .other(_): return "\(userRealm.name)'s pofile" | |
} | |
} | |
var userRealm: UserRealm { | |
switch self { | |
case .mine: return try! Realm().objectForPrimaryKey(UserRealm.self, key: Shared.mineId)! | |
case .other(let userId): return try! Realm().objectForPrimaryKey(UserRealm.self, key: userId)! | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment