iOS 개발에서 VIPER/Clean Architecture를 사용하는 경우 파일을 자동으로 생성하는Generamba를 사용합니다.

iOS 개발로 인해 archiitecture는 VIPER를 사용하려고 하는데 파일이 추가되었습니까?
그럼, Generamba(※)를 사용하세요˙ω˙) 이렇게 되면
※ 나는 Generamba를'제네람바'라고 부른다.내 동료 러시아 사람이 그렇게 말한 것 같아서.지미바일 수도 있어.

Generamba는 무엇입니까?


Generamba는 Xcode를 위한 코드 발생기입니다.VIPER Module을 위해 설계됐지만, 맞춤 제작이 쉬워 다양한 학급에서 Objective-C와 Swift로 제작할 수 있다.Generamba Overview

설치하다.


Ruby2.2개 이상 이동하는 환경에서는 gem install generamba만 수행됩니다.

설치 확인

generambageneramba version가 명령을 실행하면 다음과 같이 출력할 수 있다.
➜  ~ generamba
Commands:
  generamba gen [MODULE_NAME] [TEMPLATE_NAME]  # Creates a new VIPER module with a given name from a s...
  generamba help [COMMAND]                     # Describe available commands or one specific command
  generamba setup                              # Creates a Rambafile with a config for a given project
  generamba template <command>                 # Provides a set of commands for working with templates
  generamba version                            # Prints out Generamba current version

➜  ~ generamba version
Version: 1.3.0
Release date: 05.10.2016
Change notes: https://github.com/rambler-digital-solutions/Generamba/releases/tag/1.3.0

간단한 How to


