File tree Expand file tree Collapse file tree 8 files changed +157
-0
lines changed
Expand file tree Collapse file tree 8 files changed +157
-0
lines changed Original file line number Diff line number Diff line change 1+ # This workflow will build a Swift project
2+ # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift
3+
4+ name : CI
5+
6+ on :
7+ push :
8+ branches : [ "main" ]
9+ pull_request :
10+ branches : [ "main" ]
11+
12+ jobs :
13+ build :
14+
15+ runs-on : macos-latest
16+
17+ steps :
18+ - uses : actions/checkout@v3
19+ - name : Build
20+ run : swift build -v
21+ - name : Run tests
22+ run : swift test -v
Original file line number Diff line number Diff line change 1+ name : docc
2+ on :
3+ push :
4+ branches : ["main"]
5+ permissions :
6+ contents : read
7+ pages : write
8+ id-token : write
9+ concurrency :
10+ group : " pages"
11+ cancel-in-progress : true
12+ jobs :
13+ pages :
14+ environment :
15+ name : github-pages
16+ url : ${{ steps.deployment.outputs.page_url }}
17+ runs-on : macos-12
18+ steps :
19+ - name : git checkout
20+ uses : actions/checkout@v3
21+ - name : docbuild
22+ run : |
23+ xcodebuild docbuild -scheme Network \
24+ -derivedDataPath /tmp/docbuild \
25+ -destination 'generic/platform=iOS';
26+ $(xcrun --find docc) process-archive \
27+ transform-for-static-hosting /tmp/docbuild/Build/Products/Debug-iphoneos/Network.doccarchive \
28+ --hosting-base-path Network \
29+ --output-path docs;
30+ echo "<script>window.location.href += \"/documentation/network\"</script>" > docs/index.html;
31+ - name : artifacts
32+ uses : actions/upload-pages-artifact@v1
33+ with :
34+ path : ' docs'
35+ - name : deploy
36+ id : deployment
37+ uses : actions/deploy-pages@v1
Original file line number Diff line number Diff line change 1+ .DS_Store
2+ /.build
3+ /Packages
4+ /* .xcodeproj
5+ xcuserdata /
6+ DerivedData /
7+ .swiftpm /config /registries.json
8+ .swiftpm /xcode /package.xcworkspace /contents.xcworkspacedata
9+ .netrc
Original file line number Diff line number Diff line change 1+ // swift-tools-version: 5.7
2+ // The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+ import PackageDescription
5+
6+ let package = Package (
7+ name: " Network " ,
8+ platforms: [
9+ . iOS( . v14) ,
10+ . macOS( . v11) ,
11+ . watchOS( . v7) ,
12+ . tvOS( . v14)
13+ ] ,
14+ products: [
15+ // Products define the executables and libraries a package produces, and make them visible to other packages.
16+ . library(
17+ name: " Network " ,
18+ targets: [ " Network " ]
19+ )
20+ ] ,
21+ dependencies: [
22+ // Dependencies declare other packages that this package depends on.
23+ . package ( url: " https://github.com/0xOpenBytes/o " , from: " 2.0.0 " )
24+ ] ,
25+ targets: [
26+ // Targets are the basic building blocks of a package. A target can define a module or a test suite.
27+ // Targets can depend on other targets in this package, and on products in packages this package depends on.
28+ . target(
29+ name: " Network " ,
30+ dependencies: [
31+ " o "
32+ ]
33+ ) ,
34+ . testTarget(
35+ name: " NetworkTests " ,
36+ dependencies: [ " Network " ]
37+ )
38+ ]
39+ )
Original file line number Diff line number Diff line change 1+ # Network
2+
3+ Network is a convenience typealias for ` o.url ` that represents network access. ` o.url ` is a group of functions in the ` o ` module that provides network access and manipulation operations.
4+
5+ ## Usage
6+ To use ` Network ` , simply import ` Network ` and use the ` Network ` typealias in your code:
7+
8+ ``` swift
9+ import Network
10+
11+ // Get data from a URL
12+ let data = try await Network.get (url : URL (string : " https://example.com/data.json" )! )
13+
14+ // Post data to a URL
15+ let postData = " Hello, world!" .data (using : .utf8 )!
16+ try await Network.post (url : URL (string : " https://example.com/post" )! , body : postData)
17+ ```
Original file line number Diff line number Diff line change 1+ import o
2+
3+ /**
4+ A convenience typealias for `o.url` to represent network access.
5+
6+ `o.url` is a group of functions in the `o` module that provides network access and manipulation operations.
7+
8+ Examples:
9+
10+ ```swift
11+ let data = try await Network.get(url: URL(string: "https://example.com/data.json")!)
12+ try await Network.post(url: URL(string: "ftp://example.com/greeting.txt")!, body: postData)
13+ ```
14+ */
15+ public typealias Network = o . url
Original file line number Diff line number Diff line change 1+ import XCTest
2+ @testable import Network
3+
4+ final class NetworkTests : XCTestCase { }
You can’t perform that action at this time.
0 commit comments