diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..330d167 --- /dev/null +++ b/.gitignore @@ -0,0 +1,90 @@ +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## User settings +xcuserdata/ + +## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) +*.xcscmblueprint +*.xccheckout + +## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) +build/ +DerivedData/ +*.moved-aside +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 + +## Obj-C/Swift specific +*.hmap + +## App packaging +*.ipa +*.dSYM.zip +*.dSYM + +## Playgrounds +timeline.xctimeline +playground.xcworkspace + +# Swift Package Manager +# +# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. +# Packages/ +# Package.pins +# Package.resolved +# *.xcodeproj +# +# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata +# hence it is not needed unless you have added a package configuration file to your project +# .swiftpm + +.build/ + +# CocoaPods +# +# We recommend against adding the Pods directory to your .gitignore. However +# you should judge for yourself, the pros and cons are mentioned at: +# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control +# +# Pods/ +# +# Add this line if you want to avoid checking in source code from the Xcode workspace +# *.xcworkspace + +# Carthage +# +# Add this line if you want to avoid checking in source code from Carthage dependencies. +# Carthage/Checkouts + +Carthage/Build/ + +# Accio dependency management +Dependencies/ +.accio/ + +# fastlane +# +# It is recommended to not store the screenshots in the git repo. +# Instead, use fastlane to re-generate the screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://docs.fastlane.tools/best-practices/source-control/#source-control + +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots/**/*.png +fastlane/test_output + +# Code Injection +# +# After new code Injection tools there's a generated folder /iOSInjectionProject +# https://github.com/johnno1962/injectionforxcode + +iOSInjectionProject/ diff --git a/Spottie/Backend/EventBroker.swift b/Spottie/Backend/EventBroker.swift new file mode 100644 index 0000000..cc802fa --- /dev/null +++ b/Spottie/Backend/EventBroker.swift @@ -0,0 +1,8 @@ +// +// EventBroker.swift +// Spottie +// +// Created by Lee Jun Kit on 22/5/21. +// + +import Foundation diff --git a/Spottie/Backend/HTTPClient.swift b/Spottie/Backend/HTTPClient.swift new file mode 100644 index 0000000..b593110 --- /dev/null +++ b/Spottie/Backend/HTTPClient.swift @@ -0,0 +1,8 @@ +// +// HTTPClient.swift +// Spottie +// +// Created by Lee Jun Kit on 20/5/21. +// + +import Foundation diff --git a/Spottie/Backend/SpotifyAPI.swift b/Spottie/Backend/SpotifyAPI.swift new file mode 100644 index 0000000..ed39075 --- /dev/null +++ b/Spottie/Backend/SpotifyAPI.swift @@ -0,0 +1,8 @@ +// +// SpotifyAPI.swift +// Spottie +// +// Created by Lee Jun Kit on 20/5/21. +// + +import Foundation diff --git a/Spottie/Backend/Types/API/CurrentlyPlayingContextObject.swift b/Spottie/Backend/Types/API/CurrentlyPlayingContextObject.swift new file mode 100644 index 0000000..e416090 --- /dev/null +++ b/Spottie/Backend/Types/API/CurrentlyPlayingContextObject.swift @@ -0,0 +1,12 @@ +// +// CurrentTrackResponse.swift +// Spottie +// +// Created by Lee Jun Kit on 23/5/21. +// + +struct CurrentPlayerStateResponse: Codable { + var isPlaying: Bool + var shuffleState: Bool + +} diff --git a/Spottie/Backend/Types/Base/AlbumObject.swift b/Spottie/Backend/Types/Base/AlbumObject.swift new file mode 100644 index 0000000..a43f246 --- /dev/null +++ b/Spottie/Backend/Types/Base/AlbumObject.swift @@ -0,0 +1,15 @@ +// +// AlbumObject.swift +// Spottie +// +// Created by Lee Jun Kit on 22/5/21. +// + +struct AlbumObject: Codable { + var gid: String + var name: String + var artist: ArtistObject + var label: String + var date: DateObject + var coverGroup: CoverGroupObject +} diff --git a/Spottie/Backend/Types/Base/ArtistObject.swift b/Spottie/Backend/Types/Base/ArtistObject.swift new file mode 100644 index 0000000..a86e9c0 --- /dev/null +++ b/Spottie/Backend/Types/Base/ArtistObject.swift @@ -0,0 +1,11 @@ +// +// ArtistObject.swift +// Spottie +// +// Created by Lee Jun Kit on 22/5/21. +// + +struct ArtistObject: Codable { + var gid: String + var name: String +} diff --git a/Spottie/Backend/Types/Base/CoverGroupObject.swift b/Spottie/Backend/Types/Base/CoverGroupObject.swift new file mode 100644 index 0000000..db5ddd0 --- /dev/null +++ b/Spottie/Backend/Types/Base/CoverGroupObject.swift @@ -0,0 +1,10 @@ +// +// CoverGroupObject.swift +// Spottie +// +// Created by Lee Jun Kit on 22/5/21. +// + +struct CoverGroupObject: Codable { + var image: [ImageObject] +} diff --git a/Spottie/Backend/Types/Base/DateObject.swift b/Spottie/Backend/Types/Base/DateObject.swift new file mode 100644 index 0000000..646909e --- /dev/null +++ b/Spottie/Backend/Types/Base/DateObject.swift @@ -0,0 +1,12 @@ +// +// DateObject.swift +// Spottie +// +// Created by Lee Jun Kit on 22/5/21. +// + +struct DateObject: Codable { + var year: Int + var month: Int + var day: Int +} diff --git a/Spottie/Backend/Types/Base/ImageObject.swift b/Spottie/Backend/Types/Base/ImageObject.swift new file mode 100644 index 0000000..9312546 --- /dev/null +++ b/Spottie/Backend/Types/Base/ImageObject.swift @@ -0,0 +1,13 @@ +// +// ImageObject.swift +// Spottie +// +// Created by Lee Jun Kit on 22/5/21. +// + +struct ImageObject: Codable { + var fileId: String + var size: String + var width: Int + var height: Int +} diff --git a/Spottie/Backend/Types/Base/TrackObject.swift b/Spottie/Backend/Types/Base/TrackObject.swift new file mode 100644 index 0000000..39db0a1 --- /dev/null +++ b/Spottie/Backend/Types/Base/TrackObject.swift @@ -0,0 +1,17 @@ +// +// TrackObject.swift +// Spottie +// +// Created by Lee Jun Kit on 22/5/21. +// + +struct TrackObject: Codable { + var gid: String + var name: String + var album: AlbumObject + var artist: ArtistObject + var number: Int + var discNumber: Int + var duration: Int + var popularity: Int +} diff --git a/Spottie/Backend/Types/Base/WebAPIArtistObject.swift b/Spottie/Backend/Types/Base/WebAPIArtistObject.swift new file mode 100644 index 0000000..f76c22b --- /dev/null +++ b/Spottie/Backend/Types/Base/WebAPIArtistObject.swift @@ -0,0 +1,8 @@ +// +// WebAPIArtistObject.swift +// Spottie +// +// Created by Lee Jun Kit on 24/5/21. +// + +import Foundation diff --git a/Spottie/Backend/Types/Base/WebAPIImageObject.swift b/Spottie/Backend/Types/Base/WebAPIImageObject.swift new file mode 100644 index 0000000..9ab1a70 --- /dev/null +++ b/Spottie/Backend/Types/Base/WebAPIImageObject.swift @@ -0,0 +1,8 @@ +// +// WebAPIImageObject.swift +// Spottie +// +// Created by Lee Jun Kit on 24/5/21. +// + +import Foundation diff --git a/Spottie/Backend/Types/Base/WebAPISimplifiedAlbumObject.swift b/Spottie/Backend/Types/Base/WebAPISimplifiedAlbumObject.swift new file mode 100644 index 0000000..fd3d4b8 --- /dev/null +++ b/Spottie/Backend/Types/Base/WebAPISimplifiedAlbumObject.swift @@ -0,0 +1,10 @@ +// +// WebAPISimplifiedArtistObject.swift +// Spottie +// +// Created by Lee Jun Kit on 24/5/21. +// + +struct WebAPISimplifiedArtistObject: Codable { + +} diff --git a/Spottie/Backend/Types/Base/WebAPISimplifiedArtistObject.swift b/Spottie/Backend/Types/Base/WebAPISimplifiedArtistObject.swift new file mode 100644 index 0000000..baa9830 --- /dev/null +++ b/Spottie/Backend/Types/Base/WebAPISimplifiedArtistObject.swift @@ -0,0 +1,8 @@ +// +// WebAPISimplifiedArtistObject.swift +// Spottie +// +// Created by Lee Jun Kit on 24/5/21. +// + +import Foundation diff --git a/Spottie/Backend/Types/Base/WebAPITrackObject.swift b/Spottie/Backend/Types/Base/WebAPITrackObject.swift new file mode 100644 index 0000000..8d00a79 --- /dev/null +++ b/Spottie/Backend/Types/Base/WebAPITrackObject.swift @@ -0,0 +1,8 @@ +// +// WebAPITrackObject.swift +// Spottie +// +// Created by Lee Jun Kit on 24/5/21. +// + +import Foundation diff --git a/Spottie/Backend/Types/Events/ContextChangedEvent.swift b/Spottie/Backend/Types/Events/ContextChangedEvent.swift new file mode 100644 index 0000000..0e8d113 --- /dev/null +++ b/Spottie/Backend/Types/Events/ContextChangedEvent.swift @@ -0,0 +1,8 @@ +// +// ContextChangedEvent.swift +// Spottie +// +// Created by Lee Jun Kit on 22/5/21. +// + +import Foundation diff --git a/Spottie/Backend/Types/Events/InactiveSessionEvent.swift b/Spottie/Backend/Types/Events/InactiveSessionEvent.swift new file mode 100644 index 0000000..bb88bed --- /dev/null +++ b/Spottie/Backend/Types/Events/InactiveSessionEvent.swift @@ -0,0 +1,8 @@ +// +// InactiveSessionEvent.swift +// Spottie +// +// Created by Lee Jun Kit on 22/5/21. +// + +import Foundation diff --git a/Spottie/Backend/Types/Events/MetadataAvailableEvent.swift b/Spottie/Backend/Types/Events/MetadataAvailableEvent.swift new file mode 100644 index 0000000..ecb1de4 --- /dev/null +++ b/Spottie/Backend/Types/Events/MetadataAvailableEvent.swift @@ -0,0 +1,8 @@ +// +// MetadataAvailableEvent.swift +// Spottie +// +// Created by Lee Jun Kit on 22/5/21. +// + +import Foundation diff --git a/Spottie/Backend/Types/Events/PlaybackPausedEvent.swift b/Spottie/Backend/Types/Events/PlaybackPausedEvent.swift new file mode 100644 index 0000000..a2a9c32 --- /dev/null +++ b/Spottie/Backend/Types/Events/PlaybackPausedEvent.swift @@ -0,0 +1,8 @@ +// +// PlaybackPaused.swift +// Spottie +// +// Created by Lee Jun Kit on 22/5/21. +// + +import Foundation diff --git a/Spottie/Backend/Types/Events/PlaybackResumedEvent.swift b/Spottie/Backend/Types/Events/PlaybackResumedEvent.swift new file mode 100644 index 0000000..4bc39bd --- /dev/null +++ b/Spottie/Backend/Types/Events/PlaybackResumedEvent.swift @@ -0,0 +1,8 @@ +// +// PlaybackResumedEvent.swift +// Spottie +// +// Created by Lee Jun Kit on 22/5/21. +// + +import Foundation diff --git a/Spottie/Backend/Types/Events/TrackChangedEvent.swift b/Spottie/Backend/Types/Events/TrackChangedEvent.swift new file mode 100644 index 0000000..b40a888 --- /dev/null +++ b/Spottie/Backend/Types/Events/TrackChangedEvent.swift @@ -0,0 +1,8 @@ +// +// TrackChangedEvent.swift +// Spottie +// +// Created by Lee Jun Kit on 22/5/21. +// + +import Foundation diff --git a/Spottie/Backend/Types/Events/TrackSeekedEvent.swift b/Spottie/Backend/Types/Events/TrackSeekedEvent.swift new file mode 100644 index 0000000..e3df294 --- /dev/null +++ b/Spottie/Backend/Types/Events/TrackSeekedEvent.swift @@ -0,0 +1,8 @@ +// +// TrackSeekedEvent.swift +// Spottie +// +// Created by Lee Jun Kit on 22/5/21. +// + +import Foundation diff --git a/Spottie/Backend/Types/Events/VolumeChangedEvent.swift b/Spottie/Backend/Types/Events/VolumeChangedEvent.swift new file mode 100644 index 0000000..2860ade --- /dev/null +++ b/Spottie/Backend/Types/Events/VolumeChangedEvent.swift @@ -0,0 +1,8 @@ +// +// VolumeChangedEvent.swift +// Spottie +// +// Created by Lee Jun Kit on 22/5/21. +// + +import Foundation diff --git a/Spottie/Backend/Types/Nothing.swift b/Spottie/Backend/Types/Nothing.swift new file mode 100644 index 0000000..71866af --- /dev/null +++ b/Spottie/Backend/Types/Nothing.swift @@ -0,0 +1,8 @@ +// +// Nothing.swift +// Spottie +// +// Created by Lee Jun Kit on 20/5/21. +// + +import Foundation diff --git a/Spottie/Backend/Types/SpotifyEvent.swift b/Spottie/Backend/Types/SpotifyEvent.swift new file mode 100644 index 0000000..2fddc29 --- /dev/null +++ b/Spottie/Backend/Types/SpotifyEvent.swift @@ -0,0 +1,28 @@ +// +// WebsocketMessage.swift +// Spottie +// +// Created by Lee Jun Kit on 22/5/21. +// + +enum EventType: String, Codable { + case contextChanged + case trackChanged + case playbackEnded + case playbackPaused + case playbackResumed + case volumeChanged + case trackSeeked + case metadataAvailable + case playbackHaltStateChanged + case sessionCleared + case sessionChanged + case inactiveSession + case connectionDropped + case connectionEstablished + case panic +} + +struct WebsocketMessage: Codable { + var type: EventType +} diff --git a/Spottie/Backend/Types/SpottieError.swift b/Spottie/Backend/Types/SpottieError.swift new file mode 100644 index 0000000..1b585b0 --- /dev/null +++ b/Spottie/Backend/Types/SpottieError.swift @@ -0,0 +1,8 @@ +// +// SpottieError.swift +// Spottie +// +// Created by Lee Jun Kit on 22/5/21. +// + +import Foundation diff --git a/Spottie/Backend/WebsocketClient.swift b/Spottie/Backend/WebsocketClient.swift new file mode 100644 index 0000000..49fa91f --- /dev/null +++ b/Spottie/Backend/WebsocketClient.swift @@ -0,0 +1,58 @@ +// +// SpotifyState.swift +// Spottie +// +// Created by Lee Jun Kit on 22/5/21. +// + +import Foundation +import Combine + +class WebsocketClient: NSObject, URLSessionWebSocketDelegate { + var urlSession: URLSession! + var websocketTask: URLSessionWebSocketTask! + let delegateQueue = OperationQueue() + + init(url: URL) { + super.init() + urlSession = URLSession(configuration: .default, delegate: self, delegateQueue: delegateQueue) + websocketTask = urlSession.webSocketTask(with: url) + connect() + } + + // MARK: - URLSessionWebSocketDelegate + func urlSession(_ session: URLSession, webSocketTask: URLSessionWebSocketTask, didOpenWithProtocol protocol: String?) { + + } + + func urlSession(_ session: URLSession, webSocketTask: URLSessionWebSocketTask, didCloseWith closeCode: URLSessionWebSocketTask.CloseCode, reason: Data?) { + + } + + // MARK: - Receiving events + func connect() { + websocketTask.resume() + listen() + } + + func listen() { + websocketTask.receive {[weak self] result in + switch result { + case .success(let response): + switch response { + case .data(_): + print("data received") + case .string(let message): + print("string received") + print(message) + @unknown default: + print("Unknown default") + } + case .failure(let error): + print("Error: \(error)") + } + + self?.listen() + } + } +} diff --git a/Spottie/ViewModels/FakePlayerViewModel.swift b/Spottie/ViewModels/FakePlayerViewModel.swift new file mode 100644 index 0000000..1c779c6 --- /dev/null +++ b/Spottie/ViewModels/FakePlayerViewModel.swift @@ -0,0 +1,8 @@ +// +// FakePlayerViewModel.swift +// Spottie +// +// Created by Lee Jun Kit on 24/5/21. +// + +import Foundation diff --git a/Spottie/ViewModels/PlayerStateProtocol.swift b/Spottie/ViewModels/PlayerStateProtocol.swift new file mode 100644 index 0000000..ad78bc4 --- /dev/null +++ b/Spottie/ViewModels/PlayerStateProtocol.swift @@ -0,0 +1,8 @@ +// +// PlayerStateProtocol.swift +// Spottie +// +// Created by Lee Jun Kit on 24/5/21. +// + +import Foundation diff --git a/Spottie/ViewModels/PlayerViewModel.swift b/Spottie/ViewModels/PlayerViewModel.swift new file mode 100644 index 0000000..dffb859 --- /dev/null +++ b/Spottie/ViewModels/PlayerViewModel.swift @@ -0,0 +1,13 @@ +// +// SpotifyState.swift +// Spottie +// +// Created by Lee Jun Kit on 22/5/21. +// + +import Foundation +import Combine + +class SpotifyState: ObservableObject { + @Published var currentTrackTitle = ""; +} diff --git a/Spottie/Views/BottomBar.swift b/Spottie/Views/BottomBar.swift new file mode 100644 index 0000000..c19a571 --- /dev/null +++ b/Spottie/Views/BottomBar.swift @@ -0,0 +1,20 @@ +// +// BottomBar.swift +// Spottie +// +// Created by Lee Jun Kit on 20/5/21. +// + +import SwiftUI + +struct BottomBar: View { + var body: some View { + Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + } +} + +struct BottomBar_Previews: PreviewProvider { + static var previews: some View { + BottomBar() + } +} diff --git a/Spottie/Views/Components/NextTrackButton.swift b/Spottie/Views/Components/NextTrackButton.swift new file mode 100644 index 0000000..16c6948 --- /dev/null +++ b/Spottie/Views/Components/NextTrackButton.swift @@ -0,0 +1,20 @@ +// +// NextTrackButton.swift +// Spottie +// +// Created by Lee Jun Kit on 24/5/21. +// + +import SwiftUI + +struct NextTrackButton: View { + var body: some View { + Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + } +} + +struct NextTrackButton_Previews: PreviewProvider { + static var previews: some View { + NextTrackButton() + } +} diff --git a/Spottie/Views/Components/NowPlaying.swift b/Spottie/Views/Components/NowPlaying.swift new file mode 100644 index 0000000..58aff9b --- /dev/null +++ b/Spottie/Views/Components/NowPlaying.swift @@ -0,0 +1,20 @@ +// +// NowPlaying.swift +// Spottie +// +// Created by Lee Jun Kit on 25/5/21. +// + +import SwiftUI + +struct NowPlaying: View { + var body: some View { + Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + } +} + +struct NowPlaying_Previews: PreviewProvider { + static var previews: some View { + NowPlaying() + } +} diff --git a/Spottie/Views/Components/PlayPauseButton.swift b/Spottie/Views/Components/PlayPauseButton.swift new file mode 100644 index 0000000..b2c64a2 --- /dev/null +++ b/Spottie/Views/Components/PlayPauseButton.swift @@ -0,0 +1,20 @@ +// +// PlayPauseButton.swift +// Spottie +// +// Created by Lee Jun Kit on 20/5/21. +// + +import SwiftUI + +struct PlayPauseButton: View { + var body: some View { + Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + } +} + +struct PlayPauseButton_Previews: PreviewProvider { + static var previews: some View { + PlayPauseButton() + } +} diff --git a/Spottie/Views/Components/PlayerControls.swift b/Spottie/Views/Components/PlayerControls.swift new file mode 100644 index 0000000..df236ab --- /dev/null +++ b/Spottie/Views/Components/PlayerControls.swift @@ -0,0 +1,20 @@ +// +// PlayerControls.swift +// Spottie +// +// Created by Lee Jun Kit on 25/5/21. +// + +import SwiftUI + +struct PlayerControls: View { + var body: some View { + Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + } +} + +struct PlayerControls_Previews: PreviewProvider { + static var previews: some View { + PlayerControls() + } +} diff --git a/Spottie/Views/Components/PreviousTrackButton.swift b/Spottie/Views/Components/PreviousTrackButton.swift new file mode 100644 index 0000000..39abf01 --- /dev/null +++ b/Spottie/Views/Components/PreviousTrackButton.swift @@ -0,0 +1,20 @@ +// +// PreviousTrackButton.swift +// Spottie +// +// Created by Lee Jun Kit on 24/5/21. +// + +import SwiftUI + +struct PreviousTrackButton: View { + var body: some View { + Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + } +} + +struct PreviousTrackButton_Previews: PreviewProvider { + static var previews: some View { + PreviousTrackButton() + } +} diff --git a/Spottie/Views/Components/RepeatButton.swift b/Spottie/Views/Components/RepeatButton.swift new file mode 100644 index 0000000..eee81fc --- /dev/null +++ b/Spottie/Views/Components/RepeatButton.swift @@ -0,0 +1,20 @@ +// +// RepeatButton.swift +// Spottie +// +// Created by Lee Jun Kit on 25/5/21. +// + +import SwiftUI + +struct RepeatButton: View { + var body: some View { + Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + } +} + +struct RepeatButton_Previews: PreviewProvider { + static var previews: some View { + RepeatButton() + } +} diff --git a/Spottie/Views/Components/ShuffleButton.swift b/Spottie/Views/Components/ShuffleButton.swift new file mode 100644 index 0000000..f62d315 --- /dev/null +++ b/Spottie/Views/Components/ShuffleButton.swift @@ -0,0 +1,20 @@ +// +// ShuffleButton.swift +// Spottie +// +// Created by Lee Jun Kit on 25/5/21. +// + +import SwiftUI + +struct ShuffleButton: View { + var body: some View { + Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + } +} + +struct ShuffleButton_Previews: PreviewProvider { + static var previews: some View { + ShuffleButton() + } +} diff --git a/Spottie/Views/Components/TrackProgressSlider.swift b/Spottie/Views/Components/TrackProgressSlider.swift new file mode 100644 index 0000000..e17cc3d --- /dev/null +++ b/Spottie/Views/Components/TrackProgressSlider.swift @@ -0,0 +1,20 @@ +// +// TrackProgressSlider.swift +// Spottie +// +// Created by Lee Jun Kit on 26/5/21. +// + +import SwiftUI + +struct TrackProgressSlider: View { + var body: some View { + Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + } +} + +struct TrackProgressSlider_Previews: PreviewProvider { + static var previews: some View { + TrackProgressSlider() + } +} diff --git a/Spottie/ContentView.swift b/Spottie/Views/ContentView.swift similarity index 53% rename from Spottie/ContentView.swift rename to Spottie/Views/ContentView.swift index f047a58..7737e9f 100644 --- a/Spottie/ContentView.swift +++ b/Spottie/Views/ContentView.swift @@ -7,10 +7,18 @@ import SwiftUI +enum Screen: Hashable { + case home, search, library +} + struct ContentView: View { + @State var screen: Screen? = .home + var body: some View { - Text("Hello, world!") - .padding() + NavigationView { + Sidebar(state: $screen) + } + .navigationViewStyle(DoubleColumnNavigationViewStyle()) } } diff --git a/Spottie/Views/Home.swift b/Spottie/Views/Home.swift new file mode 100644 index 0000000..34fc912 --- /dev/null +++ b/Spottie/Views/Home.swift @@ -0,0 +1,20 @@ +// +// Home.swift +// Spottie +// +// Created by Lee Jun Kit on 20/5/21. +// + +import SwiftUI + +struct Home: View { + var body: some View { + Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + } +} + +struct Home_Previews: PreviewProvider { + static var previews: some View { + Home() + } +} diff --git a/Spottie/Views/Library.swift b/Spottie/Views/Library.swift new file mode 100644 index 0000000..aa8bf0e --- /dev/null +++ b/Spottie/Views/Library.swift @@ -0,0 +1,20 @@ +// +// Library.swift +// Spottie +// +// Created by Lee Jun Kit on 20/5/21. +// + +import SwiftUI + +struct Library: View { + var body: some View { + Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + } +} + +struct Library_Previews: PreviewProvider { + static var previews: some View { + Library() + } +} diff --git a/Spottie/Views/Search.swift b/Spottie/Views/Search.swift new file mode 100644 index 0000000..8c248b5 --- /dev/null +++ b/Spottie/Views/Search.swift @@ -0,0 +1,20 @@ +// +// Search.swift +// Spottie +// +// Created by Lee Jun Kit on 20/5/21. +// + +import SwiftUI + +struct Search: View { + var body: some View { + Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + } +} + +struct Search_Previews: PreviewProvider { + static var previews: some View { + Search() + } +} diff --git a/Spottie/Views/Sidebar.swift b/Spottie/Views/Sidebar.swift new file mode 100644 index 0000000..893e4c0 --- /dev/null +++ b/Spottie/Views/Sidebar.swift @@ -0,0 +1,20 @@ +// +// Sidebar.swift +// Spottie +// +// Created by Lee Jun Kit on 20/5/21. +// + +import SwiftUI + +struct Sidebar: View { + var body: some View { + Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + } +} + +struct Sidebar_Previews: PreviewProvider { + static var previews: some View { + Sidebar() + } +}