Complete rename across all bundle IDs, App Groups, CloudKit containers, StoreKit product IDs, data store filenames, URL schemes, logger subsystems, Swift identifiers, user-facing strings (7 languages), file names, directory names, Xcode project, schemes, assets, and documentation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
95 lines
2.8 KiB
Swift
95 lines
2.8 KiB
Swift
//
|
|
// IconView.swift
|
|
// Reflect (iOS)
|
|
//
|
|
// Created by Trey Tartt on 1/20/22.
|
|
//
|
|
|
|
import SwiftUI
|
|
import SwiftData
|
|
|
|
struct BGViewItem: View {
|
|
@AppStorage(UserDefaultsStore.Keys.moodTint.rawValue, store: GroupUserDefaults.groupDefaults) private var moodTint: MoodTints = .Default
|
|
|
|
let mood: Mood
|
|
let size: CGSize
|
|
var color: Color
|
|
let animate: Bool
|
|
let yRowPosition: Float
|
|
|
|
init(mood: Mood, size: CGSize, animate: Bool, yRowPosition: Float, color: Color) {
|
|
self.color = color
|
|
self.mood = mood
|
|
self.size = size
|
|
self.yRowPosition = yRowPosition
|
|
self.animate = animate
|
|
}
|
|
|
|
var body: some View {
|
|
FontAwesomeMoodImages.icon(forMood: mood)
|
|
.resizable()
|
|
.frame(width: size.width, height: size.height)
|
|
.foregroundColor(DefaultMoodTint.color(forMood: mood))
|
|
// .blur(radius: 3)
|
|
.opacity(0.1)
|
|
.accessibilityHidden(true)
|
|
}
|
|
}
|
|
|
|
struct BGView: View, Equatable {
|
|
@AppStorage(UserDefaultsStore.Keys.moodTint.rawValue, store: GroupUserDefaults.groupDefaults) private var moodTint: MoodTints = .Default
|
|
|
|
var numAcross: Int
|
|
var numDown: Int
|
|
let iconSize = 35
|
|
|
|
init(screenSize: CGSize = CGSize(width: 393, height: 852)) {
|
|
numAcross = Int(screenSize.width) / iconSize
|
|
numDown = Int(screenSize.height) / iconSize
|
|
}
|
|
|
|
var randomMood: Mood? {
|
|
return Mood.allValues.randomElement()
|
|
}
|
|
|
|
var body: some View {
|
|
VStack {
|
|
ForEach(0...numDown, id: \.self) { row in
|
|
HStack {
|
|
ForEach(0...numAcross, id: \.self) { _ in
|
|
if let randomMood = randomMood {
|
|
BGViewItem(mood: randomMood,
|
|
size: .init(width: iconSize,height: iconSize),
|
|
animate: false,
|
|
yRowPosition: Float(row)/Float(numDown),
|
|
color: moodTint.color(forMood:randomMood))
|
|
}
|
|
}.frame(minWidth: 0, maxWidth: .infinity)
|
|
.padding([.trailing, .leading], 13.5)
|
|
}
|
|
.padding(.top, -9)
|
|
}
|
|
}
|
|
.padding(.top, -50)
|
|
}
|
|
|
|
static func == (lhs: BGView, rhs: BGView) -> Bool {
|
|
return true
|
|
}
|
|
}
|
|
|
|
#if !WIDGET_EXTENSION
|
|
struct BGView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
BGView().modelContainer(DataController.shared.container)
|
|
.onAppear(perform: {
|
|
DataController.shared.populateMemory()
|
|
})
|
|
|
|
BGView()
|
|
.preferredColorScheme(.dark)
|
|
.modelContainer(DataController.shared.container)
|
|
}
|
|
}
|
|
#endif
|