Hi,
Private Relay is already out. And it has been pretty stable from my experience.
Take care
David
Post
Replies
Boosts
Views
Activity
Hi,
the error message says "no such module" and to my knowledge there is no swift library called parse. Try removing line 2 as your view is not using any other libraries than UIKit. If you are using a third party library or package from git make sure to use the package manager found under "File" -> "Packages".
Take care,
David
Hi,
not quite sure if your question is regarding the available storage space, or the download itself.
But if your device has not enough storage available you can temporarily offload apps to free up space, or upload images and files to iCloud to free up enough space to download the file of your choice.
Either way remember that filling your phones storage up so much can lead to software updates not working and therefore system data can build up.
Take care
David
Hi,
based on the code you shared I would change two things.
If the class contains nothing but a single @Published variable I would just declare a single variable in your ContentView:
struct ContentView: View {
@State private var response: String = ""
...}
And to get rid of the error you have to publish the changes on the main thread(the error warns you because a data task is running on a background thread and also completes on one and therefore any changes you want to display need to be on the main thread).
private func makeRequest() {
URLSession.shared.dataTask(with: URL(string: "https://my-json-server.typicode.com/typicode/demo/posts/1")!, completionHandler: { data, _, _ in
DispatchQueue.main.async{
self.response = String(bytes: data!, encoding: .utf8)!
}
})
.resume()
}
The first part with the class is optional but there is no need for a separate class with a single value :)
Take care
David
Hi,
based on their response they either believe that it is not relevant that your app needs the users location to give personalized suggestions, or they are missing some information like a good NSLocationUsageDescription.
Either way two things you can try to improve your review:
Check that the user can opt out of using their location - then just display random topics and tell the user that for more personal results they need to grant location access.
Make sure that you are only asking for LocationWhenInUse permission and not LocationAlwaysPermission as the second option needs a proper reason to be used in an app.
When all of the above is met make sure that you tell the user exactly why you need their location. For Instance show a splash screen and explain what the location permission is for and why it is a good idea to grant access to it.
Hope this helps
Take care
David
Hi,
it looks like there is more code than is shown in your screenshot. Could you share the entire View you are trying to preview?
Alternatively your Mac could struggle building your preview, are any other apps running that could eat up your performance?
Take care
David
Hi,
I would start by wrapping your ScrollView in a ScrollViewReader. With this property you can programmatically scroll to positions and even animate them. By giving the last item in your list an id like so .id(topID) you can scroll to this item using .scrollTo(_anchor)
Hope this helps,
take care
David
Hi,
Can you provide your complete view, including the @Binding selection and the parent view?
Take care,
David
Instead of showing a static text you could create a simple animation(like left to right) and display that where the thumbnail would be. This gives the user visual feedback that something is loading and happening and not that your app is frozen or stuck.
Hi,
you use the @Published wrapper for Observable Object and environment objects. They behave similarly to the @State wrapper, but can be used to get view updates from classes outside the current view, bind multiple views to one value and so on. So the only reason why you would want an @Published property is when you want to take advantage of the automatic view updates.
As you already mentioned, if any of your values change in the background you need to push these changes on the main thread. Because how should SwiftUI know that you want an update on your UI if the Object was modified by a background thread.
I don't white get why you would "confuse" the user by having the wrong status displayed. If you have a background task that needs to finish before changing the UI, you should use either a completion handler, or if your app targets iOS 15 you could use the async-await pattern...
Hi,
I am experiencing the same issue. The last beta has some weird effect on how the accent color is applied. Hopefully this issue will be fixed in a future release.
Take care,
David
Hi,
when you say it aborts on the line of the Circle view, what does the log say? Could you post the log message when your app terminates?
Take care,
David
Hi,
Based on your error messages you have two separate problems.
Multiline
"Cannot declare entity named '$reel'; the '$' prefix is reserved for implicitly-synthesized declarations"
This happens because $ is for Binding variables and ForEach does not work with Bindings. So you will have to remove the $ in the ForEach and also when declaring the variable inside the closure because you only get a one-way variable from ForEach.
That leads to the second problem. the view you have inside the ForEach requires a Binding Variable, which you can only get from @State, or @ObservedObject and because ForEach doesn't work with Bindings (yet) you will have to find a solution without binding the reel to the View. Maybe send the id of the reel into the next view and then fetch the full reel separately.
Take care,
David
Hi,
by looking at the other post I would recommend using a different model structure to achieve what you want. ForEach doesn't know what model you currently have and therefore can't access the values behind them, event if they have the same name. I would create a universal model that has a variable pointing at the type. And based on that type you can decide if you want to show a traffic sign, or a police sign.
enum SignType{
case PoliceSign
case TrafficSign
}
struct Sign: Codable, Identifiable{
var id: UUID
var type: SignType // use enum to define type
var image: String?
...
}
And by making the struct conform to Identifiable you will always have a unique id. Depending an the type you can then access the corresponding selection and solve the issue with mismatching models.
David
Hi,
I also had some problems with sheets and a Binding Bool in the past.
I would try two things.
Are you sure that the tmpEvent you set using showSheet() isn't returning an optional value that might be nil? you can try adding:
guard let tmpEvent = Event(context: viewContext) else{
print("found nil")
return
}
and if you see something in the log you know that it contains nil. This also prevents the sheet from being shown while the Event is nil.
In general I would avoid having optionals in your views because you always have to deal with optional values, or risking that your app is getting terminated because of force unwrapping.
If that doesn't work, try using an default value and see if it later on changes to the correct value. If this is the case, your sheet is presented before the event got an initial value...
Take care,
David