Post

Replies

Boosts

Views

Activity

Launch Screen Image
I have set in my info.plist file, the background and image I want for my launch screen. The image is 200px x 200px and for some reason, when the launch screen happens, the image gets stretched, not keeping the original size. How can I fix it ? Thank you
4
0
1.6k
Sep ’21
Calling API
The main view on my app brings data from 3 different API calls. So when the app starts, the data are still being returned, so nothing is seen but just a blank space. They are basically a Thumbnail and its title. What would be the best solution for that: Have a temporary thumb and a text like "loading" OR any other approach? Thank you
1
0
723
Sep ’21
Init or body ?
I have a store, but need to call the method inside the body. However the only way it works is if I call it inside init otherwise I have an error. @ObservedObject var store = MyStore() init(category: categoryModel) {     store.getData(categoryId: category.id) //here works } var body: some View {         store.getData(categoryId: category.id) //Here I will have the error: Type '()' cannot conform to 'View' Why ? Thx
1
0
516
Nov ’21
SF Symbols Fill
I am using SF symbols on my TabBar but even though I use the stroke version, it inserts the fill one. ProductsListView()         .tabItem {            Image(systemName: "book")            Text("Products")         } However, the image that shows up when I run the application in the book.fill Why this could be happening? Thx
2
0
2.3k
Nov ’21
Loading View on API call
I have a Loading view saying "Please wait" that I want to be presented until the data from the API comes back. However, self.showLoading = false is executed even before store.getHomeItems() is finished. How can I do it ? struct HomeView: View {   @State var showLoading = false ... if (self.showLoading == true) { LoadingView() } else { //my content } ... ScrollView { //my scroll content } .onAppear { self.showLoading = true       DispatchQueue.main.async {          store.getHomeItems()       } self.showloading = false ... } I also dont know if I can call Dispatch on my HomeView, since my API layer has also an another DispatchQueue. URLSession.shared.dataTask(with: url) { (data, _, _) in       guard let data = data else { return }               let myItems = try! JSONDecoder().decode([ItemModel].self, from: data)      DispatchQueue.main.asyncAfter(deadline: .now() + 10) {         completion(myItems)       }        }     .resume() Thank you
2
0
1.5k
Nov ’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
1.9k
Dec ’21
Call 2o API after finishing 1st one
I have a button that when pressed should call an API which return an ID. Then having this ID, I will call a 2nd API. Button(action: { var id = self.callApi1() self.callApi2(id) }) { Text("Start") } How can I call the Api2 JUST when the Api1 was finished and returned its value ? Thank you
3
0
533
Dec ’21
Text - Formatted HTML
I have an app where I am bringing some formatted text from the database. The problem is when I use: Text(myDataComingFromJson), of course, my text will be something like: I've created an extension where I can remove the HTML tags but then all my text will be in only one paragraph and the lists won't exist () The second approach would use WKWebView but then I will have some headaches formatting text or loading extra views to do the job. Question: Is there a way to use Text directly, but keeping break lines and lists? Even though I have to change the content at the database level ? I also have tried using \r\n in the database but still didn't work. Is there a better solution? Thank you all
1
1
456
Aug ’21