Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fantastic JOB #47

Closed
wizard699 opened this issue Oct 26, 2014 · 3 comments
Closed

Fantastic JOB #47

wizard699 opened this issue Oct 26, 2014 · 3 comments

Comments

@wizard699
Copy link

Only a word: FANTASTIC!!!
Many compliments for your job.
I'm at start with swift coding .... but, it's possibile to have some tips to extract and use your Info page in other apps? If I copy class and View in a app coded with Object C, there are a lot of error.
Which are dependencies for Info page?

Thanks

@aclissold
Copy link
Owner

Awesome, thanks!

There's a lot going on with that view controller. Here's the tutorial I used to get up-and-running with a UIPageViewController.

Everything related to the transition manager is very specific code for animating between the Info and Bios views, and probably isn't relevant or necessary in a different project.

If you're asking about the Bios view controller as well, it makes use of iCarousel for the scrollable thumbnail images.

I came up with a way to represent the styled content as simple [key: attributed string] dictionaries; this code is completely self-contained in InfoAndBiosContent.swift. You pass an Array of (style, text) tuples as input to the contentFromComponents function and it gives you an NSAttributedString. contactUs is a simple example of that.

@rome111
Copy link

rome111 commented May 17, 2015

Great Job! I'm new to coding but this is one of the best open source apps I've come across. Could you give me some advice on how to add multiple rss feeds to the app?

Thanks.

@aclissold
Copy link
Owner

Nice!! Thanks! I guess I'll use this issue as a general discussion board 😛

That's pretty vague, but here's a head start… let's say you want to use your own custom RSS feeds in the Sections view, like Hacker News.

Hacker News

in Main.storyboard, click on the web view for PostViewController and set it to "Scale Pages To Fit." I have this disabled since the content of my RSS feed is just text that I don't want people to zoom into.

step 1
step 2

Then you'll wanted to modify FeedParser.swift because I'm doing stuff that's only relevant to my RSS feed in there as well.

Before:

return NSURL(string: "\(baseURL)&o=\(offset)&l=\(length)&f=rss")!`

After:

return NSURL(string: baseURL)!`.

Similarly, in PostViewController.swift I'm forcing the mobile site. You can disable this by commenting it out.

// URL = URL.stringByReplacingOccurrencesOfString("//www", withString: "//m")

Finally, add Hacker News to SectionsViewController.swift by adding its name to the array of section titles and adding its URL to the array of URLs:

let titles = ["News", "Life", "Sports", "Arts & Entertainment", "Opinion", "Satire", "Hacker News"]
let baseURLs = [
    "News": "\(prefix)news,news/*",
    "Life": "\(prefix)life,life/*",
    "Sports": "\(prefix)sports,sports/*",
    "Arts & Entertainment": "\(prefix)arts_and_entertainment,arts_and_entertainment/*",
    "Opinion": "\(prefix)opinion,opinion/*",
    "Satire": "\(prefix)satire,satire/*",
    "Hacker News": "https://news.ycombinator.com/rss"
]

This will break the other sections though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants