Skip to content

WithoutEvil/iOS-Architecture

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

iOS架构

目录

代码规范

项目架构(MVC)

1. Model

目前项目所用框架:JSONModel, 类似框架:Mantle

2. View

代码编写UI所用AutoLayout库: Masonry

特点

  1. 优势:可以设置约束优先级
  2. chain式语法
  3. update、remake约束
  4. 也有swift版本项目SnapKit

项目早期也使用过PureLayout,但和Masonry相比,虽然语法工整了一些,但是还是毫无置疑地使用Masonry

工具

1. Git

1. Git学习:

2. Git Team

引用第三方开源项目

###1. submodule 引用第三方开源项目的一种方式

如何checkout相关的submodule的代码

checkout submodule project source:

  1. git submodule init: initialize your local configuration file

  2. git submodule update: fetch all the data and check out the appropriate commit listed in your superproject

add an existing Git repository as a submodule of the repository that we’re working on

  1. git submodule add https://github.com/demo/demo

摘自: https://git-scm.com/book/en/v2/Git-Tools-Submodules

###2. cocoapods 引用第三方开源项目的一种方式

Search for pods (above). Then list the dependencies in a text file named Podfile in your Xcode project directory:

platform :ios, '8.0'
use_frameworks!

target 'MyApp' do
  pod 'AFNetworking', '~> 2.6'
  pod 'ORStackView', '~> 3.0'
  pod 'SwiftyJSON', '~> 2.3'
end

Tip: CocoaPods provides a pod init command to create a Podfile with smart defaults.
####1. Now you can install the dependencies in your project:

$ pod install

####2. Make sure to always open the Xcode workspace instead of the project file when building your project:

$ open App.xcworkspace

####3. Now you can import your dependencies e.g.:

Now you can import your dependencies e.g.:

摘自: https://cocoapods.org/GET STARTED

我们将Pods目录加入版本控制

最后我们鼓励使用优秀的第三方开源项目,但如果对第三方开源项目不了解,原理没搞懂,除非是公认的优秀开源项目,否则禁止在项目中使用

###3. Carthage 引用第三方开源项目的一种方式

Carthage is a decentralized dependency manager for Cocoa application.

To integrate Demo with Carthage, add this to your Cartfile:

git "git@demo.com:iOS/Demo.git" ~> 0.1.2

Run carthage update to build the framework and drag the built Demo.framework into your Xcode project (as well as embed it in your target if necessary).

深入研究文档

无论你学习哪些方面的新知识,你真的需要深入学习他们的文档从而以它正确的方式来使用它。人们往往不做功课就过快地或错误地采取某种解决方案,从而陷入非常被动的局面。

License

iOS-Architecture is released under the MIT license. See LICENSE for details.

About

项目中所用的架构

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published