Giter VIP home page Giter VIP logo

iostemplateproject's Introduction

iOSTemplateProject

1. Thông tin:

  • Template cho dự án iOS
  • Mô hình: MVC
  • Ngôn ngữ: Swift 3.x
  • Hệ điều hành: iOS 8.0 trở lên

2. Thư viện:

2.1. Quản lý:

  • Cocoapods: nên dùng
  • Carthage

2.2. Các thư viện nên dùng:

  • Alamofire: networking
  • ObjectMapper: parse JSON cho các model
  • PromiseKit: đơn giản hóa việc sử dụng cho các hàm async
  • Swinject: áp dụng pattern Dependency Injection
  • MagicalRecord: hỗ trợ cho Core Data
  • MBProgressHUD: hiển thị loading indicator

3. Cấu trúc dự án:

Entensions:

Thư mục chứa các extension.

Models:

Thư mục chứa Core Data entity, các class DTO. Nên dùng Mapper để map giữa entity và DTO.

class EntityMapper {
func map(from product: Product, to entity: ProductEntity) {
entity.id = product.id
entity.name = product.name
entity.price = product.price
}

func product(from entity: ProductEntity) -> Product {
return Product(id: entity.id ?? "",
name: entity.name ?? "",
price: entity.price)
}
}

Repositories:

Các class CRUD tương tác với database.

class ProductRepository {
func add(_ product: Product) {

}

func all() -> [Product] {
return []
}
}

Services:

Thư mục chứa các service về API và business logic của app. Nên chia mỗi service và các file liên quan ra 1 folder riêng.

class APIService {

}
protocol ProductServiceProtocol {
func add(_ product: Product)
}


class ProductService: ProductServiceProtocol {
let productRepository: ProductRepository

init(productRepository: ProductRepository) {
self.productRepository = productRepository
}

func add(_ product: Product) {

}
}

Views:

Thư mục chứa các storyboard, view controller và view. Nên chia mỗi chức năng ra 1 folder để dễ quản lý.

Libararies:

Chứa các thư viện ngoài cocoapods, carthage. Đây là các thư viện cần customize thư viện gốc.

Resources:

Chứa các file data, resource như các file html, xml, ảnh, video ...

iostemplateproject's People

Contributors

tuan188 avatar

Watchers

James Cloos avatar  avatar

Forkers

dungkv-1044

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.