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?
Search results for
swiftui
16,582 results found
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I would also appreciate sample code, as the sample for Core Data and CloudKit is not using SwiftUI.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
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.
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 😀
Try this http://iphonesdkdev.blogspot.com/2019/06/how-to-use-swiftui-previews-for.html
Topic:
App & System Services
SubTopic:
Core OS
Tags:
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?
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 {
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?
Does anyone have any idea how to present a popover from SwiftUI Button in a macOS application. I can't find any documentation on this anywhere.
It‘s working fine, just not out of the box. See: https://github.com/unixzii/SwiftUI-2048/tree/e1d1489228dc61702eeab8b6c598f0185847222d
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
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()) } }
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:
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
I want to add Button to View that will dismiss a presented controller.
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