When youâre working on a iOS or OSX app, youâre bound to use a library, framework or other code that was generously shared by other people. The right thing to do (especially when the license requires it!) is to acknowledge that youâre using their work in your app.
There are various ways to go about this, but Iâve just released a script called Acknowledge that will make it very easy. It also works very well with DCOAboutWindow, which I released earlier.
![Acknowledgments] /assets/img/old/content/acknowledge-acknowledgments.jpg)
Acknowledge is a simple bash script that will easily generate a rtf that contains all the acknowledgments for libraries, frameworks and other code youâve used in your iOS or OSX project.
Itâs made to work very well with DCOAboutWindow and Cocoapods. Acknowledge relies on MultiMarkdown by Fletcher Penny.
You can read more about Acknowledge on GitHub, or follow the setup guide below.
Clone
Clone the repo, preferably into the root of your Xcode project:
$ git clone git@github.com:DangerCove/Acknowledge.git
Or if your project is a repo already, add it as a submodule:
$ git submodule add git@github.com:DangerCove/Acknowledge.git
Install multimarkdown
Follow the guide on Fletcherâs website, or if youâre using homebrew:
$ brew install multimarkdown
Copy acknowledge.cfg.default to acknowledge.cfg:
$ cd Acknowledge
$ cp acknowledge.cfg.default acknowledge.cfg
Customize the paths to multimarkdown and your Pods folder if necessary.
Add acknowledgments
If you use Cocoapods and have your Pods directory setup, you are ready to go. Just run acknowledge
.
Other acknowledgments
Just add a markdown file to the sources
directory and Acknowledge will handle the rest. Make sure the extension is .md
.
Order
You mightâve notice the 10_
and 20_
prefixes in front of the files in the sources
folder. Acknowledge will concatenate the files in order, so just add files and change to number to change the order.
The acknowledgments generated by Cocoapods will always be prepended with 10_
.
Potential directory layout
.
|- Acknowledge/
| |- acknowledge
| |- ...
| |- source/
| | |- 11_Vendor.md
| | |- 20_Acknowledge.md
|- Pods/
| |- Pods-acknowledgements.markdown
|- |- ...
|- Podfile
|- Coolproject.xcodeproj
|- Coolproject.xcworkspace
|- ...
Test it
Donât skip this step, youâll need to output in the next one.
Open a terminal window and run acknowledge
once to see if it works, and to generate the initial Acknowledgments.rtf
.
Fix any errors and proceed.
Add it to Xcode
Youâll probably want to show the acknowledgments somewhere in your app (have a look at DCOAboutWindow if youâre working on a Mac app, btw).
Simply add the generated Acknowledgments.rtf
file to your project and display it somewhere.
Generate the acknowledgments on each build
Keeping your acknowledgments up to date is easy if you add Acknowledge as a build phase. Hereâs how that works:
- Open Xcode;
- Select your project and open the
Build Phases
tab; - Click
Editor â Add Build Phase â Add Run Script Build Phase
; - Name your script something like âUpdate Acknowledgmentsâ and position it so that itâs above
Copy Bundle Resources
; - Now add the following code:
cd Acknowledge && ./acknowledge
(Make sure to adapt the paths if the script isnât located in the default folder.)
It should look something like this:
Thatâs it! Just build your project and youâre set.