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
// | |
// ContentView.swift | |
// HonkHonk | |
// | |
// Created by Thomas Ricouard on 23/12/2020. | |
// | |
import SwiftUI |
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
public class MusicPlayerManager: ObservableObject { | |
public static let shared = MusicPlayerManager() | |
public enum PlayMode { | |
case random, ordered | |
} | |
@Published public var songs: [String: Song] = [:] { | |
@Published public var currentSong: Song? { | |
didSet { |
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 Purchases | |
struct SubscribeView: View { | |
enum Source: String { | |
case dashboard, turnip, turnipForm, list, musics | |
} | |
@EnvironmentObject private var subscriptionManager: SubscriptionManager | |
@Environment(\.presentationMode) private var presentationMode | |
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 SwiftUI | |
import Purchases | |
public class SubscriptionManager: ObservableObject { | |
public static let shared = SubscriptionManager() | |
public enum SubscriptionStatus { | |
case subscribed, notSubscribed | |
} |
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
struct ItemsListView: View { | |
@ObservedObject var viewModel: ItemsViewModel | |
@State private var showSortSheet = false | |
@State private var itemRowsDisplayMode: ItemRowView.DisplayMode = .large | |
var currentItems: [Item] { | |
get { | |
if !viewModel.searchText.isEmpty { | |
return viewModel.searchItems | |
} else if viewModel.sort != nil { |
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
private var sortSheet: ActionSheet { | |
var buttons: [ActionSheet.Button] = [] | |
for sort in ItemsViewModel.Sort.allCases { | |
buttons.append(.default(Text(sort.rawValue.localizedCapitalized), | |
action: { | |
self.viewModel.sort = sort | |
})) | |
} | |
if viewModel.sort != nil { |
NewerOlder