@@ -11,16 +11,16 @@ import SwiftUI
1111struct SingleBlurModule : View {
1212 let cornerR : CGFloat = 17.5
1313 let oneSide : CGFloat = 68
14- let color : Color
14+ let color : Color ?
1515 let image : String
16- @Binding var intensity : Int
16+ @Binding var intensity : Int ?
1717
1818 var body : some View {
1919 ZStack {
20- CIVisualEffectView ( effect: UIBlurEffect ( style: . light) , intensity: $intensity. doubleBinding)
20+ CIVisualEffectView ( effect: UIBlurEffect ( style: . light) , intensity: $intensity. toUnwrapped ( defaultValue : 50 ) . doubleBinding)
2121 . frame ( width: oneSide, height: oneSide)
2222 . cornerRadius ( cornerR)
23- color
23+ ( color ?? Color . gray )
2424 . cornerRadius ( cornerR)
2525 . frame ( width: oneSide, height: oneSide)
2626
@@ -37,7 +37,7 @@ struct EditCCColorsView: View {
3737 var body : some View {
3838 let _ = saveOCToUserDefaults ( )
3939 List {
40- Section ( header: Label ( " Preview " , systemImage: " eye " ) ) {
40+ Section ( header: Label ( " Preview " , systemImage: " eye " ) , footer : Text ( " Note: This preview isn't 100% accurate to what the actual control center will look like. " ) ) {
4141 HStack {
4242 Spacer ( )
4343// Spacer(minLength: 0)
@@ -53,7 +53,7 @@ struct EditCCColorsView: View {
5353 Image ( " PreviewWall \( selectedWallpaper) " )
5454 . resizable ( )
5555 . scaledToFill ( )
56- . blur ( radius: CGFloat ( state. moduleBGBlur) )
56+ . blur ( radius: CGFloat ( state. moduleBGBlur ?? 50 ) )
5757 state. moduleBGColor
5858
5959 } )
@@ -65,26 +65,26 @@ struct EditCCColorsView: View {
6565 }
6666 } . listRowSeparator ( . hidden)
6767 Section ( header: Label ( " Control Center Background " , systemImage: " paintbrush " ) ) {
68- ColorPicker ( " Colour (with opacity) " , selection: $state. moduleBGColor)
68+ ColorPicker ( " Colour (with opacity) " , selection: $state. moduleBGColor. toUnwrapped ( defaultValue : . gray ) )
6969 HStack {
70- Text ( " Blur ( \( state. moduleBGBlur) ) " )
70+ Text ( " Blur ( \( state. moduleBGBlur ?? 50 ) ) " )
7171 Spacer ( )
72- Slider ( value: $state. moduleBGBlur. doubleBinding, in: 0 ... 100 , step: 1 ) {
72+ Slider ( value: $state. moduleBGBlur. toUnwrapped ( defaultValue : 50 ) . doubleBinding, in: 0 ... 100 , step: 1 ) {
7373 Text ( " Blur " )
7474 } minimumValueLabel: { Text ( " 0 " ) } maximumValueLabel: { Text ( " 100 " ) } . frame ( width: 150 )
7575 }
7676 }
7777
7878 Section ( header: Label ( " Module Colour " , systemImage: " paintbrush " ) ) {
79- ColorPicker ( " Colour (with opacity) " , selection: $state. moduleColor)
79+ ColorPicker ( " Colour (with opacity) " , selection: $state. moduleColor. toUnwrapped ( defaultValue : . gray ) )
8080 HStack {
81- Text ( " Blur ( \( state. moduleBlur) ) " )
81+ Text ( " Blur ( \( state. moduleBlur ?? 50 ) ) " )
8282 Spacer ( )
83- Slider ( value: $state. moduleBlur. doubleBinding, in: 0 ... 100 , step: 1 ) {
83+ Slider ( value: $state. moduleBlur. toUnwrapped ( defaultValue : 50 ) . doubleBinding, in: 0 ... 100 , step: 1 ) {
8484 Text ( " Blur " )
8585 } minimumValueLabel: { Text ( " 0 " ) } maximumValueLabel: { Text ( " 100 " ) } . frame ( width: 150 )
8686 }
8787 }
88- } . navigationBarTitle ( " Edit CC Colours " )
88+ } . navigationBarTitle ( " Edit CC Colours " ) . navigationBarTitleDisplayMode ( . inline )
8989 }
9090}
0 commit comments