Post

Replies

Boosts

Views

Activity

Reply to Equal width buttons in VStack
SwiftUI draws the button as wide as it needs to be for the title. It's up to you to tell it how wide the button should be. I do this by creating and applying a new ButtonStyle, like this: import SwiftUI struct ContentView: View { var body: some View { VStack(alignment: .center) { Button("Short", action: {}) .buttonStyle(MyButtonStyle(bgColor: .gray, fgColor: .white)) Button("Long title", action: {}) .buttonStyle(MyButtonStyle(bgColor: .yellow, fgColor: .black)) Button("A longer button title", action: {}) .buttonStyle(MyButtonStyle(bgColor: .green, fgColor: .white)) Button("A much, much, much longer button title", action: {}) .buttonStyle(MyButtonStyle(bgColor: .blue, fgColor: .white)) } } } struct MyButtonStyle: ButtonStyle { var bgColor: Color? var fgColor: Color? func makeBody(configuration: Configuration) -> some View { configuration.label .font(.headline) .bold() .allowsTightening(true) .lineLimit(2) .frame(width: 200, height: 60) .background(bgColor ?? .gray) .foregroundStyle(fgColor ?? .white) .clipShape(RoundedRectangle(cornerRadius: 16)) } } #Preview { ContentView() } That example gives you this: Note that you can change the number of lines in the button by changing .lineLimit().
4w
Reply to IOS18 “updates”
now I just have to have the same lock screen and home screen background? No. Just customise the Lock Screen as usual, and when you see the two screens (the Lock Screen and Home Screen with darkened squares for the app icons), tap the Home Screen one, and at the bottom tap "Photo". I have my phone in darkmode so now I just have to deal with the ugly black thumbnails for the app? I can’t revert them to normal colors while keeping dark mode? Yes, I think you can. Customise the Home Screen by holding a finger down in a space on the screen, then in the top left tap "Edit" then "Customize". In the panel that appears at the bottom of the screen choose "Light", then press the little sun icon in the top left of that panel. That will change the background to dark, but leave the icons light. Does that work for you? By the way, these are the Developer Forums where third party developers of apps for Apple;s operating systems talk about code and ask for help on how to write some code. This isn't the place for product support questions. For that, go to the Apple Support Forums. Thanks.
Oct ’24
Reply to LGBTIQ
You can either pay someone to do it - but, please don't solicit for it here; or you can learn to write it yourself. There are lots of Swift and SwiftUI tutorials, and the Apple Developer pages have sample code that will help you along.
Oct ’24
Reply to Developer Mode
These are the Developer Forums, where developers of apps for Apple's platforms ask each other for hints and tips on coding. Your question is more of a product support one, so I'd suggest you ask it over at the Apple Support Forums. Thanks.
Oct ’24