Questions tagged [swiftui-environment]

141 questions
0
votes
0 answers

swift DisplayMessageAction can I know its disappearance event

I use Message and SwiftUI Environment display an App Store message,I want to know the event or callback when the App Store message action disappears My project is UIKit frame,So I had to use UIKit call SwiftUI, I have a transparent…
0
votes
0 answers

SwiftUI - Localization: What is the difference between locale versions

I want to make my app show different view for the Japanese people. There are so many different ways to get SwiftUI's locale, what is the difference between them? @Environment(\.locale) var locale locale == Locale(identifier: "ja_JP") …
user14119170
  • 1,191
  • 3
  • 8
  • 21
0
votes
0 answers

Pin in swiftUI able to click and show small info text above it

I'm new to swiftUI and I made this view where you see a maps with different pins on it. I wanted it so when I click the pin it shows a little box above it with the info about the place (name, address) I found other threads about it but I couldn't…
robbe505
  • 13
  • 3
0
votes
1 answer

Work with Property wrappers in nested views in SwiftUI

I'm fairly new to SwiftUI and I ran into this issue trying to figure out how to work with Environment object in many views. I'm trying to move to the next view after successful login which is happening, I'm then updating @Published Isloggedin to…
0
votes
3 answers

Bug in SwiftUI? iOS 15. List refresh action is executed on an old instance of View -- how to work around?

I'm using the refreshable modifier on List https://developer.apple.com/documentation/SwiftUI/View/refreshable(action:) The List is contained in a view (TestChildView) that has a parameter. When the parameter changes, TestChildView is reinstantiated…
Travis
  • 2,961
  • 4
  • 22
  • 29
0
votes
0 answers

Changes in @Published ObservableObject not updating Views

I know there are a ton of similar threads, however after three weeks I cannot get this code working. Perhaps Stack Overflow can see an obvious error. Source of truth comes from this ObservableObject class where a locationManager function updates the…
0
votes
2 answers

How do I pass data from a variable in a view to a view model class

I have data contained in a variable called selectedFolderId, and the intent of this is I want to pass this data in this variable into a class whereby I read contents of my database from firestore anytime the ShoppingListItemsView loads. I would…
Emere
  • 45
  • 4
0
votes
2 answers

SwiftUI: Logout and switch screens from a popover

In my app, I have a View which is set to either a login View or a home TabView, depending on if the user is logged in. From the TabView, the user can go to a profile popover and logout. I want to switch back to the login View from this popover. I…
0
votes
1 answer

How do you return back to the HomeView after hitting a complete/submitted button?

I am running into an issue now. When I click on the button in my ResultsView, it does not go back to ContentView. It was previously working, and now is not for some reason. I have to use the navigation’s back button to go back to the ContentView.…
0
votes
2 answers

Strange behaviour with List View when using custom UITextField(by using UIViewRepresentable) as child views

I noticed that the Binding is not working as expected when we use UITextfield as subViews of a SwiftUI List with the help of UIViewRepresentable protocol. i have implemented like a dynamic form using List View and the Custom TextField Views, when i…
0
votes
2 answers

How can I load state from en EnvironmentObject in SwiftUI?

So I am working on a view where I want to load state from an EnvironmentObject which acts something like a database. I would like to achieve something like this: class MyDB: ObservableObject { func getName(_ id: RecordID) -> String { ... } …
sak
  • 2,612
  • 24
  • 55
0
votes
1 answer

How to hide label associated with disclosure button in picker displayed in form

i have a picker in form which is enclosed in Navigation View. The Picker item displays disclosure button with label text in it. Is there any way we can hide the label that is associated with disclosure button?. For example in the above image i want…
0
votes
1 answer

New To Swift: Im not sure why the names of the users are not displaying? Swift UI

So I created this project to learn Swift Ui but I am stuck. I can't figure out why the HomeView isn't displaying the name of the contact. I created the ContactModel to store the contact details and the ContactViewModel to store all of the contacts…
Nexteon
  • 39
  • 6
0
votes
0 answers

ObservableObject And Switching between views

am a beginner in swiftui, still learning how to deal with ObservableObject let me show my code and illustrate what is my question... JsonResponse as follows: { "error" : false, "user" : { "username" : "Maxwell", "id" : 84560, "name"…
0
votes
1 answer

Trouble using @environmentObject and @StateObject

I am creating my first app and I am having trouble using @EnvironmentObject and @StateObject. When I run the simulator it opens my ContentView(). I am trying to get it to where it opens the MainView(), which has a tabView. And now the tabView is not…
Zavien
  • 3
  • 2