iOS-Viper-Architecture 项目教程

打印 上一主题 下一主题

主题 1114|帖子 1114|积分 3342

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

x
iOS-Viper-Architecture 项目教程

  iOS-Viper-ArchitectureThis repository contains a detailed sample app that implements VIPER architecture in iOS using libraries and frameworks like Alamofire, AlamofireImage, PKHUD, CoreData etc.项目地点:https://gitcode.com/gh_mirrors/ios/iOS-Viper-Architecture
1. 项目的目次结构及介绍

  1. iOS-Viper-Architecture/
  2. ├── Application/
  3. │   ├── AppDelegate.swift
  4. │   └── MainWireframe.swift
  5. ├── Modules/
  6. │   ├── Home/
  7. │   │   ├── Contracts/
  8. │   │   ├── Interactor/
  9. │   │   ├── Presenter/
  10. │   │   ├── Protocols/
  11. │   │   ├── Router/
  12. │   │   └── View/
  13. │   └── Detail/
  14. │       ├── Contracts/
  15. │       ├── Interactor/
  16. │       ├── Presenter/
  17. │       ├── Protocols/
  18. │       ├── Router/
  19. │       └── View/
  20. ├── Resources/
  21. │   ├── Assets.xcassets
  22. │   ├── Info.plist
  23. │   └── LaunchScreen.storyboard
  24. └── Supporting Files/
  25.     └── main.swift
复制代码
目次结构介绍



  • Application: 包罗应用的入口文件和主要配置文件。

    • AppDelegate.swift: 应用的入口和生命周期管理。
    • MainWireframe.swift: 应用的主要路由和初始化配置。

  • Modules: 包罗应用的主要功能模块,每个模块都遵照 VIPER 架构。

    • Home: 主页模块。
    • Detail: 详情页模块。

  • Resources: 包罗应用的资源文件。

    • Assets.xcassets: 图片和其他资源。
    • Info.plist: 应用的配置文件。
    • LaunchScreen.storyboard: 启动屏幕。

  • Supporting Files: 包罗应用的支持文件。

    • main.swift: 应用的启动文件。

2. 项目的启动文件介绍

main.swift

  1. import UIKit
  2. UIApplicationMain(
  3.     CommandLine.argc,
  4.     CommandLine.unsafeArgv,
  5.     nil,
  6.     NSStringFromClass(AppDelegate.self)
  7. )
复制代码
main.swift 是应用的启动文件,负责调用 UIApplicationMain 函数来启动应用,并指定 AppDelegate 作为应用的代理类。
3. 项目的配置文件介绍

Info.plist

Info.plist 是应用的配置文件,包罗应用的根本信息和配置项,例如应用的表现名称、版本号、权限设置等。
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3. <plist version="1.0">
  4. <dict>
  5.     <key>CFBundleDevelopmentRegion</key>
  6.     <string>en</string>
  7.     <key>CFBundleDisplayName</key>
  8.     <string>iOS-Viper-Architecture</string>
  9.     <key>CFBundleExecutable</key>
  10.     <string>$(EXECUTABLE_NAME)</string>
  11.     <key>CFBundleIdentifier</key>
  12.     <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
  13.     <key>CFBundleInfoDictionaryVersion</key>
  14.     <string>6.0</string>
  15.     <key>CFBundleName</key>
  16.     <string>$(PRODUCT_NAME)</string>
  17.     <key>CFBundlePackageType</key>
  18.     <string>APPL</string>
  19.     <key>CFBundleShortVersionString</key>
  20.     <string>1.0</string>
  21.     <key>CFBundleVersion</key>
  22.     <string>1</string>
  23.     <key>LSRequiresIPhoneOS</key>
  24.     <true/>
  25.     <key>UILaunchStoryboardName</key>
  26.     <string>LaunchScreen</string>
  27.     <key>UIMainStoryboardFile</key>
  28.     <string>Main</string>
  29.     <key>UIRequiredDeviceCapabilities</key>
  30.     <array>
  31.         <string>armv7</string>
  32.     </array>
  33.     <key>UISupportedInterfaceOrientations</key>
  34.     <array>
  35.         <string>UIInterfaceOrientationPortrait</string>
  36.         <string>UIInterfaceOrientationLandscapeLeft</string>
  37.         <string>UIInterfaceOrientationLandscapeRight</string>
  38.     </array>
  39.     <key>UISupportedInterfaceOrientations~ipad</key>
  40.     <array>
  41.         <string>UIInterfaceOrientationPort
复制代码
iOS-Viper-ArchitectureThis repository contains a detailed sample app that implements VIPER architecture in iOS using libraries and frameworks like Alamofire, AlamofireImage, PKHUD, CoreData etc.项目地点:https://gitcode.com/gh_mirrors/ios/iOS-Viper-Architecture

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

笑看天下无敌手

论坛元老
这个人很懒什么都没写!
快速回复 返回顶部 返回列表