Technical requirements
You can find the code files present in this chapter on GitHub at https://github.com/PacktPublishing/Swift-Cookbook-Third-Edition/tree/main/Chapter%2010/Chapter%2010%20-%20Core%20ML.
Building an image capture app
In this first recipe, we’re going to create an app that captures either an image from your camera roll or an image taken from your camera. This will set up our iOS app ready for us to incorporate CoreML to detect objects in our photos.
Getting ready
For this recipe, you’ll need the latest version of Xcode available from the Mac App Store.
How to do it...
With Xcode open, let’s get started:
- Create a new project in Xcode. Go to File | New | Project | iOS App.
- In
Main.storyboard
, add the following:- Add
UISegmentedControl
with two options (Photo / Camera Roll
andLive Camera
). - Next, add a
UILabel
view just underneath. - Add a
UIImageView
view beneath that. - Finally, add a
UIButton
component.
- Add
- Space these accordingly...