Delegated Administration Hooks: The Write Hook


Using Lock with Swift


This document covers an outdated version of Lock for iOS. We recommend you to upgrade to v2

Lock was written in Objective-C but it can be used from a pure Swift project or a Hybrid project (Swift & Objective-C).

The Hook Contract

Create Objective-C Bridging Header

In order to use Lock classes in any Swift file, you need to add a Objective-C Bridging Header to your project. The easiest way is to create a dummy Objective-C file in your Swift project (or Swift file in a Objective-C project), this will make Xcode prompt to create the bridging header, just press "YES". After that you can delete the dummy file from your project and open the bridging header file which is called <YouAppName>-Bridging-Header.h.

For more information, please check this guide from Apple.

Sample Usage

Use Lock

In <YouAppName>-Bridging-Header.h just add the following line

And Lock classes will be available in all your Swift codebase. So to show A0LockViewController just use the following snippet: