├── .gitignore ├── Clean Swift Files └── Clean Files.xctemplate │ ├── TemplateIcon.png │ ├── TemplateIcon@2x.png │ ├── TemplateInfo.plist │ ├── ___VARIABLE_ClassName:identifier___Controller.swift │ ├── ___VARIABLE_ClassName:identifier___Interactor.swift │ ├── ___VARIABLE_ClassName:identifier___Models.swift │ ├── ___VARIABLE_ClassName:identifier___Presenter.swift │ ├── ___VARIABLE_ClassName:identifier___Router.swift │ └── ___VARIABLE_ClassName:identifier___Worker.swift ├── LICENSE ├── README.md ├── importTemplate └── sources ├── clean-swift.png └── tutorial.gif /.gitignore: -------------------------------------------------------------------------------- 1 | # OS X 2 | .DS_Store 3 | 4 | # Xcode 5 | build/ 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | xcuserdata/ 15 | *.xccheckout 16 | *.moved-aside 17 | DerivedData 18 | *.hmap 19 | *.ipa 20 | 21 | # Bundler 22 | .bundle 23 | 24 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 25 | # Carthage/Checkouts 26 | 27 | Carthage/Build 28 | 29 | # We recommend against adding the Pods directory to your .gitignore. However 30 | # you should judge for yourself, the pros and cons are mentioned at: 31 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 32 | # 33 | # Note: if you ignore the Pods directory, make sure to uncomment 34 | # `pod install` in .travis.yml 35 | # 36 | Pods/ 37 | -------------------------------------------------------------------------------- /Clean Swift Files/Clean Files.xctemplate/TemplateIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emrcftci/CleanSwiftArchitectureGenerator/8aecf8632e1528d4a253821beb16906b7cfc5a84/Clean Swift Files/Clean Files.xctemplate/TemplateIcon.png -------------------------------------------------------------------------------- /Clean Swift Files/Clean Files.xctemplate/TemplateIcon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emrcftci/CleanSwiftArchitectureGenerator/8aecf8632e1528d4a253821beb16906b7cfc5a84/Clean Swift Files/Clean Files.xctemplate/TemplateIcon@2x.png -------------------------------------------------------------------------------- /Clean Swift Files/Clean Files.xctemplate/TemplateInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Kind 6 | Xcode.IDEFoundation.TextSubstitutionFileTemplateKind 7 | Description 8 | All classes for a Clean structured feature 9 | Summary 10 | All classes for a Clean structured feature 11 | SortOrder 12 | 30 13 | AllowedTypes 14 | 15 | public.swift-source 16 | 17 | DefaultCompletionName 18 | Clean 19 | MainTemplateFile 20 | ___FILEBASENAME___.swift 21 | Options 22 | 23 | 24 | Identifier 25 | ClassName 26 | Required 27 | 28 | Name 29 | Feature Name : 30 | Description 31 | Please type the name of the feature 32 | Type 33 | text 34 | NotPersisted 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Clean Swift Files/Clean Files.xctemplate/___VARIABLE_ClassName:identifier___Controller.swift: -------------------------------------------------------------------------------- 1 | //___FILEHEADER___ 2 | 3 | import UIKit 4 | 5 | protocol ___VARIABLE_ClassName___DisplayLogic: class { 6 | 7 | } 8 | 9 | final class ___VARIABLE_ClassName___Controller: UIViewController { 10 | 11 | var interactor: ___VARIABLE_ClassName___BusinessLogic? 12 | var router: (___VARIABLE_ClassName___RoutingLogic & ___VARIABLE_ClassName___DataPassing)? 13 | 14 | // MARK: Object lifecycle 15 | 16 | override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { 17 | super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) 18 | setup() 19 | } 20 | 21 | required init?(coder aDecoder: NSCoder) { 22 | super.init(coder: aDecoder) 23 | setup() 24 | } 25 | 26 | // MARK: Setup 27 | 28 | private func setup() { 29 | let viewController = self 30 | let interactor = ___VARIABLE_ClassName___Interactor() 31 | let presenter = ___VARIABLE_ClassName___Presenter() 32 | let worker = ___VARIABLE_ClassName___Worker() 33 | let router = ___VARIABLE_ClassName___Router() 34 | viewController.interactor = interactor 35 | viewController.router = router 36 | interactor.presenter = presenter 37 | interactor.worker = worker 38 | presenter.viewController = viewController 39 | router.viewController = viewController 40 | router.dataStore = interactor 41 | } 42 | } 43 | 44 | extension ___VARIABLE_ClassName___Controller: ___VARIABLE_ClassName___DisplayLogic { 45 | 46 | } 47 | -------------------------------------------------------------------------------- /Clean Swift Files/Clean Files.xctemplate/___VARIABLE_ClassName:identifier___Interactor.swift: -------------------------------------------------------------------------------- 1 | //___FILEHEADER___ 2 | 3 | import Foundation 4 | 5 | protocol ___VARIABLE_ClassName___BusinessLogic: class { 6 | 7 | } 8 | 9 | protocol ___VARIABLE_ClassName___DataStore: class { 10 | 11 | } 12 | 13 | class ___VARIABLE_ClassName___Interactor: ___VARIABLE_ClassName___BusinessLogic, ___VARIABLE_ClassName___DataStore { 14 | 15 | var presenter: ___VARIABLE_ClassName___PresentationLogic? 16 | var worker: ___VARIABLE_ClassName___Worker? 17 | 18 | } 19 | -------------------------------------------------------------------------------- /Clean Swift Files/Clean Files.xctemplate/___VARIABLE_ClassName:identifier___Models.swift: -------------------------------------------------------------------------------- 1 | //___FILEHEADER___ 2 | 3 | import Foundation 4 | 5 | enum ___VARIABLE_ClassName___ { 6 | 7 | enum UseCase { 8 | 9 | struct Request { } 10 | 11 | struct Response { } 12 | 13 | struct ViewModel { } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Clean Swift Files/Clean Files.xctemplate/___VARIABLE_ClassName:identifier___Presenter.swift: -------------------------------------------------------------------------------- 1 | //___FILEHEADER___ 2 | 3 | import Foundation 4 | 5 | protocol ___VARIABLE_ClassName___PresentationLogic: class { 6 | 7 | } 8 | 9 | final class ___VARIABLE_ClassName___Presenter: ___VARIABLE_ClassName___PresentationLogic { 10 | 11 | weak var viewController: ___VARIABLE_ClassName___DisplayLogic? 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Clean Swift Files/Clean Files.xctemplate/___VARIABLE_ClassName:identifier___Router.swift: -------------------------------------------------------------------------------- 1 | //___FILEHEADER___ 2 | 3 | import Foundation 4 | 5 | protocol ___VARIABLE_ClassName___RoutingLogic: class { 6 | 7 | } 8 | 9 | protocol ___VARIABLE_ClassName___DataPassing: class { 10 | var dataStore: ___VARIABLE_ClassName___DataStore? { get } 11 | } 12 | 13 | final class ___VARIABLE_ClassName___Router: ___VARIABLE_ClassName___RoutingLogic, ___VARIABLE_ClassName___DataPassing { 14 | 15 | weak var viewController: ___VARIABLE_ClassName___Controller? 16 | var dataStore: ___VARIABLE_ClassName___DataStore? 17 | 18 | } 19 | -------------------------------------------------------------------------------- /Clean Swift Files/Clean Files.xctemplate/___VARIABLE_ClassName:identifier___Worker.swift: -------------------------------------------------------------------------------- 1 | //___FILEHEADER___ 2 | 3 | import Foundation 4 | 5 | final class ___VARIABLE_ClassName___Worker { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Emre Çiftçi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Clean Swift Architecture Template 2 | 3 | 4 |

