I have defined this function:
func need_rebalance() -> (Bool, RebalanceStrategy) {
}
where RebalanceStrategy is an enum type
enum RebalanceStrategy: String {
case LeftRight = "LeftRight"
case RightLeft = "RightLeft"
}
When I tried to print it this way,
println("Need rebalance? \(self.need_rebalance())")
I got output like this:
Need rebalance? (false, (Enum Value))
My questions are:
1) Is there an easy to extract a value from a tuple? (Hopefully something similar to python e.g. self.need_rebalance()[1]. Apparently this syntax does not work in swift because tuple does not support subscript()
)
2) How can I print the raw value of enum instead of having (Enum Value)
?
I am using XCode6 Beta5