Reputation: 1711
In Obj-C:
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
How would I do the same in Swift?
Upvotes: 1
Views: 849
Reputation: 1409
Enums work differently in Swift compared to Objective-C. The type is UIImagePickerControllerSourceType, but the values are accessed with dot notation:
picker.sourceType = UIImagePickerControllerSourceType.Camera
Since the attribute you are setting is already known to be of type UIImagePickerControllerSourceType, you can skip that part and just write:
picker.sourceType = .Camera
Upvotes: 2