Last active
March 12, 2018 16:46
-
-
Save cafielo/da90154aca23aa6f9888bf19ec6e575d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
protocol Expandable { | |
var isExpanded: Bool { get set } | |
} | |
class Bag: Expandable { | |
var isExpanded = true | |
} | |
class CarryOn: Expandable { | |
var isExpanded = true | |
} | |
class Closet: Expandable { | |
var isExpanded = true | |
} | |
let bag = Bag() | |
let carryOn = CarryOn() | |
let closet = Closet() | |
let expandableItems: [Expandable] = [bag, carryOn, closet] | |
// expandableItems.forEach { $0.isExpanded = false } // Here !!! I got an immutable error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment