This text is sensitive. Try generating new copy.
Back in the early days of computers, text was copied to the display and then the rest of the display was scrolled to show the rest of the text. It’s all been changed now—there are more complex mechanisms and I think it’s time we introduced another!
Code reader
A simple macOS application for reading code from images, written entirely in Swift using the Vision Framework.
Use
- Drag and drop image
- Press the conversion key
Storyboard converted to Swift – https://swiftify.com/converter/storyboard2swiftui
import Swiftul
import Introspect
// TODO : Install the SwiftUI-Introspect package from https://github.com/siteline/SwiftUI-Introspect
// DefaultViewController
1/
struct DefaultView : View {
@State private var fullText : String
var body : some View
Stack( alignment : topLeading)
GeometryReader { geometry
TextField( Placeholder, text : $fullText)
introspectTextField(customize : { textField in
textField.adjustsFontSizeToFitWidth = true
extField. backgroundColor = UIColor. systemTeal
textField. minimumFontSize = 17.
textField. Superview. frame = CGRect(x : DynamicSizeHelper.get0ffsetX(20), y :
DynamicSizeHelper-get0ffsetY(274), width : DynamicSizeHelper. getWidth(280), height :
DynamicSizeHelper.getHeight(18.5))
})
. frame (width : DynamicSizeHelper. getWidth(280), height :
DynamicSizeHelper.getHeight(18.5))
. Font(. system(size: , weight: . regular))
.offset(x: DynamicSizeHelper.getoffsetX(20), DynamicSizeHelper.get0ffsetY(274))
TextField( placeholder, text: $fullText)
prospectTextField( customize: t textField in
textField.adjustsFontSizeToFitWidth=true
textField. backgroundColor UIColor. systemRed
textField. clearButtonMode = . whileEditing
textField
mFontSize = 17.0
textField. . Frame = CGRect (x : DynamicSizeHelper. getOffsetX(20), y :
DynamicSizeHelper-get0ffsetY(202), width : DynamicSizeHelper.getWidth(280), height :
DynamicSizeHelper.getHeight(26,5))
}
– frame(width : DynamicSizeHelper-getwidth(280), height :
DynamicSizeHelper.getHeight(2
font(. system(size: 14, weight: . regular))
offset(x: DynamicSizeHelper.get0ffsetX(20), y: DynamicSizeHelper.getOffsetY(202))
TextField(placeholder, text: $fullText)
introspectTextField( adjust: { textField in
textField. adjustsFontSizeToFitwidth = true
textField. backgroundColor: UIColor. systemPurple
textField.clearButtonMode=.unlessEditing
textField. minimumFontSize = 17. 0
textField. Superview. frame = CGRect (x : DynamicSizeHelper.getOffsetX(20), y :
DynamicSizeHelper-getOffsetY(136), width : DynamicSizeHelper.getWidth(280), height :
DynamicSizeHelper.getHeight(28.5))
F
frame (width: DynamicSizeHelper.getWidth(280), height:
DynamicSizeHelper-getHeight(28.5))
font ( .
(size: 14. weight: .regular))
.offset(x: DynamicSizeHelper.get0ffsetX(20), y: DynamicSizeHelper.getOffsetY(136))
TextField( placeholder, text: $fullText)
textFieldStyle(RoundedBorderTextFieldStyle())
introspectTextField(customize: textField in
textField.adjustsFontSizeToFitWidth=true
textField. backgroundColor = UIColor. systemOrange
textField.clearButtonMode= always
textField.minimumFontSize = 17.0
})
frame(width: DynamicSizeHelper-getWidth(280), height:
DynamicSizeHelper.getHeight(34)) Police
(. system (size: 14, weight: regular))
.offset (x: DynamicSizeHelper.get0ffsetX(20), y: DynamicSizeHelper.getOffsetY(75))
. frame(width: DynamicSizeHelper.getwidth(320), height: DynamicSizeHelper.getHeight(568))
. background( color(.)
dgesIgnoringSafeArea(.all)
struct DefaultView_Previews: PreviewProvider {
static var previews : some View
DefaultView()
Dynamic Size Helper
struct DynamicSizeHelper {
static let baseViewWidth : CGFloat = 320.0
static private
t baseViewHeight :
GFloat
568.(
static func getHeight (_ height : CGFloat) -> CGFloat
return (height baseViewHeight) * UIScreen. Main. bounds. height
static func getWidth(_ width : CGFloat) -> CGFloat
return (width baseViewWidt
UIScreen.
in. bounds. width
static func get0ffsetX(_ x : CGFloat) -> CGFloat
return (x / baseViewWidth) * UIScreen. main. bounds. width
}
static func get0ffsetY(_ y : CGFloat) CGFloat
return ( y / baseViewHeight)
UIScreen.
a. Boundaries. Height.
macOS
macOS Catalina
Download the application directly. https://github.com/Ibrahimhass/CodeReader/releases/download/1.0.2/CodeReader.zip
Author
Md Ibrahim Hassan, [email protected].
GitHub
https://github.com/Ibrahimhass/CodeReader
Related Tags:
swiftui macos app exampleswiftui macos app tutorialapple developer sample codeswiftui macos exampleswift macos app tutorialswiftui tutorial,People also search for,Privacy settings,How Search works,swiftui macos app example,swiftui macos app tutorial,apple developer sample code,swiftui macos example,swift macos app tutorial,swiftui tutorial,how to make a mac app without xcode,swiftui macos menu bar