Skip to content

Commit c6c40ef

Browse files
committed
init
0 parents  commit c6c40ef

File tree

8 files changed

+157
-0
lines changed

8 files changed

+157
-0
lines changed

.github/workflows/CI.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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

.github/workflows/docc.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
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

Package.resolved

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
)

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
```

Sources/Network/Network.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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

Tests/NetworkTests/NetworkTests.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import XCTest
2+
@testable import Network
3+
4+
final class NetworkTests: XCTestCase { }

0 commit comments

Comments
 (0)