Crush & Lovely's iOS boilerplate

Related tags

Miscellaneous Amaro
Overview

icon Amaro Build Status

Crush & Lovely's iOS boilerplate.

Changelog

Say what now?

We want to hit the ground running. Xcode and the iOS ecosystem don't make that easy. Enter Amaro. After running one simple command, you get a ready-to-build universal iOS application, full of delights.

Gimme gimme

Change to your projects directory, run this line in your terminal, and follow the prompts:

ruby -e "$(curl -fsSL https://raw.github.com/crushlovely/Amaro/master/tiramisu)"

Of course, if you're wary of running random scripts (legit!), please read tiramisu. At a high level, the script creates a local git repository with Amaro as a remote named "bootstrap", tweaks filenames and contents as per your input, and grabs third-party code from Cocoapods.

(Tiramisu is Italian for "pick me up". Bootstrap... pick me up... get it?!? 💃 )

Details and Requirements

The bootstrap assumes:

  • You are using Xcode 7 or later.
  • You have version 0.34.1 or later of the CocoaPods gem installed.
  • You are on OS 10.9 or later
  • You are targetting iOS 8.0, at minimum (and thus will be compiling against at least the iOS 8.0 SDK).
    • As of October 2015, 91% of iOS devices are on iOS 8 or later.

Want to use Swift? Go to town! The small amount of code that is included in generated projects is in Objective-C, but you can blow it all away and replace it with Swift on a whim.

What's Included?

Amaro aims to set you up with all you need to write a beautiful, maintainable, well-tested app. All the default pods are optional; feel free to pick and choose as needed for your project (though you will probably want most of them).

Foundation

  • A well-chosen class prefix is enforced (or may be omitted entirely... the times, they are a-changin')
  • A local git repository for the application is created (and committed to a few times through the initialization process).
  • A sane .gitignore file is included.
  • A Certificates directory is included with a readme file about what to include so that other developers can test and release the app.
  • Sensible defaults for build options, warnings, and the like.
    • Build configurations are split into xcconfig files for modularity and consistency. We're using jspahrsummers/xcconfigs as our base.
    • There are separate staging, production, and distribution schemes, and corresponding preprocessor macros. No more fiddling with variables here and there to switch your target environment.
  • Automatic ways to easily distinguish between builds of the app:
    • Ad-hoc and development builds have their bundle id suffixed with ".adhoc" or ".dev" so that they can co-exist on devices with other builds.
    • Ad-hoc and development builds' icons are badged with an 🅢 for staging environments and a 🅟 for production environments. The bundle names (but not the display names) are also changed to easily distinguish them in places where it may otherwise be difficult.
  • The build number of the app is incremented on every ad-hoc and distribution build. This ensures that external distribution services can reliably distinguish builds, even if the version number itself doesn't change.
  • CocoaPods are integrated from the get-go.
  • A barebones settings bundle is included with an "Acknowledgements" section that includes licenses for all your pods. It's automatically updated after each pod install.
  • Identifiers from storyboards and asset catalogs are pulled out into constants, much like objc-codegenutils.

Logging, Error Reporting, Testing

  • CocoaLumberjack is configured for logging. A custom formatter is used by default to include the class and method name in log messages.
  • Specta and Expecta are included to allow for the creation of Rspec-like tests. Xcode integration for testing is fully configured; add your tests to the Specs target and hit Cmd+U.

Utility Belt

  • AFNetworking
  • libextobjc's scope and keypath checking modules.
  • Asterism, a fast, simple and flexible library for manipulating collections.
  • Sidecar, Crush's homegrown library. Features commonly needed functionality, such as creating UIColors from hex, playing short sound effects, and performing blocks on the main thread.

More...

Additionally, the Podfile notes a few other libraries that you may find useful:

  • FormatterKit, for all your string-formatting needs.
  • PromiseKit, a promises/futures library similar to Promises/A+, and related wrappers for core libraries.
  • Mantle, a project from the GitHub folks to make simpler, safer model classes.
  • SSKeychain, a friendly wrapper around the Keychain API.
  • DateTools, if you find yourself needing to do a lot of datetime math.

Maintaining the Spirit

Amaro will get you started on the right foot, but it's up to you not to mess it up! Here are some tips to stay in line with the spirit of the project.

Read up on the included and optional libraries. Most of them are very good at solving common problems, and you should become familiar with them. Ideally you should spend your time solving problems, not solving problems around solving problems.

Here are some specific tips:

  • Making a change to a build setting? Make it once in your project's .xcconfig file, so that it will propagate to all configurations.
  • Adding an external library? If there's a podspec for it, bring it in via Cocoapods. If there's not, consider writing one and submitting it upstream. Use git submodules as a last resort; version and dependency management with them is a pain in the ass.
    • There should almost never be a reason to check in third-party projects wholesale. If you need to modify someone else's code, fork the repo and include the fork in your Podfile with a direct :git reference.
  • Use CocoaLumberjack's DDLog variants instead of NSLog. It's faster, provides more information, is more configurable, and understands log levels. All of that with the same familiar syntax. Retrain your fingers.
  • Need to define different settings in staging and production? Check out the ProjectName-Environment.h file in Other Sources. It defines macros to test the type of build that is currently taking place.

License

The real content and value of Amaro is as a template; once you've created a new project with the initialization script, Amaro leaves barely a trace. So, in most cases, the only licenses you need to worry about are those of the third-party software you've included. But anyway, should you want to deal with Amaro itself, it's MIT licensed:

Copyright (c) 2014 Crush & Lovely, LLC

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Third-Party License Rundown

As mentioned above, the bootstrap automatically generates a settings section containing license information for all your Cocoapods. If that's unacceptable for your purposes, here's the license information on the major components:

Similar Projects

Once upon a time there was a similar project, but it seems to have been abandoned. More recently, the lovely folks at thoughtbot released liftoff. Amaro takes a different tack than liftoff: more opinions, less scriptability. Check it out for an alternative take on the problem.

Know of anything else in the realm? Drop us a line! We'd love to hear about it and see how others are tackling things.

Acknowledgements

The lovely icon was created by Ray Bruwelheide. It is licensed under the Creative Commons Attribution 3.0 license.

Comments
  • Added support for xcode 8.x

    Added support for xcode 8.x

    Modified the code to make it work with xcode 8.x. Had to make the following changes:

    1. Changed the xcode version check to now allow Xcode 8.x
    2. Added --allow-unrelated-histories flag to git as git 2.11 is shipped with mac os x sierra and the previous command was failing here.

    Fixes #41 and #42

    opened by karnikad 5
  • Pods-Environment.h file be found

    Pods-Environment.h file be found

    OSX 10.10.5, fresh install a few minutes this is what I get:

    screen shot 2015-09-19 at 5 57 38 pm screen shot 2015-09-19 at 5 57 57 pm

    I can comment out the import but I think none of my macros defined in this file will be correct :P (It builds just fine when I comment it out however)

    opened by JAStanton 3
  • Unable to create project

    Unable to create project

    Initializing submodules and CocoaPods... 💀 Error Command: pod install --silent Output: [!] Unable to satisfy the following requirements:

    • CocoaLumberjack/Core (~> 1.9.0) required by Sidecar (0.2.0)
    • CocoaLumberjack/Core (~> 1.9.0) required by Sidecar/Non-ARC (0.2.0)
    • CocoaLumberjack required by Podfile
    • CocoaLumberjack/Extensions required by CocoaLumberjack (1.9.2)
    • CocoaLumberjack/Core required by CocoaLumberjack/Extensions (1.9.2)
    • CocoaLumberjack/Core (= 2.0.0-beta4) required by CrashlyticsLumberjack (2.0.0-beta4)
    opened by kronik 3
  • Failure at creating new Project

    Failure at creating new Project

    If i let the Organization blank or insert it in lowercase i run in this failure.

        ___           ___
       /\  \         /\__\
      /  \  \       / /  /
     / /\ \__\     / /__/
     \ \ \/__/  &  \ \  \
      \ \__\        \ \__\
       \/__/         \/__/  Amaro v0.3.5
    
    Checking environment... 👍
    Repository: git://github.com/crushlovely/Amaro.git
    Branch: master
    
    New project name: TestProjekt
    Class prefix (optional; 2 or preferably 3 characters): TP
    Your name (blank for RealName: Carsten): RealName: Carsten
    Organization name (blank for ipol): ipol
    -e:789:in `+': no implicit conversion of nil into String (TypeError)
        from -e:789:in `block (2 levels) in <main>'
        from -e:258:in `[]'
        from -e:258:in `run!'
        from -e:308:in `block in run_sequence'
        from -e:307:in `each'
        from -e:307:in `run_sequence'
        from -e:827:in `<main>'
    
    

    I think it's caused by the downcase! method.

    Downcases! the contents of str, returning nil if no changes were made. http://ruby-doc.org/core-2.0/String.html#method-i-downcase-21

    opened by BanditsBacon 3
  • Pods-Environment.h file not found from Cocoapods version 0.34.1

    Pods-Environment.h file not found from Cocoapods version 0.34.1

    The build script should be updated to take into considerations the way that cocoa pods behave since v 0.34.1 Take a look at this: https://github.com/CocoaPods/CocoaPods/issues/2536

    opened by chasseurmic 3
  • Please make this compatible with Xcode 8

    Please make this compatible with Xcode 8

    Getting this error

    Amaro requires the default Xcode command line tools to point to Xcode 7.0 or later. Yours point to 8.0.
    Install Xcode 7.0 or later, and run "xcode-select" to point to that.
    
    opened by nvrtdfrst 2
  • git history not deleted

    git history not deleted

    When a new project is created using Amaro, the git history and the remote is not deleted so for the new project:

    • There are a lot of commits information from the template project Amaro.
    • If the user does not replace the remote, the test project will be committed / pulled to Amaro Github repository.

    Maybe a previous step to "git init" can be to delete the .git folder to remove the entire history, but preserving the submodules ( xcconfigs project ) information.

    opened by fjordansilva 2
  • Build problems

    Build problems

    When trying to compile and run the project with the default options, I get this error:

    PhaseScriptExecution Crashlytics\ Script /Users/fjordansilva/Library/Developer/Xcode/DerivedData/AmaroTest-dsdunwqxitzwvphcameumeafrebm/Build/Intermediates/AmaroTest.build/Debug_Staging-iphoneos/AmaroTest.build/Script-BDF1758318C3A844008BD9C6.sh cd /Users/fjordansilva/Proyectos/Connectis/AmaroTest/Amaro/AmaroTest /bin/sh -c /Users/fjordansilva/Library/Developer/Xcode/DerivedData/AmaroTest-dsdunwqxitzwvphcameumeafrebm/Build/Intermediates/AmaroTest.build/Debug_Staging-iphoneos/AmaroTest.build/Script-BDF1758318C3A844008BD9C6.sh

    2014-08-12 13:40:03.194 run[7300:507] Crashlytics.framework/run 1.3.9 2014-08-12 13:40:03.220 run[7300:507]

    Crashlytics: dSYM Error

    Unable to process AmaroTest.app.dSYM at path /Users/fjordansilva/Library/Developer/Xcode/DerivedData/AmaroTest-dsdunwqxitzwvphcameumeafrebm/Build/Products/Debug_Staging-iphoneos/AmaroTest.app.dSYM Make sure your project build settings are generating a dSYM file. DEBUG_INFORMATION_FORMAT should be set to dwarf-with-dsym for all configurations. This could also be a timing issue, make sure the Crashlytics run script build phase is the last build phase and no other scripts have moved the dSYM from the location Xcode generated it.

    Command /bin/sh failed with exit code 1

    opened by fjordansilva 2
  • Update jspahrsummers/xcconfigs repo URL

    Update jspahrsummers/xcconfigs repo URL

    • Change jspahrsummers/xcconfigs archive URL from a .zip extension to .tar.gz so that the tar command on the other end of the pipe can process the input properly

    Otherwise, this is the error I'm getting:

     ~  Development  ruby -e "$(curl -fsSL https://raw.github.com/crushlovely/Amaro/master/tiramisu)"
        ___           ___
       /\  \         /\__\
      /  \  \       / /  /
     / /\ \__\     / /__/
     \ \ \/__/  &  \ \  \
      \ \__\        \ \__\
       \/__/         \/__/  Amaro v1.0.0
    
    Checking environment... 👍
    Repository: https://github.com/crushlovely/Amaro.git
    Branch: master
    
    New project name: TestProj
    Class prefix (optional; 2 or preferably 3 characters): TP
    Your name (blank for George Kontridze): George Kontridze
    Organization name (blank for The Company): The Company
    Bundle ID domain (blank for com.thecompany): com.thecompany
    
    🎉  It's time to build your project!
    Pausing for 3 seconds in case you change your mind. Press any key to abort.
    
    Initializing local repository... 👍
    Fetching repository... 👍
    Merging... 👍
    Cleaning up... 👍
    Renaming project files... 👍
    Renaming prefixed files... 👍
    Updating file contents... 👍
    Committing... 👍
    Pulling latest xcconfigs... 💀
    Error
    Command: 'TestProj/Other-Sources/Configuration/jspahrsummers-xcconfigs/UpdateXCConfigs.sh' -q
    Output:
    gzip: stdin has more than one entry--rest ignored
    tar: Child returned status 2
    tar: Error is not recoverable: exiting now
    
    opened by gkze 1
  • Script Error

    Script Error

    Hi! when I started working with my project I changed the app from universal to iPhone, once it was done I decided I would go ahead and build a basic iPad version and re-enabled iPad support. Now when I start the app I get this: error: Script error: string index out of range Please report this to https://github.com/crushlovely/Amaro/issues and include the details below.

    Traceback (most recent call last): File "/Users/JustMe/Development/iOS/projects/MyApp/Scripts/GenerateStoryboardIDs.py", line 179, in idList = IDList.fromFile(fn, prefix, needRestorationIDs) File "/Users/JustMe/Development/iOS/projects/MyApp/Scripts/GenerateStoryboardIDs.py", line 92, in fromFile res._addIds(viewControllerIds, cls.VIEW_CONTROLLER) File "/Users/JustMe/Development/iOS/projects/MyApp/Scripts/GenerateStoryboardIDs.py", line 78, in addIds self.addId(id, type) File "/Users/JustMe/Development/iOS/projects/MyApp/Scripts/GenerateStoryboardIDs.py", line 73, in addId variableName = lib.variableNameForString(id, self._defaultPrefixes, suffixes) File "/Users/JustMe/Development/iOS/projects/MyApp/Scripts/AmaroLib.py", line 295, in variableNameForString result = self.smartLowerCase(result) File "/Users/JustMe/Development/iOS/projects/MyApp/Scripts/AmaroLib.py", line 305, in smartLowerCase return s[0].lower() + s[1:] IndexError: string index out of range

    I'm pretty confident this is something I did, I'm just not sure what it is.

    Thanks!

    -Aaron

    opened by obriena 1
  • Amaro Install Error

    Amaro Install Error

    Hi all,

    I'm having some trouble with the steup. See below, any pointers? Thanks.

    -e:789:in `+': no implicit conversion of nil into String (TypeError)
        from -e:789:in `block (2 levels) in <main>'
        from -e:258:in `[]'
        from -e:258:in `run!'
        from -e:308:in `block in run_sequence'
        from -e:307:in `each'
        from -e:307:in `run_sequence'
        from -e:827:in `<main>'
    
    opened by nishtacular 1
  • ":CFBundleShortVersionString", Does Not Exist File Doesn't Exist

    Hi,

    I am trying to setup project and I get the following error:

    Checking environment... 💀 Error Command: /usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' '/Library/Developer/CommandLineTools/../Info.plist' Output: Print: Entry, ":CFBundleShortVersionString", Does Not Exist File Doesn't Exist, Will Create: /Library/Developer/CommandLineTools/../Info.plist

    Thanks, Attiqe

    opened by attiqeurrehman 0
  • run into python script issue for generate storyboard ID

    run into python script issue for generate storyboard ID

    report this:

    error: Script error: string index out of range
    Please report this to https://github.com/crushlovely/Amaro/issues and include the details below.
    
    Traceback (most recent call last):
      File "/Users/caoer115/Documents/Projects/DUMMY/Scripts/GenerateStoryboardIDs.py", line 179, in <module>
        idList = IDList.fromFile(fn, prefix, needRestorationIDs)
      File "/Users/caoer115/Documents/Projects/DUMMY/Scripts/GenerateStoryboardIDs.py", line 92, in fromFile
        res._addIds(viewControllerIds, cls.VIEW_CONTROLLER)
      File "/Users/caoer115/Documents/Projects/DUMMY/Scripts/GenerateStoryboardIDs.py", line 78, in _addIds
        self._addId(id_, type_)
      File "/Users/caoer115/Documents/Projects/DUMMY/Scripts/GenerateStoryboardIDs.py", line 73, in _addId
        variableName = lib.variableNameForString(id_, self._defaultPrefixes, suffixes)
      File "/Users/caoer115/Documents/Projects/DUMMY/Scripts/AmaroLib.py", line 297, in variableNameForString
        result = self.smartLowerCase(result)
      File "/Users/caoer115/Documents/Projects/DUMMY/Scripts/AmaroLib.py", line 307, in smartLowerCase
        return s[0].lower() + s[1:]
    IndexError: string index out of range
    
    opened by caoer 3
  • Make migration and updates to bootstrapped projects easy

    Make migration and updates to bootstrapped projects easy

    See #22 for an example of when this comes up.

    Not sure how best to tackle this. I guess there are two options:

    1. Make some bitchin' way for this to happen automatically. Would probably entail capturing the options the user entered into tiramisu when the project was created, and then using that to recreate the internal state of tiramisu, and making changes, and running the diff by the user? Seems like this would be nigh impossible to get right.

    2. Make some centralized repository of information about migrating (e.g., a wiki). Also start keeping better track of what changes between versions, so users can be aware if they ought to do something.

    enhancement 
    opened by misterfifths 0
Owner
Crush & Lovely
Crush & Lovely
This is a template repository for quickly creating boilerplate code for a SwiftUI macOS menu bar app.

Menu Bar App This is a template repository for quickly creating boilerplate code for a SwiftUI macOS menu bar app. License This app is released into t

apparata 5 Dec 6, 2022
Kushal Shingote 1 Feb 2, 2022
iOS's Stocks App clone written in React Native for demo purpose (available both iOS and Android).

FinanceReactNative iOS's Stocks App clone written in React Native for demo purpose (available both iOS and Android). Data is pulled from Yahoo Finance

kf 2k Dec 29, 2022
Project 03 I created for "iOS & Swift - The Complete iOS App Development Bootcamp"

Dicee This is the third project I created for "iOS & Swift - The Complete iOS App Development Bootcamp" Our Goal The objective of this tutorial is to

Lukas Goodfellow 0 Dec 23, 2021
IOS-Prework - CodePath intro to iOS prework.

Hello World App Submitted by: Emmanuel Assumang Time spent: 1.5 hours spent in total App Description This is a simple mobile app programmed in Swift t

null 0 Dec 31, 2021
Home Assistant Native iOS Application built with SwiftUI for iOS 15+

Home Assistant - Native iOS SwiftUI Application Screenshots Disclaimer - Please read This application is mostly a not-working mockup written in SwiftU

Alessio Santoru 34 Dec 13, 2022
Google-Blogger-iOS-App - Using Google Blogger API to build an iOS app like Medium

Google Blogger iOS App Using Google Blogger API to build an iOS app like Medium!

Ricky Chuang 9 Dec 13, 2022
Ios jetpack - A codabase for iOS projects foundations

iOSJetpack A codabase for iOS projects foundations Neworking Data Reusable Proto

MonsterTechStudio 1 Jan 24, 2022
A native iOS UI widget for adding Spokestack to any iOS app.

A native iOS library for adding Spokestack to any iOS app. Installation Edit Podfile CocoaPods is a dependency manager for Cocoa projects. For usage a

Spokestack 6 Jun 8, 2021
Learning iOS Frontend: Aplikasi iOS Pemesanan Makanan dengan SwiftUI, WidgetKit, Google Fonts, dan Assets dari Figma

Foody Aplikasi Foody adalah Aplikasi iOS Pemesanan Makanan dengan SwiftUI, WidgetKit, Google Fonts, dan Assets dari Figma untuk Mempelajari Ilmu Front

DK 10 Aug 20, 2022
Wasmic allows you to run WebAssembly in a safe way on iOS.

wasmic-ios Bootstrap $ git clone https://github.com/kateinoigakukun/wasmic-ios.git $ git -c submodule."fastlane".update=none submodule update --init -

Yuta Saito 58 Dec 12, 2022
iOS architectures - MVC, MVP, MVVM, MVVM-C, ReactorKit, VIPER, Clean Architecture

iOS architectures - MVC, MVP, MVVM, MVVM-C, ReactorKit, VIPER, Clean Architecture, RIBs; Repository Pattern, Rxflow, Swinject, Tuist, Xcodegen, Cocoapods, SPM, Carthage + Rome

null 123 Dec 21, 2022
Demo of using Metal to render EDR / HDR content on iOS platform

MetalEDR-iOS Demo of using Metal to render EDR/HDR content on iOS platform. How it works This demo uses a hack to activate EDR display on iOS platform

Wutian 38 Oct 24, 2022
ConfettiKit is a custom framework used to add Confetti on your iOS/iPadOS projects.

ConfettiKit is a custom framework used to add Confetti on your iOS/iPadOS projects. The kit provides variety of customisations inorder to design a confetti which matches your project's UI. ConfettiKit makes your work of adding Confetti on your project with just one line of code.

Gokul Nair 14 Sep 27, 2022
Hỗ trợ làm màn hình thanh toán trên ứng dụng iOS/ iPad OS.

Hỗ trợ làm màn hình thanh toán trên ứng dụng iOS/ iPad OS. Rate star nếu bạn thấy tốt, hoặc báo cáo cho tôi qua Issues

null 5 Dec 28, 2021
🛠 A flexible and easy template created to speed up the development of your iOS application based on the MVP pattern.

Model-View-Presenter template A flexible and easy template created to speed up the development of your iOS application based on the MVP pattern. This

Tamerlan Satualdypov 22 Nov 9, 2022
Control Nvidia jetbot which is based on Jetson Nano via iOS app

jetbot-remote-control This is very basic example project which control Nvidia Jetbot remotely via iOS app Based on jetbot of Nvidia, adding sample sou

Nguyen Quoc Thanh 13 Oct 6, 2021
Turbo-iOS base project that's entirely driven from your backend Rails app.

Turbo-iOS base project that's entirely driven from your backend Rails app.

Dale Zak 109 Dec 11, 2022
PlayCover is a project that allows you to sideload iOS apps on macOS( currently arm, Intel support will be tested.

PlayCover is a project that allows you to sideload iOS apps on macOS( currently arm, Intel support will be tested.

Alexandr 4k Jul 8, 2022