SlideShare ist ein Scribd-Unternehmen logo
1 von 14
Downloaden Sie, um offline zu lesen
Create an iOS 
Framework, document it 
and not die trying 
by @alexruperez
• Fast iterative builds when developing the 
framework. We may have a simple application that 
has the .framework as a dependency and we 
want to quickly iterate on development of 
the .framework. 
• Infrequent distribution builds of the .framework. 
• Resource distribution should be intuitive and not 
bloat the application. 
• Setup for third-party developers using 
the .framework should be easy.
Uncheck “Create git repository on…” option.
• Developers expect to be able to import your framework by importing the 
<YourFramework/YourFramework.h> header. Ensure that your project has such a 
header (if you created a new static library then there should already be a 
YourFramework.h and YourFramework.m file; you can delete the .m). 
• Add Build Phases from the menu. Click on Editor > Add Build Phase -> Add Copy 
Headers Build Phase. Note: If the menu options are grayed out, you'll need to click 
on the whitespace below the Build Phases to regain focus and retry. 
• You'll see 3 sections for Public, Private, and Project headers. To modify the scope of 
any header, drag and drop the header files between the sections. Alternatively you 
can open the Project Navigator and select the header. Next expand the Utilities 
pane for the File Inspector (Cmd+Option+0). 
• Look at the "Target Membership" group and ensure that the checkbox next to the .h 
file is checked. Change the scope of the header from "Project" to "Public". You might 
have to uncheck and check the box to get the dropdown list. This will ensure that 
the header gets copied to the correct location in the copy headers phase.
• By default the static library project will copy private and 
public headers to the same folder: /usr/local/include. To 
avoid mistakenly copying private headers to our framework 
we want to ensure that our public headers are copied to a 
separate directory, e.g. Headers. 
• To change this setting, select the project in the Project 
Navigator and then click the "Build Settings" tab. Search for 
"public headers" and then set the "Public Headers Folder 
Path" to "Headers" for all configurations. If you are working 
with multiple Frameworks make sure that this folder is 
unique.
• We do not want to strip any code from the library; 
we leave this up to the application that is linking 
to the framework. To disable code stripping we 
must modify the following configuration settings. 
• "Dead Code Stripping" => No (for all settings) 
• "Strip Debug Symbols During Copy" => No (for 
all settings) 
• "Strip Style" => Non-Global Symbols (for all 
settings)
• Select Editor menu > Add Build Phase > Add 
Run Script Build Phase 
set -e! 
! 
mkdir -p "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/Versions/A/Headers"! 
! 
# Link the "Current" version to "A"! 
/bin/ln -sfh A "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/Versions/Current"! 
/bin/ln -sfh Versions/Current/Headers "${BUILT_PRODUCTS_DIR}/$ 
{PRODUCT_NAME}.framework/Headers"! 
/bin/ln -sfh "Versions/Current/${PRODUCT_NAME}" "${BUILT_PRODUCTS_DIR}/$ 
{PRODUCT_NAME}.framework/${PRODUCT_NAME}"! 
! 
# The -a ensures that the headers maintain the source modification date so that we don't 
constantly! 
# cause propagating rebuilds of files that import these headers.! 
/bin/cp -a "${TARGET_BUILD_DIR}/${PUBLIC_HEADERS_FOLDER_PATH}/" "$ 
{BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/Versions/A/Headers"
• Add the static library target to the "Target 
Dependencies”. 
• Set “Arquitectures” and “Valid arquitectures” in 
the Build Settings to i386, x86_64, armv7, 
armv7s and arm64. 
• Select Editor menu > Add Build Phase > Add 
Run Script Build Phase
set -e! 
set +u! 
# Avoid recursively calling this script.! 
if [[ $SF_MASTER_SCRIPT_RUNNING ]]! 
then! 
exit 0! 
fi! 
set -u! 
export SF_MASTER_SCRIPT_RUNNING=1! ! 
SF_TARGET_NAME=${PROJECT_NAME}! 
SF_EXECUTABLE_PATH="lib${SF_TARGET_NAME}.a"! 
SF_WRAPPER_NAME="${SF_TARGET_NAME}.framework"! 
SF_BUNDLE_NAME="${SF_TARGET_NAME}.bundle"! !# 
The following conditionals come from! 
# https://github.com/kstenerud/iOS-Universal-Framework! ! 
if [[ "$SDK_NAME" =~ ([A-Za-z]+) ]]! 
then! 
SF_SDK_PLATFORM=${BASH_REMATCH[1]}! 
else! 
echo "Could not find platform name from SDK_NAME: $SDK_NAME"! 
exit 1! 
fi! ! 
if [[ "$SDK_NAME" =~ ([0-9]+.*$) ]]! 
then! 
SF_SDK_VERSION=${BASH_REMATCH[1]}! 
else! 
echo "Could not find sdk version from SDK_NAME: $SDK_NAME"! 
exit 1! 
fi! ! 
if [[ "$SF_SDK_PLATFORM" = "iphoneos" ]]! 
then! 
SF_OTHER_PLATFORM=iphonesimulator! 
else! 
SF_OTHER_PLATFORM=iphoneos! 
fi! ! 
if [[ "$BUILT_PRODUCTS_DIR" =~ (.*)$SF_SDK_PLATFORM$ ]]! 
then! 
SF_OTHER_BUILT_PRODUCTS_DIR="${BASH_REMATCH[1]}${SF_OTHER_PLATFORM}"! 
else! 
echo "Could not find platform name from build products directory: $BUILT_PRODUCTS_DIR"! 
exit 1! 
fi!!# 
Build the other platform.! 
xcrun xcodebuild -project "${PROJECT_FILE_PATH}" -target "${TARGET_NAME}" -configuration "${CONFIGURATION}" -sdk ${SF_OTHER_PLATFORM}$ 
{SF_SDK_VERSION} BUILD_DIR="${BUILD_DIR}" OBJROOT="${OBJROOT}" BUILD_ROOT="${BUILD_ROOT}" SYMROOT="${SYMROOT}" $ACTION! !# 
Smash the two static libraries into one fat binary and store it in the .framework! 
xcrun lipo -create "${BUILT_PRODUCTS_DIR}/${SF_EXECUTABLE_PATH}" "${SF_OTHER_BUILT_PRODUCTS_DIR}/${SF_EXECUTABLE_PATH}" -output "$ 
{BUILT_PRODUCTS_DIR}/${SF_WRAPPER_NAME}/Versions/A/${SF_TARGET_NAME}"! !# 
Copy the binary to the other architecture folder to have a complete framework in both.! 
cp -a "${BUILT_PRODUCTS_DIR}/${SF_WRAPPER_NAME}/Versions/A/${SF_TARGET_NAME}" "${SF_OTHER_BUILT_PRODUCTS_DIR}/$ 
{SF_WRAPPER_NAME}/Versions/A/${SF_TARGET_NAME}"! ! 
rm -rf "${PROJECT_DIR}/Framework/"! 
mkdir "${PROJECT_DIR}/Framework/"! 
cp -rf "${BUILT_PRODUCTS_DIR}/${SF_WRAPPER_NAME}" "${PROJECT_DIR}/Framework/"! 
cp -rf "${BUILT_PRODUCTS_DIR}/${SF_BUNDLE_NAME}" "${PROJECT_DIR}/Framework/" 2>/dev/null || :
• Add the Framework Project to your Application 
Project 
• Select your project in the Project Navigator and 
open the "Build Phases" tab. Expand the "Target 
Dependencies" group and click the + button. 
Select the static library target and click “Add". 
• Expand the "Link Binary With Libraries" phase 
and click the + button. Select the .a file that's 
exposed by your framework's project and then 
click add.
• git clone git://github.com/tomaz/appledoc.git 
• sudo sh install-appledoc.sh 
• Select Editor menu > Add Build Phase > Add Run Script 
Build Phase 
#appledoc Xcode script! 
# Start constants! 
company="alexruperez";! 
companyID="com.alexruperez";! 
companyURL="http://alexruperez.com";! 
target="iphoneos";! 
outputPath="~/help";! 
# End constants! 
/usr/local/bin/appledoc ! 
--project-name "${PROJECT_NAME}" ! 
--project-company "${company}" ! 
--company-id "${companyID}" ! 
--docset-atom-filename "${company}.atom" ! 
--docset-feed-url "${companyURL}/${company}/%DOCSETATOMFILENAME" ! 
--docset-package-url "${companyURL}/${company}/%DOCSETPACKAGEFILENAME" ! 
--docset-fallback-url "${companyURL}/${company}" ! 
--output "${outputPath}" ! 
--ignore "Private" ! 
--publish-docset ! 
--docset-platform-family "${target}" ! 
--logformat xcode ! 
--keep-intermediate-files ! 
--no-repeat-first-par ! 
--no-warn-invalid-crossref ! 
--exit-threshold 2 ! 
"${PROJECT_DIR}"! 
rm -rf "${PROJECT_DIR}/Documentation/"! 
mkdir "${PROJECT_DIR}/Documentation/"! 
cp -rf ~/help/html/ "${PROJECT_DIR}/Documentation/"
/// Simple description 
! 
! 
! 
/** 
* Description. 
* 
* @warning Warning 
* @param Param A 
* @param Param B 
* @return Return 
*/
Addendum 
• alexruperez/FrameworkExample 
• jverkoey/iOS-Framework 
• tomaz/appledoc

Weitere ähnliche Inhalte

Was ist angesagt?

Aleksey_Demedetskiy_Jenkins
Aleksey_Demedetskiy_JenkinsAleksey_Demedetskiy_Jenkins
Aleksey_Demedetskiy_Jenkins
Ciklum
 
Building GPU-Accelerated Mobile Application Interfaces with Starling and Feat...
Building GPU-Accelerated Mobile Application Interfaces with Starling and Feat...Building GPU-Accelerated Mobile Application Interfaces with Starling and Feat...
Building GPU-Accelerated Mobile Application Interfaces with Starling and Feat...
Joseph Labrecque
 

Was ist angesagt? (19)

Selenium in the palm of your hand: Appium and automated mobile testing
Selenium in the palm of your hand: Appium and automated mobile testingSelenium in the palm of your hand: Appium and automated mobile testing
Selenium in the palm of your hand: Appium and automated mobile testing
 
Gearing up for mobile push notifications
Gearing up for mobile push notificationsGearing up for mobile push notifications
Gearing up for mobile push notifications
 
Simple ways to deploy VM Images from Self Service UI in IBM Cloud Orchestrato...
Simple ways to deploy VM Images from Self Service UI in IBM Cloud Orchestrato...Simple ways to deploy VM Images from Self Service UI in IBM Cloud Orchestrato...
Simple ways to deploy VM Images from Self Service UI in IBM Cloud Orchestrato...
 
KKBOX WWDC17 UIKit Drag and Drop - Mario
KKBOX WWDC17  UIKit Drag and Drop - MarioKKBOX WWDC17  UIKit Drag and Drop - Mario
KKBOX WWDC17 UIKit Drag and Drop - Mario
 
Hello windows 10
Hello windows 10Hello windows 10
Hello windows 10
 
monkeyTalk
monkeyTalkmonkeyTalk
monkeyTalk
 
Integrate Jenkins with S3
Integrate Jenkins with S3Integrate Jenkins with S3
Integrate Jenkins with S3
 
Aleksey_Demedetskiy_Jenkins
Aleksey_Demedetskiy_JenkinsAleksey_Demedetskiy_Jenkins
Aleksey_Demedetskiy_Jenkins
 
Inspect The Uninspected
Inspect The UninspectedInspect The Uninspected
Inspect The Uninspected
 
iOS Remote Notifications
iOS Remote NotificationsiOS Remote Notifications
iOS Remote Notifications
 
Create or Modify Virtual system Patterns using IBM Cloud Orchestrator v2.5
Create or Modify Virtual system Patterns using  IBM Cloud Orchestrator v2.5Create or Modify Virtual system Patterns using  IBM Cloud Orchestrator v2.5
Create or Modify Virtual system Patterns using IBM Cloud Orchestrator v2.5
 
Henry Been - Secure development: keeping your application secrets private
Henry Been - Secure development: keeping your application secrets privateHenry Been - Secure development: keeping your application secrets private
Henry Been - Secure development: keeping your application secrets private
 
DevOpsDays Austin - Configuration Management Evolution
DevOpsDays Austin - Configuration Management EvolutionDevOpsDays Austin - Configuration Management Evolution
DevOpsDays Austin - Configuration Management Evolution
 
Building GPU-Accelerated Mobile Application Interfaces with Starling and Feat...
Building GPU-Accelerated Mobile Application Interfaces with Starling and Feat...Building GPU-Accelerated Mobile Application Interfaces with Starling and Feat...
Building GPU-Accelerated Mobile Application Interfaces with Starling and Feat...
 
Iteratively Develop Microservices with Speed on Kubernetes
Iteratively Develop Microservices with Speed on KubernetesIteratively Develop Microservices with Speed on Kubernetes
Iteratively Develop Microservices with Speed on Kubernetes
 
Building Mobile Apps With Xamarin and Visual Studio App Center
Building Mobile Apps With Xamarin and Visual Studio App CenterBuilding Mobile Apps With Xamarin and Visual Studio App Center
Building Mobile Apps With Xamarin and Visual Studio App Center
 
KKBOX WWDC17 WatchOS - Dada
KKBOX WWDC17  WatchOS  - DadaKKBOX WWDC17  WatchOS  - Dada
KKBOX WWDC17 WatchOS - Dada
 
PlayFab multiplayer_party
PlayFab multiplayer_partyPlayFab multiplayer_party
PlayFab multiplayer_party
 
PlayFab and unity gdc2019
PlayFab and unity gdc2019PlayFab and unity gdc2019
PlayFab and unity gdc2019
 

Ähnlich wie Gigigo Workshop - Create an iOS Framework, document it and not die trying

Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3
Drupalcon Paris
 
Gnubs pres-foss-cdac-sem
Gnubs pres-foss-cdac-semGnubs pres-foss-cdac-sem
Gnubs pres-foss-cdac-sem
Sagun Baijal
 

Ähnlich wie Gigigo Workshop - Create an iOS Framework, document it and not die trying (20)

"I have a framework idea" - Repeat less, share more.
"I have a framework idea" - Repeat less, share more."I have a framework idea" - Repeat less, share more.
"I have a framework idea" - Repeat less, share more.
 
Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3
 
OpenWRT guide and memo
OpenWRT guide and memoOpenWRT guide and memo
OpenWRT guide and memo
 
APEX Application Lifecycle and Deployment 20220714.pdf
APEX Application Lifecycle and Deployment 20220714.pdfAPEX Application Lifecycle and Deployment 20220714.pdf
APEX Application Lifecycle and Deployment 20220714.pdf
 
Dependent things dependency management for apple sw - slideshare
Dependent things   dependency management for apple sw - slideshareDependent things   dependency management for apple sw - slideshare
Dependent things dependency management for apple sw - slideshare
 
FLOW3 Tutorial - T3CON11 Frankfurt
FLOW3 Tutorial - T3CON11 FrankfurtFLOW3 Tutorial - T3CON11 Frankfurt
FLOW3 Tutorial - T3CON11 Frankfurt
 
Pass Summit Linux Scripting for the Microsoft Professional
Pass Summit Linux Scripting for the Microsoft ProfessionalPass Summit Linux Scripting for the Microsoft Professional
Pass Summit Linux Scripting for the Microsoft Professional
 
Gnubs-pres-foss-cdac-sem
Gnubs-pres-foss-cdac-semGnubs-pres-foss-cdac-sem
Gnubs-pres-foss-cdac-sem
 
Gnubs pres-foss-cdac-sem
Gnubs pres-foss-cdac-semGnubs pres-foss-cdac-sem
Gnubs pres-foss-cdac-sem
 
Configuration as Dependency: Managing Drupal 8 Configuration with git and Com...
Configuration as Dependency: Managing Drupal 8 Configuration with git and Com...Configuration as Dependency: Managing Drupal 8 Configuration with git and Com...
Configuration as Dependency: Managing Drupal 8 Configuration with git and Com...
 
Building and Maintaining a Distribution in Drupal 7 with Features
Building and Maintaining a  Distribution in Drupal 7 with FeaturesBuilding and Maintaining a  Distribution in Drupal 7 with Features
Building and Maintaining a Distribution in Drupal 7 with Features
 
Fluent Development with FLOW3 1.0
Fluent Development with FLOW3 1.0Fluent Development with FLOW3 1.0
Fluent Development with FLOW3 1.0
 
Build Automation of PHP Applications
Build Automation of PHP ApplicationsBuild Automation of PHP Applications
Build Automation of PHP Applications
 
(Re)-Introduction to Maven
(Re)-Introduction to Maven(Re)-Introduction to Maven
(Re)-Introduction to Maven
 
Creating Better Builds with Gradle
Creating Better Builds with GradleCreating Better Builds with Gradle
Creating Better Builds with Gradle
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
Php Development With Eclipde PDT
Php Development With Eclipde PDTPhp Development With Eclipde PDT
Php Development With Eclipde PDT
 
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)
 
