{"id":13672628,"url":"https://github.com/Binlogo-Archive/iOS-Practice-Checklist","last_synced_at":"2025-04-27T22:32:31.413Z","repository":{"id":143698549,"uuid":"173584023","full_name":"Binlogo-Archive/iOS-Practice-Checklist","owner":"Binlogo-Archive","description":"iOS 精进与实践检查清单","archived":false,"fork":false,"pushed_at":"2020-03-17T09:42:26.000Z","size":22,"stargazers_count":95,"open_issues_count":0,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-26T12:44:34.619Z","etag":null,"topics":["best-practice","ios","ios-app","ios-swift"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Binlogo-Archive.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-03-03T14:15:56.000Z","updated_at":"2025-03-06T09:08:32.000Z","dependencies_parsed_at":"2023-06-14T12:00:32.894Z","dependency_job_id":null,"html_url":"https://github.com/Binlogo-Archive/iOS-Practice-Checklist","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Binlogo-Archive%2FiOS-Practice-Checklist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Binlogo-Archive%2FiOS-Practice-Checklist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Binlogo-Archive%2FiOS-Practice-Checklist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Binlogo-Archive%2FiOS-Practice-Checklist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Binlogo-Archive","download_url":"https://codeload.github.com/Binlogo-Archive/iOS-Practice-Checklist/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251219601,"owners_count":21554444,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["best-practice","ios","ios-app","ios-swift"],"created_at":"2024-08-02T09:01:42.208Z","updated_at":"2025-04-27T22:32:29.707Z","avatar_url":"https://github.com/Binlogo-Archive.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"# iOS 实践与精进检查清单\n\n\u003e 回顾即开始\n\n## 目录\n\n1. [开始项目](#开始项目)\n2. [实用公共库](#实用公共库)\n3. [架构](#架构)\n4. [数据储存](#数据储存)\n5. [资源](#资源)\n6. [编码规范](#编码规范)\n7. [安全性](#安全性)\n8. [诊断](#诊断)\n\n## 开始项目\n\n### Xcode\n\n- [ ] [Apple 帮助 - Xcode](https://help.apple.com/xcode/mac)\n- [ ] 自定义项目信息配置 - IDETemplateMacros.plist\n\n  - [帮助文档](https://help.apple.com/xcode/mac/9.0/index.html?localePath=en.lproj#/dev7fe737ce0)\n\n- [ ] 配置 Target\n\n### .gitignore\n\n- [ ] Git 添加 `.gitignore`: [Swift](https://github.com/github/gitignore/blob/master/Swift.gitignore) or [Objective-C](https://github.com/github/gitignore/blob/master/Objective-C.gitignore)\n\n  - [ ] 工具：[gitignore.io](https://gitignore.io/)\n\n### 依赖管理\n\n- [ ] CocoaPods [文档](https://guides.cocoapods.org/syntax/podfile.html)\n\n```shell\nsudo gem install cocoapods # 安装\npod init # 初始化创建 Podfile\npod install/update # 安装/更新依赖\n```\n\n- [ ] Carthage (Swift) [文档](https://github.com/Carthage/Carthage#quick-start)\n\n```shell\nbrew install carthage # 安装\ncarthage bootstrap/update # 安装或更新依赖\n```\n\n### 工程目录结构\n\n- [ ] 规范化命名\n- [ ] 熟悉并保持合理的目录结构\n\n```\nAwesomeProject\n├─ Assets\n│    ├─ Info.Plist\n│    ├─ Localizable.strings\n│    ├─ R.generated.swift # 可选，R.swift 生成\n│    ├─ LaunchScreen.storyboard\n│    ├─ Assets.xcassets\n│    ├─ ProjectName.entitlements\n│    ├─ BuildConfigs\n│    └─ ···\n├─Sources\n│    ├─ Modules\n│   ├─ MyModule\n│   │   │   ├─ Models\n│   │   │   ├─ Views\n│   │   │   └─ Controllers (or ViewModels)\n│   │    └─ ···\n│   ├─ Stores\n│   ├─ Helpers\n│   ├─ Utilities\n│   ├─ Extentsions\n│   ├─ Mediator\n│   ├─ Ventors\n│   └─ ···\n├─Tests\n└─ ···\n```\n\n- [ ] 字符串本地化（Localization）\n\n  - [ ] [WWDC 404 - New Localization Workflows in Xcode 10](https://developer.apple.com/videos/play/wwdc2018/404/)\n  - [ ] [WWDC 401 - Localizing with Xcode 9](https://developer.apple.com/videos/play/wwdc2017/401)\n  - [ ] [WWDC 201 - Internationalization Best Practices](https://developer.apple.com/videos/play/wwdc2016/201)\n\n- [ ] 最小化常量作用域（Constants）\n\n```swift\n// 全局常量建议采用 Enum 定义\nenum Constants {\n    static let myConstant = \"Just a constant\"\n}\nenum Apprearance {\n    enum Sizes {\n        static let gutter: CGFloat = 15\n        static let cardGutter: CGFloat = 8\n        ···\n    }\n    enum Color {\n        static let primaryColor = UIColor(red: 0.22, green: 0.58, blue: 0.29, alpha: 1.0)\n        static let secondaryColor = UIColor.lightGray\n        static let background = UIColor.white\n\n        enum Red {\n               // 可视化颜色\n            static let medium = #colorLiteral(red: 0.22, green: 0.58, blue: 0.29, alpha: 1.0)\n            static let light = #colorLiteral(red: 0.22, green: 0.58, blue: 0.29, alpha: 1.0)\n        }\n    }\n}\n```\n\n- [ ] Git 分支模型\n\n  - [ ] [git-flow 的工作流 - Tower](https://www.git-tower.com/learn/git/ebook/cn/command-line/advanced-topics/git-flow)\n  - [ ] [gitflow-avh 拓展](https://github.com/petervanderdoes/gitflow-avh)\n\n## 实用公共库\n\n- [ ] [Alamofire](https://github.com/Alamofire/Alamofire) 网络库\n- [ ] [Moya](https://github.com/Moya/Moya) 基于 Alamofire 封装的网络抽象层\n- [ ] [Reachability.swift](https://github.com/ashleymills/Reachability.swift) 用于网络状况检查\n- [ ] [R.swift](https://github.com/mac-cain13/R.swift) 自动将各种资源强类型化\n- [ ] [SwiftDate](https://github.com/malcommac/SwiftDate)/[DateTool](https://github.com/MatthewYork/DateTools) 时间日期处理库\n- [ ] [RxSwift](https://github.com/ReactiveX/RxSwift) 响应式编程框架 by [ReactiveX.io](http://reactivex.io/)\n- [ ] [LayoutKit](https://github.com/linkedin/LayoutKit) 高性能视图布局库\n- [ ] [Kingfisher](https://github.com/onevcat/Kingfisher) 轻量级图片下载缓存库\n- [ ] [NSLogger](https://github.com/fpillet/NSLogger) 便捷日志工具\n- [ ] [Willow](https://github.com/Nike-Inc/Willow) 轻量级日志工具 [教程](https://medium.com/joshtastic-blog/convenient-logging-in-swift-75e1adf6ba7c)\n- [ ] [FLEX](https://github.com/Flipboard/FLEX)/[DoraemonKit](https://github.com/didi/DoraemonKit) 应用内 Debug 工具库\n- [ ] Keychain 便捷封装库\n\n  - [KeychainAccess](https://github.com/kishikawakatsumi/KeychainAccess)\n  - [Valet](https://github.com/square/Valet) by _Square, Inc._\n\n## 架构\n\n- [ ] [Model-View-Controller (MVC) in iOS: A Modern Approach](https://www.raywenderlich.com/1073-model-view-controller-mvc-in-ios-a-modern-approach)\n- [ ] [Introduction to MVVM](https://www.objc.io/issues/13-architecture/mvvm/)\n- [ ] [MVVM with Coordinators and RxSwift](https://academy.realm.io/posts/mobilization-lukasz-mroz-mvvm-coordinators-rxswift/)\n- [ ] [ReactiveCocoa and MVVM, an Introduction](http://www.sprynthesis.com/2014/12/06/reactivecocoa-mvvm-introduction/)\n\n### Model\n\n- [ ] 保持 Model 不可变性, `struct` + `Codable` [Apple 文档](https://developer.apple.com/documentation/foundation/archives_and_serialization/encoding_and_decoding_custom_types)\n- [ ] [SwiftyJSON](https://github.com/SwiftyJSON/SwiftyJSON) / [Argo](https://github.com/thoughtbot/Argo) [可选]\n\n### Views\n\n- [ ] 采用 AutoLayout 布局\n\n  - [ ] [Apple 文档 - NSLayoutAnchor](https://developer.apple.com/documentation/uikit/nslayoutanchor)\n  - [ ] [WWDC 220 - High Performance Auto Layout](https://developer.apple.com/videos/play/wwdc2018/220)\n  - [ ] [WWDC 218 - Mysteries of Auto Layout, Part 1](https://developer.apple.com/videos/play/wwdc2015/218)\n  - [ ] [WWDC 219 - Mysteries of Auto Layout, Part 2](https://developer.apple.com/videos/play/wwdc2015/219)\n\n### Controllers\n\n- [ ] 避免控制器臃肿\n\n  - [ ] [8 Patterns to Help You Destroy Massive View Controller](http://khanlou.com/2014/09/8-patterns-to-help-you-destroy-massive-view-controller/)\n\n- [ ] 尽量采用依赖注入而不是单例\n\n```swift\nlet fooViewController = FooViewController(withViewModel: fooViewModel)\n```\n\n## 设计模式\n\n- [ ] 设计模式 Swift 示例 [英文原文](https://github.com/ochococo/Design-Patterns-In-Swift) [中文翻译](https://github.com/Binlogo/Design-Patterns-In-Swift-CN)\n\n## 数据储存\n\n- [ ] 避免\"回调地狱\"（callback hell）\n- [ ] [RxSwift](https://github.com/ReactiveX/RxSwift) 异步响应式编程\n\n```swift\nfunc fetchGigs(for artist: Artist) -\u003e Observable\u003c[Gig]\u003e {\n    // ...\n}\n```\n\n- [ ] CoreData 持久化\n\n  - [ ] [Apple 文档 - Core Data](https://developer.apple.com/documentation/coredata)\n  - [ ] [WWDC 224 - Core Data Best Practices](https://developer.apple.com/videos/play/wwdc2018/224/)\n\n## 资源\n\n- [ ] 采用 `.pdf` 矢量图\n- [ ] [R.swift](https://github.com/mac-cain13/R.swift) 自动集中管理图片、xib、字符串等各项资源\n- [ ] [ImageOptim](https://imageoptim.com/mac) 图片优化\n\n## 编码规范\n\n- [ ] [API Design Guidelines for Swift](https://swift.org/documentation/api-design-guidelines/)\n- [ ] [LinkedIn's Official Swift Style Guide](https://github.com/linkedin/swift-style-guide)\n\n- [ ] `//MARK:` + `Extension`分组结构化代码\n\n```swift\nimport SomeExternalFramework\n\nclass FooViewController : UIViewController {\n\n    let foo: Foo\n\n    private let fooStringConstant = \"FooConstant\"\n    private let floatConstant = 1234.5\n\n    // MARK: Lifecycle\n\n    // Custom initializers go here\n    ···\n}\n\n// MARK: View Lifecycle\nextension FooViewController {\n\n    override func viewDidLoad() {\n        super.viewDidLoad()\n        // ...\n    }\n\n}\n\n// MARK: Layout\nextension FooViewController {\n\n    private func makeViewConstraints() {\n        // ...\n    }\n\n}\n\n// MARK: User Interaction\nextension FooViewController {\n\n    func foobarButtonTapped() {\n        // ...\n    }\n\n}\n\n// MARK: FoobarDelegate\nextension FooViewController: FoobarDelegate {\n\n    func foobar(foobar: Foobar, didSomethingWithFoo foo: Foo) {\n        // ...\n    }\n\n}\n\n// MARK: Helpers\nextension FooViewController {\n\n    private func displayNameForFoo(foo: Foo) {\n        // ...\n    }\n\n}\n```\n\n## 安全性\n\n- [ ] [Apple 文档 - iOS Security Guide](https://www.apple.com/business/site/docs/iOS_Security_Guide.pdf)\n\n### 数据储存\n\n- [ ] Token、用户名密码及部分隐私敏感数据避免采用 `UserDefault` 或 `CoreData` 等非加密持久化方式\n- [ ] 采用 `KeyChain` 加密储存敏感数据\n\n  - [ ] [Apple 文档 - Storing Keys in the Keychain](https://developer.apple.com/documentation/security/certificate_key_and_trust_services/keys/storing_keys_in_the_keychain)\n  - [ ] [KeychainAccess](https://github.com/kishikawakatsumi/KeychainAccess)\n\n### 网络\n\n- [ ] 采用 `https` TLS 加密传输\n\n### 日志采集\n\n- [ ] 设置正确的日志输出等级\n- [ ] 线上环境**一定**不要打印密码等敏感信息\n- [ ] 记录基本代码控制流，以便调试\n\n### 用户交互\n\n- [ ] `UITextField` 用于密码等敏感信息输入时设置`secureTextEntry` 为 `true`\n- [ ] 必要时清空剪贴板等可能存在的敏感数据\n\n  - [ ] `applicationDidEnterBackground`\n\n## 诊断\n\n- [ ] 重视并尽量解决编译器警告\n- [ ] 静态分析\n\n  - [ ] _Product → Analyze_\n\n- [ ] 调试\n\n  - [ ] 开启 `Exception` 断点\n  - [ ] [Reveal](http://revealapp.com/) 视图调试\n\n- [ ] 性能剖析\n\n  - [ ] [Apple 帮助 - Instruments](https://help.apple.com/instruments/mac)\n\n## 开发社区\n\n\u003e 借助社区的力量，并积极融入社区，贡献自己的力量\n\n### 课程网站\n\n- [Ray Wenderlich](https://www.raywenderlich.com/)\n- [nshipster.com](https://nshipster.com/)\n- [objc.io](https://www.objc.io/blog/)\n- [AppCoda](https://www.appcoda.com/)\n- [pointfree.co](https://www.pointfree.co/)\n\n### 博客\n\n- [Paul Hudson](https://hackingwithswift.com/)\n- [John Sundell](https://www.swiftbysundell.com/)\n- [Antoine van der Lee](https://www.avanderlee.com/)\n- [Vadim Bulavin](https://www.vadimbulavin.com/)\n- [Keith Harrison](https://useyourloaf.com/)\n- [Majid Jabrayilov](https://swiftwithmajid.com/)\n- [Bart Jacobs](https://cocoacasts.com/)\n- [Soroush Khanlou](http://khanlou.com/)\n- [Erica Sadun](https://ericasadun.com/)\n- [Andrew Bancroft](https://www.andrewcbancroft.com/)\n\n### 订阅\n\n- [iOS Goodies](http://ios-goodies.com/)\n- [iOS Dev Weekly](https://iosdevweekly.com/)\n- [Swift Developments](https://andybargh.com/swiftdevelopments/)\n- [Indie iOS focus weekly](http://indieiosfocus.com/)\n\n### 播客\n\n- [iOS Dev Discussions](https://podcasts.apple.com/us/podcast/ios-dev-discussions-sean-allen/id1426167395)\n- [Swift over Coffee](https://podcasts.apple.com/us/podcast/swift-over-coffee/id1435076502)\n- [Swift by Sundell](https://swiftbysundell.com/podcast/)\n- [iPhreaks](https://devchat.tv/iphreaks/)\n\n### 开发者\n\n- [Genius-Track](https://github.com/Binlogo/Genius-Track)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBinlogo-Archive%2FiOS-Practice-Checklist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBinlogo-Archive%2FiOS-Practice-Checklist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBinlogo-Archive%2FiOS-Practice-Checklist/lists"}