Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
0xLeif committed Mar 7, 2023
0 parents commit c6c40ef
Show file tree
Hide file tree
Showing 8 changed files with 157 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/CI.yml
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
37 changes: 37 additions & 0 deletions .github/workflows/docc.yml
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
9 changes: 9 additions & 0 deletions .gitignore
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
14 changes: 14 additions & 0 deletions Package.resolved
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
}
39 changes: 39 additions & 0 deletions Package.swift
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"]
)
]
)
17 changes: 17 additions & 0 deletions README.md
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)
```
15 changes: 15 additions & 0 deletions Sources/Network/Network.swift
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
4 changes: 4 additions & 0 deletions Tests/NetworkTests/NetworkTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import XCTest
@testable import Network

final class NetworkTests: XCTestCase { }

0 comments on commit c6c40ef

Please sign in to comment.