A couple of weeks ago, I made my first litte Xcode project using SwiftUI.The ContentView is just a simple TabbedView using binding/state variable to select a tab.Code look like this:import SwiftUI struct ContentView : View { @State var selection: Int = 1 var body: some View { TabbedView(selection: $selection) { Text(Tab 1!).tabItemLabel(Text(Tab 1)).tag(1) Text(Tab 2!).tabItemLabel(Text(Tab 2)).tag(2) } } }Back then, when I first made the project, it was running fine.Now, it just crashes consistently with the log:dyld: lazy symbol binding failed: Symbol not found: _$s7SwiftUI5StateV13delegateValueAA7BindingVyxGvg Referenced from: /Users/asl/Library/Developer/Xcode/DerivedData/aaa-byucivzkosyehgdhjnjxicgrjnbi/Build/Products/Debug/aaa.app/Contents/MacOS/aaa Expected in: /System/Library/Frameworks/SwiftUI.framework/Versions/A/SwiftUIdyld: Symbol not found: _$s7SwiftUI5StateV13delegateValueAA7BindingVyxGvg Referenced from: /Users/asl/Library/Developer/Xcode/DerivedData/aaa-byucivzkosyehgdhjnjxicgrjnbi/Bu
Search results for
swiftui
16,614 results found
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I'm uploading a new SwiftUI app to Testflight. I use Combine to get data from my own REST API. I got an email from Apple saying that i'm using non-public APIs.We identified one or more issues with a recent delivery for your app, Tailosive Hub 1.0 (30). Please correct the following issues, then upload again. ITMS-90338: Non-public API usage - The app references non-public symbols in Tailosive Hub: _$s7Combine18PassthroughSubjectC4sendyyxF, _$s7Combine18PassthroughSubjectCACyxq_Gycfc, _$s7Combine18PassthroughSubjectCMa, _$s7Combine18PassthroughSubjectCyxq_GAA9PublisherAAMc.I'm not using any private APIs and following public documentations.Thanks in advance!
I have beel fiddling with SwiftUI and it has taken up a huge amount of CPU %. Has anybody else experienced this? It it takes forever to build. I think I have it confused.My Xcode is shut down, but I still have two swift processes running at 98%.Something wrong here....
I have a Tinder-like Vstack card that swipes left and right. The VStack contains an Image and a TextField below it. I want to drag the Image and have it drag the whole VStack, TextField included. It does that. However, the TextField also drags the whole VStack. I only want the Image to drag and have the textfield work as a textfield. Here is the code for the VStack.return VStack { VStack { Image(food) .resizable() .aspectRatio(1.0, contentMode: .fit) .clipShape(RoundedRectangle(cornerRadius: 50)) TextField(Leave a comment, text: $comment, onEditingChanged: { if $0 { self.kGuardian.showField = 0 } }) { commentText = self.comment } .padding() .background(GeometryGetter(rect: $kGuardian.rects[0])) .background(Color(red: 239.0/255.0, green: 243.0/255.0, blue: 244.0/255.0, opacity: 1.0), cornerRadius: 10.0) } .padding() .shadow(color: Color.black, radius: 15, x: 2, y: 2) .offset( x: viewState.width + dragState.translation.width // y: viewState.height + dragState.translation.height ) // .animation(.basic(duration:
SwiftUI makes it pretty hard to read wto whom a property applies.But, seems that .gesture(longPressDrag) applies to VSTack, not to the image, isn't it ?If so, it is normal that the textField in the stack responds to the gesture.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
I have a textfield set in a VStack. Everything is as it should be except that the keyboard is no longer showing up. Where did I mess up? How can I get the keyboard to show again?return VStack { Image(food) .resizable() .aspectRatio(1.0, contentMode: .fit) .clipShape(RoundedRectangle(cornerRadius: 50)) .gesture(longPressDrag) .padding() .offset(y: kGuardian.slide).animation(.basic(duration: 1.5)) .shadow(color: Color.black, radius: 15, x: 2, y: 2) TextField(Leave a comment, text: $comment, onEditingChanged: { if $0 { self.kGuardian.showField = 0 } }) { commentText = self.comment } .padding() .background(GeometryGetter(rect: $kGuardian.rects[0])) .background(Color(red: 239.0/255.0, green: 243.0/255.0, blue: 244.0/255.0, opacity: 1.0), cornerRadius: 10.0) } .padding() .shadow(color: Color.black, radius: 15, x: 2, y: 2) .offset( x: viewState.width + dragState.translation.width ) .presentation($showAlert) { Alert(title: Text(User commented on this photo!), message: Text(commentText), primaryButton: .default(Text(O
Hello,Is it possible to access the Now Playing view on watchOS with SwiftUI? Also, how do ensure that the information from MPNowPlayingInfoCenter appear? I have provided the metadata, but no Now Playing view appear.
Is there an equivalent of “touchUpInside” in SwiftUI?In UIKit, it was very easy to look for a touchUpInside event.With SwiftUI, we can attach a “tapAction”, but this will require re-training users to always be “quick and decisive” in their actions.Any hope for a more deliberative, slow-fingered user?
I am unable to use more than one .presentation in a SwiftUI view. Below is a simple example.import SwiftUI struct ContentView : View { @State private var showingAlert = false @State private var showSavedAlert = false var body: some View { VStack { Text(Hello World) Button(action: { self.showingAlert = true }) { Text(Save) } Button(action: { self.showSavedAlert = true }) { Text(Save2) } } .presentation($showingAlert) { Alert(title: Text(Save File?), message: Text(Do you want to save?), primaryButton: .default(Text(Save)) { }, secondaryButton: .cancel()) } .presentation($showSavedAlert) { Alert(title: Text(Another Save File?), message: Text(Do you want to save?), primaryButton: .default(Text(Save)) { }, secondaryButton: .cancel()) } } } #if DEBUG struct ContentView_Previews : PreviewProvider { static var previews: some View { ContentView() } } #endifDoes anybody have a workaround?
Thanks for answers in https://forums.developer.apple.com/thread/119202 for some help by pointing out using a DragGesture with a minimum distance of 0. This has helped in developing the following code to partially emulate a button. It gets a flash effect that ends when the gesture is finished. It still doesn't handle the inside part of touchUpInside - that detects if the touch is still inside before taking final action. The code creates a ViewModifier to make it easy to apply the flash effect.import SwiftUI struct PressedView: ViewModifier { // Produces a flash overlay when pressed @Binding var isPressed: Bool let myWhite = Color.init(.sRGB, white: 1, opacity: 0.5) let myWhite2 = Color.init(.sRGB, white: 1, opacity: 0.25) func body(content: Content) -> some View { if isPressed { return content.overlay(Color.clear.background(RadialGradient(gradient: Gradient(colors: [ myWhite, myWhite2]), center: .center, startRadius: 10, endRadius: 100), cornerRadius: 0)) } else { // NOTE: tried to return something
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
I'm working with Combine in Xcode 11 beta 3 and IOS 13 beta 3, and I'm hitting an odd compiler error. I'm not sure if I'm not specifying something sufficiently or completely, or if this is a error with the swift compiler not being able to correctly infer what it needs to know.I have a UIImageView reference, and I'm making my code is a Combine pipeline that retrieves a URL to populate that imageview and then (tries to use) assign to set it into place.The short form of this code (full code at https://github.com/heckj/swiftui-notes/blob/master/UIKit-Combine/ViewController.swift#L167-L231):URLSession.shared.dataTaskPublisher(for: URL(string: firstUser.avatar_url)!) // ^^ this hands back (Data, response) objects .handleEvents(receiveSubscription: { _ in DispatchQueue.main.async { self.activityIndicator.startAnimating() } }, receiveCompletion: { _ in DispatchQueue.main.async { self.activityIndicator.stopAnimating() } }, receiveCancel: { DispatchQueue.main.async { self.activityIndicator.stopAnimating() } })
What is the SwiftUI equivalent to returnKeyType? How do we implement it?
It depends on the keyboard. Which keyboard type do you use (Decimal, ASCII, default…)Found this thread to explain clearly how to set keyboard type (some include a done key) in SwiftUI.https://stackoverflow.com/questions/56517515/how-to-set-keyboard-type-of-textfield-in-swiftui
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
Then, you should get a return key at the bottom right. Do you get it ?What I understand is that is not yet possible to change directly in SwiftUI,there's no official way to do so at the moment. Your best bet at the moment is to wrap UITextFieldFromhttps://stackoverflow.com/questions/56517515/how-to-set-keyboard-type-of-textfield-in-swiftui
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
Hi,I am developing an app that has 5 buttons on the screen. Tapping on a button would take you to another viewController.How would I do this in SwiftUI?Here's my code:import SwiftUI struct MainSwiftUI : View { var body: some View { VStack { Button(action: {}) { // Text(Pick One) .cornerRadius(40) } .background(Color .red) Button(action: {}) { // action Text(Pick Two) .cornerRadius(40) } .background(Color .green) Button(action: {}) { // action Text(Pick Three) .cornerRadius(40) } .background(Color .blue) Button(action: {}) { // action Text(Disclaimer) .cornerRadius(40) } .background(Color.black) Button(action: {}) { // action Text(About) .cornerRadius(40) } .background(Color.black) } } } #if DEBUG struct MainSwiftUI_Previews : PreviewProvider { static var previews: some View { Group { MainSwiftUI() .previewDevice(Apple Watch Series 4 - 40mm) MainSwiftUI() .previewDevice(Apple Watch Series 4 - 44mm) } } } #endif