In this UIKit app, I have to display numbers (from 1 to 100), in a label., on several lines, with 8 numbers on each line. Order is computed by the app for a specific purpose.
The numbers are separated by space. Label font is Helvetica Neue 15.0.
I want to get them aligned vertically.
So, I have a padding so that they are all the same length of 4.
Problem: the space have smaller width (half in fact) than digits, so alignment is disrupted:
Of course, I can use fixed width fonts (like Menlo), but I've not found one that fits (the zero is barred, which is not looking great in the app).
I have tried using
class func monospacedDigitSystemFont(
ofSize fontSize: CGFloat,
weight: UIFont.Weight
) -> UIFont
and apply to label.text. To no avail as it modifies only digits, not space char.
I have found a workaround, padding with 2 spaces instead of one,
but is there another solution ?
So I am looking for a space character that would have the same width as a digit. There existe thin space (https://en.wikipedia.org/wiki/Whitespace_character) but not larger space.
Does it exist ?
Post
Replies
Boosts
Views
Activity
Since recently (maybe after updating to Sonoma 14.7.1 - 23H222, but not sure, I get a crash report stating that SafariBookmarksSyncAgent quitted unexpectedly Once acquitted the report, it will reappear 2 minutes later as long as Xcode is open.
Configuration:
Sonoma 14.7.1
Safari Technology Preview Release 208 (Safari 18.2, WebKit 19621.1.5.1)
Xcode 15.3 (15E204a)
That seems to be a known problem.
Question: Is it due to MacOS version ? To Xcode version ? To Safari version ? To webKit version ? Or to simulator, as I gat an AegirPoster crash (as described here: https://stackoverflow.com/questions/77083912/macbook-pro-crashes-when-using-simulator-aegirposter-process)
I read that I would need to restart some devices (eg, iPhone). That seems to temporarily solve the problem
Here is a part of the report:
Incident Identifier: 0D2456DF-5801-41D6-8294-2BF442224913
CrashReporter Key: 4DE33529-174E-32C5-D8A8-26FE128BE16B
Hardware Model: Mac14,12
Process: SafariBookmarksSyncAgent [38972]
Path: /Volumes/VOLUME/*/SafariSupport.bundle/SafariBookmarksSyncAgent
Identifier: com.apple.SafariBookmarksSyncAgent
Version: 8614 (8614.1.25.0.17)
Code Type: ARM-64 (Native)
Role: Unspecified
Parent Process: launchd_sim [28070]
Coalition: com.apple.CoreSimulator.SimDevice.0058D576-D9FF-4169-8437-D0A24C923500 [9832]
Responsible Process: SimulatorTrampoline [1116]
Date/Time: 2024-11-27 15:19:42.4908 +0100
Launch Time: 2024-11-27 15:19:42.4610 +0100
OS Version: macOS 14.7.1 (23H222)
Release Type: User
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000204476580
Exception Codes: 0x0000000000000001, 0x0000000204476580
VM Region Info: 0x204476580 is not in any region. Bytes after previous region: 894002561 Bytes before following region: 58984012416
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
VM_ALLOCATE 1cefdc000-1cefe0000 [ 16K] r--/rwx SM=PRV
---> GAP OF 0xdf1020000 BYTES
commpage (reserved) fc0000000-1000000000 [ 1.0G] ---/--- SM=COW reserved VM address space (unallocated)
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [38972]
Triggered by Thread: 0
Thread 0 Crashed:
0 dyld_sim 0x104f9dc7c dyld4::SyscallDelegate::forEachInDirectory(char const*, bool, void (char const*, char const*) block_pointer) const + 172
1 dyld_sim 0x104f88b6c invocation function for block in dyld4::ProcessConfig::PathOverrides::processVersionedPaths(dyld4::ProcessConfig::Process const&, dyld4::SyscallDelegate&, dyld4::ProcessConfig::DyldCache const&, dyld3::Platform, dyld3::GradedArchs const&, lsl::Allocator&) + 104
2 dyld_sim 0x104f88aa0 dyld4::ProcessConfig::PathOverrides::forEachInColonList(char const*, char const*, bool&, void (char const*, bool&) block_pointer) + 224
3 dyld_sim 0x104f886b8 dyld4::ProcessConfig::PathOverrides::processVersionedPaths(dyld4::ProcessConfig::Process const&, dyld4::SyscallDelegate&, dyld4::ProcessConfig::DyldCache const&, dyld3::Platform, dyld3::GradedArchs const&, lsl::Allocator&) + 144
4 dyld_sim 0x104f882a8 dyld4::ProcessConfig::PathOverrides::PathOverrides(dyld4::ProcessConfig::Process const&, dyld4::ProcessConfig::Security const&, dyld4::ProcessConfig::Logging const&, dyld4::ProcessConfig::DyldCache const&, dyld4::SyscallDelegate&, lsl::Allocator&) + 344
5 dyld_sim 0x104f868b8 dyld4::ProcessConfig::ProcessConfig(dyld4::KernelArgs const*, dyld4::SyscallDelegate&, lsl::Allocator&) + 152
6 dyld_sim 0x104f85e30 _dyld_sim_prepare + 352
7 dyld 0x10492fa8c dyld4::prepareSim(dyld4::RuntimeState&, char const*) + 1276
8 dyld 0x10492e4f0 dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 308
9 dyld 0x10492def4 start + 1868
I filed a bug report: Nov 27, 2024 at 3:41 PM – FB15976427
There are at the moment a lot of spams for a bank phone number.
https://developer.apple.com/forums/thread/769506
What is really surprising is to read App Store Connect Engineer answer, each time the same:
We appreciate your interest in participating in the forums! These forums are for questions about developing software and accessories for Apple platforms. Your question seems related to a consumer feature and is better suited for the Apple Support Communities
Is it an automatic answer (I cannot believe anyone who read the post did not notice it was a spam) ? If so, couldn't it simply detect it is a spam (Apple Intelligence could come to help) and delete the message (or the account) ?
PS: it would also be a spam in Apple Support Communities
PS2: I note the message has been deleted very rapidly.
Capability to read and write ofd HFS disks on Mac has been removed since a long time.
Capability to simply read was also removed since Catalina I think.
That is surprising and sometimes frustrating. I still use a 90's MacBook for a few tasks and need from time to time to transfer files to newer Mac or read some old files stored on 3.5" disks.
Solution I use is to read the disk on an old Mac with MacOS 10.6 (I'm lucky enough to have kept one) and transfer to USB stick or airdrop…
As there is no USB port on the Macbook of course (and I have no more a working 56k modem to transfer by mail), only option if not 3,5" disk is using PCMCIA port on the MacBook for writing to an SD Card to be read in Mac Sonoma. But reading directly 3.5" disk would be great.
Hence my questions for the forum:
how hard would it be to write such a driver for READING only HFS on Mac Sonoma?
There are some software like FuseHFS. Did anyone experience it ? Did anyone have a look at the source code (said to be open source).
does anyone know why Apple removed such capability (I thought it was a tiny piece of code compared to the GB of present MacOS)?
Thanks for any insights on the matter.
To change the background of a TextField, I simply apply:
TextField("0.0", value: $p, format: .number)
.textFieldStyle(PlainTextFieldStyle())
.background(.red)
That does only work with plain style, but it works.
Trying something similar on a button changes the container view background.
The only solution I've found is to overlap with a Rectangle.
How is it ?
A SwiftUI bug ?
A current limit of Swift ?
A rationale for it ?
There a better solution I've not found ?
In this app, I set the preferredColorScheme in main
@main
struct TheApp: App {
@AppStorage("isDarkMode") private var isDarkMode = false
var body: some Scene {
WindowGroup {
ContentView()
.preferredColorScheme(isDarkMode ? .dark : .light)
}
}
}
isDarkMode is changed dynamically in code.
When code is compiled with Xcode 15.3, the background of ContentView changes from light to dark or vice versa.
When compiled with Xcode 16, no more change.
However, direct changes to objects do work, such as:
TextField("N", value: $t, format: .number)
.frame(width: 40)
.background(isDarkMode ? .gray : .white)
What has changed in Xcode 16 ? Is it documented somewhere ?
I saw this SO thread which describe similar problem.
https://www.reddit.com/r/swift/comments/upkprg/preferredcolorscheme_toggle_not_working/
This app may run on MacOS or iOS.
I want to use windowResizability modifier (specially In MacOS) which is only available on masOS 13+ and iOS 17+, but still need to run on macOS 12 or iOS 15…
So I need something like
#if os(macOS)
if #available(macOS 13 *) {
use windowResizability
#else
do not use windowResizability
#endif
#else // iOS
if #available(iOS 17 *) {
use windowResizability
#else
do not use windowResizability
#endif
Here is the code where to apply (in @main)
struct TheApp: App {
var body: some Scene {
WindowGroup {
ContentView() // 1.11.2023
.frame(
minWidth: 1200, maxWidth: .infinity,
minHeight: 600, maxHeight: .infinity)
}
.windowResizability(.contentSize) // BTW: is that really necessary ?
}
}
How can I achieve this ? Do I need to write a WindowGroup extension for the modifier ? If so, how ?
BTW: is windowResizability really necessary ? App seems to work the same without it.
I create a UIKit PullDown menu (in a positionMenu button), with the following code:
func setupPullDownMenu() {
let menu1 = UIAction(title: "Menu1") { [self] _ in
// some code
}
let menu2 = UIAction(title: "Menu2") { [self] _ in
// some code
}
let menu3 = UIAction(title: "Menu3") { [self] _ in
// some code
}
let menu = UIMenu(title: "Positions", children: [menu1, menu2, menu3])
positionMenu.menu = menu
positionMenu.showsMenuAsPrimaryAction = true
}
In Portrait, options are listed as Menu1, Menu2, Menu3
But in Landscape it is the reverse: Menu3, Menu2, Menu1
I use Xcode 16.1ß and iOS 17.0 simulator
Is it the expected behaviour ?
Is it only me ?
I received recently a notification that an answer was "recommended by Apple", with a link to the post.
But when going to the post, this recommendation (with small Apple icon) do not show.
And the forum scores are not updated.
This is not the first time I get problems with forum notifications.
I filed a bug report: FB14172207
Since 2 hours (1:20 GMT July 18), I keep receiving the exact same message from iTunesStore every 5 minutes (30 received so far, with metronome regularity):
Your banking information was accepted
Thank you for providing the requested details for xxxxxx associated with your banking update in App Store Connect.
Any payments may take up to 2 payment cycles to send. If you have any questions, contact us at http://developer.apple.com/contact/.
I did not update any information since at least 6 weeks.
I contacted support, it seems to be widespread problem.
I filed a bug report: Jul 18, 2024 at 5:51 PM – FB14377820
I've recently seen answers to posts that are apparently automatically generated but signed as App Store Connect Engineer. In several cases the answer is misinterpreting the OP.
Here is an example: https://developer.apple.com/forums/thread/758391
The OP was really a developer question. Not related to a consumer feature.
Is it really an automatic answer (which would be a bad trend for the forums IMHO)?
I see this message for the first time:
It is inserted in the OP (https://developer.apple.com/forums/thread/757852) but the link leads to nowhere (just the general page of the forum).
In … what ?!?
So I wonder what is the meaning of the message, its intent and use ? Or is it just a forum bug ?
PS: surprisingly, this post appears in Forums general page (https://developer.apple.com/forums/latest), but not in forums feedback (https://developer.apple.com/forums/tags/forums-feedback)
PS2: it appears, but after all the pinned messages which are older. Really confusing…
I posted a bug report on this: Jun 23, 2024 at 9:29 PM – FB14024970
The UI of the forum is profoundly changed. For what benefit ? It seems forum is more and more painful to use at each major revamp.
Is it only me who cannot see the improvements ?
I prepare an app to migrate from ObservableObject to Observable, from EnvironmentObject to Environment(MyClass.self) and so so forth.
That works OK, very simple.
But, that forces to run on macOS 14 or more recent.
So I would like to have it conditionally, such as:
if macOS 14 available
@Environment(ActiveConfiguration.self) var activeConfiguration: ActiveConfiguration
otherwise
@EnvironmentObject var activeConfiguration: ActiveConfiguration
The same for the class declaration:
if macOS 14 available
@Observable class ActiveConfiguration {
var config = Configuration()
}
otherwise
class ActiveConfiguration : ObservableObject {
@Published var config = Configuration()
}
Is there a way to achieve this (I understand it is not possible through extensions of Macros, as we can do for modifiers) ?
Could I define 2 classes for ActiveConfiguration, but then what about @Environment ?
I had this code working properly in Xcode 17.0.1, with macOS target as 12.4
struct SyntheseView: View {
@AppStorage("isDarkMode") var isDarkMode = false
// more declarations ………
var body: some View {
VStack {
ZStack {
// code …………………
}
.frame(width: 500, height: 300)
.background(isDarkMode ? Color(red: 0, green: 0, blue: 120/255) : Color(red: 1, green: 1, blue: 186/255))
} // VStack
In Xcode 15.3, I get the error The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions
If I comment out the background modifier, no issue.
I converted all parameters in Color to Double without success
If I replace by a fixed color as
.background(.blue)
No error.
Even the simple
.background(Color(red: 0.0, green: 0.0, blue: 0.5))
causes the error.
But:
.background(isDarkMode ? .blue : .red)
does work.
I tried to define the Colors as static color extensions to no avail.
Another bizarre point is that a similar pattern works OK for another View.
Did something change in Xcode 17.3 ?