Post

Replies

Boosts

Views

Activity

TabBar Transitions
I have a TabBar with 3 items: Home ScrollView Products NavigationView Users NavigationView When clicking on the tabBar buttons, I will go back to the related view. However, at the point where I had left. I would like to every time I move to a different tab, it starts fresh like 1st time. a) If it's a scrollview, after coming back to the tab I would like the view scrolled to the top. b) If it's a navigationView, after coming back to the tab, I would like to scroll to the top and move to the Navigation root list. How can I do it. Thx folks
0
0
370
Dec ’21
Picker without NavigationView
I have a picker on my view but it's not selectable unless I replace my VStack for a NavigationView. However I cant have a NavigationView on this page, otherwise it brakes other parts. What's the solution for that ? Thx VStack { Picker }
4
0
2.0k
Dec ’21
Convert HTML to Text
In my SwiftUI project, I am trying to convert HTML to Text. Text("h1Test/h1p Test/pbr/spanTest/spanulliitem1/liliitem2/li/ul")           .font(.body)           .frame(maxWidth: .infinity, alignment: .leading)           .padding(.bottom, 16)           Is there a way to make it happen ? Thank you
2
0
5.3k
Feb ’22
WebView
I am trying to parse some html inside my app. Not an entire html page, but just few blocks of html code. So I'm using Ink package for that. // FIRST I HAVE A WEBVIEW import SwiftUI import WebKitstruct WebView : UIViewRepresentable {   var html: String  func makeUIView(context: Context) -> WKWebView {     return WKWebView()   }  func updateUIView(_ webView: WKWebView, context: Context) {     webView.loadHTMLString(html, baseURL: nil)   }} // IN HERE I'M PARSING THE HTML AND ALSO ADDING SOME STYLING TO IT import Foundation import Ink class ParseContent: ObservableObject {   var markdown: String = ""   func parse() -> String {     let parser = MarkdownParser()     let html = parser.html(from: markdown)       let htmlStart = "<HTML><HEAD></HEAD><BODY style=\"padding: 140px; font-size: 120px; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif\">"     let htmlEnd = "</BODY></HTML>"       return htmlStart + html + htmlEnd   } } // IN HERE I AM JUST USING MY PREVIOUSLY CREATED WEBVIEW WebView(html: myHtmlContent) .onAppear() {         htmlContent = ParseContent().parse()     } So here are my questions: Why the styling isn't working since I am concatenating the html ? I see it in a lot of tutorials but cant understand why not working. I would like to have the font inside my WebView, the same as I have for my other components like Text("abc") so I would keep a pattern and the visitor woudnt realize they are different components. How to set the WebView without a vertical scroll ? Keeping the entire height coming from the parsed html ? Thank you guys :)
2
0
1.1k
Jan ’23
TabBar Transitions
I have a TabBar with 3 items: Home ScrollView Products NavigationView Users NavigationView When clicking on the tabBar buttons, I will go back to the related view. However, at the point where I had left. I would like to every time I move to a different tab, it starts fresh like 1st time. a) If it's a scrollview, after coming back to the tab I would like the view scrolled to the top. b) If it's a navigationView, after coming back to the tab, I would like to scroll to the top and move to the Navigation root list. How can I do it. Thx folks
Replies
0
Boosts
0
Views
370
Activity
Dec ’21
Picker without NavigationView
I have a picker on my view but it's not selectable unless I replace my VStack for a NavigationView. However I cant have a NavigationView on this page, otherwise it brakes other parts. What's the solution for that ? Thx VStack { Picker }
Replies
4
Boosts
0
Views
2.0k
Activity
Dec ’21
Convert HTML to Text
In my SwiftUI project, I am trying to convert HTML to Text. Text("h1Test/h1p Test/pbr/spanTest/spanulliitem1/liliitem2/li/ul")           .font(.body)           .frame(maxWidth: .infinity, alignment: .leading)           .padding(.bottom, 16)           Is there a way to make it happen ? Thank you
Replies
2
Boosts
0
Views
5.3k
Activity
Feb ’22
WebView
I am trying to parse some html inside my app. Not an entire html page, but just few blocks of html code. So I'm using Ink package for that. // FIRST I HAVE A WEBVIEW import SwiftUI import WebKitstruct WebView : UIViewRepresentable {   var html: String  func makeUIView(context: Context) -> WKWebView {     return WKWebView()   }  func updateUIView(_ webView: WKWebView, context: Context) {     webView.loadHTMLString(html, baseURL: nil)   }} // IN HERE I'M PARSING THE HTML AND ALSO ADDING SOME STYLING TO IT import Foundation import Ink class ParseContent: ObservableObject {   var markdown: String = ""   func parse() -> String {     let parser = MarkdownParser()     let html = parser.html(from: markdown)       let htmlStart = "<HTML><HEAD></HEAD><BODY style=\"padding: 140px; font-size: 120px; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif\">"     let htmlEnd = "</BODY></HTML>"       return htmlStart + html + htmlEnd   } } // IN HERE I AM JUST USING MY PREVIOUSLY CREATED WEBVIEW WebView(html: myHtmlContent) .onAppear() {         htmlContent = ParseContent().parse()     } So here are my questions: Why the styling isn't working since I am concatenating the html ? I see it in a lot of tutorials but cant understand why not working. I would like to have the font inside my WebView, the same as I have for my other components like Text("abc") so I would keep a pattern and the visitor woudnt realize they are different components. How to set the WebView without a vertical scroll ? Keeping the entire height coming from the parsed html ? Thank you guys :)
Replies
2
Boosts
0
Views
1.1k
Activity
Jan ’23