Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,7 @@ Packages/
.bundle/
bundle/
Otofuda-iOS/resources/.GoogleService-Info.plist.icloud

# SwiftFormat
BuildTools/.build
BuildTools/.swiftps
Empty file added .swift-format
Empty file.
79 changes: 79 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# document: https://github.com/realm/SwiftLint

# 無効にするルール
disabled_rules:
- multiple_closures_with_trailing_closure # 複数のクロージャーの場合でも、trailing closureを利用したいため
- empty_enum_arguments # enumの引数を省略したいため

# opt-inルールの中で無効にするルール
- conditional_returns_on_newline # ガード文などは簡潔に一行で記述したいため
- discouraged_optional_collection # PHImageManagerの既存仕様のため
- explicit_enum_raw_value # 暗黙的なraw値で問題ないため
- explicit_type_interface # 型推論を利用したいため
- fatal_error_message # メッセージは不要なため
- file_header # ヘッダには特に決まりがないため
- lower_acl_than_parent # 対応不可のため
- no_extension_access_modifier # extension_access_modifierを優先するため
- no_grouping_extension # グルーピングにextensionを利用したいため
- strict_fileprivate # fileprivateを利用したいため
- switch_case_on_newline # caseと同じ行に記述したいため
- trailing_closure # RxSwiftのOnNextでwarningが出るため

# defaultルール以外にopt-inから採用するルール
opt_in_rules:
- sorted_imports
- prohibited_super_call
- overridden_super_call
- operator_usage_whitespace
- force_unwrapping
- first_where
- explicit_init
- empty_count
- closure_spacing

# Lint対象に追加するパス
included:
- Otofuda-iOS
# - Otofuda-iOSTests
# - Otofuda-iOSUITests

# Lint対象から除外するパス
excluded:
- Carthage
- Pods
- MyLibraryDemoTests

# 1行の文字列制限
line_length:
- 200 # warning
- 300 # error

# 型の行数制限
type_body_length:
- 400 # warning
- 600 # error

# 1ファイルの行数制限
file_length:
- 500 # warning
- 1000 # error

# メソッドの行数制限
function_body_length:
- 100 # warning
- 200 # error

type_name:
min_length: 2
max_length: 40

identifier_name:
min_length: 1 # 変数名が1文字以上なら許可に変更
excluded: # excluded via string array
- id
- URL
- x
- y
- vc
- on
reporter: "xcode"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DefaultCompletionName</key>
<string>MyScene</string>
<key>Description</key>
<string>This generates a new presenter using Uncle Bob&apos;s clean architecture. Your presentation logic goes here.</string>
<key>Kind</key>
<string>Xcode.IDEKit.TextSubstitutionFileTemplateKind</string>
<key>Options</key>
<array>
<dict>
<key>Description</key>
<string>The name of the scene to create</string>
<key>Identifier</key>
<string>sceneName</string>
<key>Name</key>
<string>New Scene Name:</string>
<key>NotPersisted</key>
<true/>
<key>Required</key>
<true/>
<key>Type</key>
<string>text</string>
</dict>
<dict>
<key>Default</key>
<string>___VARIABLE_sceneName:identifier___</string>
<key>Identifier</key>
<string>productName</string>
<key>Type</key>
<string>static</string>
</dict>
<dict>
<key>Default</key>
<string>___VARIABLE_sceneName:identifier___Coordinator</string>
<key>Description</key>
<string>The coordinator name</string>
<key>Identifier</key>
<string>coordinatorName</string>
<key>Name</key>
<string>Coordinator Name:</string>
<key>Required</key>
<true/>
<key>Type</key>
<string>static</string>
</dict>
</array>
<key>Platforms</key>
<array>
<string>com.apple.platform.iphoneos</string>
</array>
<key>SortOrder</key>
<string>3</string>
<key>Summary</key>
<string>This generates a new presenter using Uncle Bob&apos;s clean architecture. Your presentation logic goes here.</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

import UIKit

