Open kovs705 opened 2 months ago
Hi @kovs705
First of all, the context must be a @StateObject
, not @State
.
Can you fix that and see if it helps?
import SwiftUI
import RichTextKit
struct MyView: View {
@StateObject var context = RichTextContext()
@State var attributedNoteText: NSAttributedString = NSAttributedString(string: "Test text")
var body: some View {
RichTextEditor(text: $attributedNoteText, context: context) {
$0.setRichTextFontSize(50)
}
.focusedValue(\.richTextContext, context)
.frame(maxWidth: .infinity)
.frame(minHeight: 100)
.richTextEditorStyle(.init(font: .preferredFont(forTextStyle: .extraLargeTitle)))
}
}
#Preview {
MyView()
}
still small.. <img src="https://github.com/danielsaidi/RichTextKit/assets/56929597/db2c0f14-6507-4d5e-8f85-c36d7fe6eb30" width="356" height="665">
I'm trying to make a font bigger but I receive strange text in console:
my code:
result: <img src="https://github.com/danielsaidi/RichTextKit/assets/56929597/5e9f0404-8928-4e9f-ac18-b225507cee9f" width="356" height="665">