Visual Design

RSS for tag

Discuss animation, branding, color, layout, typography, and other elements of great looking apps.

Posts under Visual Design tag

44 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

SwiftUI Sheet Animation Issue with Non-Default Background Colors
I'm working on a SwiftUI project where I use a .sheet modifier to present a bottom drawer with two detent sizes: .medium and .large. The drawer contains a button that toggles its size between these two states. This part works as expected. However, I'm facing an animation issue when I set a non-default background color to the sheet. Here's the simplified code for context: struct ContentView: View { @State private var selectedDetent: PresentationDetent = .medium var body: some View { VStack {} .sheet(isPresented: .constant(true)) { Button("Press Me") { selectedDetent = selectedDetent == .medium ? .large : .medium } .presentationBackground(.gray) .presentationDetents([.medium, .large], selection: $selectedDetent) } } } The issue arises when I try to set a background color using .presentationBackground(.gray) (or any color, even white). Instead of the expected behavior when pressing the button (where the upper part of the sheet closes, and the bottom part stays attached to the screen bottom), the sheet momentarily turns into a square in the middle of the screen before moving down to the .medium position. As soon as I remove the.presentationBackground(.gray) line, it works as expected: I tried several approaches, such as: Using a custom background view. Explicitly specifying animations. Adjusting view hierarchy and layering. Unfortunately, none of these solutions worked. The issue persists with any color. It seems like a bug or limitation in SwiftUI's handling of sheet animations with custom backgrounds. Has anyone else encountered this issue, or does anyone have a workaround or solution?
1
0
1.5k
Dec ’23
Xcode should include simple themes. Agree??
The themes that bundle with Xcode are all very complex, in the sense that they highlight every token-type a different color, and often use colors that are only slightly different (as there aren't nearly enough distinct colors). Given that these themes are intended to be used, they should be optimized for practicality (not just flexing the power of Xcode). Syntax highlighting is most useful when it distinguishes between things that the programmer distinguishes between conceptually (if I don't know why one variable is blue, while another, apparently similar, variable is red, the highlighting actually makes the code harder to parse correctly). I've also observed a trend towards more minimal highlighting schemes, just generally. I don't have any evidence for this, but assume other people have noticed it too. To offer a concrete example, the following scheme does the usual kinda thing with keywords, comments and literals, but sets everything else to look like plain text, except types, which are gold when they're being declared, and copper otherwise: In my experience, it's notably easier to parse like this, which helps when learning Swift & Co. This is the same theme, applied to a C-family language (Metal): I'm not asking for feedback on the theme specifically. I'm just asking whether you agree that Xcode should bundle a couple of these simpler themes.
4
1
1.1k
Jul ’24
Different methods of animating shape along custom path?
I'm trying to animate a shape (e.g. a circle) to follow a custom path, and struggling to find the best way of doing this. I've had a look at the animation options from SwiftUI, UIKit and SpriteKit and all seem very limited in what paths you can provide. Given the complexity of my path, I was hoping there'd be a way of providing a set of coordinates in some input file and have the shape follow that, but maybe that's too ambitious. I was wondering if this were even possible, and assuming not, if there were other options I could consider.
1
0
1k
Jan ’24