Files
Reflect/Shared/Models/MoodImagable.swift
Trey t 0442eab1f8 Rebrand entire project from Feels to Reflect
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>
2026-02-26 11:47:16 -06:00

208 lines
6.2 KiB
Swift

//
// MoodImagable.swift
// Reflect (iOS)
//
// Created by Trey Tartt on 2/19/22.
//
import SwiftUI
protocol MoodImagable {
static func icon(forMood mood: Mood) -> Image
}
enum MoodImages: Int, CaseIterable {
case FontAwesome
case Emoji
case HandEmjoi
case Weather
case Garden
case Hearts
case Cosmic
func icon(forMood mood: Mood) -> Image {
switch self {
case .FontAwesome:
return FontAwesomeMoodImages.icon(forMood: mood)
case .Emoji:
return EmojiMoodImages.icon(forMood: mood)
case .HandEmjoi:
return HandEmojiMoodImages.icon(forMood: mood)
case .Weather:
return WeatherMoodImages.icon(forMood: mood)
case .Garden:
return GardenMoodImages.icon(forMood: mood)
case .Hearts:
return HeartsMoodImages.icon(forMood: mood)
case .Cosmic:
return CosmicMoodImages.icon(forMood: mood)
}
}
var moodImages: MoodImagable.Type {
switch self {
case .FontAwesome:
return FontAwesomeMoodImages.self
case .Emoji:
return EmojiMoodImages.self
case .HandEmjoi:
return HandEmojiMoodImages.self
case .Weather:
return WeatherMoodImages.self
case .Garden:
return GardenMoodImages.self
case .Hearts:
return HeartsMoodImages.self
case .Cosmic:
return CosmicMoodImages.self
}
}
}
final class FontAwesomeMoodImages: MoodImagable {
static func icon(forMood mood: Mood) -> Image {
switch mood {
case .horrible:
return Image("horrible", bundle: .main)
case .bad:
return Image("bad", bundle: .main)
case .average:
return Image("average", bundle: .main)
case .good:
return Image("good", bundle: .main)
case .great:
return Image("great", bundle: .main)
case .missing:
return Image("xmark-solid", bundle: .main)
case .placeholder:
return Image("xmark-solid", bundle: .main)
}
}
}
final class EmojiMoodImages: MoodImagable {
static func icon(forMood mood: Mood) -> Image {
switch mood {
case .horrible:
return Image(uiImage: "💩".textToImage()!)
case .bad:
return Image(uiImage: "😕".textToImage()!)
case .average:
return Image(uiImage: "😑".textToImage()!)
case .good:
return Image(uiImage: "🙂".textToImage()!)
case .great:
return Image(uiImage: "😀".textToImage()!)
case .missing:
return Image("xmark-solid", bundle: .main)
case .placeholder:
return Image("xmark-solid", bundle: .main)
}
}
}
final class HandEmojiMoodImages: MoodImagable {
static func icon(forMood mood: Mood) -> Image {
switch mood {
case .horrible:
return Image(uiImage: "🖕".textToImage()!)
case .bad:
return Image(uiImage: "👎".textToImage()!)
case .average:
return Image(uiImage: "🖖".textToImage()!)
case .good:
return Image(uiImage: "👍".textToImage()!)
case .great:
return Image(uiImage: "🙏".textToImage()!)
case .missing:
return Image("xmark-solid", bundle: .main)
case .placeholder:
return Image("xmark-solid", bundle: .main)
}
}
}
final class WeatherMoodImages: MoodImagable {
static func icon(forMood mood: Mood) -> Image {
switch mood {
case .horrible:
return Image(uiImage: "⛈️".textToImage()!)
case .bad:
return Image(uiImage: "🌧️".textToImage()!)
case .average:
return Image(uiImage: "☁️".textToImage()!)
case .good:
return Image(uiImage: "".textToImage()!)
case .great:
return Image(uiImage: "☀️".textToImage()!)
case .missing:
return Image(uiImage: "🌫️".textToImage()!)
case .placeholder:
return Image("xmark-solid", bundle: .main)
}
}
}
final class GardenMoodImages: MoodImagable {
static func icon(forMood mood: Mood) -> Image {
switch mood {
case .horrible:
return Image(uiImage: "🥀".textToImage()!)
case .bad:
return Image(uiImage: "🍂".textToImage()!)
case .average:
return Image(uiImage: "🌱".textToImage()!)
case .good:
return Image(uiImage: "🌿".textToImage()!)
case .great:
return Image(uiImage: "🌸".textToImage()!)
case .missing:
return Image(uiImage: "🕳️".textToImage()!)
case .placeholder:
return Image("xmark-solid", bundle: .main)
}
}
}
final class HeartsMoodImages: MoodImagable {
static func icon(forMood mood: Mood) -> Image {
switch mood {
case .horrible:
return Image(uiImage: "💔".textToImage()!)
case .bad:
return Image(uiImage: "🩶".textToImage()!)
case .average:
return Image(uiImage: "🤍".textToImage()!)
case .good:
return Image(uiImage: "🩷".textToImage()!)
case .great:
return Image(uiImage: "💖".textToImage()!)
case .missing:
return Image(uiImage: "🖤".textToImage()!)
case .placeholder:
return Image("xmark-solid", bundle: .main)
}
}
}
final class CosmicMoodImages: MoodImagable {
static func icon(forMood mood: Mood) -> Image {
switch mood {
case .horrible:
return Image(uiImage: "🕳️".textToImage()!)
case .bad:
return Image(uiImage: "🌑".textToImage()!)
case .average:
return Image(uiImage: "🌓".textToImage()!)
case .good:
return Image(uiImage: "🌕".textToImage()!)
case .great:
return Image(uiImage: "".textToImage()!)
case .missing:
return Image(uiImage: "".textToImage()!)
case .placeholder:
return Image("xmark-solid", bundle: .main)
}
}
}