Post

Replies

Boosts

Views

Activity

Reply to Show default detail screen in UINavigationController
I think I have fixed this, without making any changes to the UINavigationController but to the view body itself. NavigationView { // wrapping in NavigationView SearchBarNavigationView(text: $searchText) { Text(searchText) } content: { Text("Hello, World!") .navigationTitle("Title") } .navigationTitle("Title") // for back button title .navigationBarHidden(true) // hiding bar when showing main content .ignoresSafeArea() Text("No selection") }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’20
Reply to No ObservableOblect
Home needs to be passed the EnvironmentObject. In ContentView you could add @StateObject private var processStatus = processStatus() and pass this into Home() .environmentObject(processStatus()) // add this
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’20
Reply to SwiftUI - CustomSearchBar - Event for clicking on the circle with the X in the text field
You can use this method to dismiss a keyboard. extension View { func dismissKeyboard() { UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil) } } The x in the search bar generally means clear the text, not end editing. You could add an onTapGesture if you’re building the search bar in SwiftUI. It would be helpful to see the code you use to make this CustomSearchBar.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’20
Reply to Custom alignment for multiple stacks
I believe using this results in the correct alignment. extension HorizontalAlignment { private struct CenterLine: AlignmentID { static func defaultValue(in context: ViewDimensions) -> CGFloat { context[HorizontalAlignment.center] } } static let centerLine = Self(CenterLine.self) } Needing to add this to the container VStack(alignment: .centerLine) { ... } and this to the views in the HStacks .alignmentGuide(.centerLine) { $0[.trailing] } // for text label on left .alignmentGuide(.centerLine) { $0[.leading] } // for control on right
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’20
Reply to Playgrounds aborts w/ Shape
I have found that on iPad turning off Enable Results will result in little to no aborts called and the code will run quicker. With the setting on, even if your code is correct (without mistakes or bugs), the complier throws errors and aborts are called.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’20
Reply to Help please
ProgressView() was introduced to iOS14 but I don’t think that calling you’re own view struct that name is the problem. Try unchecking the Enable Results settings next to the run button. I find that this causes the problem with slow rendering and the Abort called messages, as it does say that it May reduce performance.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’20
Reply to It is possible to set a background image behind a FORM in swiftUI?
You can add this to your view struct:.onAppear { UITableView.appearance().backgroundView = UIImageView(image: UIImage(named: "imageName")) } It uses a bit of UIKit to change the background view behind the form, not including the rows. The image being passed in to the UIImageView needs to be a UIImage. Take a look at the documentation - https://developer.apple.com/documentation/uikit/uiimage if you need more information on how to configure one.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’21
Reply to Right sidebar
In SwiftUI, not yet. You could implement your own custom trailing sidebar in SwiftUI or integrate some UIKit but that would be quite difficult. You’ll have to wait for WWDC21 for any improvements to SwiftUI.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’21