Giter Site home page Giter Site logo

study_english's Introduction

英語学習アプリ

環境

iOS 14.5 以上
RxSwift 5.4.4
Alamofire 6.2.0

アーキテクチャ

MVVM

・ModelにAPIリクエストの機能を持せている。初期の問題データの取得はModelの初期化時に走る。
・Modelprotocolに準拠をして、ViewModelに公開したいプロパティ・メソッドのみをModelprotocolに定義する。
・APIから取得したデータはこのModel内でのみ値を変更したいので、大元であるBehaviorRelay()はprivate letで定義してViewModelには公開していない。
・Viewに伝播させるためにObservableの型に直してViewModel/Viewに公開する。
・ViewModelは、上記のModelのObservableをViewに流すとともに、Viewの操作によって状態が発生する場合、その値を保持する役割。
・今回でいうと問題に対して回答したときの選択肢を保持する。回答画面ではこの選択した回答をもとにViewに反映させる。
・ViewはModelから流れてきたObservableの値をViewコンポーネントにバインドしている。
・新たに問題をAPIから取得したときはViewに値がバインドされているので、自動で切り替わる。
・時間的制約でView側の実装がほとんどできていないが、回答ボタンなどの使い回しができそうなコンポーネントはカスタムで独自クラスを作っている。

動作確認

本リポジトリをクローン後、Xcodeでビルドをする。
実機で確認する場合、iPhoneの設定から、study_englishのApple Developerを信頼する設定を行う。

study_english's People

Contributors

takutoki avatar

Watchers

James Cloos avatar  avatar

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.