Post

Replies

Boosts

Views

Activity

Customising TabView styling
The default design of TabView is 90% close to what I want. However, the icons, to my eye, lack a sufficient amount of spacing at the top, and slightly too much white space at the bottom. Is there a way to give more top padding to the icons? To move the icons down without changing the height of the TabView itself? Also, I find it weird that .labelStyle(.titleOnly) works on Tabs but .labelStyle(.iconOnly) doesn't work. Is that a bug? I had to use Image instead of Label: TabView { Tab { MailView() } label: { Image(systemName: "envelope") .padding(20) } Tab { SettingsView() } label: { Image(systemName: "gearshape") .padding(20) } }
2
0
306
Sep ’24
Hiding the tabBar
How do I hide the tabBar for certain navigations? I am aware of .toolbar(.hidden, for: .tabBar) but it has issues. Here is the effect I actually want (screenshot is of transitioning from one page to another) The .toolbar modifier doesn't work like that. Once the other page has been navigated to, it then shows the tabBar. That isn't what I want: I want the toolbar to be visible on the other page while swiping from page to page. I am on iOS 18/Sequoia. This is my code: NavigationStack { List { NavigationLink("your bday plans") { Text("birthday email!") .toolbar(.hidden, for: .tabBar) } } .navigationTitle("Mail") }
3
1
358
Sep ’24
Image aspect ratio
I want to maintain a 1/1 square aspect ratio (equal width and height) without specifying an exact height/width. This is proving unreasonably hard. My code is below. Image(.personsmiling) .resizable() .aspectRatio(1/1, contentMode: .fill) .padding() Previously I have used scaledToFill() and clipped() but that approach doesn't work here
4
0
309
Aug ’24
Vertical TabView
I am using .tabViewStyle(.page). I like this functionality and styling but want it to be swipe up/down rather than left/right. Is there a simple way to achieve that while keeping the little dots that mark what page your on?
1
0
297
Aug ’24
Why is it so hard to have a full-width button
I realise I can use .frame(maxWidth: .infinity). Needing to create a custom .buttonStyle is somewhat annoying (and this is needed otherwise the full width of the button is not clickable). I want to use my full-width button in combination with other standard modifiers: .controlSize, .tint, etc It is beyond me how to get these to work when also applying my custom buttonStyle. This is such a common button style among all sorts of different apps. Why is it so awkward?
0
1
188
Aug ’24