swift -高仿单糖app

前端之家收集整理的这篇文章主要介绍了swift -高仿单糖app前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

单糖——良品生活指南:家居零食、礼物美妆、海淘购物

感兴趣的朋友可以去 app store 下载

iOS 版下载地址


说明
本程序仅供学习交流,不可用于任何商业用途。

说明

因为公司使用的是 Objective-C 开发 app,没有使用 swift 来开发,所以决定自己研究 Swift,研究 Swift 的时间不长,对于 Swift 的基本语法有了大致的了解,但是对有些概念和语法还是理解的不深,所以决定模仿一些已经发布的 app,一方面可以让自己更好地理解和使用 Swift,另一方面可以和志同道合的人一起交流,共同进步。

使用 Swift 模仿的第一个 app 是单糖,总体来说界面搭建还算简单,而且结构不是很复杂,本次项目完成了大部分界面,对于项目中的数据接口都是通过 Charles 抓包获得,基本每个界面都是有数据请求,不会抓包的朋友可以看我 这一篇文章

项目中有的地方代码写的不是很简洁,毕竟自己能力有限,对 Swift 使用不是很熟练,还请各位朋友不喜勿喷。在本文的最后,有项目的完整源码,喜欢的朋友可以下载下来,如果您感觉我写的代码对您有所帮助,还请在 github 给个 star,非常感谢您的支持!~

项目截图

项目环境

项目使用 cocoapods 来管理第三方库,所以需要安装 cocoapods,安装方式网上有很多教程,这里不在详述。

  • Xcode 7.3.1
  • Swift 2.2
  • iOS 8.0
  • @H_403_34@

    使用到的第三方库:

    • SwiftyJSON - 解析 JSON 数据
    • SnapKit - 设置约束
    • Kingfisher - 缓存图片
    • SVProgressHUD - 提示
    • FDFullscreenPopGesture - 侧滑手势
    • Alamofire - 网络请求
    • @H_403_34@

      项目结构

      由于刚接触 Swift,以及对 MVVM 的理解的不深,所以没有使用 MVVM 设计模式,项目使用传统的 MVC 设计模式。

      下面是项目的完整结构

      • 首页(单糖)
        • Model
          • YMChannel.swift
          • YMHomeItem.swift
          • YMSearchResult.swift
          • @H_403_34@
          • View
            • YMHomeCell.swift
            • YMHomeCell.xib
            • YMRefreshControl.swift
            • YMRefreshView.swift
            • YMRefreshView.xib
            • YMSearchRecordView.swift
            • YMSortCell.swift
            • YMSortCell.xib
            • YMSortTableView.swift
            • @H_403_34@
            • Controller
              • YMDanTangViewController.swift
              • YMTopicViewController.swift
              • YMDetailViewController.swift
              • YMSearchViewController.swift
              • @H_403_34@ @H_403_34@
              • Product(单品)
                • Model
                  • YMProduct.swift
                  • YMProductDetail.swift
                  • YMComment.swift
                  • @H_403_34@
                  • View
                    • YMActionSheet.swift
                    • YMCollectionViewCell.swift
                    • YMCollectionViewCell.xib
                    • YMDetailChoiceButtonView.swift
                    • YMDetailChoiceButtonView.xib
                    • YMDetailCollectionViewCell.swift
                    • YMDetailCollectionViewCell.xib
                    • YMProductDetailBottomView.swift
                    • YMProductDetailToolBar.swift
                    • YMProductDetailToolBar.xib
                    • YMProductDetailTopView.swift
                    • YMShareButtonView.swift
                    • YMDetailScrollView.swift
                    • YMCommentCell.swift
                    • YMCommentCell.xib
                    • @H_403_34@
                    • Controller
                      • YMProductViewController.swift
                      • YMProductDetailViewController.swift
                      • YMTMALLViewController.swift
                      • YMTMALLViewController.xib
                      • @H_403_34@ @H_403_34@
                      • Classify(分类
                        • Model
                          • YMCollection.swift
                          • YMCollectionPost.swift
                          • YMGroup.swift
                          • @H_403_34@
                          • View
                            • YMCategoryBottomView.swift
                            • YMCategoryCollectionViewCell.swift
                            • YMCategoryCollectionViewCell.xib
                            • YMCollectionTableViewCell.swift
                            • YMCollectionTableViewCell.xib
                            • YMSeeAllTopicCell.swift
                            • YMSeeAllTopicCell.xib
                            • YMTopHeaderView.swift
                            • YMTopHeaderView.xib
                            • YMVerticalButton.swift
                            • @H_403_34@
                            • Controller
                              • YMCategoryHeaderViewController.swift
                              • YMCategoryViewController.swift
                              • YMCollectionDetailController.swift
                              • YMCollectionDetailController.xib
                              • YMPostDetailViewController.swift
                              • YMPostDetailViewController.xib
                              • YMSeeAllController.swift
                              • YMSeeAllController.xib
                              • @H_403_34@ @H_403_34@
                              • Me(我)
                                • Model
                                  • YMSetting.swift
                                  • @H_403_34@
                                  • View
                                    • YMMeChoiceView.swift
                                    • YMMeFooterView.swift
                                    • YMMineHeaderView.swift
                                    • YMSettingCell.swift
                                    • YMSettingCell.xib
                                    • @H_403_34@
                                    • Controller
                                      • YMMessageViewController.swift
                                      • YMMeViewController.swift
                                      • YMSettingViewController.swift
                                      • @H_403_34@ @H_403_34@
                                      • Login&Register(登录注册
                                        • Controller
                                          • YMLoginViewController.swift
                                          • YMLoginViewController.xib
                                          • YMRegisterViewController.swift
                                          • YMRegisterViewController.xib
                                          • YMNewfeatureViewController.swift
                                          • @H_403_34@ @H_403_34@
                                          • Main(主要)
                                            • Category
                                              • String+Extension.swift
                                              • UITableView+EmptyData.swift
                                              • UIView+Extension.swift
                                              • @H_403_34@
                                              • Controller
                                                • YMBaseViewController.swift
                                                • YMNavigationController.swift
                                                • YMTabBarController.swift
                                                • @H_403_34@
                                                • Tools

猜你在找的Swift相关文章