swift change enum value
enum SimpleEnum{
case big(String)
case small(String)
case same(String)
mutating func adjust() {
switch self{
case let .big(name):
self = .big(name + "not")
case let .small(name):
self = .small(name + "not")
case let .same(name):
self = .same(name + "not")
}
}
}
var test = SimpleEnum.big("initial")
test.adjust()
switch test {
case let .big(name):
print(name) // prints "initialnot"
case let .small(name):
print(name)
case let .same(name):
print(name)
}
Also in Swift:
- swift list
- swift corner radious of view controller
- remove child from firebase swift
- swift get day from available string
- swift change enum value
- print things in swift
- predicate realm bool swift
- set image width and height swiftui
- application tried to present a nil modal view controller on target
- swift open url
- limit log file size swift
- change selection color uitableviewcell swift
- IOS create UIAlertViewController programmatically
- dart capitalize first letter of each word
- swift remove tableview cell
- Core Data Quickest way to delete all instances of an entity swift
- swift close app
- swift out of bound elelemnt
- store bool value in nsuserdefaults swift
- swift dispatch after
- use alamofire to login in swift 5
- swift update uilabel text button
- register for remote notifications swift
- Get the length of a String swift