About 100,000 text, can be displayed using TextField However, there are other problems that do not want to be used, using Text is just to display a blank, but the position is occupied ScrollView can scroll. Is there a big god to help solve it, the code is very simple, there is nothing special?
VStack(alignment: .leading,spacing: 3){
ScrollView{
if let cnt = current?.content{
Text(cnt)
}
}
}
i try add .lineLimit(nil),.fixedSize(horizontal: false, vertical: true) None of them worked
I used another way, reading markdown files. The result is still the same
import SwiftUI
struct ContentView: View {
var body: some View {
VStack(alignment: .leading,spacing: 3){
markdownFileView()
}
}
}
struct markdownFileView: View {
let filepath = Bundle.main.url(forResource: "test", withExtension: "md")
var body: some View {
ScrollView{
LazyVStack{
// Show the markdown here
Text(try! AttributedString(
contentsOf: filepath!,
options: AttributedString.MarkdownParsingOptions(
interpretedSyntax: .inlineOnlyPreservingWhitespace
)))
}
}
}
}
@main
struct CustomPickerApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
I solved the problem with this