Posts

Post not yet marked as solved
1 Replies
127 Views
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() } }
Posted
by JavierR.
Last updated
.
Post marked as solved
2 Replies
222 Views
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")] }
Posted
by JavierR.
Last updated
.
Post not yet marked as solved
0 Replies
128 Views
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.
Posted
by JavierR.
Last updated
.
Post marked as solved
1 Replies
132 Views
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.
Posted
by JavierR.
Last updated
.
Post not yet marked as solved
0 Replies
147 Views
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)] }
Posted
by JavierR.
Last updated
.
Post not yet marked as solved
2 Replies
251 Views
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
Posted
by JavierR.
Last updated
.
Post not yet marked as solved
0 Replies
156 Views
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)) } }
Posted
by JavierR.
Last updated
.
Post not yet marked as solved
0 Replies
155 Views
I'm doing Slide Menu but when I start the simulator the sf symbol icons don't come out. Xcode 14 version for monterrey
Posted
by JavierR.
Last updated
.
Post not yet marked as solved
1 Replies
322 Views
Hello:how can I make an app with ink to take note with Pencil
Posted
by JavierR.
Last updated
.