Encrypt image using AESCrypt-ObjC and Swift.

AESCrypt is a simple to use, opinionated AES encryption / decryption Objective-C class that just works. AESCrypt uses the AES-256-CBC cipher and encodes the encrypted data with base64.

https://github.com/datomnurdin/AESCrypt-ObjC

Open Xcode and create a new Single View Application. For product name, use RevivalxSwiftAESCrypt 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.

Single View Application

Single View Application

Choose options for your new project

Choose options for your new project

Download AESCrypt-ObjC for Swift from Github here, https://github.com/Gurpartap/AESCrypt-ObjC. Copy the library into your project.

AESCrypt-ObjC

AESCrypt-ObjC

Set to Compact Width | Any Height.

Compact Width | Any Height

Compact Width | Any Height

Go to the Storyboard and drag an Image View to the main View. Select the Image View and go to the Size inspector and fill in the following values.

Show the Size inspector

Show the Size inspector

And image mode change to Aspect Fill.

Image View mode

Image View mode

Open document outline, select the Image View again and set constraint to Center Horizontally in ContainerCenter Vertically in ContainerTop space to Top Layout Guide and Leading Space to Container Margin.

Document Outline and Constraints

Document Outline and Constraints

The Storyboard will look like this.

Main.Storyboard

Main.Storyboard

Select the Assistant Editor and make sure the ViewController.swift is visible. Ctrl and drag from the Image View to the ViewController class and create the following Outlet.

Image View property outlet

Image View property outlet

Continue..