Tag Archives: framework

Swift framework development for binary distribution with CocoaPods

Swift Framework with Objective-C

Having previously developed some Objective-C based frameworks, I set out to explore doing the same with Swift and be able to deliver the framework as a Pod.

Creating a a Swift Framework is pretty straightforward and there are some great references on the subject.  One that I found very helpful was Creating and Distributing iOS Frameworks

I wanted to include some Objective-C based CocoaPods in my Swift Framework and quickly ran into an issue – you can’t use bridging headers with framework targets.

I did find a workaround which was interesting.  An answer in the thread Importing CommonCrypto in a Swift framework showed how to create a module that could be imported into Swift using an Aggregate target.  Using this answer as a guide, I was able to create a module for AFNetworking using the run script:

mkdir -p "${BUILT_PRODUCTS_DIR}/AFNetworkingModuleMap"
cat <<EOF > "${BUILT_PRODUCTS_DIR}/AFNetworkingModuleMap/module.modulemap"
module AFNetworking [system] {
header "${PODS_ROOT}/Headers/Public/AFNetworking/AFNetworking.h"
export *
}
EOF

This was interesting, but not the right approach.

Continue reading

Using and customizing the Address Book UI framework

Apple provides a nice framework for incorporating Address Book access  into your iOS application, using  the familiar UI from the Contacts app.  They provide some nice documentation on this UI in the section User Interaction: Prompting for and Displaying Data.

Here is an example of the UI that Apple indicates is available:

AddressBookUIFramework

The default UI is a little different

The above view of the controllers looks great, but getting them to work together as the images imply is not quite so straightforward.  Consider the following code snippet used to present the People Picker:

Continue reading