Skip to content

Commit

Permalink
Rename to QRCodeSwift
Browse files Browse the repository at this point in the history
  • Loading branch information
ApolloZhu committed Nov 5, 2020
1 parent 5808848 commit b8e452f
Show file tree
Hide file tree
Showing 24 changed files with 786 additions and 861 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Install Jazzy
run: sudo gem install jazzy
- name: Generate Documentation
run: jazzy --clean --author ${{ github.repository_owner }} --author_url https://${{ github.repository_owner }}.github.io --github_url https://github.com/${{ github.repository }} --github-file-prefix https://github.com/${{ github.repository }}/tree/${{ github.event.release.tag_name }} --module-version ${{ github.event.release.tag_name }} --swift-build-tool spm --module swift_qrcodejs --root-url https://${{ github.repository_owner }}.github.io/swift_qrcodejs/ --dash_url https://${{ github.repository_owner }}.github.io/swift_qrcodejs/docsets/swift_qrcodejs.xml
run: jazzy --clean --author ${{ github.repository_owner }} --author_url https://${{ github.repository_owner }}.github.io --github_url https://github.com/${{ github.repository }} --github-file-prefix https://github.com/${{ github.repository }}/tree/${{ github.event.release.tag_name }} --module-version ${{ github.event.release.tag_name }} --swift-build-tool spm --module QRCodeSwift --root-url https://${{ github.repository_owner }}.github.io/swift_qrcodejs/ --dash_url https://${{ github.repository_owner }}.github.io/swift_qrcodejs/docsets/QRCodeSwift.xml
- name: Publish
uses: peaceiris/actions-gh-pages@v3
with:
Expand Down
20 changes: 0 additions & 20 deletions .github/workflows/mac.yml

This file was deleted.

11 changes: 11 additions & 0 deletions .github/workflows/pod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: CocoaPods

on: [push, pull_request]

jobs:
pod:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Lint CocoaPods
run: pod lib lint
4 changes: 3 additions & 1 deletion .github/workflows/spm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ jobs:
- name: Build
run: swift build -v
- name: Run tests
run: swift test -v
run: swift test -v --enable-code-coverage
- name: Codecov
uses: codecov/codecov-action@v1

linux:
runs-on: ubuntu-latest
Expand Down
22 changes: 22 additions & 0 deletions Example/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// swift-tools-version:5.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "QRCodeSwiftCLI",
products: [
.executable(
name: "QRCodeSwiftCLI",
targets: ["QRCodeSwiftCLI"]),
],
dependencies: [
.package(path: ".."),
],
targets: [
.target(
name: "QRCodeSwiftCLI",
dependencies: ["QRCodeSwift"],
path: "."),
]
)
18 changes: 15 additions & 3 deletions Example/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@
SOFTWARE.
*/

import swift_qrcodejs
import QRCodeSwift
import Foundation

let args = ProcessInfo.processInfo.arguments
let ENV = ProcessInfo.processInfo.environment

let link: String
if args.count > 1 {
link = args.last!
Expand All @@ -33,5 +36,14 @@ if args.count > 1 {
link = input!
}
let qr = try QRCode(link)
let inverse = "\u{1B}[7m ", normal = "\u{1B}[0m "
print(qr.toString(filledWith: inverse, patchedWith: normal))

let background, foreground: String
if ENV.keys.contains("__XCODE_BUILT_PRODUCTS_DIR_PATHS") {
background = " "
foreground = "MM"
} else {
background = "\u{1B}[7m "
foreground = "\u{1B}[0m "
}

print(qr.toString(filledWith: background, patchedWith: foreground))
17 changes: 5 additions & 12 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,16 @@ let package = Package(
name: "swift_qrcodejs",
products: [
.library(
name: "swift_qrcodejs",
targets: ["swift_qrcodejs"]),
.executable(
name: "swift_qrcodejs-cli",
targets: ["swift_qrcodejs-cli"]),
name: "QRCodeSwift",
targets: ["QRCodeSwift"]),
],
targets: [
.target(
name: "swift_qrcodejs",
name: "QRCodeSwift",
dependencies: [],
path: "Sources/"),
.target(
name: "swift_qrcodejs-cli",
dependencies: ["swift_qrcodejs"],
path: "Example/"),
.testTarget(
name: "swift_qrcodejsTests",
dependencies: ["swift_qrcodejs"]),
name: "QRCodeSwiftTests",
dependencies: ["QRCodeSwift"]),
]
)
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# swift_qrcodejs
# QRCodeSwift (swift_qrcodejs)