Development Setup of B-Translator
Development Setup of B-TranslatorDevelopment Setup of B-Translator
Development Setup of B-Translator
 
Sbt, idea and eclipse
Sbt, idea and eclipseSbt, idea and eclipse
Sbt, idea and eclipse
 

Mehr von Alex Rupérez

Magister of Entrepreneurship - Social Development
Magister of Entrepreneurship - Social DevelopmentMagister of Entrepreneurship - Social Development
Magister of Entrepreneurship - Social Development
Alex Rupérez
 

Mehr von Alex Rupérez (7)

Iterando arquitecturas, creando herramientas | T3chFest
Iterando arquitecturas, creando herramientas | T3chFestIterando arquitecturas, creando herramientas | T3chFest
Iterando arquitecturas, creando herramientas | T3chFest
 
Desarrollando mogollón de apps a la vez... ¿en qué lío me he metido?
Desarrollando mogollón de apps a la vez... ¿en qué lío me he metido?Desarrollando mogollón de apps a la vez... ¿en qué lío me he metido?
Desarrollando mogollón de apps a la vez... ¿en qué lío me he metido?
 
MADBike – Destapando la seguridad de BiciMAD (T3chFest 2017)
MADBike – Destapando la seguridad de BiciMAD (T3chFest 2017)MADBike – Destapando la seguridad de BiciMAD (T3chFest 2017)
MADBike – Destapando la seguridad de BiciMAD (T3chFest 2017)
 
