News-YC---iPhone

所属分类:iPhone/iOS
开发工具:Swift
文件大小:0KB
下载次数:0
上传日期:2015-08-04 14:03:43
上 传 者sh-1993
说明:  iPhone版本的News YC,一款黑客新闻阅读器和交互式iOS应用程序。
(The iPhone version of News YC, a Hacker News reader and interactive iOS application.)

文件列表:
HN.xcodeproj/ (0, 2015-04-20)
HN.xcodeproj/project.pbxproj (46256, 2015-04-20)
HN.xcodeproj/project.xcworkspace/ (0, 2015-04-20)
HN.xcodeproj/project.xcworkspace/contents.xcworkspacedata (147, 2015-04-20)
HN.xcworkspace/ (0, 2015-04-20)
HN.xcworkspace/contents.xcworkspacedata (220, 2015-04-20)
HN/ (0, 2015-04-20)
HN/AppDelegate.swift (3270, 2015-04-20)
HN/Controllers/ (0, 2015-04-20)
HN/Controllers/HNCommentsViewController.swift (8497, 2015-04-20)
HN/Controllers/HNCommentsViewController.xib (2814, 2015-04-20)
HN/Controllers/HNNavigationViewController.swift (6708, 2015-04-20)
HN/Controllers/HNNavigationViewController.xib (3915, 2015-04-20)
HN/Controllers/HNPostsViewController.swift (8206, 2015-04-20)
HN/Controllers/HNPostsViewController.xib (3244, 2015-04-20)
HN/Controllers/HNSubmissionViewController.swift (7927, 2015-04-20)
HN/Controllers/HNWebViewController.swift (4886, 2015-04-20)
HN/Controllers/HNWebViewController.xib (8916, 2015-04-20)
HN/CustomViews/ (0, 2015-04-20)
HN/CustomViews/Cells/ (0, 2015-04-20)
HN/CustomViews/Cells/Comments/ (0, 2015-04-20)
HN/CustomViews/Cells/Comments/HNCommentCell.swift (6791, 2015-04-20)
HN/CustomViews/Cells/Comments/HNCommentCell.xib (9186, 2015-04-20)
HN/CustomViews/Cells/Navigation/ (0, 2015-04-20)
HN/CustomViews/Cells/Navigation/HNNavCreditsTableViewCell.swift (1699, 2015-04-20)
HN/CustomViews/Cells/Navigation/HNNavCreditsTableViewCell.xib (10204, 2015-04-20)
HN/CustomViews/Cells/Navigation/HNNavFilterTableViewCell.swift (1268, 2015-04-20)
HN/CustomViews/Cells/Navigation/HNNavLoginTableViewCell.swift (1933, 2015-04-20)
HN/CustomViews/Cells/Navigation/HNNavProfileTableViewCell.swift (1370, 2015-04-20)
HN/CustomViews/Cells/Navigation/HNNavSettingsTableViewCell.swift (1504, 2015-04-20)
HN/CustomViews/Cells/Navigation/HNNavSettingsTableViewCell.xib (6260, 2015-04-20)
HN/CustomViews/Cells/Navigation/HNNavTableHeader.swift (721, 2015-04-20)
HN/CustomViews/Cells/Navigation/HNNavThemeTableViewCell.swift (1307, 2015-04-20)
HN/CustomViews/Cells/Posts/ (0, 2015-04-20)
HN/CustomViews/Cells/Posts/HNPostsCollectionCell.swift (4779, 2015-04-20)
HN/CustomViews/Cells/Posts/HNPostsCollectionCell.xib (9537, 2015-04-20)
HN/CustomViews/Launch Screen/ (0, 2015-04-20)
HN/CustomViews/Launch Screen/HNLaunchScreen.xib (2290, 2015-04-20)
HN/CustomViews/Menu/ (0, 2015-04-20)
... ...