준비/환경

  • 프로젝트 생성

  • (옵션) Podfile
  • platform :ios, :deployment_target => "9.0"
    use_frameworks!
    
    def pods
        pod 'Alamofire', '~> 4.0.1'
        pod 'SwiftyJSON'
    end
    
    target 'sample-viper3' do
        pods
    end
    
    post_install do |installer|
        installer.pods_project.targets.each do |target|
            target.build_configurations.each do |config|
                config.build_settings['SWIFT_VERSION'] = '3.0'
            end
        end
    end
    
    

    generamba setup / generamba template install / generamba gen


    generamba의 setup부터 모델 제작까지 다 했습니다.

    1. generamba setup


    질문에 대답하면 돼.
    ➜  sample-viper4 git:(master) ✗ generamba setup
    The company name which will be used in the headers: ykeisuke
    The name of your project is sample-viper4. Do you want to use it? (yes/no) yes
    The project prefix (if any):
    The path to a .xcodeproj file of the project is 'sample-viper4.xcodeproj'. Do you want to use it? (yes/no) yes
    Select the appropriate target for adding your MODULES (type the index):
    0. sample-viper4
    1. sample-viper4Tests
    2. sample-viper4UITests
     0 👈僕は0って回答した
    Are you using unit-tests in this project? (yes/no) yes
    Select the appropriate target for adding your TESTS (type the index):
    0. sample-viper4
    1. sample-viper4Tests
    2. sample-viper4UITests
     1 👈僕は1って回答した
    Do you want to add all your modules by one path? (yes/no) yes
    Do you want to use the same paths for your files both in Xcode and the filesystem? (yes/no) yes
    The default path for creating new modules: /sample-viper4/modules
    The default path for creating tests: /sample-viper4/tests
    Are you using Cocoapods? (yes/no) yes
    The path to a Podfile is 'Podfile'. Do you want to use it? (yes/no) yes
    Are you using Carthage? (yes/no) no
    Do you want to add some well known templates to the Rambafile? (yes/no) yes 👈yesって答えること。
    
    +--------------------+----------------------------------------------------------------------------------+
    |                                      Summary for generamba setup                                      |
    +--------------------+----------------------------------------------------------------------------------+
    | company            | ykeisuke                                                                         |
    | project_name       | sample-viper4                                                                    |
    | prefix             |                                                                                  |
    | xcodeproj_path     | sample-viper4.xcodeproj                                                          |
    | podfile_path       | Podfile                                                                          |
    | templates          | ["{name: rviper_controller}", "{name: mvvm_controller}", "{name: swifty_viper}"] |
    | project_target     | sample-viper4                                                                    |
    | project_file_path  | /sample-viper4/modules                                                           |
    | project_group_path | /sample-viper4/modules                                                           |
    | test_target        | sample-viper4Tests                                                               |
    | test_file_path     | /sample-viper4/tests                                                             |
    | test_group_path    | /sample-viper4/tests                                                             |
    +--------------------+----------------------------------------------------------------------------------+
    
    Rambafile successfully created! Now run `generamba template install`.
    

    2. Template를 다운로드합니다.


    ☝마지막으로 말하려고 준비한 바와 같이 실행generamba template install하면 된다
    ➜  sample-viper4 git:(master) ✗ generamba template install
    Updating shared generamba-catalog specs...
    Installing rviper_controller...
    Installing mvvm_controller...
    Installing swifty_viper...
    

    3. 코드의 생성


    topViewController 등을 제작했다고 가정하고 실행했습니다.swifty_viper2.에 다운로드되었습니다.
    겸사겸사 스위프트 2.3을 다운받았기 때문에 짓기 전에 약간의 치료가 필요하다.
    ➜  sample-viper4 git:(master) ✗ generamba gen top swifty_viper
    
    +----------------+---------------------------+
    |            Summary for gen top             |
    +----------------+---------------------------+
    | Targets        | sample-viper4             |
    | Module path    | sample-viper4/modules/top |
    | Test targets   | sample-viper4Tests        |
    | Test file path | sample-viper4/tests/top   |
    | Template       | swifty_viper              |
    +----------------+---------------------------+
    
    Creating code files...
    Creating test files...
    Module successfully created!
    Name: top
    Project file path: sample-viper4/modules/top
    Project group path: sample-viper4/modules/top
    Test file path: sample-viper4/tests/top
    Test group path: sample-viper4/tests/top
    

    generate 이후: Main.Storyborad 수정

  • StoryBorad 추가
    View 폴더에 설정되어 있습니다.
  • Cusstom Class에서 설정topViewController
  • Top View Controller Scene에서 추가Object, Cusstom Class에서 설정topModuleInitializer

  • 시험을 준비하다


    저자 환경

  • Swift3.0
  • Xcode8.1
  • Zsh, ruby2.3, macOS Sierra, iTerm2
  • Generamba Version: 1.3.0/Release date: 05.10.2016
  • VIPER 관련 참고 자료

  • 다른 아키텍처와 단순 비교5 iOS Architectures in 5 minutes
  • VIPER 아키텍처 사용법iOS Project Architecture: Using VIPER
  • Architecting iOS Apps with VIPER
  • VIPER의 샘플 항목


  • Currency Converter
  • ☝추천 준비.코드의 양도 많지 않아 이해하기 쉽다.

  • RxSwift, Realm, Chart, Quick, Swinject 등의 샘플 항목 사용
    무식하니까 Xcode 8.순식간에 움직일 수 없음(: 3용)
  • Articles-iOS-VIPER
  • 최후


    두 달 전에 썼는데'Qita에 투고'한 줄 알고 초고만 보관했다.
    다른 기사 보고 공개한 것 같은데?그리고 지금까지 투고했다.
    Template만 준비하면 됩니다(☝준비하면swifty_viper 응용이 좋은 것 같아요.

    추기


    나는 이것을Generamba 이외의 선택으로 찾았다.
    https://github.com/infinum/iOS-VIPER-Xcode-Templates
    아이콘이 귀엽기 때문에 사람에 따라 사용해도 좋아요.나는 아직 쓸모가 없다.

    좋은 웹페이지 즐겨찾기