mirror of
https://github.com/writeas/writefreely-swiftui-multiplatform.git
synced 2024-11-15 01:11:02 +00:00
Set the font in the updateUIView method
This commit is contained in:
parent
6e60e0ded5
commit
7703e925b7
@ -17,17 +17,12 @@ private struct UITextViewWrapper: UIViewRepresentable {
|
|||||||
textField.delegate = context.coordinator
|
textField.delegate = context.coordinator
|
||||||
|
|
||||||
textField.isEditable = true
|
textField.isEditable = true
|
||||||
textField.font = UIFont.preferredFont(forTextStyle: .body)
|
|
||||||
textField.isSelectable = true
|
textField.isSelectable = true
|
||||||
textField.isUserInteractionEnabled = true
|
textField.isUserInteractionEnabled = true
|
||||||
textField.isScrollEnabled = false
|
textField.isScrollEnabled = false
|
||||||
textField.backgroundColor = UIColor.clear
|
textField.backgroundColor = UIColor.clear
|
||||||
textField.smartDashesType = .no
|
textField.smartDashesType = .no
|
||||||
|
|
||||||
let font = textStyle
|
|
||||||
let fontMetrics = UIFontMetrics(forTextStyle: .largeTitle)
|
|
||||||
textField.font = fontMetrics.scaledFont(for: font)
|
|
||||||
|
|
||||||
if nil != onDone {
|
if nil != onDone {
|
||||||
textField.returnKeyType = .next
|
textField.returnKeyType = .next
|
||||||
}
|
}
|
||||||
@ -41,6 +36,10 @@ private struct UITextViewWrapper: UIViewRepresentable {
|
|||||||
uiView.text = self.text
|
uiView.text = self.text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let font = textStyle
|
||||||
|
let fontMetrics = UIFontMetrics(forTextStyle: .largeTitle)
|
||||||
|
uiView.font = fontMetrics.scaledFont(for: font)
|
||||||
|
|
||||||
if uiView.window != nil && isEditing {
|
if uiView.window != nil && isEditing {
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
uiView.becomeFirstResponder()
|
uiView.becomeFirstResponder()
|
||||||
|
Loading…
Reference in New Issue
Block a user