![banner](https://github.com/bennyguitar/News-YC---iPhone/blob/master/resources/gh/banner.png) ## About **News/YC** is an iOS app that tries to do one thing, give you [Hacker News](https://github.com/bennyguitar/News-YC---iPhone/blob/master/https://news.ycombinator.com) and get the hell out of the way. If the app isn't doing something you feel it should, or if you think there's an easier way to get an action accomplished - open up an Issue! I want your feedback. This app was made by me, for my usage, so it probably won't line up with everybody's tastes and there is probably a huge group of people with better taste than me. Feel free to be vocal - it's the only way to make this app the best! This app **does not** use the new [HackerNews API](https://github.com/bennyguitar/News-YC---iPhone/blob/master/https://github.com/HackerNews/API), but instead relies on [libHN](https://github.com/bennyguitar/News-YC---iPhone/blob/master/https://github.com/bennyguitar/libHN) for the interface to HN content. **App Store** * 3.0 * Swift ## Table of Contents * [General Architecture](https://github.com/bennyguitar/News-YC---iPhone/blob/master/#general-architecture) * [HNNavigationBrain](https://github.com/bennyguitar/News-YC---iPhone/blob/master/#hnnavigationbrain) * [HNTheme](https://github.com/bennyguitar/News-YC---iPhone/blob/master/#hntheme) * [View Controllers](https://github.com/bennyguitar/News-YC---iPhone/blob/master/#view-controllers) * [What's Next?](https://github.com/bennyguitar/News-YC---iPhone/blob/master/#whats-next) ## General Architecture This app is built in Swift, but is really a port of an existing app with a little bit clearer design and modularity of components. There are a few architecture decisions I made to make some things easier that may or may not be defacto architecture or MVC considerations. The first of which is... ## HNNavigationBrain This class is literally the arbiter for all navigation related activities. I made this class with the idea that I shouldn't have to constantly defer navigation-related logic up through a chain to meet a UIViewController which then actually does it. That's too much of a chain, and honestly too much of a hassle. I wanted the system to be slightly knowledgable about itself. I wanted to be able to navigate at any time I want. Enter the **Brain**. The navigation brain works by making every navigable View Controller a subclass of `HNViewController` which handles a lot of boilerplate logic like building the navigation bar and responding to theme changes, etc. The biggest thing this view controller does is listen for navigation notifications, and responding if they are valid. `HNNavigationBrain` initiates navigation by a bunch of possible methods (navigate to Posts, navigate to comments for Post, etc) and passes a newly instantiated HNViewController instance through the `NSNotificationCenter` to the top-most view controller in the UINavigationController's stack. What this effectively means, is that anything can initiate navigation. All views, models, and controllers have this functionality thanks to the brain. This scheme is not without possible problems, however, but we try to minimize these as much as possible. Navigation events are fairly predictable reactions to button presses, so we don't have to worry so much about different classes calling navigation notifications at the same time. But it is beneficial to think about this as you commit and contribute to the project. It's fairly easy to use the navigation brain as well: ```swift HNNavigationBrain.navigateToComments(somePost) ``` ## HNTheme `HNTheme.currentTheme()` acts as the main interface for all them and color related functionality of the app. The `currentTheme()` singleton instance determines how all UI color schemes are assigned, and handles the notifications blasted out when the theme is changed. All HNViewControllers and their subclasses override the `resetUI()` method to reset after a theme change. Currently there are four themes in the app, two light (Day and Minima) and two dark (Night and SpaceOne). Since I'm an art guy myself, you can bet your butt there will be more themes and theme packs later. ## View Controllers As mentioned earlier, all navigable view controllers in the app are subclasses of `HNViewController` - but those don't account for all view controllers in the app. **HNViewController subclassed** * HNPostsViewController * HNCommentsViewController * HNWebViewController **UIViewController subclassed** * HNSubmissionViewController * HNNavigationViewController ## What's Next? Apart from library changes here and there whenever YC starts messing with the site site's HTML markup, here's the list of functionality I'd like to add: * Nesting Comments * Find text in comment strings * More themes!

近期下载者

相关文件


收藏者