Gigigo Rails Workshop
Gigigo Rails WorkshopGigigo Rails Workshop
Gigigo Rails Workshop
 
Gigigo Ruby Workshop
Gigigo Ruby WorkshopGigigo Ruby Workshop
Gigigo Ruby Workshop
 
iOS Sync Libraries
iOS Sync LibrariesiOS Sync Libraries
iOS Sync Libraries
 
Magister of Entrepreneurship - Social Development
Magister of Entrepreneurship - Social DevelopmentMagister of Entrepreneurship - Social Development
Magister of Entrepreneurship - Social Development
 

Kürzlich hochgeladen

If this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New NigeriaIf this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New Nigeria
Kayode Fayemi
 
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
amilabibi1
 
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptxChiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
raffaeleoman
 
Uncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoUncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac Folorunso
Kayode Fayemi
 

Kürzlich hochgeladen (18)

If this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New NigeriaIf this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New Nigeria
 
Sector 62, Noida Call girls :8448380779 Noida Escorts | 100% verified
Sector 62, Noida Call girls :8448380779 Noida Escorts | 100% verifiedSector 62, Noida Call girls :8448380779 Noida Escorts | 100% verified
Sector 62, Noida Call girls :8448380779 Noida Escorts | 100% verified
 
Dreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video TreatmentDreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video Treatment
 
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdfAWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
 
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
 
lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.
 
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptxChiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
 
Digital collaboration with Microsoft 365 as extension of Drupal
Digital collaboration with Microsoft 365 as extension of DrupalDigital collaboration with Microsoft 365 as extension of Drupal
Digital collaboration with Microsoft 365 as extension of Drupal
 
Dreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio IIIDreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio III
 
Aesthetic Colaba Mumbai Cst Call girls 📞 7738631006 Grant road Call Girls ❤️-...
Aesthetic Colaba Mumbai Cst Call girls 📞 7738631006 Grant road Call Girls ❤️-...Aesthetic Colaba Mumbai Cst Call girls 📞 7738631006 Grant road Call Girls ❤️-...
Aesthetic Colaba Mumbai Cst Call girls 📞 7738631006 Grant road Call Girls ❤️-...
 
Causes of poverty in France presentation.pptx
Causes of poverty in France presentation.pptxCauses of poverty in France presentation.pptx
Causes of poverty in France presentation.pptx
 
Thirunelveli call girls Tamil escorts 7877702510
Thirunelveli call girls Tamil escorts 7877702510Thirunelveli call girls Tamil escorts 7877702510
Thirunelveli call girls Tamil escorts 7877702510
 
ICT role in 21st century education and it's challenges.pdf
ICT role in 21st century education and it's challenges.pdfICT role in 21st century education and it's challenges.pdf
ICT role in 21st century education and it's challenges.pdf
 
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...
 
Uncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoUncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac Folorunso
 
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdfThe workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
 
My Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle BaileyMy Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle Bailey
 
Report Writing Webinar Training
Report Writing Webinar TrainingReport Writing Webinar Training
Report Writing Webinar Training
 

Gigigo Workshop - Create an iOS Framework, document it and not die trying

  • 1. Create an iOS Framework, document it and not die trying by @alexruperez
  • 2. • Fast iterative builds when developing the framework. We may have a simple application that has the .framework as a dependency and we want to quickly iterate on development of the .framework. • Infrequent distribution builds of the .framework. • Resource distribution should be intuitive and not bloat the application. • Setup for third-party developers using the .framework should be easy.
  • 3. Uncheck “Create git repository on…” option.
  • 4. • Developers expect to be able to import your framework by importing the <YourFramework/YourFramework.h> header. Ensure that your project has such a header (if you created a new static library then there should already be a YourFramework.h and YourFramework.m file; you can delete the .m). • Add Build Phases from the menu. Click on Editor > Add Build Phase -> Add Copy Headers Build Phase. Note: If the menu options are grayed out, you'll need to click on the whitespace below the Build Phases to regain focus and retry. • You'll see 3 sections for Public, Private, and Project headers. To modify the scope of any header, drag and drop the header files between the sections. Alternatively you can open the Project Navigator and select the header. Next expand the Utilities pane for the File Inspector (Cmd+Option+0). • Look at the "Target Membership" group and ensure that the checkbox next to the .h file is checked. Change the scope of the header from "Project" to "Public". You might have to uncheck and check the box to get the dropdown list. This will ensure that the header gets copied to the correct location in the copy headers phase.
  • 5. • By default the static library project will copy private and public headers to the same folder: /usr/local/include. To avoid mistakenly copying private headers to our framework we want to ensure that our public headers are copied to a separate directory, e.g. Headers. • To change this setting, select the project in the Project Navigator and then click the "Build Settings" tab. Search for "public headers" and then set the "Public Headers Folder Path" to "Headers" for all configurations. If you are working with multiple Frameworks make sure that this folder is unique.
  • 6. • We do not want to strip any code from the library; we leave this up to the application that is linking to the framework. To disable code stripping we must modify the following configuration settings. • "Dead Code Stripping" => No (for all settings) • "Strip Debug Symbols During Copy" => No (for all settings) • "Strip Style" => Non-Global Symbols (for all settings)
  • 7. • Select Editor menu > Add Build Phase > Add Run Script Build Phase set -e! ! mkdir -p "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/Versions/A/Headers"! ! # Link the "Current" version to "A"! /bin/ln -sfh A "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/Versions/Current"! /bin/ln -sfh Versions/Current/Headers "${BUILT_PRODUCTS_DIR}/$ {PRODUCT_NAME}.framework/Headers"! /bin/ln -sfh "Versions/Current/${PRODUCT_NAME}" "${BUILT_PRODUCTS_DIR}/$ {PRODUCT_NAME}.framework/${PRODUCT_NAME}"! ! # The -a ensures that the headers maintain the source modification date so that we don't constantly! # cause propagating rebuilds of files that import these headers.! /bin/cp -a "${TARGET_BUILD_DIR}/${PUBLIC_HEADERS_FOLDER_PATH}/" "$ {BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/Versions/A/Headers"
  • 8.
  • 9. • Add the static library target to the "Target Dependencies”. • Set “Arquitectures” and “Valid arquitectures” in the Build Settings to i386, x86_64, armv7, armv7s and arm64. • Select Editor menu > Add Build Phase > Add Run Script Build Phase
  • 10. set -e! set +u! # Avoid recursively calling this script.! if [[ $SF_MASTER_SCRIPT_RUNNING ]]! then! exit 0! fi! set -u! export SF_MASTER_SCRIPT_RUNNING=1! ! SF_TARGET_NAME=${PROJECT_NAME}! SF_EXECUTABLE_PATH="lib${SF_TARGET_NAME}.a"! SF_WRAPPER_NAME="${SF_TARGET_NAME}.framework"! SF_BUNDLE_NAME="${SF_TARGET_NAME}.bundle"! !# The following conditionals come from! # https://github.com/kstenerud/iOS-Universal-Framework! ! if [[ "$SDK_NAME" =~ ([A-Za-z]+) ]]! then! SF_SDK_PLATFORM=${BASH_REMATCH[1]}! else! echo "Could not find platform name from SDK_NAME: $SDK_NAME"! exit 1! fi! ! if [[ "$SDK_NAME" =~ ([0-9]+.*$) ]]! then! SF_SDK_VERSION=${BASH_REMATCH[1]}! else! echo "Could not find sdk version from SDK_NAME: $SDK_NAME"! exit 1! fi! ! if [[ "$SF_SDK_PLATFORM" = "iphoneos" ]]! then! SF_OTHER_PLATFORM=iphonesimulator! else! SF_OTHER_PLATFORM=iphoneos! fi! ! if [[ "$BUILT_PRODUCTS_DIR" =~ (.*)$SF_SDK_PLATFORM$ ]]! then! SF_OTHER_BUILT_PRODUCTS_DIR="${BASH_REMATCH[1]}${SF_OTHER_PLATFORM}"! else! echo "Could not find platform name from build products directory: $BUILT_PRODUCTS_DIR"! exit 1! fi!!# Build the other platform.! xcrun xcodebuild -project "${PROJECT_FILE_PATH}" -target "${TARGET_NAME}" -configuration "${CONFIGURATION}" -sdk ${SF_OTHER_PLATFORM}$ {SF_SDK_VERSION} BUILD_DIR="${BUILD_DIR}" OBJROOT="${OBJROOT}" BUILD_ROOT="${BUILD_ROOT}" SYMROOT="${SYMROOT}" $ACTION! !# Smash the two static libraries into one fat binary and store it in the .framework! xcrun lipo -create "${BUILT_PRODUCTS_DIR}/${SF_EXECUTABLE_PATH}" "${SF_OTHER_BUILT_PRODUCTS_DIR}/${SF_EXECUTABLE_PATH}" -output "$ {BUILT_PRODUCTS_DIR}/${SF_WRAPPER_NAME}/Versions/A/${SF_TARGET_NAME}"! !# Copy the binary to the other architecture folder to have a complete framework in both.! cp -a "${BUILT_PRODUCTS_DIR}/${SF_WRAPPER_NAME}/Versions/A/${SF_TARGET_NAME}" "${SF_OTHER_BUILT_PRODUCTS_DIR}/$ {SF_WRAPPER_NAME}/Versions/A/${SF_TARGET_NAME}"! ! rm -rf "${PROJECT_DIR}/Framework/"! mkdir "${PROJECT_DIR}/Framework/"! cp -rf "${BUILT_PRODUCTS_DIR}/${SF_WRAPPER_NAME}" "${PROJECT_DIR}/Framework/"! cp -rf "${BUILT_PRODUCTS_DIR}/${SF_BUNDLE_NAME}" "${PROJECT_DIR}/Framework/" 2>/dev/null || :
  • 11. • Add the Framework Project to your Application Project • Select your project in the Project Navigator and open the "Build Phases" tab. Expand the "Target Dependencies" group and click the + button. Select the static library target and click “Add". • Expand the "Link Binary With Libraries" phase and click the + button. Select the .a file that's exposed by your framework's project and then click add.
  • 12. • git clone git://github.com/tomaz/appledoc.git • sudo sh install-appledoc.sh • Select Editor menu > Add Build Phase > Add Run Script Build Phase #appledoc Xcode script! # Start constants! company="alexruperez";! companyID="com.alexruperez";! companyURL="http://alexruperez.com";! target="iphoneos";! outputPath="~/help";! # End constants! /usr/local/bin/appledoc ! --project-name "${PROJECT_NAME}" ! --project-company "${company}" ! --company-id "${companyID}" ! --docset-atom-filename "${company}.atom" ! --docset-feed-url "${companyURL}/${company}/%DOCSETATOMFILENAME" ! --docset-package-url "${companyURL}/${company}/%DOCSETPACKAGEFILENAME" ! --docset-fallback-url "${companyURL}/${company}" ! --output "${outputPath}" ! --ignore "Private" ! --publish-docset ! --docset-platform-family "${target}" ! --logformat xcode ! --keep-intermediate-files ! --no-repeat-first-par ! --no-warn-invalid-crossref ! --exit-threshold 2 ! "${PROJECT_DIR}"! rm -rf "${PROJECT_DIR}/Documentation/"! mkdir "${PROJECT_DIR}/Documentation/"! cp -rf ~/help/html/ "${PROJECT_DIR}/Documentation/"
  • 13. /// Simple description ! ! ! /** * Description. * * @warning Warning * @param Param A * @param Param B * @return Return */
  • 14. Addendum • alexruperez/FrameworkExample • jverkoey/iOS-Framework • tomaz/appledoc