Skip to content

Commit 5a80404

Browse files
committed
Add project files
1 parent 226b99d commit 5a80404

24 files changed

+1155
-0
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: [danielsaidi]

.github/workflows/build.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# This workflow builds and tests the project.
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift
3+
4+
name: Build Runner
5+
6+
on:
7+
push:
8+
branches: ["main"]
9+
pull_request:
10+
branches: ["main"]
11+
12+
jobs:
13+
build:
14+
runs-on: macos-15
15+
steps:
16+
- uses: actions/checkout@v3
17+
- uses: maxim-lobanov/setup-xcode@v1
18+
with:
19+
xcode-version: latest-stable
20+
- name: Build all platforms
21+
run: bash scripts/build.sh ${{ github.event.repository.name }}
22+
- name: Test iOS
23+
run: bash scripts/test.sh ${{ github.event.repository.name }}

.github/workflows/docc.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# This workflow builds publish DocC docs to GitHub Pages.
2+
# Source: https://maxxfrazer.medium.com/deploying-docc-with-github-actions-218c5ca6cad5
3+
# Sample: https://github.com/AgoraIO-Community/VideoUIKit-iOS/blob/main/.github/workflows/deploy_docs.yml
4+
5+
name: DocC Runner
6+
7+
on:
8+
push:
9+
branches: ["main"]
10+
11+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
# Allow one concurrent deployment
18+
concurrency:
19+
group: "pages"
20+
cancel-in-progress: true
21+
22+
jobs:
23+
deploy:
24+
environment:
25+
name: github-pages
26+
url: ${{ steps.deployment.outputs.page_url }}
27+
runs-on: macos-15
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v3
31+
- id: pages
32+
name: Setup Pages
33+
uses: actions/configure-pages@v4
34+
- name: Select Xcode version
35+
uses: maxim-lobanov/setup-xcode@v1
36+
with:
37+
xcode-version: latest-stable
38+
- name: Build DocC
39+
run: bash scripts/docc.sh ${{ github.event.repository.name }}
40+
- name: Upload artifact
41+
uses: actions/upload-pages-artifact@v3
42+
with:
43+
path: '.build/docs-iOS'
44+
- id: deployment
45+
name: Deploy to GitHub Pages
46+
uses: actions/deploy-pages@v4

.swiftlint.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
disabled_rules:
2+
- identifier_name
3+
- large_tuple
4+
- line_length
5+
- nesting
6+
- todo
7+
- trailing_whitespace
8+
- type_name
9+
- vertical_whitespace
10+
11+
included:
12+
- Sources
13+
- Tests

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Daniel Saidi
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
<p align="center">
2+
<img src="Resources/Icon.png" alt="Project Icon" width="250" />
3+
</p>
4+
5+
<p align="center">
6+
<img src="https://img.shields.io/github/v/release/danielsaidi/ScanCodes?color=%2300550&sort=semver" alt="Version" />
7+
<img src="https://img.shields.io/badge/swift-6.0-orange.svg" alt="Swift 6.0" />
8+
<a href="https://danielsaidi.github.io/ScanCodes"><img src="https://img.shields.io/badge/documentation-web-blue.svg" alt="Documentation" /></a>
9+
<a href="https://github.com/danielsaidi/ScanCodes/blob/master/LICENSE"><img src="https://img.shields.io/github/license/danielsaidi/ScanCodes" alt="MIT License" /></a>
10+
<a href="https://github.com/sponsors/danielsaidi"><img src="https://img.shields.io/badge/sponsor-GitHub-red.svg" alt="Sponsor my work" /></a>
11+
</p>
12+
13+
14+
# ScanCodes
15+
16+
ScanCodes is a Swift library with scan code features, such as a ``ScanCode`` SwiftUI view that can render string values as scan codes.
17+
18+
<p align="center">
19+
<img src="https://github.com/danielsaidi/ScanCodes/releases/download/0.1.0/ScanCodes-Demo.gif" alt="Demo Gif" width="300" />
20+
</p>
21+
22+
ScanCodes extends ``SwiftUICore/Image`` as well as platform-specific image types with scan code-related functionality, and has a ``ScanCodeType`` enum that defines all supported scan code types.
23+
24+
25+
26+
## Installation
27+
28+
ScanCodes can be installed with the Swift Package Manager:
29+
30+
```
31+
https://github.com/danielsaidi/ScanCodes.git
32+
```
33+
34+
35+
## Supported Platforms
36+
37+
ScanCodes supports iOS 15, iPadOS 15, macOS 12, tvOS 15, and visionOS 1.
38+
39+
40+
41+
## Support My Work
42+
43+
You can [become a sponsor][Sponsors] to help me dedicate more time on my various [open-source tools][OpenSource]. Every contribution, no matter the size, makes a real difference in keeping these tools free and actively developed.
44+
45+
46+
47+
## Getting Started
48+
49+
To render a scan code in SwiftUI, just add a ``ScanCode`` with the value and type to render:
50+
51+
```swift
52+
struct ContentView: View {
53+
54+
var body: some View {
55+
ScanCode(
56+
value: "123456789",
57+
type: .qr,
58+
scale: 5,
59+
rotation: .pi/4
60+
)
61+
}
62+
}
63+
```
64+
65+
You can use the same init arguments to create a SwiftUI ``SwiftUICore/Image`` and platform-specific image values.
66+
67+
68+
69+
## Documentation
70+
71+
The online [documentation][Documentation] has more information, articles, code examples, etc.
72+
73+
74+
75+
## Demo Application
76+
77+
The `Demo` folder has a demo app that lets you explore the library.
78+
79+
80+
81+
## Contact
82+
83+
Feel free to reach out if you have questions, or want to contribute in any way:
84+
85+
* Website: [danielsaidi.com][Website]
86+
* E-mail: [daniel.saidi@gmail.com][Email]
87+
* Bluesky: [@danielsaidi@bsky.social][Bluesky]
88+
* Mastodon: [@danielsaidi@mastodon.social][Mastodon]
89+
90+
91+
92+
## License
93+
94+
ScanCodes is available under the MIT license. See the [LICENSE][License] file for more info.
95+
96+
97+
98+
[Email]: mailto:daniel.saidi@gmail.com
99+
[Website]: https://danielsaidi.com
100+
[GitHub]: https://github.com/danielsaidi
101+
[OpenSource]: https://danielsaidi.com/opensource
102+
[Sponsors]: https://github.com/sponsors/danielsaidi
103+
104+
[Bluesky]: https://bsky.app/profile/danielsaidi.bsky.social
105+
[Mastodon]: https://mastodon.social/@danielsaidi
106+
[Twitter]: https://twitter.com/danielsaidi
107+
108+
[Documentation]: https://danielsaidi.github.io/ScanCodes
109+
[Getting-Started]: https://danielsaidi.github.io/ScanCodes/documentation/scancodes/getting-started
110+
[License]: https://github.com/danielsaidi/ScanCodes/blob/master/LICENSE

