Ok. Have you looked at the second link I posted? That seem to be a working solution but since I’m new to this I can’t figure out why my code isn’t working as in that link.
Or is it possible to have a invisible “rectangle” which is slightly larger and have the time inside that so it won’t calculate the center from the changing numbers but from the rectangle. Am I making sense?
Post
Replies
Boosts
Views
Activity
I’m looking for a solution without using a mono space font.
Ok I’m new to this forum. Didn’t know that. See correct code below.
Sorry for the code post above. By the way the clock works fine here. It’s just that the numbers shift slightly depending on what numbers are shown.
Here is the original tutorial.
https://medium.com/iu-women-in-computing/intro-to-swiftui-digital-clock-d0a60e05d394
And here is one possible solution that didn’t work for me.
https://stackoverflow.com/questions/61097821/is-there-a-way-to-keep-a-swiftui-text-label-from-slightly-moving-while-displayin/61097937
This is the “My app” code. The code above is everything in the “ContentView file”
Im doing this inSwift playground on my iPad by the way.
‘’’
import SwiftUI
@main
struct MyApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
‘’’