Swift开源:ZhihuDailyPurify - 更纯净的知乎日报
MilEbsworth
8年前
<p>把之前写的小项目升级到了 Swift 3.0 版本, 升级过程中变更不大, 并引入 RxSwift 框架和 MVVM 模式, 重构了大部分代码. RxSwift 和 RxCocoa 结合一起用还是很爽的, 很大程度上优化了业务控制流程.</p> <h3>Getting Started</h3> <ul> <li>下载源码</li> </ul> <pre> <code class="language-swift">git clone https://github.com/huaf22/zhihuSwiftDemo.git</code></pre> <ul> <li>使用 pod 安装依赖</li> </ul> <pre> <code class="language-swift">pod install</code></pre> <ul> <li>使用 Xcode 打开 zhihuSwiftDemo.xcworkspace</li> </ul> <h3>实现的功能</h3> <ul> <li>首页左滑菜单界面</li> <li>文章详情界面</li> <li>文章详情界面上下切换的动画</li> <li>主题文章界面</li> </ul> <h3>运行效果</h3> <p style="text-align:center"><img src="https://simg.open-open.com/show/d271c600203260e21b49323be62a846f.png"></p> <p style="text-align:center">1.png</p> <p style="text-align:center"><img src="https://simg.open-open.com/show/ff91396d2671e7bbec5873049f58ba4e.png"></p> <p style="text-align:center">2.png</p> <p style="text-align:center"><img src="https://simg.open-open.com/show/111e3b698fb8e34d273a9a6824f98f16.png"></p> <p style="text-align:center">3.png</p> <p style="text-align:center"><img src="https://simg.open-open.com/show/3cc407f28cd3aa4cc8e0e6c910b49010.png"></p> <p style="text-align:center">4.png</p> <h3>代码结构</h3> <pre> <code class="language-swift">├── AppDelegate.swift ├── BCComponents │ ├── Article │ │ ├── View │ │ │ ├── WLYArticleChannelView.swift │ │ │ ├── WLYArticleDetailCell.swift │ │ │ ├── WLYArticleDetailCollectionView.swift │ │ │ ├── WLYArticleDetailRefreshView.swift │ │ │ ├── WLYArticleDetailToolBarView.swift │ │ │ ├── WLYArticleListView.swift │ │ │ ├── WLYArticleNavigationBar.swift │ │ │ └── WLYArticleTableViewCell.swift │ │ ├── WLYArticleChannelViewController.swift │ │ ├── WLYArticleDetailCollectionViewController.swift │ │ └── WLYArticleListViewController.swift │ └── Home │ ├── View │ │ ├── HomeSideMenuFooterView.swift │ │ └── HomeSideMenuHeaderView.swift │ └── WLYHomeMenuViewController.swift ├── Info.plist ├── LaunchScreen.storyboard ├── Library │ ├── ArticleHTMLParser.swift │ ├── Foundation │ │ ├── DispatchQueue+Extension.swift │ │ └── NotificationCenter+Extension.swift │ ├── HTTPManager.swift │ ├── UIKit │ │ ├── UIColor+WLYCommon.swift │ │ ├── UIColor+WLYExtension.swift │ │ ├── UIScrollView+WLYPanGestureAllowEventPass.swift │ │ └── UIView+WLYExtension.swift │ ├── URLArrayTransform.swift │ ├── Vendors │ └── WLYLog.swift ├── Main.storyboard ├── Models │ ├── WLYArticle.swift │ ├── WLYArticleDetail.swift │ ├── WLYArticleTheme.swift │ ├── WLYArticleThemeResult.swift │ ├── WLYDailyArticle.swift │ ├── WLYEditor.swift │ └── WLYThemeArticles.swift ├── Services │ ├── ArticleService.swift │ ├── BaseServiceAPI.swift │ └── WLYArticleCacheService.swift ├── ViewControllers │ ├── WLYSideMenuViewController.swift │ ├── WLYTableViewController.swift │ └── WLYViewController.swift └── Views ├── UIScrollView+WLYPullToRefresh.swift ├── WLYCollectionViewCell.swift ├── WLYHorizontalLayoutButton.swift ├── WLYPullToRefreshPlugin.swift ├── WLYPullToRefreshView.swift ├── WLYRefreshLoadingView.swift ├── WLYScrollImageView.swift ├── WLYTableViewCell.swift └── WLYVerticalLayoutButton.swift 13 directories, 50 files</code></pre> <h3>知乎日报 API</h3> <p><a href="/misc/goto?guid=4959642999273782513" rel="nofollow,noindex">izzyleung/ZhihuDailyPurify</a></p> <h3>使用的开源库</h3> <ul> <li><a href="/misc/goto?guid=4958968153529640282" rel="nofollow,noindex">SnapKit</a></li> <li><a href="/misc/goto?guid=4958872058774071441" rel="nofollow,noindex">Kingfisher</a></li> <li><a href="/misc/goto?guid=4958851213782329914" rel="nofollow,noindex">Alamofire</a></li> <li><a href="/misc/goto?guid=4959673672284525554" rel="nofollow,noindex">AlamofireObjectMapper</a></li> <li><a href="/misc/goto?guid=4958860518574469711" rel="nofollow,noindex">XCGLogger</a></li> <li><a href="/misc/goto?guid=4958968587190330028" rel="nofollow,noindex">RxSwift</a></li> </ul> <p> </p>