layout on create icon view
haptic feedback when saving
This commit is contained in:
@@ -116,10 +116,10 @@ struct CreateIconView: View {
|
|||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
|
Divider().background(Color(UIColor.tertiarySystemBackground))
|
||||||
|
|
||||||
Group {
|
Group {
|
||||||
Divider().background(Color(UIColor.tertiarySystemBackground))
|
HStack(alignment: .center) {
|
||||||
|
|
||||||
HStack {
|
|
||||||
Spacer()
|
Spacer()
|
||||||
VStack(alignment: .center) {
|
VStack(alignment: .center) {
|
||||||
Menu("Left Eye") {
|
Menu("Left Eye") {
|
||||||
@@ -161,92 +161,100 @@ struct CreateIconView: View {
|
|||||||
}
|
}
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
|
.padding()
|
||||||
|
.background(
|
||||||
|
Color(uiColor: theme.currentTheme.secondaryBGColor)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
.frame(height: 5)
|
|
||||||
.padding([.leading, .trailing])
|
Divider().background(Color(UIColor.tertiarySystemBackground))
|
||||||
.padding([.top, .bottom], 10)
|
|
||||||
|
|
||||||
Group {
|
Group {
|
||||||
Divider().background(Color(UIColor.tertiarySystemBackground))
|
HStack {
|
||||||
|
ForEach(BackGroundOptions.selectable, id: \.self) { bg in
|
||||||
VStack{
|
Image(bg.rawValue, bundle: .main)
|
||||||
HStack {
|
.resizable()
|
||||||
ForEach(BackGroundOptions.selectable, id: \.self) { bg in
|
.aspectRatio(contentMode: .fill)
|
||||||
Image(bg.rawValue, bundle: .main)
|
.frame(minWidth: 10, idealWidth: 40, maxWidth: 40,
|
||||||
.resizable()
|
minHeight: 10, idealHeight: 40, maxHeight: 40,
|
||||||
.aspectRatio(contentMode: .fill)
|
alignment: .center)
|
||||||
.frame(minWidth: 10, idealWidth: 40, maxWidth: 40,
|
|
||||||
minHeight: 10, idealHeight: 40, maxHeight: 40,
|
|
||||||
alignment: .center)
|
|
||||||
.onTapGesture {
|
|
||||||
update(background: bg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mixBG
|
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
update(background: .random)
|
update(background: bg)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
mixBG
|
||||||
|
.onTapGesture {
|
||||||
|
update(background: .random)
|
||||||
|
}
|
||||||
|
|
||||||
|
ColorPicker("", selection: $customIcon.bgOverlayColor)
|
||||||
|
}
|
||||||
|
.padding()
|
||||||
|
.background(
|
||||||
|
Color(uiColor: theme.currentTheme.secondaryBGColor)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Divider().background(Color(UIColor.tertiarySystemBackground))
|
||||||
|
|
||||||
|
Group {
|
||||||
|
VStack {
|
||||||
|
HStack(spacing: 0) {
|
||||||
|
VStack(alignment: .center) {
|
||||||
|
Text("background")
|
||||||
|
ColorPicker("", selection: $customIcon.bgColor)
|
||||||
|
.labelsHidden()
|
||||||
|
}
|
||||||
|
.frame(minWidth: 0, maxWidth: .infinity)
|
||||||
|
|
||||||
ColorPicker("", selection: $customIcon.bgOverlayColor)
|
VStack(alignment: .center) {
|
||||||
|
Text("Inner")
|
||||||
|
ColorPicker("", selection: $customIcon.innerColor)
|
||||||
|
.labelsHidden()
|
||||||
|
}
|
||||||
|
.frame(minWidth: 0, maxWidth: .infinity)
|
||||||
|
|
||||||
|
VStack(alignment: .center) {
|
||||||
|
Text("Face Outline")
|
||||||
|
ColorPicker("", selection: $customIcon.circleStrokeColor)
|
||||||
|
.labelsHidden()
|
||||||
|
}
|
||||||
|
.frame(minWidth: 0, maxWidth: .infinity)
|
||||||
|
}
|
||||||
|
|
||||||
|
HStack(spacing: 0) {
|
||||||
|
VStack(alignment: .center) {
|
||||||
|
Text("Left Eye")
|
||||||
|
ColorPicker("", selection: $customIcon.leftEyeColor)
|
||||||
|
.labelsHidden()
|
||||||
|
}
|
||||||
|
.frame(minWidth: 0, maxWidth: .infinity)
|
||||||
|
|
||||||
|
VStack(alignment: .center) {
|
||||||
|
Text("right eye")
|
||||||
|
ColorPicker("", selection: $customIcon.rightEyeColor)
|
||||||
|
.labelsHidden()
|
||||||
|
}
|
||||||
|
.frame(minWidth: 0, maxWidth: .infinity)
|
||||||
|
|
||||||
|
VStack(alignment: .center) {
|
||||||
|
Text("mouth")
|
||||||
|
ColorPicker("", selection: $customIcon.mouthColor)
|
||||||
|
.labelsHidden()
|
||||||
|
}
|
||||||
|
.frame(minWidth: 0, maxWidth: .infinity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.padding()
|
||||||
|
.background(
|
||||||
|
Color(uiColor: theme.currentTheme.secondaryBGColor)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
.padding([.leading, .trailing])
|
|
||||||
.padding([.top, .bottom], 10)
|
Divider().background(Color(UIColor.tertiarySystemBackground))
|
||||||
|
|
||||||
Group {
|
Group {
|
||||||
Divider().background(Color(UIColor.tertiarySystemBackground))
|
|
||||||
|
|
||||||
HStack {
|
|
||||||
Spacer()
|
|
||||||
VStack(alignment: .center) {
|
|
||||||
Text("background")
|
|
||||||
ColorPicker("", selection: $customIcon.bgColor)
|
|
||||||
.labelsHidden()
|
|
||||||
}
|
|
||||||
Spacer()
|
|
||||||
VStack(alignment: .center) {
|
|
||||||
Text("Inner")
|
|
||||||
ColorPicker("", selection: $customIcon.innerColor)
|
|
||||||
.labelsHidden()
|
|
||||||
}
|
|
||||||
Spacer()
|
|
||||||
VStack(alignment: .center) {
|
|
||||||
Text("Face Outline")
|
|
||||||
ColorPicker("", selection: $customIcon.circleStrokeColor)
|
|
||||||
.labelsHidden()
|
|
||||||
}
|
|
||||||
Spacer()
|
|
||||||
}
|
|
||||||
|
|
||||||
HStack {
|
|
||||||
Spacer()
|
|
||||||
VStack(alignment: .center) {
|
|
||||||
Text("Left Eye")
|
|
||||||
ColorPicker("", selection: $customIcon.leftEyeColor)
|
|
||||||
.labelsHidden()
|
|
||||||
}
|
|
||||||
Spacer()
|
|
||||||
VStack(alignment: .center) {
|
|
||||||
Text("right eye")
|
|
||||||
ColorPicker("", selection: $customIcon.rightEyeColor)
|
|
||||||
.labelsHidden()
|
|
||||||
}
|
|
||||||
Spacer()
|
|
||||||
VStack(alignment: .center) {
|
|
||||||
Text("mouth")
|
|
||||||
ColorPicker("", selection: $customIcon.mouthColor)
|
|
||||||
.labelsHidden()
|
|
||||||
}
|
|
||||||
Spacer()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.padding([.leading, .trailing])
|
|
||||||
.padding([.top, .bottom], 10)
|
|
||||||
|
|
||||||
Group {
|
|
||||||
Divider().background(Color(UIColor.tertiarySystemBackground))
|
|
||||||
|
|
||||||
HStack(alignment: .center, spacing: 0) {
|
HStack(alignment: .center, spacing: 0) {
|
||||||
Button(action: {
|
Button(action: {
|
||||||
createRandom()
|
createRandom()
|
||||||
@@ -255,7 +263,7 @@ struct CreateIconView: View {
|
|||||||
.font(.title)
|
.font(.title)
|
||||||
.fontWeight(.bold)
|
.fontWeight(.bold)
|
||||||
.foregroundColor(Color(UIColor.white))
|
.foregroundColor(Color(UIColor.white))
|
||||||
|
|
||||||
})
|
})
|
||||||
.frame(minWidth: 0, maxWidth: .infinity)
|
.frame(minWidth: 0, maxWidth: .infinity)
|
||||||
.background(.blue)
|
.background(.blue)
|
||||||
@@ -267,13 +275,16 @@ struct CreateIconView: View {
|
|||||||
let icon = bigIconView.snapshot()
|
let icon = bigIconView.snapshot()
|
||||||
if let data = icon.pngData() {
|
if let data = icon.pngData() {
|
||||||
savedCustomIcon = data
|
savedCustomIcon = data
|
||||||
|
|
||||||
|
let impactMed = UIImpactFeedbackGenerator(style: .heavy)
|
||||||
|
impactMed.impactOccurred()
|
||||||
}
|
}
|
||||||
}, label: {
|
}, label: {
|
||||||
Text("Save")
|
Text("Save")
|
||||||
.font(.title)
|
.font(.title)
|
||||||
.fontWeight(.bold)
|
.fontWeight(.bold)
|
||||||
.foregroundColor(Color(UIColor.white))
|
.foregroundColor(Color(UIColor.white))
|
||||||
|
|
||||||
})
|
})
|
||||||
.frame(minWidth: 0, maxWidth: .infinity)
|
.frame(minWidth: 0, maxWidth: .infinity)
|
||||||
.background(.green)
|
.background(.green)
|
||||||
@@ -285,6 +296,11 @@ struct CreateIconView: View {
|
|||||||
|
|
||||||
struct CreateIconView_Previews: PreviewProvider {
|
struct CreateIconView_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
CreateIconView()
|
Group {
|
||||||
|
CreateIconView()
|
||||||
|
|
||||||
|
CreateIconView()
|
||||||
|
.preferredColorScheme(.dark)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user