This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This gist shows how to use a `UISegmentedControl` to achieve the goal of having expandable segment items, | |
| // where the active segment would show a label, while the others do not. | |
| // Since `UISegmentedControl` only supports images *or* text for their items, we draw a custom image for the items, | |
| // which is basically a HStack with a label and an optional label. | |
| // I've used fixed widths for the items since otherwise the whole segment item would animate, leading to funky image | |
| // resizing effects. | |
| // This only serves as a demo and is not meant to be production ready. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #if DEBUG | |
| struct DebugFrameModifier: ViewModifier { | |
| let color = Color.red | |
| let lineWidth = 0.5 | |
| let spacing: CGFloat = 16 | |
| func body(content: Content) -> some View { | |
| content | |
| .border(color) | |
| .overlay( |