Post

Replies

Boosts

Views

Activity

Comment on How do I change another View's background color as same as ColorSettingView?
Can I change Text of "Background Color" to Image of Buton? inline-code import SwiftUI struct ColorSetting: View { @Environment(.presentationMode) var presentation @Binding var bgColor : Color var body: some View { ZStack{                 bgColor                     .ignoresSafeArea()                 VStack {                    ColorPicker("Background Color"    // Can I change from Text to Image? , selection: $bgColor)                 }             }         }     }     inline-code
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’22
Comment on How to use colorPicker at another View?
Thank you so much your quick response. this was my first Question in this Developer Forums. I really appreciate it! By the way, I have one more question. I also want to change background color another view at same time. How do I change it? import SwiftUI struct ColorSettingView: View {          @Environment(.presentationMode) var presentation     let brPlayer = SoundPlayer()     @State private var bgColor = Color.white          var body: some View {                              ZStack{             bgColor                               .ignoresSafeArea()                           VStack {                               ColorPicker("Background Color", selection: $bgColor)                          Button (action: {brPlayer.brPlay()                     self.presentation                         .wrappedValue.dismiss()                 }, label: {                     Image("Quit")                         .resizable()                         .aspectRatio(contentMode: .fit)                         .padding(/@START_MENU_TOKEN@/[.leading, .bottom, .trailing]/@END_MENU_TOKEN@/)                         .frame(width: 100.0, height: 100.0)                                      })                           }                    }         } }                                           struct ColorSettingView_Previews: PreviewProvider {     static var previews: some View {         ColorSettingView()     } } //Another View like ContenViewX struct ContentViewX: View {       let kiPlayer = SoundPlayer()     @State private var bgColor = Color.white     @State var ColorSettingView = false         var body: some View {   ZStack {    //    I also want to change this view as same as ColorSettingView   bgColor         .ignoresSafeArea()   VStack {             Button (action: {kiPlayer.kiPlay()                self.ColorSettingView = true},  label: {Image("Setting")          .resizable()          .aspectRatio(contentMode: .fit)                  }       )          .sheet(isPresented: $ColorSettingView, content: {         JankenWorldRPS.ColorSettingView()}     )       } }  } } struct ContentViewX_Previews: PreviewProvider {  static var previews: some View {   ContentViewX()  } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’22
Comment on How do I change another View's background color as same as ColorSettingView?
Can I change Text of "Background Color" to Image of Buton? inline-code import SwiftUI struct ColorSetting: View { @Environment(.presentationMode) var presentation @Binding var bgColor : Color var body: some View { ZStack{                 bgColor                     .ignoresSafeArea()                 VStack {                    ColorPicker("Background Color"    // Can I change from Text to Image? , selection: $bgColor)                 }             }         }     }     inline-code
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’22
Comment on How to use colorPicker at another View?
Thank you so much your quick response. this was my first Question in this Developer Forums. I really appreciate it! By the way, I have one more question. I also want to change background color another view at same time. How do I change it? import SwiftUI struct ColorSettingView: View {          @Environment(.presentationMode) var presentation     let brPlayer = SoundPlayer()     @State private var bgColor = Color.white          var body: some View {                              ZStack{             bgColor                               .ignoresSafeArea()                           VStack {                               ColorPicker("Background Color", selection: $bgColor)                          Button (action: {brPlayer.brPlay()                     self.presentation                         .wrappedValue.dismiss()                 }, label: {                     Image("Quit")                         .resizable()                         .aspectRatio(contentMode: .fit)                         .padding(/@START_MENU_TOKEN@/[.leading, .bottom, .trailing]/@END_MENU_TOKEN@/)                         .frame(width: 100.0, height: 100.0)                                      })                           }                    }         } }                                           struct ColorSettingView_Previews: PreviewProvider {     static var previews: some View {         ColorSettingView()     } } //Another View like ContenViewX struct ContentViewX: View {       let kiPlayer = SoundPlayer()     @State private var bgColor = Color.white     @State var ColorSettingView = false         var body: some View {   ZStack {    //    I also want to change this view as same as ColorSettingView   bgColor         .ignoresSafeArea()   VStack {             Button (action: {kiPlayer.kiPlay()                self.ColorSettingView = true},  label: {Image("Setting")          .resizable()          .aspectRatio(contentMode: .fit)                  }       )          .sheet(isPresented: $ColorSettingView, content: {         JankenWorldRPS.ColorSettingView()}     )       } }  } } struct ContentViewX_Previews: PreviewProvider {  static var previews: some View {   ContentViewX()  } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’22