FeedKit

所属分类:Python编程
开发工具:Swift
文件大小:0KB
下载次数:0
上传日期:2023-06-20 09:14:12
上 传 者sh-1993
说明:  用Swift编写的RSS、Atom和JSON提要解析器
(An RSS, Atom and JSON Feed parser written in Swift)

文件列表:
.travis.yml (2701, 2022-12-07)
CHANGELOG.md (8710, 2022-12-07)
Example iOS/ (0, 2022-12-07)
Example iOS/AppDelegate.swift (3413, 2022-12-07)
Example iOS/Assets.xcassets/ (0, 2022-12-07)
Example iOS/Assets.xcassets/AppIcon.appiconset/ (0, 2022-12-07)
Example iOS/Assets.xcassets/AppIcon.appiconset/Contents.json (585, 2022-12-07)
Example iOS/Base.lproj/ (0, 2022-12-07)
Example iOS/Base.lproj/LaunchScreen.storyboard (1664, 2022-12-07)
Example iOS/Extensions/ (0, 2022-12-07)
Example iOS/Extensions/FeedTableViewController + ReusableCell.swift (1597, 2022-12-07)
Example iOS/Extensions/FeedTableViewController + TableViewLayout.swift (1776, 2022-12-07)
Example iOS/Info.plist (1149, 2022-12-07)
Example iOS/View Controllers/ (0, 2022-12-07)
Example iOS/View Controllers/FeedDetailTableViewController.swift (2160, 2022-12-07)
Example iOS/View Controllers/FeedTableViewController.swift (4871, 2022-12-07)
Example macOS/ (0, 2022-12-07)
Example macOS/AppDelegate.swift (1535, 2022-12-07)
Example macOS/Assets.xcassets/ (0, 2022-12-07)
Example macOS/Assets.xcassets/AppIcon.appiconset/ (0, 2022-12-07)
Example macOS/Assets.xcassets/AppIcon.appiconset/Contents.json (903, 2022-12-07)
Example macOS/Base.lproj/ (0, 2022-12-07)
Example macOS/Base.lproj/Main.storyboard (79387, 2022-12-07)
Example macOS/Info.plist (979, 2022-12-07)
Example macOS/ViewController.swift (4367, 2022-12-07)
Example tvOS/ (0, 2022-12-07)
Example tvOS/AppDelegate.swift (3200, 2022-12-07)
Example tvOS/Assets.xcassets/ (0, 2022-12-07)
Example tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/ (0, 2022-12-07)
Example tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/ (0, 2022-12-07)
Example tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/ (0, 2022-12-07)
Example tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/ (0, 2022-12-07)
Example tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/Contents.json (137, 2022-12-07)
Example tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Contents.json (62, 2022-12-07)
Example tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Contents.json (250, 2022-12-07)
Example tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/ (0, 2022-12-07)
Example tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/ (0, 2022-12-07)
Example tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/Contents.json (137, 2022-12-07)
Example tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Contents.json (62, 2022-12-07)
... ...

![FeedKit](https://github.com/FeedKit.png?raw=true) [![build status](https://github.comhttps://travis-ci.org/nmdias/FeedKit.svg)](https://github.comhttps://travis-ci.org/nmdias/FeedKit) [![cocoapods compatible](https://github.comhttps://img.shields.io/badge/cocoapods-compatible-brightgreen.svg)](https://github.comhttps://cocoapods.org/pods/FeedKit) [![carthage compatible](https://github.comhttps://img.shields.io/badge/carthage-compatible-brightgreen.svg)](https://github.comhttps://github.com/Carthage/Carthage) [![language](https://github.comhttps://img.shields.io/badge/spm-compatible-brightgreen.svg)](https://github.comhttps://swift.org) [![swift](https://github.comhttps://img.shields.io/badge/swift-5.0-orange.svg)](https://github.comhttps://github.com/nmdias/DefaultsKit/releases) ## Features - [x] [Atom](https://github.comhttps://tools.ietf.org/html/rfc4287) - [x] RSS [0.90](https://github.comhttp://www.rssboard.org/rss-0-9-0), [0.91](https://github.comhttp://www.rssboard.org/rss-0-9-1), [1.00](https://github.comhttp://web.resource.org/rss/1.0/spec), [2.00](https://github.comhttp://cyber.law.harvard.edu/rss/rss.html) - [x] [JSON](https://github.comhttps://jsonfeed.org/version/1) - [x] Namespaces - [x] [Dublin Core](https://github.comhttp://web.resource.org/rss/1.0/modules/dc/) - [x] [Syndication](https://github.comhttp://web.resource.org/rss/1.0/modules/syndication/) - [x] [Content](https://github.comhttp://web.resource.org/rss/1.0/modules/content/) - [x] [Media RSS](https://github.comhttp://www.rssboard.org/media-rss) - [x] [iTunes Podcasting Tags](https://github.comhttps://help.apple.com/itc/podcasts_connect/#/itcb54353390) - [x] [Documentation](https://github.comhttp://cocoadocs.org/docsets/FeedKit) - [x] Unit Test Coverage ## Requirements ![xcode](https://github.comhttps://img.shields.io/badge/xcode-11-lightgrey.svg) ![ios](https://github.comhttps://img.shields.io/badge/ios-10-lightgrey.svg) ![tvos](https://github.comhttps://img.shields.io/badge/tvos-10-lightgrey.svg) ![watchos](https://github.comhttps://img.shields.io/badge/watchos-3-lightgrey.svg) ![mac os](https://github.comhttps://img.shields.io/badge/mac%20os-10.12-lightgrey.svg) ![mac os](https://github.comhttps://img.shields.io/badge/ubuntu-16.04-lightgrey.svg) Installation >> [`instructions`](https://github.comhttps://github.com/nmdias/FeedKit/blob/master/INSTALL.md) << ## Usage Build a URL pointing to an RSS, Atom or JSON Feed. ```swift let feedURL = URL(string: "http://images.apple.com/main/rss/hotnews/hotnews.rss")! ``` Get an instance of `FeedParser` ```swift let parser = FeedParser(URL: feedURL) // or FeedParser(data: data) or FeedParser(xmlStream: stream) ``` Then call `parse` or `parseAsync` to start parsing the feed... > A **common scenario** in UI environments would be parsing a feed **asynchronously** from a user initiated action, such as the touch of a button. e.g. ```swift // Parse asynchronously, not to block the UI. parser.parseAsync(queue: DispatchQueue.global(qos: .userInitiated)) { (result) in // Do your thing, then back to the Main thread DispatchQueue.main.async { // ..and update the UI } } ``` Remember, you are responsible to manually bring the result closure to whichever queue is apropriate. Usually to the Main thread, for UI apps, by calling `DispatchQueue.main.async` . Alternatively, you can also parse synchronously. ```swift let result = parser.parse() ``` ## Parse Result FeedKit adopts Swift 5 Result type, as `Result`, and as such, if parsing succeeds you should now have a `Strongly Typed Model` of an `RSS`, `Atom` or `JSON Feed`, within the `Feed` enum: ```swift switch result { case .success(let feed): // Grab the parsed feed directly as an optional rss, atom or json feed object feed.rssFeed // Or alternatively... switch feed { case let .atom(feed): // Atom Syndication Format Feed Model case let .rss(feed): // Really Simple Syndication Feed Model case let .json(feed): // JSON Feed Model } case .failure(let error): print(error) } ``` ## Model Preview > The RSS and Atom feed Models are rather extensive throughout the supported namespaces. These are just a preview of what's available. #### RSS ```swift feed.title feed.link feed.description feed.language feed.copyright feed.managingEditor feed.webMaster feed.pubDate feed.lastBuildDate feed.categories feed.generator feed.docs feed.cloud feed.rating feed.ttl feed.image feed.textInput feed.skipHours feed.skipDays //... feed.dublinCore feed.syndication feed.iTunes // ... let item = feed.items?.first item?.title item?.link item?.description item?.author item?.categories item?.comments item?.enclosure item?.guid item?.pubDate item?.source //... item?.dublinCore item?.content item?.iTunes item?.media // ... ``` #### Atom ```swift feed.title feed.subtitle feed.links feed.updated feed.authors feed.contributors feed.id feed.generator feed.icon feed.logo feed.rights // ... let entry = feed.entries?.first entry?.title entry?.summary entry?.authors entry?.contributors entry?.links entry?.updated entry?.categories entry?.id entry?.content entry?.published entry?.source entry?.rights // ... ``` #### JSON ```swift feed.version feed.title feed.homePageURL feed.feedUrl feed.description feed.userComment feed.nextUrl feed.icon feed.favicon feed.author feed.expired feed.hubs feed.extensions // ... let item = feed.items?.first item?.id item?.url item?.externalUrl item?.title item?.contentText item?.contentHtml item?.summary item?.image item?.bannerImage item?.datePublished item?.dateModified item?.author item?.url item?.tags item?.attachments item?.extensions // ... ``` ## License FeedKit is released under the MIT license. See [LICENSE](https://github.comhttps://github.com/nmdias/FeedKit/blob/master/LICENSE) for details.

近期下载者

相关文件


收藏者