I am translating objective -C to swift, but I get error when I write assert(0) in swift, the error message is "in swift assert(0) Cannot convert value of type Int to expected argument type Bool "
my code in objective -c:
switch ([[UIApplication sharedApplication] applicationState]) {
case UIApplicationStateActive:
[statusStr appendString:@"foreground"];
break;
case UIApplicationStateInactive:
[statusStr appendString:@"inactive"];
break;
case UIApplicationStateBackground:
[statusStr appendString:@"background"];
break;
default:
assert(0);
break;
}
and translate in swift :
switch UIApplication.shared.applicationState {
case .active:
statusStr += "foreground"
case .inactive:
statusStr += "inactive"
case .background:
statusStr += "background"
default:
assert(0)
break
}
I don't know 0 mean in swift make it assert(true)
or assert(false)
.
Thanks in advance.