Skip to content

Instantly share code, notes, and snippets.

@bannzai
Last active December 26, 2016 03:17
Show Gist options
  • Save bannzai/96dd804e1d92830719491dda2fd6335e to your computer and use it in GitHub Desktop.
Save bannzai/96dd804e1d92830719491dda2fd6335e to your computer and use it in GitHub Desktop.
まだiOS Clean Architecture で消耗してるの? 爆速開発ツールを作ったのでご紹介 ref: http://qiita.com/bannzai/items/6e8add18b15af235a19f
$ kuri setup
created Kuri.yml.
created template for Entity
created template for DataStore
created template for Repository
created template for UseCase
created template for Translator
created template for Model
created template for Presenter
created template for View
created template for Wireframe
created template for Builder
Successfully setup!
$ ls
Kuri.yml KuriTemplate, YourProject YourProject.xcodeproj YourProjectTests YourProjectUITests
$ kuri generate Kuri
created: ./YourProject/Kuri/Entity/KuriEntity.swift
created: ./YourProject/Kuri/Entity/KuriEntityImpl.swift
created: ./YourProject/Kuri/DataStore/KuriDataStore.swift
created: ./YourProject/Kuri/DataStore/KuriDataStoreImpl.swift
created: ./YourProject/Kuri/Repository/KuriRepository.swift
created: ./YourProject/Kuri/Repository/KuriRepositoryImpl.swift
created: ./YourProject/Kuri/UseCase/KuriUseCase.swift
created: ./YourProject/Kuri/UseCase/KuriUseCaseImpl.swift
created: ./YourProject/Kuri/Translator/KuriTranslator.swift
created: ./YourProject/Kuri/Translator/KuriTranslatorImpl.swift
created: ./YourProject/Kuri/Model/KuriModel.swift
created: ./YourProject/Kuri/Model/KuriModelImpl.swift
created: ./YourProject/Kuri/Presenter/KuriPresenter.swift
created: ./YourProject/Kuri/Presenter/KuriPresenterImpl.swift
created: ./YourProject/Kuri/View/KuriViewController.swift
created: ./YourProject/Kuri/View/KuriViewControllerImpl.swift
created: ./YourProject/Kuri/Wireframe/KuriWireframe.swift
created: ./YourProject/Kuri/Wireframe/KuriWireframeImpl.swift
created: ./YourProject/Kuri/Builder/KuriBuilder.swift
created: ./YourProject/Kuri/Builder/KuriBuilderImpl.swift
write in project: YourProject.xcodeproj
//
// __REPOSITORY__Impl.swift
// Kuri
//
// Created by __USERNAME__ on __DATE__.
// Copyright © 2016年 __USERNAME__. All rights reserved.
//
struct __REPOSITORY__Impl: __REPOSITORY__ {
private let dataStore: __DATASTORE__
init(
dataStore: __DATASTORE__
) {
self.dataStore = dataStore
}
func fetch() throws -> __ENTITY__ {
return try dataStore.fetch()
}
}
//
// __REPOSITORY__Impl.swift
// Kuri
//
// Created by __USERNAME__ on __DATE__.
// Copyright © 2016年 __USERNAME__. All rights reserved.
//
struct __REPOSITORY__Impl: __REPOSITORY__ {
private let dataStore: __DATASTORE__
init(
dataStore: __DATASTORE__
) {
self.dataStore = dataStore
}
func fetch() throws -> __ENTITY__ {
return try dataStore.fetch()
}
}
//
// KuriRepositoryImpl.swift
// Kuri
//
// Created by kingkong999yhirose on 2016/12/25.
// Copyright © 2016年 kingkong999yhirose. All rights reserved.
//
struct KuriRepositoryImpl: KuriRepository {
private let dataStore: KuriDataStore
init(
dataStore: KuriDataStore
) {
self.dataStore = dataStore
}
func fetch() throws -> KuriEntity {
return try dataStore.fetch()
}
}
//
// KuriRepositoryImpl.swift
// Kuri
//
// Created by kingkong999yhirose on 2016/12/25.
// Copyright © 2016年 kingkong999yhirose. All rights reserved.
//
struct KuriRepositoryImpl: KuriRepository {
private let dataStore: KuriDataStore
init(
dataStore: KuriDataStore
) {
self.dataStore = dataStore
}
func fetch() throws -> KuriEntity {
return try dataStore.fetch()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment