Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aporat/alamofireswiftsoup
Alamofire extension for serialize SwiftSoup HTML documents'
https://github.com/aporat/alamofireswiftsoup
Last synced: 16 days ago
JSON representation
Alamofire extension for serialize SwiftSoup HTML documents'
- Host: GitHub
- URL: https://github.com/aporat/alamofireswiftsoup
- Owner: aporat
- License: mit
- Created: 2020-09-01T03:19:23.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-09-04T16:42:36.000Z (over 4 years ago)
- Last Synced: 2024-05-21T07:28:28.529Z (8 months ago)
- Language: Swift
- Size: 11.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AlamofireSwiftSoup
[![Build Status](https://github.com/aporat/AlamofireSwiftSoup/workflows/Tests/badge.svg)](https://github.com/aporat/AlamofireSwiftSoup/actions)
[![Cocoapods](https://img.shields.io/cocoapods/v/AlamofireSwiftSoup.svg)](https://cocoapods.org/pods/AlamofireSwiftSoup)
[![Swift](https://img.shields.io/badge/Swift-5.0-orange.svg)](https://swift.org)
[![Xcode](https://img.shields.io/badge/Xcode-11.4-blue.svg)](https://developer.apple.com/xcode)
[![MIT](https://img.shields.io/badge/License-MIT-red.svg)](https://opensource.org/licenses/MIT)## Installation
The recommended approach for installing AlamofireSwiftSoup is via the [CocoaPods](http://cocoapods.org/) package manager, as it provides flexible dependency management and dead simple installation.
Install CocoaPods if not already available:
``` bash
$ [sudo] gem install cocoapods
$ pod setup
```Edit your Podfile and add `AlamofireSwiftSoup`:
``` bash
$ edit Podfile
platform :ios, '12.0'pod 'AlamofireSwiftSoup'
```Install into your Xcode project:
``` bash
$ pod install
```## Usage
```swift
import AlamofireSwiftSoup
``````swift
AF.request("https://httpbin.org/").responseSwiftSoupHTML { dataResponse in
switch dataResponse.result {
case .failure(let error):
debugPrint(error)
case .success(let document):
if let scriptElement = try? document.select("title").first(), let titleString = try? scriptElement.html() {
debugPrint(titleString)
}
}
}```