Skip to content

Instantly share code, notes, and snippets.

@sstadelman
Created June 30, 2017 06:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sstadelman/7318206919a6b707cc32fee69326b222 to your computer and use it in GitHub Desktop.
Save sstadelman/7318206919a6b707cc32fee69326b222 to your computer and use it in GitHub Desktop.
OptionSet
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