Post

Replies

Boosts

Views

Activity

Currency name from currency codes doesn't work for all
Dear All, Going through the list of currency codes in Locale.commonISOCurrencyCodes the following expression returns currency names Locale.autoupdatingCurrent.localizedString(forCurrencyCode: currencyCode) Surprisingly, this expression does not return names for some of the most common currency codes like EUR, USD and other. How do I get a full list of names? Any hint appreciated!
1
0
334
Jul ’24
Maximise Image above Form
Dear All, I want to maximise an Image above a Form. That should be easy enough but with the naive code, the Form is pushed out of the screen. I don't want to allow scrolling. This is my code: Image(systemName: "gear") .resizable() .scaledToFit() Form { Section("section 1") { Text("text 1") Text("text 2") Text("text 3") } Section("section 2") { Text("text 1") Text("text 2") Text("text 3") } } .scrollDisabled(true) Any hint on how to achieve that the Form is fully displayed and the Image dynamically maximised in the space that is left? Thanks in advance! Cheers F
2
0
833
Feb ’24
ImageRenderer Views containing Forms/Sections
Dear All, I am using ImageRenderer (as well documented, i.e. here https://danielsaidi.com/blog/2022/06/20/using-the-swiftui-imagerenderer) to create images from views. This works fine with Views containing Texts and Images but fails as soon as there is a Form in the View. Failing means that the output is simply empty, no placeholder image is displayed as suggested by Apple documentation (https://developer.apple.com/documentation/swiftui/imagerenderer) and I am not using AppKit or UIKit. Any suggestions of how to create image snapshots from more 'complex' Views containing Forms and Sections? Any help appreciated. Cheers
0
0
280
Jan ’24
Avoid cropping Text when kerning/tracking with negative values
Hi Everybody, Using kerning or tracking on Text with negative values reduces the space between characters. Unfortunately, this also effects the trailing end of the text, which is then cropped. This is the expected behaviour according to Apple's documentation (https://developer.apple.com/documentation/swiftui/text/kerning(_:)) but not really what is intended (by me, at least) and looks rather weird (see example in the docs where 'raffle' is cropped). How to use kerning/tracking with negative values without cropping trailing characters? Any easy fix for that? Thanks!
0
0
311
Aug ’23
Package dependency in own package
Hi All, I create a Swift Package (Xcode 14.3) and add a package dependency (https://github.com/stephencelis/SQLite.swift) by copying the autogenerated dependency clause into my "Package.swift" file. The "package.resolved" file is created, all good. Somehow I cannot use the package (SQLite) from my code because the "import SQLite" is not found. This happens from an empty package as well. How can I use the dependent package in my own package? Sorry for the seemingly simple question but despite a lot of googleing and fiddling with targets/products, I don't get this to work. UI options in Xcode to add targets etc. exist only for apps, not for packages. Any hints what I am doing wrong here greatly appreciated. Cheers Florian
0
0
432
Apr ’23
Return UNAuthorizationStatus in func
Hi Everybody,I am trying to implement a function that returns the current UNAuthorizationStatus for use in a View to show a button or not. The function below doesn´t work because the closure is executed after the return - is there any simple way to achieve this?func getStatus() -> UNAuthorizationStatus { var result: UNAuthorizationStatus = .notDetermined UNUserNotificationCenter.current().getNotificationSettings( completionHandler: { (settings) in result = settings.authorizationStatus print("result in closure = \(result.rawValue)") } ) print("result at return = \(result.rawValue)") return result }Sorry, if this is a bit of a rookie question but I don´t seem to be able to figure this out.ThanksFlorian
2
0
1.1k
May ’20
@EnvironmentObject with array of class
Dear all,I am struggling with using ObservableObject in my app. In principle things work fine only view updates are not trigger when changing attributes of 'contacts.' Using 'cnt' in the same way, updates are indeed reflected in views - is there something particular I have to do with the FtContacts class to fix that?class AppEnv: ObservableObject { @Published var contacts = [FtContact]() @Published var cnt: Int = 0[...]struct ContentView: View { @EnvironmentObject var appEnv: AppEnv[...]Any idea what I am missing here?Thanks everybody
7
0
1.8k
May ’20