[![CocoaPods Version](https://img.shields.io/cocoapods/v/swift_qrcodejs.svg?style=flat)](http://cocoapods.org/pods/swift_qrcodejs)
[![CocoaPods Compatible Platforms](https://img.shields.io/cocoapods/p/swift_qrcodejs.svg?style=flat)](http://cocoapods.org/pods/swift_qrcodejs)
Expand All @@ -24,6 +24,8 @@ dependencies: [
]
```

... then add `QRCodeSwift` module/target from package `swift_qrcodejs` as your dependency.

</details>

<details>
Expand All @@ -47,14 +49,14 @@ github "ApolloZhu/swift_qrcodejs" ~> 2.1.0
<details>
<summary><strong>Manually</strong></summary>

Copy all the `.swift` files from the `Sources` folder into your project.
Add all the `.swift` files from the `Sources` folder into your project.

</details>

## Usage

```swift
import swift_qrcodejs
import QRCodeSwift

guard let qrCode = try? QRCode("Hello World!") else {
fatalError("Failed to generate QRCode")
Expand All @@ -66,11 +68,11 @@ For more, checkout the [documentation](https://apollozhu.github.io/swift_qrcodej

## Example Projects

- [swift_qrcodejs-cli](./Example/main.swift): lightweight command line tool to generate QRCodes.
- [QRCodeSwiftCLI](./Example/main.swift): lightweight command line tool to generate QRCodes.
- [EFQRCode](https://github.com/EyreFree/EFQRCode): popular Swift framework that generates stylized QRCode images.
- [Apple Watch Bilibili](https://github.com/ApolloZhu/Apple-Watch-Bilibili): login onto bilibili with QRCode.

## License

MIT License. Modified based on [qrcodejs](https://github.com/davidshimjs/qrcodejs).
See [LICENSE](./LICENSE) and each individual file header for more information.
See [LICENSE](./LICENSE) and each individual file header for more information.
2 changes: 0 additions & 2 deletions Sources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>swift_qrcodejs</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
Expand Down
9 changes: 4 additions & 5 deletions Sources/swift_qrcodejs.h → Sources/QRCodeSwift.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@
//

#import <Foundation/Foundation.h>
#import <Accelerate/Accelerate.h>

//! Project version number for swift_qrcodejs.
FOUNDATION_EXPORT double swift_qrcodejs_VersionNumber;
//! Project version number for QRCodeSwift.
FOUNDATION_EXPORT double QRCodeSwift_VersionNumber;

//! Project version string for swift_qrcodejs.
FOUNDATION_EXPORT const unsigned char swift_qrcodejs_VersionString[];
//! Project version string for QRCodeSwift.
FOUNDATION_EXPORT const unsigned char QRCodeSwift_VersionString[];
4 changes: 2 additions & 2 deletions Tests/LinuxMain.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import XCTest
@testable import swift_qrcodejsTests
@testable import QRCodeSwiftTests

XCTMain([
testCase(swift_qrcodejsTests.allTests),
testCase(QRCodeSwiftTests.allTests),
])
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/

import XCTest
@testable import swift_qrcodejs
@testable import QRCodeSwift

private func expect(_ generator: @autoclosure () throws -> QRCode, withFill fill: String, andPatch patch: String, toMatch expected: String) throws {
let qrCode = try generator()
Expand Down
32 changes: 32 additions & 0 deletions project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: swift_qrcodejs
options:
bundleIdPrefix: io.github.ApolloZhu
deploymentTarget:
iOS: 9.0
macOS: '10.9'
watchOS: 2.0
tvOS: 9.0
indentWidth: 4
tabWidth: 4
usesTabs: false
targets:
QRCodeSwiftCLI:
type: tool
platform: macOS
deploymentTarget: "10.9"
sources: [Example/main.swift]
settings:
CODE_SIGN_IDENTITY: "-"
dependencies:
- target: QRCodeSwift_macOS
QRCodeSwift:
platform: [macOS, iOS, tvOS, watchOS]
settings:
SWIFT_VERSION: 5.0
APPLICATION_EXTENSION_API_ONLY: 'YES'
PRODUCT_BUNDLE_IDENTIFIER: "io.github.ApolloZhu.QRCodeSwift"
EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200: 'arm64 arm64e armv7 armv7s armv6 armv8'
EXCLUDED_ARCHS: '$(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT)__XCODE_$(XCODE_VERSION_MAJOR))'
scheme: {}
sources: [Sources]
type: framework
102 changes: 1 addition & 101 deletions swift_qrcodejs.podspec
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
#
# Be sure to run `pod spec lint swift_qrcodejs.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec.
#
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/
#

Pod::Spec.new do |s|

# ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# These will help people to find your library, and whilst it
# can feel like a chore to fill in it's definitely to your advantage. The
# summary should be tweet-length, and the description more in depth.
#

s.name = "swift_qrcodejs"
s.version = "2.1.0"
s.summary = "Cross-appleOS SIMPLE QRCode generator for swift, modified based on qrcodejs."
Expand All @@ -32,108 +17,23 @@ Pod::Spec.new do |s|
s.homepage = "https://github.com/ApolloZhu/swift_qrcodejs"
# s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif"


# ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Licensing your code is important. See http://choosealicense.com for more info.
# CocoaPods will detect a license file if there is a named LICENSE*
# Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'.
#

# s.license = "MIT"
s.license = { :type => "MIT", :file => "LICENSE" }


# ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Specify the authors of the library, with email addresses. Email addresses
# of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also
# accepts just a name if you'd rather not provide an email address.
#
# Specify a social_media_url where others can refer to, for example a twitter
# profile URL.
#

# s.author = { "Apollo Zhu" => "[email protected]" }
# Or just: s.author = "ApolloZhu"
s.authors = { "ApolloZhu" => "[email protected]" }
s.social_media_url = "http://github.com/ApolloZhu"

# ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# If this Pod runs only on iOS or OS X, then specify the platform and
# the deployment target. You can optionally include the target after the platform.
#

# s.platform = :ios
# s.platform = :ios, "5.0"

# When using multiple platforms
s.ios.deployment_target = "8.0"
s.ios.deployment_target = "9.0"
s.osx.deployment_target = "10.9"
s.watchos.deployment_target = "2.0"
s.tvos.deployment_target = "9.0"


# ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Specify the location from where the source should be retrieved.
# Supports git, hg, bzr, svn and HTTP.
#

s.source = { :git => "https://github.com/ApolloZhu/swift_qrcodejs.git", :tag => s.version }

# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# CocoaPods is smart about how it includes source code. For source files
# giving a folder will include any swift, h, m, mm, c & cpp files.
# For header files it will include any header in the folder.
# Not including the public_header_files will make all headers public.
#

s.source_files = "Sources/**/*.{h,swift}"
s.swift_versions = ['4.2', '5.0']
# s.exclude_files = "Classes/Exclude"

# s.public_header_files = "Classes/**/*.h"


# ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# A list of resources included with the Pod. These are copied into the
# target bundle with a build phase script. Anything else will be cleaned.
# You can preserve files from being cleaned, please don't preserve
# non-essential files like tests, examples and documentation.
#

# s.resource = "icon.png"
# s.resources = "Resources/*.png"

# s.preserve_paths = "FilesToSave", "MoreFilesToSave"


# ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Link your library with frameworks, or libraries. Libraries do not include
# the lib prefix of their name.
#

# s.framework = "SomeFramework"
s.frameworks = "Foundation"

# s.library = "iconv"
# s.libraries = "iconv", "xml2"


# ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# If your library depends on compiler flags you can set them in the xcconfig hash
# where they will only apply to your library. If you depend on other Podspecs
# you can include multiple dependencies to ensure it works.

# s.requires_arc = true

# s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
# s.dependency "JSONKit", "~> 1.4"

end
Loading

0 comments on commit b8e452f

Please sign in to comment.