Fix linker errors when building in release mode

This commit is contained in:
Shadowfacts 2024-04-15 22:30:20 -04:00
parent a759731eba
commit 3f370945e6
4 changed files with 16 additions and 16 deletions

View File

@ -8,12 +8,12 @@
import Foundation import Foundation
import UIKit import UIKit
struct ThemeKey: MigratablePreferenceKey { public struct ThemeKey: MigratablePreferenceKey {
static var defaultValue: Theme { .unspecified } public static var defaultValue: Theme { .unspecified }
} }
struct AccentColorKey: MigratablePreferenceKey { public struct AccentColorKey: MigratablePreferenceKey {
static var defaultValue: AccentColor { .default } public static var defaultValue: AccentColor { .default }
} }
struct AvatarStyleKey: MigratablePreferenceKey { struct AvatarStyleKey: MigratablePreferenceKey {
@ -28,10 +28,10 @@ struct TrailingSwipeActionsKey: MigratablePreferenceKey {
static var defaultValue: [StatusSwipeAction] { [.reply, .share] } static var defaultValue: [StatusSwipeAction] { [.reply, .share] }
} }
struct WidescreenNavigationModeKey: MigratablePreferenceKey { public struct WidescreenNavigationModeKey: MigratablePreferenceKey {
static var defaultValue: WidescreenNavigationMode { .multiColumn } public static var defaultValue: WidescreenNavigationMode { .multiColumn }
static func shouldMigrate(oldValue: WidescreenNavigationMode) -> Bool { public static func shouldMigrate(oldValue: WidescreenNavigationMode) -> Bool {
oldValue != .splitScreen oldValue != .splitScreen
} }
} }

View File

@ -7,10 +7,10 @@
import Foundation import Foundation
struct TrueKey: MigratablePreferenceKey { public struct TrueKey: MigratablePreferenceKey {
static var defaultValue: Bool { true } public static var defaultValue: Bool { true }
} }
struct FalseKey: MigratablePreferenceKey { public struct FalseKey: MigratablePreferenceKey {
static var defaultValue: Bool { false } public static var defaultValue: Bool { false }
} }

View File

@ -89,13 +89,13 @@ final class Preference<Key: PreferenceKey>: Codable {
} }
} }
struct PreferencePublisher<Key: PreferenceKey>: Publisher { public struct PreferencePublisher<Key: PreferenceKey>: Publisher {
typealias Output = Key.Value public typealias Output = Key.Value
typealias Failure = Never public typealias Failure = Never
let preference: Preference<Key> let preference: Preference<Key>
func receive<S>(subscriber: S) where S : Subscriber, Never == S.Failure, Key.Value == S.Input { public func receive<S>(subscriber: S) where S : Subscriber, Never == S.Failure, Key.Value == S.Input {
preference.$storedValue.map { $0 ?? Key.defaultValue }.receive(subscriber: subscriber) preference.$storedValue.map { $0 ?? Key.defaultValue }.receive(subscriber: subscriber)
} }
} }

View File

@ -16,7 +16,7 @@ public protocol PreferenceKey {
} }
extension PreferenceKey { extension PreferenceKey {
static func didSet(in store: PreferenceStore, newValue: Value) {} public static func didSet(in store: PreferenceStore, newValue: Value) {}
} }
protocol MigratablePreferenceKey: PreferenceKey where Value: Equatable { protocol MigratablePreferenceKey: PreferenceKey where Value: Equatable {