5 | 6 |

7 | 8 | 9 | Purpose of the project 10 | ====================== 11 | 12 | :boom: This project will help you develop your project with Clean Swift Architecture. You can use this XCode Template for create Clean Swift Architecture files effortlessly. 13 | 14 | 15 | Add template to your XCode 16 | ====================== 17 | 18 | * You can add template to your XCode just double-click on `importTemplate` script. 19 | 20 | 21 |

22 | 23 |

24 | 25 | 26 | 27 | Find this repo useful? 28 | ====================== 29 | 30 | Find this repo useful? :heart: 31 | 32 | Support it by joining [stargazers](https://github.com/emrcftci/CleanSwiftTemplate/stargazers) for this repository. :star: 33 | 34 | And [follow](https://github.com/emrcftci) me for my next creations! 🤩 35 | 36 | 37 | VIPER Architecture Generator 38 | ================================== 39 | 40 | You can easily create VIPER Architecture from [here](https://github.com/Cemoo/VIPERArchitectureGenerator) 41 | 42 | License 43 | ======= 44 | 45 | ``` 46 | MIT License 47 | 48 | Copyright (c) 2019 Emre Çiftçi 49 | 50 | Permission is hereby granted, free of charge, to any person obtaining a copy 51 | of this software and associated documentation files (the "Software"), to deal 52 | in the Software without restriction, including without limitation the rights 53 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 54 | copies of the Software, and to permit persons to whom the Software is 55 | furnished to do so, subject to the following conditions: 56 | 57 | The above copyright notice and this permission notice shall be included in all 58 | copies or substantial portions of the Software. 59 | 60 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 61 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 62 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 63 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 64 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 65 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 66 | SOFTWARE. 67 | ``` 68 | -------------------------------------------------------------------------------- /importTemplate: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # -*- coding: utf-8 -*- 3 | 4 | cd $(dirname "$0") 5 | cp -R Clean\ Swift\ Files /Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File\ Templates/ -------------------------------------------------------------------------------- /sources/clean-swift.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emrcftci/CleanSwiftArchitectureGenerator/8aecf8632e1528d4a253821beb16906b7cfc5a84/sources/clean-swift.png -------------------------------------------------------------------------------- /sources/tutorial.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emrcftci/CleanSwiftArchitectureGenerator/8aecf8632e1528d4a253821beb16906b7cfc5a84/sources/tutorial.gif --------------------------------------------------------------------------------