final class ___VARIABLE_sceneName___Coordinator {
typealias ViewController = ___VARIABLE_sceneName___VC

private weak var navigator: UINavigationController?
private weak var viewController: ViewController?
private let environment: ViewController.Environment

init(navigator: UINavigationController, input: ViewController.Input, environment: ViewController.Environment = .shared) {
self.navigator = navigator
self.environment = environment
viewController = .instantiate(with: input, environment: environment)
viewController?.output(output)
}

func start() {
guard let viewController = viewController else { return }
navigator?.pushViewController(viewController, animated: true)
}

private func output(_ output: ViewController.Output) {
switch output {
case .someTapped:
// TODO: 処理を書く
break
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
103 changes: 103 additions & 0 deletions File Template/Otofuda MVVM/Scene.xctemplate/TemplateInfo.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DefaultCompletionName</key>
<string>MyScene</string>
<key>Description</key>
<string>This generates a new scene using Uncle Bob&apos;s clean architecture. It consists of the view controller, interactor, presenter, and router. You can then create individual workers to supplement the interactor.</string>
<key>Kind</key>
<string>Xcode.IDEKit.TextSubstitutionFileTemplateKind</string>
<key>Options</key>
<array>
<dict>
<key>Placeholder</key>
<string>Sample</string>
<key>Description</key>
<string>The name of the scene to create</string>
<key>Identifier</key>
<string>sceneName</string>
<key>Name</key>
<string>New Scene Name:</string>
<key>NotPersisted</key>
<true/>
<key>Required</key>
<true/>
<key>Type</key>
<string>text</string>
</dict>
<dict>
<key>Default</key>
<string>___VARIABLE_sceneName:identifier___</string>
<key>Identifier</key>
<string>productName</string>
<key>Type</key>
<string>static</string>
</dict>
<dict>
<key>Default</key>
<string>___VARIABLE_sceneName:identifier___Coordinator</string>
<key>Description</key>
<string>The coordinator name</string>
<key>Identifier</key>
<string>coordinatorName</string>
<key>Name</key>
<string>Coordinator Name:</string>
<key>Required</key>
<true/>
<key>Type</key>
<string>static</string>
</dict>
<dict>
<key>Default</key>
<string>___VARIABLE_sceneName:identifier___VC</string>
<key>Description</key>
<string>The view controller name</string>
<key>Identifier</key>
<string>viewControllerName</string>
<key>Name</key>
<string>View Controller Name:</string>
<key>Required</key>
<true/>
<key>Type</key>
<string>static</string>
</dict>
<dict>
<key>Default</key>
<string>___VARIABLE_sceneName:identifier___.storyboard</string>
<key>Description</key>
<string>The storyboard name</string>
<key>Identifier</key>
<string>storyboardName</string>
<key>Name</key>
<string>Storyboard Name:</string>
<key>Required</key>
<true/>
<key>Type</key>
<string>static</string>
</dict>
<dict>
<key>Default</key>
<string>___VARIABLE_sceneName:identifier___VM</string>
<key>Description</key>
<string>The view model name</string>
<key>Identifier</key>
<string>viewmodelName</string>
<key>Name</key>
<string>View Model Name:</string>
<key>Required</key>
<true/>
<key>Type</key>
<string>static</string>
</dict>
</array>
<key>Platforms</key>
<array>
<string>com.apple.platform.iphoneos</string>
</array>
<key>SortOrder</key>
<string>0</string>
<key>Summary</key>
<string>This generates a new scene using Uncle Bob&apos;s clean architecture.</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Y6W-OH-hqX">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--___FILEBASENAME___VC-->
<scene sceneID="s0d-6b-0kx">
<objects>
<viewController id="Y6W-OH-hqX" customClass="___FILEBASENAME___VC" customModule="Otofuda_iOS" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="5EZ-qb-Rvc">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<viewLayoutGuide key="safeArea" id="vDu-zF-Fre"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Ief-a0-LHa" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-146" y="139"/>
</scene>
</scenes>
<resources>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

import UIKit

final class ___VARIABLE_sceneName___Coordinator {
typealias ViewController = ___VARIABLE_sceneName___VC

private weak var navigator: UINavigationController?
private weak var viewController: ViewController?
private let environment: ViewController.Environment

init(navigator: UINavigationController, input _: ViewController.Input, environment: ViewController.Environment = .shared) {
self.navigator = navigator
self.environment = environment
viewController = .loadFromStoryboard(with: .init(), environment: environment)
viewController?.output(output)
}

func start() {
guard let viewController = viewController else { return }
navigator?.pushViewController(viewController, animated: true)
}

private func output(_ output: ViewController.Output) {
switch output {
case .someTapped:
// TODO: 処理を書く
break
}
}
}
Loading