Installation

CocoaPods

The preferred installation method is using CocoaPods. Add the following to your Podfile:

pod 'LightwellKit'

Then, run the following command:

pod install

Manual Installation

If you prefer to not to use Cocoapods, LightwellKit can be downloaded and manually integrated.

First download the latest version of LightwellKit.

Add Framework


Then use Finder to drag the LightwellKit.framework and drop it in your Xcode project. Make sure you check Copy items if needed.

Select your Xcode project in the project navigator on the left side. Select the General tab and make sure LightwellKit.framework has been added to the Embedded Binaries and Linked Frameworks and Libraries sections.

Add a Run Script Build Phase


A build script needs to be added to enure that only the required device architectures are included in the bundle. Otherwise Archiving and Uploading to the App Store will fail.

Select your Xcode project in the project navigator on the left side. Select the Build Phases tab. Then in the upper left corner, press the + icon and select New Run Script Phase. A new Run Script section will appear at the bottom of the list of build phases. Click the arrow next to Run Script to open the section. Then paste the following shell script:

APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"

find "$APP_PATH" -name 'LightwellKit.framework' -type d | while read -r FRAMEWORK
do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"

EXTRACTED_ARCHS=()

for ARCH in $ARCHS
do
echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
done

echo "Merging extracted architectures: ${ARCHS}"
lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"
rm "${EXTRACTED_ARCHS[@]}"

echo "Replacing original executable with thinned version"
rm "$FRAMEWORK_EXECUTABLE_PATH"
mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"

done

That’s it! You’re ready to start building with LightwellKit.