Skip to content

Instantly share code, notes, and snippets.

@speaktoalvin
Created November 28, 2016 20:49
Show Gist options
  • Save speaktoalvin/101864d882523f8ac5f312b5febbf47c to your computer and use it in GitHub Desktop.
Save speaktoalvin/101864d882523f8ac5f312b5febbf47c to your computer and use it in GitHub Desktop.
Converting From Struct to Enum
struct K {
struct StoryBoards {
struct Home {
static let Name = "Home"
static let IdNavigationViewController = "NavigationViewController"
static let IdTabsViewController = "HomeTabBarController"
}
struct Contacts {
static let Name = "Contacts"
static let IdContactsViewController = "ContactsViewController"
}
struct Settings {
static let Name = "Settings"
static let IdSettingsViewController = "SettingsViewController"
}
struct Today {
static let Name = "Today"
static let IdTodayViewController = "TodayViewController"
}
struct Mock {
static let Name = "Mock"
static let IdMockViewController = "MockViewController"
}
}
struct TodayScreen {
static let iconWidth : CGFloat = 35.0
}
struct Realm {
static let version: UInt64 = 3
}
}
// ENUM
enum K {
enum StoryBoards {
case Home
case Contacts
case Settings
case Today
case Mock
var name : String {
switch self {
case .Home : return "Home"
case .Contacts : return "Contacts"
case .Settings : return "Settings"
case .Today : return "Today"
case .Mock : return "Mock"
}
}
var controller : String {
switch self {
case .Home : return "NavigationViewController"
case .Contacts : return "ContactsViewController"
case .Settings : return "SettingsViewController"
case .Today : return "TodayViewController"
case .Mock : return "MockViewController"
}
}
var tabBar : String {
switch self {
case .Home : return "HomeTabBarController"
default : return ""
}
}
}
enum mTodayScreen {
static let iconWidth : CGFloat = 35.0
}
enum Realm {
static let version: UInt64 = 3
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment