Hi, I'll start by saying that I'm a new developer for apps for Apple devices, especially for Apple Watch, so please have mercy I'm trying to create an app for Apple Watch (WatchOs 10+) and I have a problem, my interface is made up of 3 buttons, one at the bottom of the screen and two smaller ones positioned on the top of the screen, each in their respective corners (one at the top right and the other at the top left). By positioning these buttons on the top of the screen, the top right button is covered by the default Apple time, and I would like to move it to the center, thus creating two side buttons and the time in the center. I'm also asking if there's a way to remove it since it's not useful to me, but reading some forums it seems that without it I don't pass the app verification, so I'm waiting for your advice. The only app I've seen in circulation on the app store that has the centered clock is petey.
Hi Andrei,
We love to see new developers building apps for watchOS! In terms of your time placement issue, it sounds like you might not be using the Toolbar APIs. You can set up a toolbar to have leading/trailing items in the top bar (along with a bottom item) with the following code:
SomeView()
.toolbar {
ToolbarItem(placement: .topBarLeading) {
Button("Top Leading Button!", systemImage: "star") {
// do things here
}
}
ToolbarItem(placement: .topBarTrailing) {
Button("Top Trailing Button!", systemImage: "square") {
// do things here
}
}
ToolbarItem(placement: .bottomBar) {
Button("Bottom Button!", systemImage: "triangle") {
// do things here
}
}
If you use these APIs, the system will automatically place the time in the center when you provide a top bar trailing item.
If you're still having trouble getting the time where you'd like it after adopting the Toolbar APIs, please post the code for your view here.