-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c6c40ef
Showing
8 changed files
with
157 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# This workflow will build a Swift project | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift | ||
|
||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: macos-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Build | ||
run: swift build -v | ||
- name: Run tests | ||
run: swift test -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: docc | ||
on: | ||
push: | ||
branches: ["main"] | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: true | ||
jobs: | ||
pages: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: macos-12 | ||
steps: | ||
- name: git checkout | ||
uses: actions/checkout@v3 | ||
- name: docbuild | ||
run: | | ||
xcodebuild docbuild -scheme Network \ | ||
-derivedDataPath /tmp/docbuild \ | ||
-destination 'generic/platform=iOS'; | ||
$(xcrun --find docc) process-archive \ | ||
transform-for-static-hosting /tmp/docbuild/Build/Products/Debug-iphoneos/Network.doccarchive \ | ||
--hosting-base-path Network \ | ||
--output-path docs; | ||
echo "<script>window.location.href += \"/documentation/network\"</script>" > docs/index.html; | ||
- name: artifacts | ||
uses: actions/upload-pages-artifact@v1 | ||
with: | ||
path: 'docs' | ||
- name: deploy | ||
id: deployment | ||
uses: actions/deploy-pages@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.DS_Store | ||
/.build | ||
/Packages | ||
/*.xcodeproj | ||
xcuserdata/ | ||
DerivedData/ | ||
.swiftpm/config/registries.json | ||
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata | ||
.netrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"pins" : [ | ||
{ | ||
"identity" : "o", | ||
"kind" : "remoteSourceControl", | ||
"location" : "https://github.com/0xOpenBytes/o", | ||
"state" : { | ||
"revision" : "3e83362434c82f318a8d72e0d3b0786ffb3ba640", | ||
"version" : "2.1.0" | ||
} | ||
} | ||
], | ||
"version" : 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// swift-tools-version: 5.7 | ||
// The swift-tools-version declares the minimum version of Swift required to build this package. | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "Network", | ||
platforms: [ | ||
.iOS(.v14), | ||
.macOS(.v11), | ||
.watchOS(.v7), | ||
.tvOS(.v14) | ||
], | ||
products: [ | ||
// Products define the executables and libraries a package produces, and make them visible to other packages. | ||
.library( | ||
name: "Network", | ||
targets: ["Network"] | ||
) | ||
], | ||
dependencies: [ | ||
// Dependencies declare other packages that this package depends on. | ||
.package(url: "https://github.com/0xOpenBytes/o", from: "2.0.0") | ||
], | ||
targets: [ | ||
// Targets are the basic building blocks of a package. A target can define a module or a test suite. | ||
// Targets can depend on other targets in this package, and on products in packages this package depends on. | ||
.target( | ||
name: "Network", | ||
dependencies: [ | ||
"o" | ||
] | ||
), | ||
.testTarget( | ||
name: "NetworkTests", | ||
dependencies: ["Network"] | ||
) | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Network | ||
|
||
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. | ||
|
||
## Usage | ||
To use `Network`, simply import `Network` and use the `Network` typealias in your code: | ||
|
||
```swift | ||
import Network | ||
|
||
// Get data from a URL | ||
let data = try await Network.get(url: URL(string: "https://example.com/data.json")!) | ||
|
||
// Post data to a URL | ||
let postData = "Hello, world!".data(using: .utf8)! | ||
try await Network.post(url: URL(string: "https://example.com/post")!, body: postData) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import o | ||
|
||
/** | ||
A convenience typealias for `o.url` to represent network access. | ||
`o.url` is a group of functions in the `o` module that provides network access and manipulation operations. | ||
Examples: | ||
```swift | ||
let data = try await Network.get(url: URL(string: "https://example.com/data.json")!) | ||
try await Network.post(url: URL(string: "ftp://example.com/greeting.txt")!, body: postData) | ||
``` | ||
*/ | ||
public typealias Network = o.url |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import XCTest | ||
@testable import Network | ||
|
||
final class NetworkTests: XCTestCase { } |