This assigns an array of UIUserNotificationType to a variable of UIUserNotificationType. This should not work:
1)
var userNotificationTypes: UIUserNotificationType = [UIUserNotificationType.Alert, UIUserNotificationType.Badge, UIUserNotificationType.Sound]
print(userNotificationTypes.dynamicType) // UIUserNotificationType
Here is the type of [UIUserNotificationType]
2)
let intermidiate = [UIUserNotificationType.Alert, UIUserNotificationType.Badge, UIUserNotificationType.Sound]
print(intermidiate.dynamicType) // Array<UIUserNotificationType>
Attempting to assign it fails as expected:
3)
userNotificationTypes = intermidiate // Cannot assign a value of type '[UIUserNotificationType]' to a value of type 'UIUserNotificationType'
Attempting to assign [UIUserNotificationType]
to UIUserNotificationType
obviously does not work, so why does 1)
compiles ?