Swift開源項(xiàng)目-單糖

單糖——良品生活指南:家居零食、禮物美妝、海淘購物

感興趣的朋友可以去 app store 下載

iOS 版下載地址


說明
本程序僅供學(xué)習(xí)交流,不可用于任何商業(yè)用途。

說明

因?yàn)楣臼褂玫氖?Objective-C 開發(fā) app,沒有使用 swift 來開發(fā),所以決定自己研究 Swift,研究 Swift 的時間不長,對于 Swift 的基本語法有了大致的了解,但是對有些概念和語法還是理解的不深,所以決定模仿一些已經(jīng)發(fā)布的 app,一方面可以讓自己更好地理解和使用 Swift,另一方面可以和志同道合的人一起交流,共同進(jìn)步。

使用 Swift 模仿的第一個 app 是單糖,總體來說界面搭建還算簡單,而且結(jié)構(gòu)不是很復(fù)雜,本次項(xiàng)目完成了大部分界面,對于項(xiàng)目中的數(shù)據(jù)接口都是通過 Charles 抓包獲得,基本每個界面都是有數(shù)據(jù)請求,不會抓包的朋友可以看我 這一篇文章。

項(xiàng)目中有的地方代碼寫的不是很簡潔,畢竟自己能力有限,對 Swift 使用不是很熟練,還請各位朋友不喜勿噴。在本文的最后,有項(xiàng)目的完整源碼,喜歡的朋友可以下載下來,如果您感覺我寫的代碼對您有所幫助,還請?jiān)?github 給個 star,非常感謝您的支持!~

項(xiàng)目截圖

單糖
首頁
單品
單品詳情
攻略詳情
圖文介紹
評論
分享
分類
搜索
設(shè)置

項(xiàng)目環(huán)境

項(xiàng)目使用 cocoapods 來管理第三方庫,所以需要安裝 cocoapods,安裝方式網(wǎng)上有很多教程,這里不在詳述。運(yùn)行項(xiàng)目的前,請確保安裝了 cocoapods,否則可能會出現(xiàn)錯誤。

  • Xcode 8.2.1
  • Swift 3.0
  • iOS 8.0

使用到的第三方庫:

  • SwiftyJSON - 解析 JSON 數(shù)據(jù)
  • SnapKit - 設(shè)置約束
  • Kingfisher - 緩存圖片
  • SVProgressHUD - 提示框
  • FDFullscreenPopGesture - 側(cè)滑手勢
  • Alamofire - 網(wǎng)絡(luò)請求

項(xiàng)目結(jié)構(gòu)

項(xiàng)目結(jié)構(gòu)

由于剛接觸 Swift,以及對 MVVM 的理解的不深,所以沒有使用 MVVM 設(shè)計(jì)模式,項(xiàng)目使用傳統(tǒng)的 MVC 設(shè)計(jì)模式。

項(xiàng)目中只在首頁加入了下拉刷新功能,其他界面未加入上拉和下拉刷新功能,后面有時間會完善。

下面是項(xiàng)目的完整結(jié)構(gòu)

  • 首頁(單糖)
    • 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
  • 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
  • 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
  • Me(我)
    • Model
      • YMSetting.swift
    • View
      • YMMeChoiceView.swift
      • YMMeFooterView.swift
      • YMMineHeaderView.swift
      • YMSettingCell.swift
      • YMSettingCell.xib
    • Controller
      • YMMessageViewController.swift
      • YMMeViewController.swift
      • YMSettingViewController.swift
  • Login&Register(登錄和注冊)
    • Controller
      • YMLoginViewController.swift
      • YMLoginViewController.xib
      • YMRegisterViewController.swift
      • YMRegisterViewController.xib
      • YMNewfeatureViewController.swift
  • Main(主要)
    • Category
      • String+Extension.swift
      • UITableView+EmptyData.swift
      • UIView+Extension.swift
    • Controller
      • YMBaseViewController.swift
      • YMNavigationController.swift
      • YMTabBarController.swift
    • Tools
      • YMConst.swift
      • YMNetworkTool.swift

項(xiàng)目文檔和數(shù)據(jù)接口

抓取的數(shù)據(jù)接口請看 單糖數(shù)據(jù)接口單糖數(shù)據(jù)接口詳細(xì)數(shù)據(jù)。

下載項(xiàng)目之后,點(diǎn)擊此處,查看項(xiàng)目文檔 項(xiàng)目文檔 或者直接打開文件目錄 『docs/index.html』。

運(yùn)行項(xiàng)目出現(xiàn)的問題都可以給我留言或者直接加我的 QQ 聯(lián)系,我會盡快回復(fù)。

github下載地址

喜歡的朋友希望可以給個 Star,十分感謝您的支持!~

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 發(fā)現(xiàn) 關(guān)注 消息 iOS 第三方庫、插件、知名博客總結(jié) 作者大灰狼的小綿羊哥哥關(guān)注 2017.06.26 09:4...
    肇東周閱讀 15,688評論 4 61
  • 王寶強(qiáng)事件發(fā)生以后,奧運(yùn)運(yùn)也沒人看了,不明真相的吃瓜群眾天天等著寶寶的連載,所有流量都給了寶寶。僅兩天各路娛樂媒體...
    朗里格朗朗閱讀 510評論 0 0
  • #堅(jiān)持寫作30天# 7/30 如何保持親密感 今天很開心,老婆一起參加了馬拉松。在這次跑步之前,她自己也認(rèn)為,可能...
    崔雅君閱讀 370評論 0 1
  • 第8集 如果之前的人生毫無意義,或者并不是你真正期待的,我們也可以像姜哲一樣,作廢之前所有的記憶,讓一切歸零,重新...
    迷夏的小島閱讀 6,459評論 0 4
  • 上周末朋友結(jié)婚,我做她的伴娘,前一天晚上我們倆躺床上聊天,我問她有什么感覺,她說什么感覺都沒有。我笑了笑,我這個旁...
    凪柒閱讀 325評論 0 1

友情鏈接更多精彩內(nèi)容