From e71b81f8a339c93b5799aadee1accc313814108a Mon Sep 17 00:00:00 2001 From: Bryan Luby Date: Mon, 20 May 2019 14:49:57 -0500 Subject: [PATCH 1/9] Update dependency versions Update R.swift pod version to latest Update CocoaPods version Update travis Xcode version --- Vokal-Cocoa Touch Application Base.xctemplate/.travis.yml | 2 +- Vokal-Cocoa Touch Application Base.xctemplate/Gemfile | 2 +- Vokal-Swift.xctemplate/TemplateInfo.plist | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Vokal-Cocoa Touch Application Base.xctemplate/.travis.yml b/Vokal-Cocoa Touch Application Base.xctemplate/.travis.yml index 503588e..a6be31e 100755 --- a/Vokal-Cocoa Touch Application Base.xctemplate/.travis.yml +++ b/Vokal-Cocoa Touch Application Base.xctemplate/.travis.yml @@ -1,5 +1,5 @@ language: swift -osx_image: xcode10 +osx_image: xcode10.2 before_install: - echo -e "machine github.com\n login ${CI_USER_TOKEN}" >> ~/.netrc before_script: diff --git a/Vokal-Cocoa Touch Application Base.xctemplate/Gemfile b/Vokal-Cocoa Touch Application Base.xctemplate/Gemfile index 86f26bf..1e42674 100755 --- a/Vokal-Cocoa Touch Application Base.xctemplate/Gemfile +++ b/Vokal-Cocoa Touch Application Base.xctemplate/Gemfile @@ -1,4 +1,4 @@ source 'https://rubygems.org' -gem 'cocoapods', '~>1.5' +gem 'cocoapods', '~>1.6.1' gem 'fastlane' gem 'slather' diff --git a/Vokal-Swift.xctemplate/TemplateInfo.plist b/Vokal-Swift.xctemplate/TemplateInfo.plist index ea95777..2e124c6 100755 --- a/Vokal-Swift.xctemplate/TemplateInfo.plist +++ b/Vokal-Swift.xctemplate/TemplateInfo.plist @@ -116,7 +116,7 @@ ../Podfile:swiftbasics use_frameworks! - pod 'R.swift', '~> 5.0.0.alpha.2' + pod 'R.swift', '~> 5.0.3' pod 'SwiftLint' Extensions/ReuseIdentifiable.swift From f77d782905521d6494913bc3f7fb3a2aebb6b7fd Mon Sep 17 00:00:00 2001 From: Bryan Luby Date: Mon, 20 May 2019 16:24:46 -0500 Subject: [PATCH 2/9] Add SwiftLint rules --- Vokal-Swift.xctemplate/.swiftlint.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Vokal-Swift.xctemplate/.swiftlint.yml b/Vokal-Swift.xctemplate/.swiftlint.yml index 613dd2b..df107ec 100755 --- a/Vokal-Swift.xctemplate/.swiftlint.yml +++ b/Vokal-Swift.xctemplate/.swiftlint.yml @@ -12,11 +12,14 @@ disabled_rules: - type_name - unused_optional_binding - variable_name + - weak_delegate opt_in_rules: - force_unwrapping - implicitly_unwrapped_optional - unneeded_parentheses_in_closure_argument + - vertical_whitespace_closing_braces + - vertical_whitespace_opening_braces force_unwrapping: severity: error From 5359c6dab4a6c43f3314c5c3d2280be339a154f6 Mon Sep 17 00:00:00 2001 From: Bryan Luby Date: Mon, 20 May 2019 16:53:42 -0500 Subject: [PATCH 3/9] Update Swift version --- .../TemplateInfo.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vokal-Cocoa Touch Application Base.xctemplate/TemplateInfo.plist b/Vokal-Cocoa Touch Application Base.xctemplate/TemplateInfo.plist index f43ecc3..92e91eb 100755 --- a/Vokal-Cocoa Touch Application Base.xctemplate/TemplateInfo.plist +++ b/Vokal-Cocoa Touch Application Base.xctemplate/TemplateInfo.plist @@ -426,7 +426,7 @@ end CODE_SIGN_IDENTITY[sdk=iphoneos*] iPhone Developer SWIFT_VERSION - 4.2 + 5.0 Targets From 4ad9ed37651b89d93e19c04d71e5f950a7a32d3c Mon Sep 17 00:00:00 2001 From: Bryan Luby Date: Mon, 20 May 2019 17:08:08 -0500 Subject: [PATCH 4/9] Update TrueColors script - Default to Swift - Default to not use IBDesignables --- .../Scripts/DevsJustWantToHaveFun.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Vokal-Cocoa Touch Application Base.xctemplate/Scripts/DevsJustWantToHaveFun.sh b/Vokal-Cocoa Touch Application Base.xctemplate/Scripts/DevsJustWantToHaveFun.sh index 5f0249c..050e8c8 100755 --- a/Vokal-Cocoa Touch Application Base.xctemplate/Scripts/DevsJustWantToHaveFun.sh +++ b/Vokal-Cocoa Touch Application Base.xctemplate/Scripts/DevsJustWantToHaveFun.sh @@ -28,8 +28,8 @@ FONT_DIR="${RESOURCES_DIR}/Fonts" # Prefix to use for extensions/categories, ex: VOK. PREFIX="FIXME" -# Change this to "swift" if you want your files to output in swift. -LANGUAGE="objc" +# Change this to "objc" if you want your files to output in Objective-C. +LANGUAGE="swift" # Make sure everything is set up before trying to run if [ "${PREFIX}" = "FIXME" ]; then @@ -42,4 +42,5 @@ fi --output-dir "${OUTPUT_DIR}" \ --font-dir "${FONT_DIR}" \ --prefix "${PREFIX}" \ - --"${LANGUAGE}" + --"${LANGUAGE}" \ + --noibdesignables From 43e9e6ff7e1a96da1e07dc58206c32b1effc17ad Mon Sep 17 00:00:00 2001 From: Bryan Luby Date: Mon, 20 May 2019 17:24:34 -0500 Subject: [PATCH 5/9] Remove ReuseIdentifiable This is now included in the VOKUtilities pod --- .../ReuseIdentifiable.swift | 45 ------------------- Vokal-Swift.xctemplate/TemplateInfo.plist | 6 +-- 2 files changed, 3 insertions(+), 48 deletions(-) delete mode 100644 Vokal-Swift.xctemplate/ReuseIdentifiable.swift diff --git a/Vokal-Swift.xctemplate/ReuseIdentifiable.swift b/Vokal-Swift.xctemplate/ReuseIdentifiable.swift deleted file mode 100644 index 8169516..0000000 --- a/Vokal-Swift.xctemplate/ReuseIdentifiable.swift +++ /dev/null @@ -1,45 +0,0 @@ -// -// ___FILENAME___ -// ___PACKAGENAME___ -// -// Created by ___FULLUSERNAME___ on ___DATE___. -// ___COPYRIGHT___ -// - -import UIKit - -/** - * Mix-in protocol for cells and views that make use of a reuse identifier. The default implementation - * of defaultReuseIdentifier returns the class name. Add this protocol to a class to use that - * default functionality. - */ -protocol ReuseIdentifiable: class { - static var defaultReuseIdentifier: String { get } -} - -extension ReuseIdentifiable where Self: UIView { - static var defaultReuseIdentifier: String { - return String(describing: self) - } -} - -/// Provide a default reuse identifier for table view cells -extension UITableViewCell: ReuseIdentifiable { - // Mix-in -} - -/// Provide a default reuse identifier for table view headers and footers -extension UITableViewHeaderFooterView: ReuseIdentifiable { - // Mix-in -} - -/// Provide a default reuse identifier for collection view cells -extension UICollectionReusableView: ReuseIdentifiable { - // Mix-in -} - -// Include this if using MapKit -/// Provide a default reuse identifier for map annotation views -//extension MKAnnotationView: ReuseIdentifiable { -// // Mix-in -//} diff --git a/Vokal-Swift.xctemplate/TemplateInfo.plist b/Vokal-Swift.xctemplate/TemplateInfo.plist index 2e124c6..996a626 100755 --- a/Vokal-Swift.xctemplate/TemplateInfo.plist +++ b/Vokal-Swift.xctemplate/TemplateInfo.plist @@ -89,13 +89,13 @@ Nodes - Extensions/ReuseIdentifiable.swift main.swift ../R.generated.swift AppDelegate.swift TestingAppDelegate.swift View Controllers/ViewController.swift Protocols/CommonInitializedView.swift + Extensions/.gitkeep Controls/Base/BaseControl.swift Controls/Base/BaseButton.swift Controls/Base/BaseTextField.swift @@ -118,12 +118,12 @@ pod 'R.swift', '~> 5.0.3' pod 'SwiftLint' - Extensions/ReuseIdentifiable.swift + Extensions/.gitkeep Group Extensions Path - ReuseIdentifiable.swift + .gitkeep View Controllers/ViewController.swift From cbacd6bfbf330210f3a4e94a3c3bbd7fa0f23547 Mon Sep 17 00:00:00 2001 From: Bryan Luby Date: Tue, 21 May 2019 09:48:39 -0500 Subject: [PATCH 6/9] Clean up --- .../TemplateInfo.plist | 5 +---- Vokal-Swift.xctemplate/TemplateInfo.plist | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Vokal-Cocoa Touch Application Base.xctemplate/TemplateInfo.plist b/Vokal-Cocoa Touch Application Base.xctemplate/TemplateInfo.plist index 92e91eb..66b1d00 100755 --- a/Vokal-Cocoa Touch Application Base.xctemplate/TemplateInfo.plist +++ b/Vokal-Cocoa Touch Application Base.xctemplate/TemplateInfo.plist @@ -144,7 +144,6 @@ target '___PACKAGENAME___' do End - target '___PACKAGENAME___Tests' do # Put pods used for both test targets here pod 'VOKMockUrlProtocol' @@ -154,7 +153,6 @@ target '___PACKAGENAME___' do pod 'KIF' end end - end post_install do | installer | @@ -168,8 +166,7 @@ post_install do | installer | config.build_settings['DEBUG_INFORMATION_FORMAT'] = 'dwarf' end end -end - +end Group Non-iOS Resources diff --git a/Vokal-Swift.xctemplate/TemplateInfo.plist b/Vokal-Swift.xctemplate/TemplateInfo.plist index 996a626..fdfa1f3 100755 --- a/Vokal-Swift.xctemplate/TemplateInfo.plist +++ b/Vokal-Swift.xctemplate/TemplateInfo.plist @@ -116,7 +116,7 @@ ../Podfile:swiftbasics use_frameworks! - pod 'R.swift', '~> 5.0.3' + pod 'R.swift' pod 'SwiftLint' Extensions/.gitkeep From abb679f72a41e1db05c0bf8ce5cc623a8779c6d1 Mon Sep 17 00:00:00 2001 From: Bryan Luby Date: Tue, 21 May 2019 11:00:50 -0500 Subject: [PATCH 7/9] R.swift updates --- Vokal-Swift.xctemplate/Scripts/R.swift.sh | 2 +- Vokal-Swift.xctemplate/TemplateInfo.plist | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Vokal-Swift.xctemplate/Scripts/R.swift.sh b/Vokal-Swift.xctemplate/Scripts/R.swift.sh index 7e37f9f..ffbafbb 100755 --- a/Vokal-Swift.xctemplate/Scripts/R.swift.sh +++ b/Vokal-Swift.xctemplate/Scripts/R.swift.sh @@ -5,4 +5,4 @@ if [[ "${CI}" == 'true' && "${TRAVIS}" == 'true' ]]; then exit 0 fi -"$PODS_ROOT/R.swift/rswift" generate "$SRCROOT" +"$PODS_ROOT/R.swift/rswift" generate "$SRCROOT/R.generated.swift" diff --git a/Vokal-Swift.xctemplate/TemplateInfo.plist b/Vokal-Swift.xctemplate/TemplateInfo.plist index fdfa1f3..b61f218 100755 --- a/Vokal-Swift.xctemplate/TemplateInfo.plist +++ b/Vokal-Swift.xctemplate/TemplateInfo.plist @@ -73,6 +73,14 @@ /bin/bash ShellScript "${SRCROOT}/___PACKAGENAME___/Scripts/R.swift.sh" + InputFiles + + $TEMP_DIR/rswift-lastrun + + OutputFiles + + $SRCROOT/R.generated.swift + Class From bb4d792559ac0a293b52b45a19c8125c35cfde83 Mon Sep 17 00:00:00 2001 From: Bryan Luby Date: Tue, 21 May 2019 11:16:28 -0500 Subject: [PATCH 8/9] Spacing --- .../___PACKAGENAMEASIDENTIFIER___.swift | 1 - Vokal-Swift.xctemplate/ViewController.swift | 1 - .../___PACKAGENAMEASIDENTIFIER___.swift | 1 - 3 files changed, 3 deletions(-) diff --git a/KIF Test Bundle Swift.xctemplate/___PACKAGENAMEASIDENTIFIER___.swift b/KIF Test Bundle Swift.xctemplate/___PACKAGENAMEASIDENTIFIER___.swift index 4ae7848..3a764cf 100755 --- a/KIF Test Bundle Swift.xctemplate/___PACKAGENAMEASIDENTIFIER___.swift +++ b/KIF Test Bundle Swift.xctemplate/___PACKAGENAMEASIDENTIFIER___.swift @@ -10,7 +10,6 @@ import UIKit import KIF class ___FILEBASENAMEASIDENTIFIER___: KIFTestCase { - func testAreAnyTestsWritten() { XCTFail("You should write some KIF tests.") } diff --git a/Vokal-Swift.xctemplate/ViewController.swift b/Vokal-Swift.xctemplate/ViewController.swift index aa8a3c6..1900aa5 100755 --- a/Vokal-Swift.xctemplate/ViewController.swift +++ b/Vokal-Swift.xctemplate/ViewController.swift @@ -9,5 +9,4 @@ import UIKit class ViewController: UIViewController { - } diff --git a/Vokal-iOS Test Bundle Base-swift.xctemplate/___PACKAGENAMEASIDENTIFIER___.swift b/Vokal-iOS Test Bundle Base-swift.xctemplate/___PACKAGENAMEASIDENTIFIER___.swift index d030e08..91eb8ba 100755 --- a/Vokal-iOS Test Bundle Base-swift.xctemplate/___PACKAGENAMEASIDENTIFIER___.swift +++ b/Vokal-iOS Test Bundle Base-swift.xctemplate/___PACKAGENAMEASIDENTIFIER___.swift @@ -9,7 +9,6 @@ import XCTest class ___FILEBASENAMEASIDENTIFIER___: XCTestCase { - func testAreAnyTestsWritten() { XCTFail("You should write some unit tests.") } From a8415cd957d15246bd4047833433f096ed10d2ee Mon Sep 17 00:00:00 2001 From: Bryan Luby Date: Tue, 21 May 2019 11:16:35 -0500 Subject: [PATCH 9/9] Update README --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 73dc0c7..3910d92 100755 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ This repo contains Objective-C and Swift templates to start up a new Vokal proje For people outside of Vokal: you'll need to make some adjustments after creating your project from these templates. In particular, you'll need to remove our private podspec repo from the `Podfile`, and update the certificate repo in `fastlane/Matchfile`. If you have issues beyond that, feel free to [drop us a note](mailto:ios@vokal.io). ## Maintaining these templates -Apple doesn't have documentation on managing templates like this, but [there is a third-party guide for Xcode 4](http://www.learn-cocos2d.com/store/xcode4-template-documentation/) that's still mostly correct for Xcode 10. +Apple doesn't have documentation on managing templates like this, but [there is a third-party guide for Xcode 4](https://web.archive.org/web/20180423060655/http://www.learn-cocos2d.com/store/xcode4-template-documentation) that's still mostly correct for Xcode 10. If you're updating the templates, you'll note that there are Vokal-fied versions of several templates in this project - this is to facilitate making sure that certain stock files which would otherwise be created are not created. These were forked from the Xcode 7 templates, but as of Xcode 10, the base template had not changed significantly from the one included in 7. @@ -105,3 +105,4 @@ Adjust the run scripts in this target as necessary. For example, if your project * 2.x: works with Swift 3 in Xcode 8 * 3.x: works with Swift 4 in Xcode 9 * 4.x: works with Swift 4.2 in Xcode 10 +* 5.x: works with Swift 5.0 in Xcode 10.2