nmdias / FeedKit

An RSS, Atom and JSON Feed parser written in Swift
MIT License
1.19k stars 174 forks source link

Not Able to Check Multiple Items in a Feed #40

Closed heysaik closed 7 years ago

heysaik commented 7 years ago

Hello! In my app, I want to display the first 10 different items in a feed in a UICollectionView. I can only access the first item in a feed shown in your documentation. How would I be able to gather the first 10 items and add them to an array?

nmdias commented 7 years ago

Hi @theindiandev1065,

The example shown in the documentation...

let item = feed.items?.first

...accesses an array of items. You can iterate over these:

feed?.items?.forEach({ (item) in
    print(item.title)
})

Or access them Individually:

self.feed?.items?[0].title // first
self.feed?.items?[1].title // second
// ... and so on
heysaik commented 7 years ago

Thanks!