Search results for

swiftui

16,614 results found

Post

Replies

Boosts

Views

Activity

Very simple Cocoa/SwiftUI app suddenly doesn't work anymore
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
2
0
1.4k
Jul ’19
The app references non-public symbols "Combine"
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!
6
0
2.3k
Jul ’19
SwiftUI Gobbling Up CPU
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....
9
0
7.9k
Jul ’19
SwiftUI: Editable TextField in draggable VStack
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:
1
0
1.4k
Jul ’19
SwiftUI : Why is my keyboard not showing?
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
4
0
8.9k
Jul ’19
SwiftUI touchUpInside ?
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?
1
0
3.8k
Jul ’19
Cannot Stack .presentation (Alerts)
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?
1
0
809
Jul ’19
Reply to SwiftUI touchUpInside ?
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:
Jul ’19
Odd compiler error with using .assign() to a keypath
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() } })
2
0
1.9k
Jul ’19
Reply to SwiftUI : returnKeyType
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:
Jul ’19
Reply to SwiftUI : returnKeyType
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:
Jul ’19
Going from one view to another via a Button & SwiftUI
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
0
0
424
Jul ’19