RELEASE_NOTES.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Release Notes
2+
3+
VideoKit will use semver after 1.0.
4+
5+
Until then, breaking changes can happen in any version, and deprecations may be removed in any minor version bump.
6+
7+
8+
## 0.1
9+
10+
This is the first public release of ScanCodes.
11+
12+
### ✨ New Features
13+
14+
* `ScanCode` can render any string as a scan code.
15+
* `Image` can be initialized with a scan code value.
16+
* `UIImage` and `NSImage` can be initialized with a scan code value.

package_version.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
# Documentation:
4+
# This script creates a new project version for the current project.
5+
# You can customize this to fit your project when you copy these scripts.
6+
# You can pass in a custom branch if you don't want to use the default one.
7+
8+
SCRIPT="scripts/package_version.sh"
9+
chmod +x $SCRIPT
10+
bash $SCRIPT

scripts/build.sh

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/bin/bash
2+
3+
# Documentation:
4+
# This script builds a <TARGET> for all provided <PLATFORMS>.
5+
# This script targets iOS, macOS, tvOS, watchOS, and xrOS by default.
6+
# You can pass in a list of <PLATFORMS> if you want to customize the build.
7+
8+
# Usage:
9+
# build.sh <TARGET> [<PLATFORMS> default:iOS macOS tvOS watchOS xrOS]
10+
# e.g. `bash scripts/build.sh MyTarget iOS macOS`
11+
12+
# Exit immediately if a command exits with a non-zero status
13+
set -e
14+
15+
# Verify that all required arguments are provided
16+
if [ $# -eq 0 ]; then
17+
echo "Error: This script requires at least one argument"
18+
echo "Usage: $0 <TARGET> [<PLATFORMS> default:iOS macOS tvOS watchOS xrOS]"
19+
echo "For instance: $0 MyTarget iOS macOS"
20+
exit 1
21+
fi
22+
23+
# Define argument variables
24+
TARGET=$1
25+
26+
# Remove TARGET from arguments list
27+
shift
28+
29+
# Define platforms variable
30+
if [ $# -eq 0 ]; then
31+
set -- iOS macOS tvOS watchOS xrOS
32+
fi
33+
PLATFORMS=$@
34+
35+
# A function that builds $TARGET for a specific platform
36+
build_platform() {
37+
38+
# Define a local $PLATFORM variable
39+
local PLATFORM=$1
40+
41+
# Build $TARGET for the $PLATFORM
42+
echo "Building $TARGET for $PLATFORM..."
43+
if ! xcodebuild -scheme $TARGET -derivedDataPath .build -destination generic/platform=$PLATFORM; then
44+
echo "Failed to build $TARGET for $PLATFORM"
45+
return 1
46+
fi
47+
48+
# Complete successfully
49+
echo "Successfully built $TARGET for $PLATFORM"
50+
}
51+
52+
# Start script
53+
echo ""
54+
echo "Building $TARGET for [$PLATFORMS]..."
55+
echo ""
56+
57+
# Loop through all platforms and call the build function
58+
for PLATFORM in $PLATFORMS; do
59+
if ! build_platform "$PLATFORM"; then
60+
exit 1
61+
fi
62+
done
63+
64+
# Complete successfully
65+
echo ""
66+
echo "Building $TARGET completed successfully!"
67+
echo ""

scripts/chmod.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
# Documentation:
4+
# This script makes all scripts in this folder executable.
5+
6+
# Usage:
7+
# scripts_chmod.sh
8+
# e.g. `bash scripts/chmod.sh`
9+
10+
# Exit immediately if a command exits with a non-zero status
11+
set -e
12+
13+
# Use the script folder to refer to other scripts.
14+
FOLDER="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
15+
16+
# Find all .sh files in the FOLDER except chmod.sh
17+
find "$FOLDER" -name "*.sh" ! -name "chmod.sh" -type f | while read -r script; do
18+
chmod +x "$script"
19+
done

0 commit comments

Comments
 (0)