Search results for

swiftui

16,584 results found

Post

Replies

Boosts

Views

Activity

Selecting wrong image from Light/Dark choices
I have an icon. I made a white version so I could support dark mode. But when I put the preview (SwiftUI) to dark mode, I get what is in Any, not what is in Light or Dark. So I have a white outlined version in Dark and a black one in Light and then I cannot leave Any empty. Whatever I put in there is what I will get. I am thinking maybe I have to do something in the app (I do with Material on Android), but that does not seem to be the case as the demos did not show any code changes. Maybe it's a bug?
0
0
513
Jun ’19
SwiftUI Failures in Interfacing with UIKit sample
There are several faliures with completed project https://developer.apple.com/tutorials/swiftui/interfacing-with-uikitI'm listing them all here since I can't find a way to submit a bug report via Feedback Assisstant.Tested on beta 1 and beta 2 in simulator and on device.--- Run the completed project and you get compile error in Home.swift: Incorrect argument labels in call (have '_:destination:', expected 'destination:label:') PresentationButton( Image(systemName: person.crop.circle) .imageScale(.large) .accessibility(label: Text(User Profile)) .padding(), destination: ProfileHost() )Trying the suggested fix, give another error, for which no fix was suggested: Extra argument 'labeldestination' in callI was able to fix by making call like other button: PresentationButton(destination: ProfileHost()) { Image(systemName: person.crop.circle) .imageScale(.large) .accessibility(label: Text(User Profile)) .padding() }--- User Profile can only be openned once.Open the Profile by touching upper right icon, Pro
1
0
2.1k
Jun ’19
Index out of range for TextField binding to an element in an array
I want to create a UI that allows me to create an arbitrary list of strings. For this, I have created a UI that has a button to append strings to a String Array. I also want to be able to arbitrarily remove any of the strings, so I have another button next to each element that removes it from the array. If I use a simple `Text` view, everything works just fine; however, if I change to using a `TextView` to allow the user to change the value, then I get an index out of range error when trying to remove an element from the array. Digging in it looks like although the element is removed from the array, the view acts as if it hasn't been removed. I'm not sure if I'm doing something wrong or if this is a bug.To reproduce:1. Create an iOS project with SwiftUI2. Replace the default ContentView.swift code with the following:import SwiftUI struct ContentView : View { @State var myList: [String] = [] var body: some View { VStack(alignment: .leading) { AppendButton(myList: $myList) ListView(myList: $myList) Spa
1
0
1.9k
Jun ’19
SwiftUI works in simulator but not on device iPhoneX
I am running Catalina beta on a Mac Mini using Xcode 11 beta. I attempt to write a short app using the SwiftUI ContentView. It runs perfectly in the simulator but not on my iPhone running iOS 13 beta. Fails with EXC_BAD_ACCESS error. An app without the SwiftUI works fine both in simulator and on the device. Has anyone else encoutered this?
3
0
2.8k
Jun ’19
UIViewControllerRepresentable memory leak with SwiftUI
I have created a very simple example of how a UIViewController represented by UIViewControllerRepresentable is never deallocated.struct ContentView : View { @State private var showRepView = true var body: some View { VStack { Text(Square).font(.largeTitle).tapAction { self.showRepView.toggle() } if showRepView { SomeRepView().frame(width: 100, height: 200) } } } }The representation implementation follows:struct SomeRepView: View { var body: some View { RepViewController() } } struct RepViewController: UIViewControllerRepresentable { func makeUIViewController(context: Context) -> SomeCustomeUIViewController { let vc = SomeCustomeUIViewController() print(INIT (vc)) return vc } func updateUIViewController(_ uiViewController: SomeCustomeUIViewController, context: Context) { } static func dismantleUIViewController(_ uiViewController: SomeCustomeUIViewController, coordinator: Self.Coordinator) { print(DISMANTLE) } } class SomeCustomeUIViewController: UIViewController { override func viewDidLoad() { super.viewDid
3
0
4k
Jun ’19
Reply to How to create custom UIMenuItem for UITableViewController in Swift
This is not aimed at you Quincey - this stinks of a massive bug that should have been resolved with the introduction of the newer #selector syntax that allows the specification of a fully qualified path to the handling selector. In fact, the full qualification gets totally ignored and the nearest method with the same signature gets celled instead (in this case, the one in the cell).I have succeeded by putting a closure variable on the cell class and assigning that to the controller, and that executes correctly.I have also seen a couple of articles on calling along the responder chain from the cell to get the table view controller to respond and I am also going to try this out.I suppose we might not expect this kind of failing to be addressed soon; since SwiftUI seems to be the new shiny, I'm guessing those of us supporting legacy apps (that can't easily be moved to SwiftUI) by adding new features to them could be left high and dry.
Topic: UI Frameworks SubTopic: UIKit Tags:
Jun ’19
Really Basic Dark Mode implementation question
Let's say I create a SwiftUI View file called TestThen let's modify the PreviewProvider section to look like this:#if DEBUG struct Test_Previews : PreviewProvider { static var previews: some View { Group { Test() Test() .environment(.colorScheme, .dark) } } } #endifNow when I look at my preview, I notice that the Text color is different for the Light and the Dark mode, but the background color does not change by default. So the text on the Dark Mode Version will not show up since it is white on white.If I take my main section of code and then wrap the Text view in a List View like this:struct Test : View { var body: some View { List(/0 ..< 5/) { item in Text(/Hello World!) } } }then it handles changing the background color of the list to be black in dark mode so the white text shows up properly.My question is: Do we have to check manually to see if the mode is Light or Dark to change the Background color in code? Or is there a native container view to wrap the Text in this case inside that will ha
2
0
2.4k
Jun ’19