Skip to content

Commit

Permalink
Merge pull request #42 from bryanluby/updates
Browse files Browse the repository at this point in the history
Xcode 10 updates
  • Loading branch information
bryanluby authored Oct 26, 2018
2 parents 0891c3e + 6b055bf commit a41b545
Show file tree
Hide file tree
Showing 36 changed files with 101 additions and 160 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ 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 9.
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.

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 9, the base template had not changed significantly from the one included in 7.
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.

Note that you may need to grab updated versions of these templates from the belly of Xcode when a new version of Xcode is released. As of Xcode 9, these templates can be found at the following paths:
Note that you may need to grab updated versions of these templates from the belly of Xcode when a new version of Xcode is released. As of Xcode 10, these templates can be found at the following paths:

* Projects: `/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates/Project Templates/iOS`
* Aggregate target: `/Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/Project Templates/Base/Other/Aggregate.xctemplate`
Expand Down Expand Up @@ -75,8 +75,6 @@ You can then delete the `MoveToNonUITestTarget` from the filesystem as the test

- The build phase that runs the [R.swift](https://github.com/mac-cain13/R.swift) script needs to be moved, since it cannot be positioned properly in the template. In the Build Phases for the main target, drag *R.swift Generation Script* up in the list so that it's right above *Compile Sources*

- Note that there's a build-time script to throw compiler warnings whenever you've added a `//WARN:` comment, similar to how `#warning` is used in Obj-C. Find and delete any warnings from this method.

- There are a couple scripts which are included at the base project level which default to generating Objective-C code. In order to generate Swift files for DevsJustWantToHaveFun, you will need to update the scripts to use `swift` instead of `objc` for the `LANGUAGE` option. These scripts can be found in the `[project]/Scripts` folder.

### 5. For All Projects
Expand Down Expand Up @@ -106,3 +104,4 @@ Adjust the run scripts in this target as necessary. For example, if your project
* 1.x: works with Swift 2.2 and 2.3 in Xcode 7 or 8
* 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
4 changes: 2 additions & 2 deletions Vokal-Cocoa Touch Application Base.xctemplate/.travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: objective-c
osx_image: xcode9.2
language: swift
osx_image: xcode10
before_install:
- echo -e "machine github.com\n login ${CI_USER_TOKEN}" >> ~/.netrc
before_script:
Expand Down
4 changes: 2 additions & 2 deletions Vokal-Cocoa Touch Application Base.xctemplate/Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source 'https://rubygems.org'
gem 'cocoapods', '~>1.4'
gem 'cocoapods', '~>1.5'
gem 'fastlane'
gem 'slather', '~>2.4'
gem 'slather'
11 changes: 9 additions & 2 deletions Vokal-Cocoa Touch Application Base.xctemplate/TemplateInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
<string>source &apos;https://github.com/vokal/PrivatePodspecRepo-iOS.git&apos;
source &apos;https://github.com/CocoaPods/Specs.git&apos;
platform :ios, &apos;11.0&apos;
platform :ios, &apos;12.0&apos;
target &apos;___PACKAGENAME___&apos; do
pod &apos;xUnique&apos;
Expand All @@ -160,6 +160,13 @@ post_install do | installer |
# Update acknowledgements in the Settings.bundle from pods automagically
require &apos;fileutils&apos;
FileUtils.cp_r(&apos;Pods/Target Support Files/Pods-___PACKAGENAME___/Pods-___PACKAGENAME___-acknowledgements.plist&apos;, &apos;___PACKAGENAME___/Settings.bundle/Acknowledgements.plist&apos;, :remove_destination =&gt; true)
# Fix App Store Connect issue with Pods: https://stackoverflow.com/questions/25755240/too-many-symbol-files-after-successfully-submitting-my-apps
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['DEBUG_INFORMATION_FORMAT'] = 'dwarf'
end
end
end
</string>
<key>Group</key>
Expand Down Expand Up @@ -418,7 +425,7 @@ end
<key>CODE_SIGN_IDENTITY[sdk=iphoneos*]</key>
<string>iPhone Developer</string>
<key>SWIFT_VERSION</key>
<string>4.0</string>
<string>4.2</string>
</dict>
</dict>
<key>Targets</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ platform :ios do
api_token: ENV["HOCKEY_API_TOKEN"],
notes: release_notes,
notify: '0', # Means do not notify
status: '1', # Means do not make available for download
status: '2', # Means make available for download
)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ @implementation ___VARIABLE_classPrefix___HTTPSessionManager (MockData)

