Swiftui Questions
Ad
Warning: "Modifying state during view update, this will cause undefined behavior." in UIViewRepresentable
So i have a uiviewrepresentable which wraps a uitextfield, and i get this error during the textfieldshouldchangecharactersinrange
SwiftUI function shows "Modifying state during view update, this will cause undefined behavior."
The code works in that it brings up 5 random consonants and 2 vowels just like i want, but it is showing a warning message that "modifying
Swiftui Force Update View
In my content view i have a home page with some text that says "welcome, xxxx" where xxxx is the name fetched from a firebase database.
SwiftUI Text being truncated unexpectedly
I have an hstack with three elements, as such: hstack(alignment: .firsttextbaseline) { text(title.uppercased())
Swiftui Navigation link not updating correctly with each individual user's page in a gridview
I am trying to achieve a view with users in a vgrid, when a user's profile picture is tapped it should go directly to his/her profile. i have
Transparent section header?
I'm creating a transparent list with transparent rows and section headers. but as soon as the rows slide under the section
Faild to decode JSON, SwiftUI
I can’t seem to decode my json. it locates, and loads, but fails to decode. here is the json example: [{ "name":
Placing the toggle sidebar button on the sidebar toolbar
I have a three column layout macos application with the first being the sidebar. i have a button that toggles that enabling the user to hide the
Swift, fetching data in viewmodel and passing it to view
I'm trying to update data in my viewmodel here is my viewmodel; import swiftui import corelocation final class
Cannot create var
I'm facing a problem with creating an variable. here's an example what i've wanted to do: i have json data in [ ]. i'm choosing smth in the
Ad
SwiftUI when can i use if statement in result builder?
I notice that sometimes i am able to use if-else statement in swiftui's result builder just fine. for example, inside a body:
SwiftUI open a new View on link click inside of WKWebView
I would like to open a new view in swfitui (webview) after clicking on a link inside of wkwebview, i do not know how to do. i understand that you
SwiftUI how to force a divider for navigation bar in NavigationView
My app has simple navigation logic using navigation view. i use the inline style navigation bar: mainview
SwiftUI: @State variable does not update View when its value changes (within same View)
I am very new to swiftui. maybe i am not completely understanding how @state annotated variables work. as far as i know, when you update their
Cannot use instance member 'service' within property initializer; property initializers run before 'self' is available
Im trying to get longitude and latitude from struct gservice and set it on a map. but can't initialize @state var region, because of
Class or View isn't updating
Basically, i have a class which fetches profile info from firestore, but when i edit the profile and submit the changes and return to the profile
Using CoreData as dynamic Widget Intents in SwiftUI
I've followed along the apple developer code-along videos
Swift get data from service in view model
Hi i'm a beginner at swift and i'm using a viewmodel and i'm trying to fetch data from an api i've setup locally as follows; // //
Status Bar is transparent with UIHostingController
The following is a simplified project to highlight the problem, which i have in a real project. i have a project, where i add a swiftui
SwiftUI List scrolls to the top on tapping to view sheet
I have a list in my view that has an ontapgesture on each of the items in the list that is set to display a
How do I let text retrieved from Firestore load upon the view being shown?
Intro hi there. i recently asked a different question asking how to implement user-triggered fcms. i quickly realised that in order to
Ad
iOS: Firebase: Database lives in a different region. Where to put the link?
I am new to swiftui and i am currently making my first ever firebase app. (xcode swiftui ios 15.0) i have this problem. when i want to save
How to subscribe to EventKit changes in SwiftUI?
I am trying to understand how to subscribe to eventkit calendar event updates within swiftiu. the eventkit documentation shows how to do
SwuiftUI Custom Sorting
I'm just starting out in swuiftui so bear with me. i have a game stuct that has a field lastupdated and title. i want to have the choice to sort
Fastest component that works with NSAttributedString?
Looks like nstextfield is too slow for work with large attributed texts. 1000 rows with 18 symbols each are slow
SwiftUI passing an observed object into a new view and getting updates
I am very new to swift working on my first app and having trouble having a view update. i am passing an object into a new view, however the new
NSInvalidArgumentException: nil is not a valid object ID
My app currently uses a navigationlink to open a view like this: lazyvgrid(columns: gridlayout, spacing: 10) {
SwiftUI getby UUID
I'm pretty new to swiftui so i'm hoping someone can help me out here. i have a uuid and i am trying to save content into that specific object, but
False error? `Variable used before being initialized` DURING initialization in init()
Sorry for the non-sense example. tried to simplify it, still don’t get what’s going on. the following gives me variable 'self.greeting'
How to add an unescaped closure Swift Firebase
When i compile i get this error "the path to the document cannot be empty". to fix this, i should add an unescaped closure. how
Wrapping currency expression in a constant in SwiftUI
I am learning swift and xcode and there is a task that i have problems wrapping my mind around. there are three places where i use value
Declaring a temperature type variable in SwiftUI
I want to create a universal converter for temperature, distance and time. in each of the sub-main views the user should be able to choose the
Ad
Calling a sheet from a menu item
I have a macos app that has to display a small dialog with some information when the user presses the menu item "info". i've
SwiftUI decoding JSON from API
I know there are already some articles regarding this issue, but i could not find anything related to my json. this is how my json likes
How to use NavigationLink for List view swipe action
I'm wondering how to place navigationlink into swipeactions section in code below. code itself is compiled without any issue but when i tap
Change a rotation of AnchorEntity in RealityKit
I placed 3d object to arviewcontroller after 3 seconds of placing object, then i want to rotate object by 90 degrees:
Save the selection state of the current selected item on a list
A macos app that works with local files need to reload the files when it gets focused again. this is to load any new files that might have been
How would I wrap the subtitle for the image url so that it leads to another screen?
I am trying to allow a user to click on a picture and allow them to get information about that image, how would i go about that? i was thinking
@StateObject vs @ObservedObject when passed externally but owned by the view
Based on this answer:
Is there a way to keep rounded corners when scrolling through content vertically in scrollview
Before scrolling starts, everything looks great with rounded corners displaying on the screen. the problem comes when user starts scrolling
How to stop TabView from reloading entire view on @StateObject changes?
I have a variable within my @stateobject that is used to show new message notifications. it is updated periodically from my backend
SwiftUI : Converting Int16 to String
I'm learning swift and i have problems displaying the result of a pickertextfield as an string instead of an int16... i'm using an int16 because i
Swift UIApplication not in scope
I want to change isidletimerdisabled when a specific view appears. in swiftui i use .onappear { uiapplication.shared.isidletimerdisabled =
Ad
Thread 1: "+[UIImage systemImageNamed:]: unrecognized selector sent to class 0x111e616e0"
Thread 1: "+[uiimage systemimagenamed:]: unrecognized selector sent to class 0x111e616e0" this error occurs in
SwiftUI - Get data in remote JSON data to refresh on App startup
I am a noob (and my code/model currently will show it so please go easy on me!). i’m taking a first whack at creating a recipes style
How can define an enum for Shape with defined and custom shapes
If we look to clipshape modifier .clipshape(shape: shape) it is a function that takes a shape and do it works! i
(SwiftUI) can anyone tell me why my NavigationView is creating extra NavigationBars and blank space in the footer? (video included)
I have an app with 3 views. they are connected by a navigationview and have navigationlinks that link to the next view. however, all views are
How to remove special characters from the `TextField` in SwiftUI
I need to apply some validations in my form like remove special character, accept only number, alphabets,
How do I take the name of the Firebase document? Swift
How do i take the name of the firebase document, directly from the information of the logged in user? basically i have a user collection
How to round corners in Custom Shapes in SwiftUI?
i want to add round corner (corner radius) in my custom shape. i'm having trouble using path.addcurve or
The body of view to be destroyed gets called (but it shouldn't)
While verifying how binding invalidates a view (indirectly), i find an unexpected behavior. if the view hierarchy is
SwiftUI ForEach statement iterate the list twice
I've got foreach loop inside a picker widget, that suppose to iterate a list of items (handler.items). however, in reality, i
Global view which blurry overlays other views and can be easily called
A similar question is asked here:
Why can i create local variables in a view builder in SwiftUI
I think i used to get error complaining about having a local variable in the view builder. i also looked up online and found this:
Ad
How to make text properly aligned with padding in SwiftUI?
So i have these two texts that i'm trying to align at the same pixel basically, but it seems that one is more offset than the other. like so, the
SwiftUI: Saving likes in CoreData for each individual cell
How do i save the like state for each individual cell? i decided to save via coredata, but the like is saved for all cells at once. in the
SwiftUI using ForEach and onTapGesture to update selected element causing crash
I have some code that i am using, the idea is that the user selects a card they like and a sheet is presented to show more information about that
How to remove blank space between two text views in SwiftUI
I have a problem with a text view. i have a list of menu products, and the products contains a description. but, when a product don't have a
SwiftUI: Pattern matching causes view to animate incorrectly
I'm implementing a very simple view (childview) that will slide up from the bottom of parentview when a button is
How to pass SwiftUI View as function parameter?
I want to show swiftui views as subview of a uiviewcontroller. these views must implement a protocol. i have
Use data from CoreData in label
World! i work in swiftui, i want to use data from coredata in label. use likeddbe.isliked instead of
How to use @Viewbuilder and return view in swiftUi?
I have overlay with below code .overlay(abcviewmodel.iserror ? anyview(dialogboxonebutton(accessibilityid: "dialogboxes",
ToolbarContent: add a .disabled(Bool) method
I've created a custom toolbarcontent for common buttons, such as save, edit, cancel, etc... for example:
In SwiftUI how can I clip a part of a view with another view?
I am trying to overlap two circles in swiftui and have a margin between them. i am presently using this method: zstack {
NavigationLink jumps back when @ObservedObject is changed and @AppStorage is used
I've tracked down an annoying bug in my code and managed to recreate the issue using xcode's default ios app as a starting point and adding a few
Ad
SwiftUI Setting Bind<String> in Text field
I've got the following object that contain list of strings: class handler: observableobject { @published var items = [string]() }
Conditionally updating a second property during animation in SwiftUI
I have an animated arc drawn in swiftui that represents data coming from two devices. when the arc animates to the left, the
AsyncImage not loading inside VStack
When using an asyncimage inside a vstack, the image never loads. the handler is called once, and the
SwiftUI sheet closure capture list syntax
How would i add capture list to a swiftui .sheet(content: ) closure? i have a sheet in swiftui and in the content: closure i check the
What's the difference between `Task` and `async` in SwiftUI
So i have seen code like: func dosomething() { async { let foo = await something() } } vs
Understanding Preferences in SwiftUI
Ios 15 swift 5.5 trying to understand preferences, but struggling with geometryreader i crafted this code reading a tutorial, but it
Perform SCNAction using a button (SwiftUI)
With uikit i have created a sceneview with an object, that can perform scnactions when a button has been pressed: import uikit
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
SwiftUI: didSet doesn't update view
In the following, reproduced example, i have the following code which makes up a single screen. there's a lot of code, but it's simple!
How to inject a Model from the Environment into a ViewModel in SwiftUI
I am trying to mvvm my swiftui app, but am unable to find a working solution for injecting a shared model from @environmentobject into the app's
swiftUI: strange behavior with AVAudioPlayer
I want to build an onboarding screen for an app especially for blind people. so the pages should play a small mp3 file. but if i implement
Ad
Having trouble initializing sub-view when navigating to it from parent?
I am trying to navigate to a subview and initialize it from a property passed from the parent view without using onappear.
iOS widget background-image goes black after couple of minutes
I am currently developing an ios widget with swiftui and have a strange behaviour of the background-image of my medium-sized widget. i am
How would I code this Tab Bar in Flutter?
I have some experience with swiftui and i wrote this code some time ago. i am currently learning how to use flutter to build ui. how would i go
TextField Can't input number in ios 14.5
Textfield input number but text no display in ios 14.5 ??? i have a text to display a num, then touch will show the text field and checkmark to
SwiftUI Picker unable to transfer data from Picker to Binding variable
Hopefully you can see what i'm trying to achieve from the code below but simply put, i'm trying to update .selectedtown which is binded to my
I try to create a Button with Drag Gesture like the bubble messenger of android
I created an image with drag gesture, but when i convert it to a button, full screen become the button, so when i click to anywhere in the screen,
How to increase or decrease the probability of an item of an array being picked
Lets say i have an array of numbers like this: // create array of numbers let numbers =
Restructure NavigationLink to Button for LongPressGesture
I am trying to put an option for .onlongpressgesture for this list of groups. however, it doesn't seem to work and i figure, it will work on
swiftUI move transition with a draw limit?
I have a transition between two texts i want to mimic with a swiftui transition. this is my reference:
iOS SwiftUI - How to stick a label to a rotating view without the label rotating too?
This is the desired outcome
SwiftUI: Binding in initializer: default value
Consider the following example: struct testview: view { @binding private var value: string init(value:
Ad
SFSafariViewController - How to change the color of the address bar and tab menu
How to change the color of the address bar and tab menu in swiftui 3.0 using sfsafariviewcontroller. i've tried various things, but that
value being constant in swiftUI
I am sorry im not sure that the title makes sense but if u read, im sure u will understand my problem. i have declared a variable @state
SwiftUI: State variable from observed singleton property leads to error
I use a singleton to access subscription offerings from revenuecat as an @observedobject on various views in the app:
Swift UI - Closure containing control flow statement cannot be used with result builder 'CommandsBuilder'
I'm trying to check if my array contains the machine learning model output, but its giving me this weird error, and i don't understand it.
How can I wait until all Combine publishers finished their jobs in Swift?
I'd like to be notified the moment all combine publishers have done their work like dispatchgroup and .notify do.
Cannot convert value of type 'Image' to expected argument type 'UIImage'
I am using an imagepicker to select an image from library and store in coredata (as binary). in another view this selected image is shown as a
I want to set a background to the TabBar
I don't know how to change the background of the tabbar by an image (i try to change the background of tabbar, not try to change the tabbar icon
SwiftUI bug with navigation view rotation?
While testing my app to make sure it behaves properly under screen rotations, i discovered that navigation links do not work after a certain
Child NavigationView doesn't honor modifiers on iOS 15
I have an issue with a child navigationview that doen't honor modifiers like you can try and see with below single code file working
Disable autocorrect on an iOS 15 SwiftUI searchable search bar
I have a swiftui and core data app and have implemented the new ios 15 search bar api. .searchable(text: $searchtext) // this is a
Matched Geometry Effect with AsyncImage iOS 15
Consider the following example: struct contentview: view { @state var showsplash: bool = true @namespace var
Ad
iOS 15: Navigation link popping out, again
In the last few months, many developers have reported navigationlinks to unexpectedly pop out and some workarounds have been published, including
Prefill textfields in SwiftUI is broken in iOS 15
In ios 14 i've following code which prefills all textfields from the coredata model struct editsimplesearchview: view {
Ad
Blog Categories
Ad