Files
Reflect/Shared/Models/CustomIcon.swift
Trey t fce13af84e re-do the way a custom icon is generated / stored
fix small roll up header text going outside of circle view
2022-02-14 17:02:56 -06:00

148 lines
4.0 KiB
Swift

//
// CustomIcon.swift
// Feels (iOS)
//
// Created by Trey Tartt on 2/13/22.
//
import SwiftUI
class CustomIcon: ObservableObject {
static let numberOfBGItems = 99
static let defaultCustomIcon = CustomIcon(leftEye: EyeOptions.defaultOption,
rightEye: EyeOptions.defaultOption,
mouth: MouthOptions.defaultOption,
background: IconView_Previews.backgrounds,
bgColor: .red,
innerColor: .green,
bgOverlayColor: .orange,
rightEyeColor: .orange,
leftEyeColor: .yellow,
mouthColor: .green,
circleStrokeColor: .pink)
init(leftEye: EyeOptions,
rightEye: EyeOptions,
mouth: MouthOptions,
background: [(BackGroundOptions, UUID)],
bgColor: Color,
innerColor: Color,
bgOverlayColor: Color,
rightEyeColor: Color,
leftEyeColor: Color,
mouthColor: Color,
circleStrokeColor: Color
) {
self.leftEye = leftEye
self.rightEye = rightEye
self.mouth = mouth
self.background = background
self.bgColor = bgColor
self.innerColor = innerColor
self.bgOverlayColor = bgOverlayColor
self.rightEyeColor = rightEyeColor
self.leftEyeColor = leftEyeColor
self.mouthColor = mouthColor
self.circleStrokeColor = circleStrokeColor
}
@Published var leftEye: EyeOptions
@Published var rightEye: EyeOptions
@Published var mouth: MouthOptions
@Published var background: [(BackGroundOptions, UUID)]
@Published var bgColor: Color
@Published var innerColor: Color
@Published var bgOverlayColor: Color
@Published var leftEyeColor: Color
@Published var rightEyeColor: Color
@Published var mouthColor: Color
@Published var circleStrokeColor: Color
}
enum BackGroundOptions: String, CaseIterable, Codable {
case horrible
case bad
case average
case good
case great
case random
static var selectable: [BackGroundOptions] {
return [.great, .good, .average, .bad, .horrible]
}
static public var defaultOption: BackGroundOptions {
BackGroundOptions.random
}
public var image: Image {
return Image(self.rawValue, bundle: .main)
}
}
enum Eyes: String, Codable {
case left
case right
}
enum EyeOptions: String, CaseIterable, Codable {
case fire = "fire"
case bolt = "bolt2"
case dollar = "dollar"
case bell = "bell"
case btc = "btc"
case code = "code"
case crown = "crown"
case divide = "divide"
case exclamation = "exclamation"
case fan = "fan"
case floppy = "floppy"
case x = "x"
case skull = "skull"
case covid = "covid"
case bomb = "bomb"
case skull2 = "skull2"
case poo = "poo"
static public var defaultOption: EyeOptions {
EyeOptions.fire
}
public var image: Image {
return Image(self.rawValue, bundle: .main)
}
}
enum MouthOptions: String, CaseIterable, Codable {
case fire = "fire"
case bolt = "bolt2"
case dollar = "dollar"
case bell = "bell"
case btc = "btc"
case code = "code"
case crown = "crown"
case divide = "divide"
case exclamation = "exclamation"
case fan = "fan"
case floppy = "floppy"
case x = "x"
case skull = "skull"
case covid = "covid"
case bomb = "bomb"
case skull2 = "skull2"
case poo = "poo"
static public var defaultOption: MouthOptions {
MouthOptions.bomb
}
public var image: Image {
return Image(self.rawValue, bundle: .main)
}
}