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)
}
}
Post
Replies
Boosts
Views
Activity
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")
}
Which components does the controlSize modifier actually work on? I've been unable to find a list. I often try it on a component just to find it doesn't work.
It would be useful to have a comprehensive list in the docs.
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
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?
In HTML, a form element actually has key functionality: it submits the form to the server.
In SwiftUI, is a Form a necessity when using form elements, or is it only for use when you want specific styles applied? Is Form just a visual thing or does it provide any behaviour?
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?
I watched the WWDC 2023 session titled Explore media formats for the web. It talked in depth about the Managed Media Source API but google is not finding anything about this API. I'd really like to read more about it