This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// SpotifyAPIManager.swift | |
// Musock | |
// | |
// Created by Terje Lønøy on 02/08/2022. | |
// | |
import Foundation | |
class SpotifyAPIManager { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import Combine | |
@propertyWrapper | |
public class PreviewPublisher<Value> { | |
let isPreview = ProcessInfo.processInfo.environment["XCODE_RUNNING_FOR_PREVIEWS"] == "1" | |
private var defaultValue: Value | |
private var previewValue: Value | |
private let innerSubject = PassthroughSubject<Value, Never>() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
@propertyWrapper public struct Preview<Value> { | |
let isPreview = ProcessInfo.processInfo.environment["XCODE_RUNNING_FOR_PREVIEWS"] == "1" | |
public var wrappedValue: Value { | |
get { | |
return isPreview ? previewValue : defaultValue | |
} | |
set { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@propertyWrapper struct Debug<Value> { | |
var wrappedValue: Value { | |
get { | |
#if DEBUG | |
return debugValue | |
#else | |
return defaultValue | |
#endif | |
} | |
set { |