Skip to content

Instantly share code, notes, and snippets.

@cipolleschi
Created December 22, 2020 08:30
Show Gist options
  • Save cipolleschi/09a01942d0796d53f2c2634192c55b82 to your computer and use it in GitHub Desktop.
Save cipolleschi/09a01942d0796d53f2c2634192c55b82 to your computer and use it in GitHub Desktop.
struct ShippingOptions: OptionSet {
let rawValue: Int
static let nextDay = ShippingOptions(rawValue: 1 << 0)
static let secondDay = ShippingOptions(rawValue: 1 << 1)
static let priority = ShippingOptions(rawValue: 1 << 2)
static let standard = ShippingOptions(rawValue: 1 << 3)
static let express: ShippingOptions = [.nextDay, .secondDay]
static let all: ShippingOptions = [.express, .priority, .standard]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment