Search results for

swiftui

16,582 results found

Post

Replies

Boosts

Views

Activity

Custom fonts in SwiftUI?
Is it possible to use custom fonts in SwiftUI? I can only find the title, subheadline, etc. type enumerations. But if I actually want to define a new font that I am importing to the project, how would I go about that?
3
0
17k
Jun ’19
Keyboard type in SwiftUI
Haven't seen anyone set, show or say how to set the Keyboard type for a TextField in SwiftUI yet. For example numberic or email keyboards etc.Can't seem to figure it out. Anyone else have any ideas?EDIT: For now there doesn't seem to be a way other than interfacing with UIKit. Doing so, one could interface with a UITextView and set the keyboard type there. Hopefully in the near future Apple will make simple things like choosing keyboard type and having password fields available in SwiftUI, but for now it seems we are stuck with interfacing.
5
0
12k
Jun ’19
Importing a SwiftUI View from another module results in initializer is inaccessible due to 'internal' protection level
I have declared a View called RootView inside a module called Core and marked its protection level as public. However after importing Core and attempting to use the view, I get the following error in the second image: RootView initializer is inaccessible due to 'internal' protection level.EDIT: So apparently I can't upload images. I have attached image links in another post, it needs approval apparently 😀
3
0
8.3k
Jun ’19
SwiftUI Light/Dark color doesn't work
Hi, I've followed this guide (Choose adaptive color for UI) https://developer.apple.com/documentation/appkit/supporting_dark_mode_in_your_interfaceBut still when I change the color schema to .dark the used color remains the Any.Is it a bug or do I have to do some configurations?
5
0
3.4k
Jun ’19
Shapes inside ScrollView not shown in SwiftUI?
Hello all,I'm just playing around with the new SwiftUI' ScrollView and I would like to draw some basic shapes inside the ScrollView. It compiles but does not show for an unknown reason. The Circle above the ScrollView is shown, but the ScrollView itself has no content shown and I would like to understand why? I added a size because it seams that SwiftUI is not knowing how to scale it - just an idea. import SwiftUIstruct ContentView : View { var body: some View { NavigationView { VStack { Circle().size(width: 40, height: 40).fill(Color.red) ScrollView(showsHorizontalIndicator: false) { HStack { ForEach(0..<100) { Circle().size(width: 40, height: 40).fill(Color.red) } } }.frame(height: 80) Spacer() }.navigationBarTitle(Text(Test)) } }}But when I embed this into a ZStack containing additional Text it works. Obviously, there is something like the position missing:struct ContentView : View { var body: some View { NavigationView { VStack { ScrollView(showsHorizontalIndicator: false) { HStack {
1
0
1.6k
Jun ’19
iPad Apps for Mac + SwiftUI
The Xcode 11 beta release notes mention:Xcode 11 beta doesn’t support working with SwiftUI in a project configured to use UIKit for Mac.Source: https://developer.apple.com/documentation/xcode_release_notes/xcode_11_beta_release_notesDoes anyone know if this is a temporary limitation that will be resolved before Xcode 11 is released? Or is this a fundamental limitation of SwiftUI?
2
0
905
Jun ’19
SwiftUI dismiss model
Since SwiftUI is declarative there is no `dismiss` methode.How can is add a dismiss/close button to the `DetailView`?struct DetailView: View { var body: some View { Text(Detail) } } struct ContentView : View { var body: some View { PresentationButton(Text(Click to show), destination: DetailView()) } }
5
0
6.9k
Jun ’19
Reply to Is SwiftUI backwards compatible with iOS 12 and below?
SwiftUI will require Swift 5.1+, so unless they back-port both it and Swift to the current releases, *and* come up with creative fixes to module stability with Swift 5.0, I'd say no.The unfortunate side-effect with ABI stability in Swift 5 is that the system isn't just exposing the swift libraries, but depending on a particular version for its own use. Module stability (being able to compile against binaries compiled with a different Swift version) is also only coming in Swift 5.1, which means that you still can't link against a library (system or third party) compiled with Swift 5.0 or earlier. So replacing the Swift version in current releases with 5.1 could be a big, breaking change.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’19
How to make a resizable HSplitView for macOS?
Hello, I'm trying to mock up a simple UI for a typical Mac app with a sidebar and a content area.Starting from the SwiftUI Xcode template, I got this far:struct ContentView : View { var body: some View { HSplitView() { List() { Text(Sidebar) Text(Sidebar) Text(Sidebar) Text(Sidebar) } List() { Text(Content) Text(Content) Text(Content) Text(Content) } } .frame(minWidth: 100, maxWidth: .infinity, minHeight: 100, maxHeight: .infinity, alignment: .topLeading) } }Two big issues so far:1. The top-level HSplitView does not resize with the window. It remains at the size it is created when the app launches, regardless of how you resize the window. Does the NSHostingView need to have an autoresizing mask or layout constraints? (It doesn't come with any in the Xcode template.)2. I can't seem to make the two subviews of the splitView resizable by the splitter, even if I give them frame() modifiers.Since this API is so new, I can't find any examples online.Has anyone successfully made a macOS app in SwiftUI
7
0
9.1k
Jun ’19
Is there a limit to the number of files using VStacks
Hello,I have a project with 6 simple SwiftUI files, each presenting simple views (Text, Image, Slider, DatePicker...).When I create file number 7 (and following) I get an error on the entry to the VStack { (Unable to infer complex closure return type; add explicit type to disambiguate.)I have tried cleaning the build folder. Closing the project, Xcode, and restarting themIf I create a new projet and paste the below in it compiles and executes rightly.Any ideas ?CheersLarsimport SwiftUIstruct Slider : View { @State var celsius: Double = 0 var body: some View { VStack { Slider(value: $celsius, from: -100.00, through: 100.00, by: 1.0) Text((celsius) Celsius is (celsius * 9 / 5 + 32) Fahrenheit) } }}#if DEBUGstruct Slider_Previews : PreviewProvider { static var previews: some View { Slider() }}#endif
3
0
2.2k
Jun ’19