Created
June 30, 2017 06:00
-
-
Save sstadelman/7318206919a6b707cc32fee69326b222 to your computer and use it in GitHub Desktop.
OptionSet
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 Constraints { | |
struct Horizontal: OptionSet { | |
let rawValue: UInt8 | |
static let masterTextView = Horizontal(rawValue: 1) | |
static let detailImageView = Horizontal(rawValue: 2) | |
static let descriptionTextView = Horizontal(rawValue: 3) | |
static let statusTextView = Horizontal(rawValue: 4) | |
static let iconsTextView = Horizontal(rawValue: 5) | |
static let lead = Horizontal(rawValue: 6) | |
static let trail = Horizontal(rawValue: 7) | |
var string: String { | |
switch rawValue { | |
case Horizontal.masterTextView.rawValue: | |
return "[masterTextView]" | |
case Horizontal.detailImageView.rawValue: | |
return "[detailImageView]-(detailImageTrailPad)-" | |
case Horizontal.descriptionTextView.rawValue: | |
return "-(descriptionLeadPad)-[descriptionLabel]" | |
case Horizontal.statusTextView.rawValue: | |
return "[statusTextView]" | |
case Horizontal.lead.rawValue: | |
return "H:|" | |
case Horizontal.trail.rawValue: | |
return "|" | |
default: | |
return "" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment