I want implement the lower TabView with the SideMenu in the App. I have a TabviewCustom. when I implement Tabview , the sideMenu disappears how to implement it.
How to implement it ?
Post
Replies
Boosts
Views
Activity
I'm having trouble with the code to link the buttons to the following View.
ZStack(){
Color(.systemGray6).ignoresSafeArea()
VStack()
{
ScrollView(.horizontal, showsIndicators: false)
{
HStack()
{
ForEach(MockData.items)
{ item in
ZStack
{
Button(action:{ })
{
NavigationLink(destination: selectedView(name: item.name))
{ EmptyView()}
RoundedRectangle(cornerRadius: 10)
.foregroundStyle(item.color.self)
.frame(width: 70, height: 70)
}
Image(systemName: item.image)
.foregroundColor(.white)
.font(.system(size: 30))
.padding(25)
}
}
}//scrollview
//opciones
}//cierre del VStack
.padding(.top, 20)
.padding(.leading)
Spacer()
}//cierre Zstack
} //cierre de Zstack
.navigationTitle("Caracteristicas")
.toolbar{
ToolbarItem(placement: .navigationBarLeading)
{
Button(action:{},
label: {
Image(systemName: "switch.2")})
}
ToolbarItem(placement: .navigationBarTrailing)
{
Button(action:{},
label: {Image(systemName: "person.circle")})
}
}//toolBar
.accentColor(.red)
}
}
}
struct Item: Identifiable {
var id = UUID()
var name: String
var color: Color
var image: String
}
struct MockData {
static var items = [Item(name: "Medical" ,color: .red, image:"heart"),
Item(name: "Illnes" ,color: .blue, image:"pill"),
Item( name:"Vaccune" ,color: .orange, image: "syringe"),
Item(name: "Dewor" ,color: .green, image: "microbe"),
Item(name: "Allergie" ,color:.purple, image: "allergens")]
}
@ViewBuilder
private func selectedView (name: String) -> some View {
switch name {
case "Medical": MedicalView()
case "Illness": IllnessView()
case "Vaccune": VaccuneView()
case "Dewor": DeworView()
case "Allergie": AllergieView()
default: EmptyView()
}
}
I have a foreach with five options to link different View how to do it with button or NavigationLink using switch Case.
HStack()
{
ForEach(MockData.items)
{ item in
ZStack
{
Button(action: {}) {
NavigationLink("") {
switch item {
case "MedicalView":
MedicalView()
case "IllnesView":
IllnessView()
case "VaccuneView":
VaccuneView()
case "DeworView":
DeworView()
case "AllergieView":
AllergieView()
}
}
}
{
RoundedRectangle(cornerRadius: 10)
.foregroundStyle(item.color.self)
.frame(width: 70, height: 70)
.disabled(false)
}
Image(systemName: item.image)
.foregroundColor(.white)
.font(.system(size: 30))
}
}//scrollview
//opciones
}//cierre del VStack
.padding(.top, 20)
.padding(.leading)
Spacer()
}//cierre Zstack
} //cierre de Zstack
.navigationTitle("Caracteristicas")
.toolbar{
ToolbarItem(placement: .navigationBarLeading)
{
Button(action:{},
label: {
Image(systemName: "switch.2")})
}
ToolbarItem(placement: .navigationBarTrailing)
{
Button(action:{},
label: {Image(systemName: "person.circle")})
}
}//toolBar
.accentColor(.red)
}
}
}
}
struct Item: Identifiable {
let id = UUID()
let color: Color
let image: String
}
struct MockData {
static var items = [Item(color: .red, image: "heart"),
Item(color: .blue, image:"pill"),
Item(color: .orange, image: "syringe"),
Item(color: .green, image: "microbe"),
Item(color:.purple, image: "allergens")]
}
To apply this IpV6 support in the App, you have to implement some code within the App. Although I've done the settings in the share folder.
I want to use Foreach and NavigationLink with SfSymbol for menu where each rectangle comes out SFSymbol differently and be able to link to the different View.
HStack()
{
ForEach(MockData.items)
{item in
//NavigationLink(
RoundedRectangle(cornerRadius: 10 )
.frame(width: 70, height: 70)
.foregroundStyle(item.color.gradient)
}
}//scrollview
//opciones
}//cierre del VStack
.padding(.top, 20)
.padding(.leading)
Spacer()
}//cierre Zstack
} //cierre de Zstack
.navigationTitle("Caracteristicas")
.toolbar{
ToolbarItem(placement: .navigationBarLeading)
{
Button(action:{},
label: {
Image(systemName: "switch.2")})
}
ToolbarItem(placement: .navigationBarTrailing)
{
Button(action:{},
label: {Image(systemName: "person.circle")})
}
}//toolBar
.accentColor(.red)
}
}
}
struct Item: Identifiable {
let id = UUID()
let color: Color
let image: String
}
struct MockData {
static var items = [Item(color: .red, image:"heart" ),
Item(color: .blue, image:"pill"),
Item(color: .orange, image: "syringe"),
Item(color: .green, image:"microbe"),
Item(color:.purple, image: "allergens")]
}
I need help figuring out how to do it.
I'm using foreach to make some options in a horizontal scrollview then I want to link the next page view. The problem is putting Symbol SF in the code. How can I put this according to the code?
ScrollView(.horizontal, showsIndicators: false)
{
HStack()
{
ForEach(MockData.items) {item in
RoundedRectangle(cornerRadius: 10 )
.frame(width: 80, height: 80)
.foregroundStyle(item.color.gradient)
}
}
struct Item: Identifiable {
let id = UUID()
let color: Color
//var image: Image
}
struct MockData {
static var items = [Item(color: .red),
Item(color: .blue),
Item(color: .orange),
Item(color: .green),
Item(color:.purple)]
}
I want to make a scrollview that has different óptimos and different . colors and also links to Scrollview. Distances as i can do it
like this example. Where eachn option links to sswiftview. the problem is that you don`t button
As I can include several buttons that swipe from right to left at the top of the screen. Having this code.
@Binding var selected: Int
var body: some View {
NavigationView{
VStack(){
}
.navigationTitle("Carecteries")
.toolbar{
ToolbarItem(placement: .navigationBarLeading )
{
Button(action:{
},
label: {Image(systemName: "person.circle")})
}
ToolbarItem(placement: .navigationBarTrailing)
{
Button(action:{
},
label: {Image(systemName: "i.circle")})
}
}
.accentColor(.red)
}//close Navigation
}
}
struct HomeView_Previews: PreviewProvider {
static var previews: some View {
HomeView(selected: .constant(0))
}
}
I'm doing Slide Menu but when I start the simulator the sf symbol icons don't come out. Xcode 14 version for monterrey