Post

Replies

Boosts

Views

Activity

Reply to SwiftUI design elements
import SwiftUI struct ContentView: View { var body: some View { HStack { VStack { RoundedRectangle(cornerRadius: 25.0) .fill(Color.red) RoundedRectangle(cornerRadius: 25.0) .fill(Color.green) } VStack { RoundedRectangle(cornerRadius: 25.0) .fill(Color.blue) } } .frame(height: 200) .padding() } } #Preview { ContentView() }
Topic: Design SubTopic: General Tags:
Jul ’24
Reply to SwiftUI design elements
No, that's not the best way to do what you want. The reason you got "Hello World!" with a red background is because of this: Text("Hello, World!") .background(RoundedRectangle(cornerRadius: 25.0).fill(Color.red)) You applied the .background modifier to the Text item, so just the text was given the red background. What you want to do is use a ZStack. Just like HStack is a horizontal stack and VStack is a stack along the vertical axis, a ZStack is a stack along the z-axis. Put a rectangle inside the ZStack and it will become the background, then you layer your content on top, i.e.: struct DashboardView: View { var body: some View { HStack { VStack { VStack { ZStack { RoundedRectangle(cornerRadius: 25.0) .fill(Color.red) Text("Text 1") } } VStack { ZStack { RoundedRectangle(cornerRadius: 25.0) .fill(Color.green) Text("Text 2") } } } VStack { ZStack { RoundedRectangle(cornerRadius: 25.0) .fill(Color.blue) VStack { Spacer() Text("Text 3") Spacer() Text("Text 4") Spacer() } } } } .foregroundStyle(.white) .frame(height: 200) .padding() } } The ordering is important, for both content and modifiers. If you reverse the RoundedRectangle(...) and Text you won't see the text because the rectangle is in front of it, i.e.: Text("Text 1") RoundedRectangle(cornerRadius: 25.0) .fill(Color.red) By the way, .foregroundColor() is deprecated. While it works now, it will be removed in a later version of the OS, so you should move to the new foregroundStyle() modifier instead. Also note that if all your text inside those rectangles is going to be the same colour, you can add that modifier to the top-level HStack, as I have done above.
Topic: Design SubTopic: General Tags:
Jul ’24
Reply to Bug in IOS 18 Developer Beta version
There is an issue with Screen Time in the iOS 18 betas. Please raise bugs with Apple - and not in these forums. The Developer Forums aren't really the right place to raise bugs in a new version of an OS. Apple's engineers aren't reading through these pages to see if anyone's found a bug. These forums are for third-party developers writing apps for Apple's platforms to discuss issues with their code. You need to raise each issue you find separately at https://www.apple.com/feedback/ You can post the FB numbers here if you want, so that others can link to them. Others have already raised this particular issue, but your report might contain the pertinent information that will help Apple fix the bug.
Jul ’24
Reply to iOS 18 beta problem
Please raise bugs with Apple - and not in these forums. The Developer Forums aren't really the right place to raise bugs in a new version of an OS. Apple's engineers aren't reading through these pages to see if anyone's found a bug. These forums are for third-party developers writing apps for Apple's platforms to discuss issues with their code. You need to raise each issue you find separately at https://www.apple.com/feedback/ You can post the FB numbers here if you want, so that others can link to them.
Jul ’24
Reply to ios 18 3 bugs
The Developer Forums aren't really the right place to raise bugs in a new version of an OS. Apple's engineers aren't reading through these pages to see if anyone's found a bug. These forums are for third-party developers writing apps for Apple's platforms to discuss issues with their code. You need to raise each issue you find separately at https://www.apple.com/feedback/ You can post the FB numbers here if you want, so that others can link to them.
Jul ’24
Reply to Screen Time Bug
Is this on the iOS 18 beta, or is it something to do with an app that you're developing? If neither, your question is more of a product support one, so I'd suggest you ask it over at the Apple Support Forums. These are the Developer Forums, where developers of apps for Apple's platforms ask each other for hints and tips on coding their own apps. If it's on the betas, can you show us a screenshot of what you're entering?
Jul ’24