Core Graphics is an API included in both Cocoa and Cocoa Touch. It allows you to draw graphic objects on the graphic destination. In this tutorial we will draw some basic shapes such as a rectangle or a circle. This tutorial is made with Xcode 8 and built for iOS 10.
Open Xcode and create a new Single View Application.
Choose Next. For product name, use IOS10DrawShapesTutorial and then fill out the Organization Name and Organization Identifier with your customary values. Enter Swift as Language and make sure only iPhone is selected in Devices.
Go to the Storyboard and drag a Horizontal Stack View from the Object Library to the top section of the main View. Go to the Attributes inspector and in the Stack View section and change the Distributon type to Fill Equally. Drag 3 buttons from the Object Library to the Stack View and give them the following names: Rectangle, Lines and Circle. Select the Stack View and Select the Pin button from the Auto Layout button on the bottom-right of the Storyboard and fill in the following values. Select Add 3 Constraints.