Skip to content

Commit

Permalink
Update tvos demo, update version
Browse files Browse the repository at this point in the history
  • Loading branch information
dagronf committed May 4, 2024
1 parent d33571d commit 485dc47
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
4 changes: 2 additions & 2 deletions DSF_QRCode.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = 'DSF_QRCode'
s.version = '18.6.0'
s.version = '19.0.0'
s.summary = 'A simple drop-in macOS/iOS/tvOS/watchOS QR Code generator view for Swift, Objective-C and SwiftUI.'
s.homepage = 'https://github.com/dagronf/QRCode'
s.license = { :type => 'MIT', :file => 'LICENSE' }
Expand All @@ -25,6 +25,6 @@ s.tvos.framework = 'UIKit'
s.watchos.framework = 'UIKit'

s.source_files = 'Sources/QRCode/**/*.swift'
s.swift_versions = ['5.4', '5.5', '5.6', '5.7', '5.8', '5.9']
s.swift_versions = ['5.4', '5.5', '5.6', '5.7', '5.8', '5.9', '5.10']

end
18 changes: 8 additions & 10 deletions Demo/QRCodeView Demo/Simple tvOS QRCode/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,15 @@ import SwiftUI

import QRCode

let qrcode: QRCode.Document = {
let d = QRCode.Document(generator: QRCodeGenerator_External())
d.utf8String = "https://www.apple.com.au"
d.design.foregroundColor(CGColor(gray: 1, alpha: 1))
d.design.style.background = nil
d.design.shape.eye = QRCode.EyeShape.Leaf()
d.design.shape.onPixels = QRCode.PixelShape.RoundedPath(cornerRadiusFraction: 0.5)
return d
}()

struct ContentView: View {
let qrcode = try! QRCode.build
.generator(QRCodeGenerator_External())
.url(URL(string: "https://www.apple.com.au")!)
.foregroundColor(CGColor(gray: 1, alpha: 1))
.backgroundColor(CGColor(gray: 0, alpha: 0))
.eye.shape(QRCode.EyeShape.Leaf())
.document

var body: some View {
VStack {
QRCodeDocumentUIView(document: qrcode)
Expand Down
8 changes: 8 additions & 0 deletions Sources/QRCode/QRCode+Builder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ public extension QRCode {
// MARK: - Setting content

public extension QRCode.Builder {
/// Set a custom generator for the builder
/// - Parameter generator: The QR code generator
/// - Returns: self
func generator(_ generator: any QRCodeEngine) -> QRCode.Builder {
self.document.qrcode.generator = generator
return self
}

/// Set the text to encode
/// - Parameters:
/// - text: The text
Expand Down

0 comments on commit 485dc47

Please sign in to comment.