Giter Club home page Giter Club logo

swiftui-template's Introduction

iOS Template

SwiftUI+Combineのテンプレートプロジェクト

環境

  • Xcode 14
  • Swift 5.3

依存ツールの導入

Homebrew

SwiftLintとLicense-plistの管理にHomebrewを利用しています。環境構築の前にHomebrewを利用できるようにしてください。

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

プロジェクト構築

プロジェクトの生成とライブラリのダウンロードをする

$ make bootstrap 

Sample

ソースコード上のSampleがprefixのコードが該当します。 設計を元に作ってみたSampleになります。 AppCoordinator.swiftのCoordinatorは変更して、確認。

Sample

あらゆるInputを埋め込んでいます。

Sample Github

GitHub APIを叩いて、ユーザー一覧を表示する

test

設計

SwiftUI + MVVM + Clean Architectureで作成されています。以下詳細。

  • Datasource
    • APIs
      • リクエスト、レスポンスの構造体
      • 通信基盤はMoya(Alamofire)
      • Combine
    • Entities
      • サーバーないしはローカルDBなど扱う構造体
      • Decodable(サーバー) or Realm(ローカルDB)
    • Gateways
      • サーバーないしはローカルDBなど、アクセスクラス
      • Combine
  • Repositories
    • Domain LayerとのI/F
    • Datasource層(Gateway)から受け取ったEntityをUseCaseへ渡す
    • Combine
  • Domains
    • UseCases
      • 各種ユースケース
      • 必要に応じてRepositoryへデータ取得を要求
      • 必要に応じてTranslatorでデータをレイヤー加工
    • Translators
      • Data Layerで扱うデータ形式であるEntityを,Presentation Layerで扱うデータ形式であるDomain Modelへと(相互)変換する
    • Models
      • Domain Model構造体
  • Application
    • Presenters
      • ViewModel
        • Domain LayerとのI/F
        • 各種UIイベント等に対し,binding
        • 必要に応じてUseCaseを実行する
      • Coordinator
        • DI
      • Presenter
        • 遷移や画面間の管理
        • 画面上のイベントDelegate制御
      • View
        • SwiftUI

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.