+ (void)switchToMockData
{
NSURLSessionConfiguration *sessionConfiguration = [___VARIABLE_classPrefix___HTTPSessionManager sharedManager].session.configuration;
NSURLSessionConfiguration *sessionConfiguration = ___VARIABLE_classPrefix___HTTPSessionManager.sharedManager.session.configuration;

Class mockURLProtocol = VOKMockUrlProtocol.class;
NSMutableArray *currentProtocolClasses = [sessionConfiguration.protocolClasses mutableCopy] ?: [NSMutableArray array];
Expand All @@ -26,7 +26,7 @@ + (void)switchToMockData

+ (void)switchToLiveNetwork
{
NSURLSessionConfiguration *sessionConfiguration = [___VARIABLE_classPrefix___HTTPSessionManager sharedManager].session.configuration;
NSURLSessionConfiguration *sessionConfiguration = ___VARIABLE_classPrefix___HTTPSessionManager.sharedManager.session.configuration;

Class mockURLProtocol = VOKMockUrlProtocol.class;
NSMutableArray *currentProtocolClasses = [sessionConfiguration.protocolClasses mutableCopy];
Expand Down
6 changes: 6 additions & 0 deletions Vokal-Swift.xctemplate/.swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@ disabled_rules:

opt_in_rules:
- force_unwrapping
- implicitly_unwrapped_optional
- unneeded_parentheses_in_closure_argument

force_unwrapping:
severity: error

implicitly_unwrapped_optional:
severity: error

trailing_comma:
mandatory_comma: true
Expand All @@ -28,3 +33,4 @@ excluded:
- ___PACKAGENAME___/Scripts
- ___PACKAGENAME___/Resources
- R.generated.swift
- vendor # If running on Travis CI, a "vendor" directory will be added that may have Swift files that should not be linted.
1 change: 0 additions & 1 deletion Vokal-Swift.xctemplate/APICompletionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import XCTest
@testable import ___PACKAGENAME___

class APICompletionTests: XCTestCase {

let StandardTestTimeout = 3.0

// MARK: - Test Lifecycle
Expand Down
3 changes: 1 addition & 2 deletions Vokal-Swift.xctemplate/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
import UIKit

class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

//WARN: Did you read the instructions? :D
#warning("Did you read the instructions? :D")
}
1 change: 0 additions & 1 deletion Vokal-Swift.xctemplate/BaseButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import UIKit
* Make sure to call super.commonInit() in your implementation!
*/
class BaseButton: UIButton, CommonInitializedView {

var oneTimeThingsAreSetUp = false

// MARK: - Setup functions which should be overridden
Expand Down
1 change: 0 additions & 1 deletion Vokal-Swift.xctemplate/BaseCollectionViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import UIKit
* Make sure to call super.commonInit() in your implementation!
*/
class BaseCollectionViewCell: UICollectionViewCell, CommonInitializedView {

var oneTimeThingsAreSetUp = false

// MARK: - Setup functions which should be overridden
Expand Down
1 change: 0 additions & 1 deletion Vokal-Swift.xctemplate/BaseControl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import UIKit
* Make sure to call super.commonInit() in your implementation!
*/
class BaseControl: UIControl, CommonInitializedView {

var oneTimeThingsAreSetUp = false

// MARK: - Setup functions which should be overridden
Expand Down
1 change: 0 additions & 1 deletion Vokal-Swift.xctemplate/BaseImageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import UIKit
* Make sure to call super.commonInit() in your implementation!
*/
class BaseImageView: UIImageView, CommonInitializedView {

var oneTimeThingsAreSetUp = false

// MARK: - Setup functions which should be overridden
Expand Down
1 change: 0 additions & 1 deletion Vokal-Swift.xctemplate/BaseLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import UIKit
* Make sure to call super.commonInit() in your implementation!
*/
class BaseLabel: UILabel, CommonInitializedView {

var oneTimeThingsAreSetUp = false

// MARK: - Setup functions which should be overridden
Expand Down
3 changes: 1 addition & 2 deletions Vokal-Swift.xctemplate/BaseTableViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import UIKit
* Make sure to call super.commonInit() in your implementation!
*/
class BaseTableViewCell: UITableViewCell, CommonInitializedView {

var oneTimeThingsAreSetUp = false

// MARK: - Setup functions which should be overridden
Expand All @@ -36,7 +35,7 @@ class BaseTableViewCell: UITableViewCell, CommonInitializedView {
super.init(coder: aDecoder)
}

override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.commonInit()
}
Expand Down
1 change: 0 additions & 1 deletion Vokal-Swift.xctemplate/BaseTableViewHeaderFooterView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import UIKit
* Make sure to call super.commonInit() in your implementation!
*/
class BaseTableViewHeaderFooterView: UITableViewHeaderFooterView, CommonInitializedView {

var oneTimeThingsAreSetUp = false

// MARK: - Setup functions which should be overridden
Expand Down
1 change: 0 additions & 1 deletion Vokal-Swift.xctemplate/BaseTextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import UIKit
* Make sure to call super.commonInit() in your implementation!
*/
class BaseTextField: UITextField, CommonInitializedView {

var oneTimeThingsAreSetUp = false

// MARK: - Setup functions which should be overridden
Expand Down
1 change: 0 additions & 1 deletion Vokal-Swift.xctemplate/BaseTextView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import UIKit
* Make sure to call super.commonInit() in your implementation!
*/
class BaseTextView: UITextView, CommonInitializedView {

var oneTimeThingsAreSetUp = false

// MARK: - Setup functions which should be overridden
Expand Down
1 change: 0 additions & 1 deletion Vokal-Swift.xctemplate/BaseView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import UIKit
* Make sure to call super.commonInit() in your implementation!
*/
class BaseView: UIView, CommonInitializedView {

var oneTimeThingsAreSetUp = false

// MARK: - Setup functions which should be overridden
Expand Down
3 changes: 1 addition & 2 deletions Vokal-Swift.xctemplate/CommonInitializedView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import UIKit
* See BaseView for an example of implementing this protocol.
*/
protocol CommonInitializedView {

/// Variable to track whether the one-time things are already set up.
var oneTimeThingsAreSetUp: Bool { get }

Expand Down Expand Up @@ -41,8 +40,8 @@ protocol CommonInitializedView {
}

// MARK: - Default implementation of protocol for view subclasses.
extension CommonInitializedView where Self: UIView {

extension CommonInitializedView where Self: UIView {
func setupOneTimeThingsIfNeeded() {
if !self.oneTimeThingsAreSetUp {
self.setupOneTimeThings()
Expand Down
1 change: 0 additions & 1 deletion Vokal-Swift.xctemplate/CoreDataUtility.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import Vokoder
run `setupCoreDataForTesting` in that file as well.
*/
struct CoreDataUtility {

// MARK: - Setup consolidation methods

/**
Expand Down
6 changes: 6 additions & 0 deletions Vokal-Swift.xctemplate/DLog.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ Note: The message is the only required variable for any of these.
/* A detailed log statement which will only print when in debug mode.

- parameter message: The message you wish to log out.
- parameter filename: The filename of the original caller.
- parameter function: The function of the original caller
- parameter line: the line number of the original caller.
*/
func DLog(_ message: @autoclosure () -> String,
filename: String = #file,
Expand All @@ -37,6 +40,9 @@ func DLog(_ message: @autoclosure () -> String,
A detailed log statement which will always print.

- parameter message: The message you wish to log out.
- parameter filename: The filename of the original caller.
- parameter function: The function of the original caller
- parameter line: the line number of the original caller.
*/
func ALog(_ message: @autoclosure () -> String,
filename: String = #file,
Expand Down
1 change: 0 additions & 1 deletion Vokal-Swift.xctemplate/HTTPSessionManager+MockData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ private class INeedABundle {
}

extension HTTPSessionManager {

/**
Sets up the networking stack to use VOKMockURLProtocol.
*/
Expand Down
1 change: 0 additions & 1 deletion Vokal-Swift.xctemplate/HTTPSessionManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import Foundation
import Alamofire

class HTTPSessionManager {

static var AlamofireManager = Alamofire.SessionManager.default

static func switchManagerConfiguration(to configuration: URLSessionConfiguration) {
Expand Down
15 changes: 3 additions & 12 deletions Vokal-Swift.xctemplate/MainAPIUtility.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,17 @@ typealias APIEmptyResponseCompletion = (NSNull) -> Void
// MARK: - Header enums

enum HTTPHeaderKey: String {
case
Authorization //Automatically "Authorization"
case Authorization //Automatically "Authorization"
}

enum HTTPHeaderValue {
case
token(token: String)
case token(token: String)
}

// MARK: Version Handling

enum APIVersion: String {
case
v1 //Automatically uses "v1"
case v1 //Automatically uses "v1"

/**
Takes the passed in path and prepends a version to it. For example:
Expand Down Expand Up @@ -102,7 +99,6 @@ extension APIVersionable {
structs can then call the more generic methods in this class.
*/
class MainAPIUtility {

// MARK: - Variables

/// Singleton instance
Expand Down Expand Up @@ -138,7 +134,6 @@ class MainAPIUtility {
string keys and string values.
*/
private func headerStringDictionary(fromHeaderDictionary headers: [HTTPHeaderKey: HTTPHeaderValue]) -> [String: String] {

var headerStrings = [String: String]()
for (key, value) in headers {
switch value {
Expand All @@ -158,7 +153,6 @@ class MainAPIUtility {
userEmail: String,
success: @escaping APIDictionaryCompletion,
failure: @escaping APIFailureCompletion) {

let fullURLString = ServerEnvironment.fullURLString(for: path)
let headerStrings = self.headerStringDictionary(fromHeaderDictionary: headers)

Expand Down Expand Up @@ -189,7 +183,6 @@ class MainAPIUtility {
params: APIDictionary? = nil,
success: @escaping APISuccessCompletion<T>,
failure: @escaping APIFailureCompletion) {

let fullURLString = ServerEnvironment.fullURLString(for: path)
let headerStrings = self.headerStringDictionary(fromHeaderDictionary: headers)

Expand All @@ -213,7 +206,6 @@ class MainAPIUtility {
params: APIDictionary,
success: @escaping APISuccessCompletion<T>,
failure: @escaping APIFailureCompletion) {

let fullURLString = ServerEnvironment.fullURLString(for: path)
let headerStrings = self.headerStringDictionary(fromHeaderDictionary: headers)

Expand All @@ -237,7 +229,6 @@ class MainAPIUtility {
private func handle<T>(response: DataResponse<Any>,
success: @escaping APISuccessCompletion<T>,
failure: @escaping APIFailureCompletion) {

if shouldDebugPrintInfo {
debugPrint(response)
}
Expand Down
Loading

0 comments on commit a41b545

Please sign in to comment.