Skip to content

Commit

Permalink
feature: Update to v0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderwe committed Aug 16, 2019
1 parent cb1db88 commit c511a21
Show file tree
Hide file tree
Showing 25 changed files with 150 additions and 83 deletions.
32 changes: 31 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.0.1] - YYYY-MM-DD
- Include network utilities
- Adapt for SwiftUI
- Include Swift Package Manager

## [0.0.1] - 2019-08-16

### Added

- External libraries
- SwiftLint
- R.Swift
- SwiftDate
- IQKeyboardManager
- PromiseKit
- Internals
- Utilities
- Logging
- Localisation
- UserDefaults

### Fixed

- Errors in `project.yml` which lead to incorrect configured Xcode projects

[unreleased]: https://github.com/alexanderwe/ios-starter/compare/v1.0.0...HEAD
[0.0.1]: https://github.com/alexanderwe/ios-starter/releases/tag/v0.0.1

<!-- keywords to be used
### Added
Expand All @@ -20,3 +48,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
### Security
-->
35 changes: 29 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# iOS-Starter

This is a template project for boostrapping iOS applications.
![version](https://img.shields.io/badge/version-v0.0.1-green)

This is a template project for bootstrapping iOS applications.

> When Xcode 11 is released, this template will convert from CocoaPods to Swift Package Manager
## Prequisites

Expand All @@ -17,14 +21,33 @@ brew install xcodegen
- `cookiecutter` will prompt you for:
- The project name
- Apple Developer Team details
- etc.
- other details
- `cookiecutter` will create all necessary files
- `XcodeGen` will now run automatically creating a `.xcodeproj` file
- `XcodeGen` runs and automatically creates a `.xcodeproj` file
- Afterwards `pod install` will run to download all necessary dependencies
- Finally `Xcode` will launch your new project
- Happy Coding ! 🤓

## Included libraries
## Included external libraries

- Handle asynchronous code
- [PromiseKit](https://github.com/mxcl/PromiseKit) - Avoid the Callback Hell
- Code Style
- [SwiftLint](https://www.github.com/realm/SwiftLint) - Common linting rules
- Helpers
- [Rswift](https://github.com/mac-cain13/R.swift) - Type safe access to string resources
- [SwiftDate](https://github.com/malcommac/SwiftDate) - Work with Dates is a breeze
- [IQKeyboardManager](https://github.com/hackiftekhar/IQKeyboardManager) - Handle common keyboard issues on iOS

## Structure

The structure of the project tries to follow the idea in [this article](https://theswiftdev.com/2016/07/06/conventions-for-xcode/) from `The.Swift.Dev`

## Git Hooks

This template comes with a `.githooks` directory. Inside you can find and create hooks which will run in the local `.git` repository.

Available hooks:

- [SwfitLint](https://www.github.com/realm/SwiftLint) - Common linting rules
- [Rswft](https://github.com/mac-cain13/R.swift) - Type safe access to string resources
- commit-msg (run before committing):
- Verifies that the commit message follows the standard [Conventional Commits](https://www.conventionalcommits.org) specification (+ one additional commit type `ci`)
8 changes: 4 additions & 4 deletions cookiecutter.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"projectName": "Example",
"projectDirectory": "{{cookiecutter.projectName|lower|replace(' ', '-')}}-ios",
"teamId": "123456",
"teamName": "Your Team Name",
"companyName": "Your company name",
"teamId": "TeamID",
"teamName": "TeamName",
"companyName": "CompanyName",
"bundleIdentifier": "com.example.{{cookiecutter.projectName|lower|replace(' ', '-')}}",
"deploymentTarget": "12.0",
"deploymentTarget": "12.4",
"runCocoaPods": "y",
"runXcodeGen": "y"
}
12 changes: 9 additions & 3 deletions hooks/post_gen_project.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
#! /bin/bash

# Run xcodegen to create .xcodeproj file
{%- if cookiecutter.runXcodeGen == 'y' %}
xcodegen
{%- endif %}

# Install cocoapods dependecies
{%- if cookiecutter.runCocoaPods == 'y' %}
pod install
{%- endif %}


# If xcodegen has generated a .xcodeproj file we want to open it
{%- if cookiecutter.runXcodeGen == 'y' %}
xed .
{%- endif %}


# Set up git
git init
mv commit-msg .git/hooks/commit-msg
chmod u+x .git/hooks/commit-msg

## Configure git hooks
chmod +x ./.githooks/commit-msg
git config core.hooksPath .githooks

printf 'all done - enjoy 🤓'
8 changes: 8 additions & 0 deletions {{cookiecutter.projectDirectory}}/.githooks/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

# Directory of the hooks
hookDir=$(dirname $0)

# Specify the hooks you want to run during
# the commit-msg process:
$hookDir/verify_conventional_commit "$1"
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ def main():
# example:
# feat(apikey): added the ability to add api key to configuration
try:
pattern = r'(build|ci|docs|feat|fix|perf|refactor|style|test|chore|revert)(\([\w\-]+\))?:\s.*'
pattern = r'(fix|feat|chore|docs|style|refactor|perf|test|ci)(\([\w\-]+\))?:\s.*'
filename = sys.argv[1]
ss = open(filename, 'r').read()
m = re.match(pattern, ss)
if m == None:
raise Exception("conventional commit validation failed")
raise Exception("conventional commit validation failed")
except Exception as e:
print(e)
exit(1)
exit(1)

if __name__ == "__main__":
main()
2 changes: 0 additions & 2 deletions {{cookiecutter.projectDirectory}}/.swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# Based on https://github.com/Lickability/swift-best-practices/blob/master/.swiftlint.yml

disabled_rules: # rule identifiers to exclude from running
# Rationale: Xcode auto indentation can cause this warning
# https://github.com/realm/SwiftLint/blob/master/Rules.md#closure-end-indentation
Expand Down
13 changes: 9 additions & 4 deletions {{cookiecutter.projectDirectory}}/Podfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target '{{cookiecutter.projectName}}' do
target 'iOS Application' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!

# Pods for {{cookiecutter.projectName}}
# Pods for iOS Application

# Async
pod 'PromiseKit'

# Code Quality
pod 'SwiftLint'

# Helpers
pod 'R.swift'
pod 'IQKeyboardManagerSwift'
pod 'SwiftDate'

target '{{cookiecutter.projectName}}Tests' do
target 'iOS Application Tests' do
inherit! :search_paths
# Pods for testing
end

target '{{cookiecutter.projectName}}UITests' do
target 'iOS Application UI Tests' do
inherit! :search_paths
# Pods for testing
end
Expand Down
3 changes: 2 additions & 1 deletion {{cookiecutter.projectDirectory}}/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
## Setup

- Fill the README
- Move `R.generated.swift` to `Sources` and untick `Copy items if needed`
- Initially build the project
- Add `R.generated.swift` from `Sources` to the project and untick `Copy items if needed`
- Delete this TODO section. (And enjoy your fresh and clean Project-setup 🙌)

---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import UIKit
import IQKeyboardManagerSwift

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
Expand All @@ -15,6 +16,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.

// Init IQKeyboardManager
// IQKeyboardManager.shared.enable = true
// IQKeyboardManager.shared.shouldResignOnTouchOutside = true
// IQKeyboardManager.shared.enableAutoToolbar = false

return true
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina6_1" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand All @@ -11,9 +14,21 @@
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Hello World!" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="h2C-1c-4HG">
<rect key="frame" x="160" y="437.5" width="94" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="h2C-1c-4HG" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="73D-HE-Eef"/>
<constraint firstItem="h2C-1c-4HG" firstAttribute="centerY" secondItem="8bC-Xf-vdC" secondAttribute="centerY" id="hV3-by-GNO"/>
</constraints>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// Loca.swift
// PTV
// Localization.swift
// {{cookiecutter.projectName}}
//
// Created by Automated on {% now 'utc', '%d/%m/%Y' %}.
// Copyright © {% now 'utc', '%Y' %} {{cookiecutter.companyName}}. All rights reserved.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ extension OSLogType: CustomStringConvertible {
case OSLogType.info:
return "ℹ️(info)"
case OSLogType.debug:
return "🔹(debug)"
return "🐛(debug)"
case OSLogType.error:
return "‼️(error)"
case OSLogType.fault:
return "💣(fault)"
return "🧨(fault)"
default:
return "DEFAULT"
}
Expand Down
Loading

0 comments on commit c511a21

Please sign in to comment.