Swift开源项目-单糖
单糖——良品生活指南:家居零食、礼物美妆、海淘购物
感兴趣的朋友可以去 app store 下载
iOS 版下载地址
说明
本程序仅供学习交流,不可用于任何商业用途。
说明
因为公司使用的是 Objective-C 开发 app,没有使用 swift 来开发,所以决定自己研究 Swift,研究 Swift 的时间不长,对于 Swift 的基本语法有了大致的了解,但是对有些概念和语法还是理解的不深,所以决定模仿一些已经发布的 app,一方面可以让自己更好地理解和使用 Swift,另一方面可以和志同道合的人一起交流,共同进步。
使用 Swift 模仿的第一个 app 是单糖,总体来说界面搭建还算简单,而且结构不是很复杂,本次项目完成了大部分界面,对于项目中的数据接口都是通过 Charles 抓包获得,基本每个界面都是有数据请求,不会抓包的朋友可以看我 这一篇文章。
项目中有的地方代码写的不是很简洁,毕竟自己能力有限,对 Swift 使用不是很熟练,还请各位朋友不喜勿喷。在本文的最后,有项目的完整源码,喜欢的朋友可以下载下来,如果您感觉我写的代码对您有所帮助,还请在 github 给个 star,非常感谢您的支持!~
项目截图

单糖

首页

单品

单品详情

攻略详情

图文介绍

评论

分享

分类

搜索

我

设置
项目环境
项目使用 cocoapods 来管理第三方库,所以需要安装 cocoapods,安装方式网上有很多教程,这里不在详述。运行项目的前,请确保安装了 cocoapods,否则可能会出现错误。
- Xcode 8.2.1
- Swift 3.0
- iOS 8.0
使用到的第三方库:
- SwiftyJSON – 解析 JSON 数据
- SnapKit – 设置约束
- Kingfisher – 缓存图片
- SVProgressHUD – 提示框
- FDFullscreenPopGesture – 侧滑手势
- Alamofire – 网络请求
项目结构

项目结构
由于刚接触 Swift,以及对 MVVM 的理解的不深,所以没有使用 MVVM 设计模式,项目使用传统的 MVC 设计模式。
项目中只在首页加入了下拉刷新功能,其他界面未加入上拉和下拉刷新功能,后面有时间会完善。
下面是项目的完整结构
- 首页(单糖)
- Model
- YMChannel.swift
- YMHomeItem.swift
- YMSearchResult.swift
- View
- YMHomeCell.swift
- YMHomeCell.xib
- YMRefreshControl.swift
- YMRefreshView.swift
- YMRefreshView.xib
- YMSearchRecordView.swift
- YMSortCell.swift
- YMSortCell.xib
- YMSortTableView.swift
- Controller
- YMDanTangViewController.swift
- YMTopicViewController.swift
- YMDetailViewController.swift
- YMSearchViewController.swift
- Model
- Product(单品)
- Model
- YMProduct.swift
- YMProductDetail.swift
- YMComment.swift
- 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
- Controller
- YMProductViewController.swift
- YMProductDetailViewController.swift
- YMTMALLViewController.swift
- YMTMALLViewController.xib
- Model
- Classify(分类)
- Model
- YMCollection.swift
- YMCollectionPost.swift
- YMGroup.swift
- View
- YMCategoryBottomView.swift
- YMCategoryCollectionViewCell.swift
- YMCategoryCollectionViewCell.xib
- YMCollectionTableViewCell.swift
- YMCollectionTableViewCell.xib
- YMSeeAllTopicCell.swift
- YMSeeAllTopicCell.xib
- YMTopHeaderView.swift
- YMTopHeaderView.xib
- YMVerticalButton.swift
- Controller
- YMCategoryHeaderViewController.swift
- YMCategoryViewController.swift
- YMCollectionDetailController.swift
- YMCollectionDetailController.xib
- YMPostDetailViewController.swift
- YMPostDetailViewController.xib
- YMSeeAllController.swift
- YMSeeAllController.xib
- Model
- Me(我)
- Model
- YMSetting.swift
- View
- YMMeChoiceView.swift
- YMMeFooterView.swift
- YMMineHeaderView.swift
- YMSettingCell.swift
- YMSettingCell.xib
- Controller
- YMMessageViewController.swift
- YMMeViewController.swift
- YMSettingViewController.swift
- Model
- Login&Register(登录和注册)
- Controller
- YMLoginViewController.swift
- YMLoginViewController.xib
- YMRegisterViewController.swift
- YMRegisterViewController.xib
- YMNewfeatureViewController.swift
- Controller
- Main(主要)
- Category
- String+Extension.swift
- UITableView+EmptyData.swift
- UIView+Extension.swift
- Controller
- YMBaseViewController.swift
- YMNavigationController.swift
- YMTabBarController.swift
- Tools
- YMConst.swift
- YMNetworkTool.swift
- Category
项目文档和数据接口
抓取的数据接口请看 单糖数据接口 和 单糖数据接口详细数据。
下载项目之后,点击此处,查看项目文档 项目文档 或者直接打开文件目录 『docs/index.html』。
运行项目出现的问题都可以给我留言或者直接加我的 QQ 联系,我会尽快回复。
github下载地址
喜欢的朋友希望可以给个 Star,十分感谢您的支持!~
转载请注明:SuperIT » Swift开源项目-单糖