added alamofire, redoing network layer. added system icons and list headers
This commit is contained in:
parent
8ce84d11bf
commit
d91ce89670
@ -3,7 +3,7 @@
|
|||||||
archiveVersion = 1;
|
archiveVersion = 1;
|
||||||
classes = {
|
classes = {
|
||||||
};
|
};
|
||||||
objectVersion = 50;
|
objectVersion = 52;
|
||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
@ -11,7 +11,9 @@
|
|||||||
E98254C223F9FFF90056D9D3 /* PlaylistView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E98254C123F9FFF90056D9D3 /* PlaylistView.swift */; };
|
E98254C223F9FFF90056D9D3 /* PlaylistView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E98254C123F9FFF90056D9D3 /* PlaylistView.swift */; };
|
||||||
E98254C823FA25D20056D9D3 /* PlaylistList.swift in Sources */ = {isa = PBXBuildFile; fileRef = E98254C723FA25D20056D9D3 /* PlaylistList.swift */; };
|
E98254C823FA25D20056D9D3 /* PlaylistList.swift in Sources */ = {isa = PBXBuildFile; fileRef = E98254C723FA25D20056D9D3 /* PlaylistList.swift */; };
|
||||||
E98254CA23FA26600056D9D3 /* PlaylistRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = E98254C923FA26600056D9D3 /* PlaylistRow.swift */; };
|
E98254CA23FA26600056D9D3 /* PlaylistRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = E98254C923FA26600056D9D3 /* PlaylistRow.swift */; };
|
||||||
E98254CC23FA2D0A0056D9D3 /* NetTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = E98254CB23FA2D0A0056D9D3 /* NetTypes.swift */; };
|
E98254D023FB00B60056D9D3 /* LoginScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = E98254CF23FB00B60056D9D3 /* LoginScreen.swift */; };
|
||||||
|
E98254D923FB53780056D9D3 /* Alamofire in Frameworks */ = {isa = PBXBuildFile; productRef = E98254D823FB53780056D9D3 /* Alamofire */; };
|
||||||
|
E98254DB23FB64740056D9D3 /* Network.swift in Sources */ = {isa = PBXBuildFile; fileRef = E98254DA23FB64740056D9D3 /* Network.swift */; };
|
||||||
E9EA690B23F9A5430012C3E8 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9EA690A23F9A5430012C3E8 /* AppDelegate.swift */; };
|
E9EA690B23F9A5430012C3E8 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9EA690A23F9A5430012C3E8 /* AppDelegate.swift */; };
|
||||||
E9EA690D23F9A5430012C3E8 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9EA690C23F9A5430012C3E8 /* SceneDelegate.swift */; };
|
E9EA690D23F9A5430012C3E8 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9EA690C23F9A5430012C3E8 /* SceneDelegate.swift */; };
|
||||||
E9EA690F23F9A5430012C3E8 /* RootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9EA690E23F9A5430012C3E8 /* RootView.swift */; };
|
E9EA690F23F9A5430012C3E8 /* RootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9EA690E23F9A5430012C3E8 /* RootView.swift */; };
|
||||||
@ -44,7 +46,8 @@
|
|||||||
E98254C123F9FFF90056D9D3 /* PlaylistView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaylistView.swift; sourceTree = "<group>"; };
|
E98254C123F9FFF90056D9D3 /* PlaylistView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaylistView.swift; sourceTree = "<group>"; };
|
||||||
E98254C723FA25D20056D9D3 /* PlaylistList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaylistList.swift; sourceTree = "<group>"; };
|
E98254C723FA25D20056D9D3 /* PlaylistList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaylistList.swift; sourceTree = "<group>"; };
|
||||||
E98254C923FA26600056D9D3 /* PlaylistRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaylistRow.swift; sourceTree = "<group>"; };
|
E98254C923FA26600056D9D3 /* PlaylistRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaylistRow.swift; sourceTree = "<group>"; };
|
||||||
E98254CB23FA2D0A0056D9D3 /* NetTypes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetTypes.swift; sourceTree = "<group>"; };
|
E98254CF23FB00B60056D9D3 /* LoginScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginScreen.swift; sourceTree = "<group>"; };
|
||||||
|
E98254DA23FB64740056D9D3 /* Network.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Network.swift; sourceTree = "<group>"; };
|
||||||
E9EA690723F9A5430012C3E8 /* Music Tools.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Music Tools.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
E9EA690723F9A5430012C3E8 /* Music Tools.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Music Tools.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
E9EA690A23F9A5430012C3E8 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
E9EA690A23F9A5430012C3E8 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||||
E9EA690C23F9A5430012C3E8 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
|
E9EA690C23F9A5430012C3E8 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
|
||||||
@ -66,6 +69,7 @@
|
|||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
E98254D923FB53780056D9D3 /* Alamofire in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@ -97,7 +101,7 @@
|
|||||||
E98254BF23F9BE040056D9D3 /* Network */ = {
|
E98254BF23F9BE040056D9D3 /* Network */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
E98254CB23FA2D0A0056D9D3 /* NetTypes.swift */,
|
E98254DA23FB64740056D9D3 /* Network.swift */,
|
||||||
);
|
);
|
||||||
path = Network;
|
path = Network;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -109,6 +113,7 @@
|
|||||||
E98254C123F9FFF90056D9D3 /* PlaylistView.swift */,
|
E98254C123F9FFF90056D9D3 /* PlaylistView.swift */,
|
||||||
E98254C723FA25D20056D9D3 /* PlaylistList.swift */,
|
E98254C723FA25D20056D9D3 /* PlaylistList.swift */,
|
||||||
E98254C923FA26600056D9D3 /* PlaylistRow.swift */,
|
E98254C923FA26600056D9D3 /* PlaylistRow.swift */,
|
||||||
|
E98254CF23FB00B60056D9D3 /* LoginScreen.swift */,
|
||||||
);
|
);
|
||||||
path = Views;
|
path = Views;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -199,6 +204,9 @@
|
|||||||
dependencies = (
|
dependencies = (
|
||||||
);
|
);
|
||||||
name = "Music Tools";
|
name = "Music Tools";
|
||||||
|
packageProductDependencies = (
|
||||||
|
E98254D823FB53780056D9D3 /* Alamofire */,
|
||||||
|
);
|
||||||
productName = "Music Tools";
|
productName = "Music Tools";
|
||||||
productReference = E9EA690723F9A5430012C3E8 /* Music Tools.app */;
|
productReference = E9EA690723F9A5430012C3E8 /* Music Tools.app */;
|
||||||
productType = "com.apple.product-type.application";
|
productType = "com.apple.product-type.application";
|
||||||
@ -271,6 +279,9 @@
|
|||||||
Base,
|
Base,
|
||||||
);
|
);
|
||||||
mainGroup = E9EA68FE23F9A5430012C3E8;
|
mainGroup = E9EA68FE23F9A5430012C3E8;
|
||||||
|
packageReferences = (
|
||||||
|
E98254D723FB53770056D9D3 /* XCRemoteSwiftPackageReference "alamofire" */,
|
||||||
|
);
|
||||||
productRefGroup = E9EA690823F9A5430012C3E8 /* Products */;
|
productRefGroup = E9EA690823F9A5430012C3E8 /* Products */;
|
||||||
projectDirPath = "";
|
projectDirPath = "";
|
||||||
projectRoot = "";
|
projectRoot = "";
|
||||||
@ -314,14 +325,15 @@
|
|||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
E98254CC23FA2D0A0056D9D3 /* NetTypes.swift in Sources */,
|
|
||||||
E98254CA23FA26600056D9D3 /* PlaylistRow.swift in Sources */,
|
E98254CA23FA26600056D9D3 /* PlaylistRow.swift in Sources */,
|
||||||
E9EA690B23F9A5430012C3E8 /* AppDelegate.swift in Sources */,
|
E9EA690B23F9A5430012C3E8 /* AppDelegate.swift in Sources */,
|
||||||
E9EA690D23F9A5430012C3E8 /* SceneDelegate.swift in Sources */,
|
E9EA690D23F9A5430012C3E8 /* SceneDelegate.swift in Sources */,
|
||||||
|
E98254DB23FB64740056D9D3 /* Network.swift in Sources */,
|
||||||
E98254C823FA25D20056D9D3 /* PlaylistList.swift in Sources */,
|
E98254C823FA25D20056D9D3 /* PlaylistList.swift in Sources */,
|
||||||
E9EA690F23F9A5430012C3E8 /* RootView.swift in Sources */,
|
E9EA690F23F9A5430012C3E8 /* RootView.swift in Sources */,
|
||||||
E98254BD23F9B7A90056D9D3 /* Playlist.swift in Sources */,
|
E98254BD23F9B7A90056D9D3 /* Playlist.swift in Sources */,
|
||||||
E98254C223F9FFF90056D9D3 /* PlaylistView.swift in Sources */,
|
E98254C223F9FFF90056D9D3 /* PlaylistView.swift in Sources */,
|
||||||
|
E98254D023FB00B60056D9D3 /* LoginScreen.swift in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@ -646,6 +658,25 @@
|
|||||||
defaultConfigurationName = Release;
|
defaultConfigurationName = Release;
|
||||||
};
|
};
|
||||||
/* End XCConfigurationList section */
|
/* End XCConfigurationList section */
|
||||||
|
|
||||||
|
/* Begin XCRemoteSwiftPackageReference section */
|
||||||
|
E98254D723FB53770056D9D3 /* XCRemoteSwiftPackageReference "alamofire" */ = {
|
||||||
|
isa = XCRemoteSwiftPackageReference;
|
||||||
|
repositoryURL = "https://github.com/alamofire/alamofire.git";
|
||||||
|
requirement = {
|
||||||
|
kind = upToNextMajorVersion;
|
||||||
|
minimumVersion = 5.0.0;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
/* End XCRemoteSwiftPackageReference section */
|
||||||
|
|
||||||
|
/* Begin XCSwiftPackageProductDependency section */
|
||||||
|
E98254D823FB53780056D9D3 /* Alamofire */ = {
|
||||||
|
isa = XCSwiftPackageProductDependency;
|
||||||
|
package = E98254D723FB53770056D9D3 /* XCRemoteSwiftPackageReference "alamofire" */;
|
||||||
|
productName = Alamofire;
|
||||||
|
};
|
||||||
|
/* End XCSwiftPackageProductDependency section */
|
||||||
};
|
};
|
||||||
rootObject = E9EA68FF23F9A5430012C3E8 /* Project object */;
|
rootObject = E9EA68FF23F9A5430012C3E8 /* Project object */;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
<Workspace
|
<Workspace
|
||||||
version = "1.0">
|
version = "1.0">
|
||||||
<FileRef
|
<FileRef
|
||||||
location = "self:Music Tools.xcodeproj">
|
location = "self:">
|
||||||
</FileRef>
|
</FileRef>
|
||||||
</Workspace>
|
</Workspace>
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"object": {
|
||||||
|
"pins": [
|
||||||
|
{
|
||||||
|
"package": "Alamofire",
|
||||||
|
"repositoryURL": "https://github.com/alamofire/alamofire.git",
|
||||||
|
"state": {
|
||||||
|
"branch": null,
|
||||||
|
"revision": "0c8cb78d05b6d067ee331c05058ff4dedcb45ffa",
|
||||||
|
"version": "5.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"version": 1
|
||||||
|
}
|
@ -14,6 +14,12 @@
|
|||||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
|
<subviews>
|
||||||
|
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" fixedFrame="YES" image="Logo" translatesAutoresizingMaskIntoConstraints="NO" id="nIw-aa-ATp">
|
||||||
|
<rect key="frame" x="-49" y="192" width="512" height="512"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||||
|
</imageView>
|
||||||
|
</subviews>
|
||||||
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
|
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
|
||||||
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
|
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
|
||||||
</view>
|
</view>
|
||||||
@ -23,4 +29,7 @@
|
|||||||
<point key="canvasLocation" x="53" y="375"/>
|
<point key="canvasLocation" x="53" y="375"/>
|
||||||
</scene>
|
</scene>
|
||||||
</scenes>
|
</scenes>
|
||||||
|
<resources>
|
||||||
|
<image name="Logo" width="250" height="40"/>
|
||||||
|
</resources>
|
||||||
</document>
|
</document>
|
||||||
|
21
Music Tools/Assets.xcassets/Logo.imageset/Contents.json
vendored
Normal file
21
Music Tools/Assets.xcassets/Logo.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"filename" : "MusicToolsIcon1024.png",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"version" : 1,
|
||||||
|
"author" : "xcode"
|
||||||
|
}
|
||||||
|
}
|
BIN
Music Tools/Assets.xcassets/Logo.imageset/MusicToolsIcon1024.png
vendored
Normal file
BIN
Music Tools/Assets.xcassets/Logo.imageset/MusicToolsIcon1024.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"filename" : "first.pdf"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"version" : 1,
|
|
||||||
"author" : "xcode"
|
|
||||||
}
|
|
||||||
}
|
|
BIN
Music Tools/Assets.xcassets/first.imageset/first.pdf
vendored
BIN
Music Tools/Assets.xcassets/first.imageset/first.pdf
vendored
Binary file not shown.
@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"filename" : "second.pdf"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"version" : 1,
|
|
||||||
"author" : "xcode"
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
@ -1,33 +0,0 @@
|
|||||||
//
|
|
||||||
// EndPointType.swift
|
|
||||||
// Music Tools
|
|
||||||
//
|
|
||||||
// Created by Ellie McCarthy on 17/02/2020.
|
|
||||||
// Copyright © 2020 Sarsoo. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
protocol EndPointType {
|
|
||||||
var domain: URL { get }
|
|
||||||
var path: String { get }
|
|
||||||
var httpMethod: HTTPMethod { get }
|
|
||||||
var task: HTTPTask { get }
|
|
||||||
var headers: HTTPHeaders? { get }
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum HTTPMethod: String {
|
|
||||||
case get = "GET"
|
|
||||||
case post = "POST"
|
|
||||||
case put = "PUT"
|
|
||||||
case delete = "DELETE"
|
|
||||||
}
|
|
||||||
|
|
||||||
public typealias HTTPHeaders = [String:String]
|
|
||||||
public typealias Parameters = [String:Any]
|
|
||||||
|
|
||||||
public enum HTTPTask {
|
|
||||||
case request
|
|
||||||
|
|
||||||
case requestParameters(bodyParameters: Parameters?, urlParameters: Parameters?)
|
|
||||||
}
|
|
80
Music Tools/Network/Network.swift
Normal file
80
Music Tools/Network/Network.swift
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
//
|
||||||
|
// Network.swift
|
||||||
|
// Music Tools
|
||||||
|
//
|
||||||
|
// Created by Andy Pack on 18/02/2020.
|
||||||
|
// Copyright © 2020 Sarsoo. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import Alamofire
|
||||||
|
|
||||||
|
class MusicToolsNetwork {
|
||||||
|
|
||||||
|
var baseBath: String = "https://music.sarsoo.xyz/"
|
||||||
|
|
||||||
|
public func request(path: String,
|
||||||
|
method: Alamofire.HTTPMethod,
|
||||||
|
parameters: [String:String]? ,
|
||||||
|
encoder: Alamofire.ParameterEncoder?,
|
||||||
|
headers: Alamofire.HTTPHeaders? ) {
|
||||||
|
|
||||||
|
guard let uwParameters = parameters else {
|
||||||
|
AF.request(baseBath + path,
|
||||||
|
method: method,
|
||||||
|
headers: headers ).validate().response { response in
|
||||||
|
debugPrint(response)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
AF.request(baseBath + path,
|
||||||
|
method: method,
|
||||||
|
parameters: uwParameters,
|
||||||
|
headers: headers ).response { response in
|
||||||
|
debugPrint(response)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class BasicAuthNetwork: MusicToolsNetwork {
|
||||||
|
var username: String
|
||||||
|
var password: String
|
||||||
|
|
||||||
|
init(username: String, password: String) {
|
||||||
|
self.username = username
|
||||||
|
self.password = password
|
||||||
|
}
|
||||||
|
|
||||||
|
func getHeader() -> String {
|
||||||
|
return "\(username):\(password)".toBase64()
|
||||||
|
}
|
||||||
|
|
||||||
|
public func authedRequest(path: String,
|
||||||
|
method: Alamofire.HTTPMethod,
|
||||||
|
parameters: [String:String]?,
|
||||||
|
encoder: Alamofire.ParameterEncoder?,
|
||||||
|
headers: Alamofire.HTTPHeaders? ) {
|
||||||
|
|
||||||
|
let encoded = "\(username):\(password)".toBase64()
|
||||||
|
|
||||||
|
var txHeaders = headers
|
||||||
|
|
||||||
|
if headers == nil {
|
||||||
|
txHeaders = Alamofire.HTTPHeaders()
|
||||||
|
}
|
||||||
|
txHeaders?.add(name: "Authorization", value: "Basic \(encoded)")
|
||||||
|
|
||||||
|
request(path: path, method: method, parameters: parameters, encoder: encoder, headers: txHeaders)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension String {
|
||||||
|
|
||||||
|
func toBase64() -> String {
|
||||||
|
return Data(self.utf8).base64EncodedString()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
43
Music Tools/Views/LoginScreen.swift
Normal file
43
Music Tools/Views/LoginScreen.swift
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
//
|
||||||
|
// LoginScreen.swift
|
||||||
|
// Music Tools
|
||||||
|
//
|
||||||
|
// Created by Andy Pack on 17/02/2020.
|
||||||
|
// Copyright © 2020 Sarsoo. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct LoginScreen: View {
|
||||||
|
var body: some View {
|
||||||
|
VStack {
|
||||||
|
Image("Logo")
|
||||||
|
.resizable()
|
||||||
|
.frame(width: 200.0, height: 200.0, alignment: .trailing)
|
||||||
|
.cornerRadius(18)
|
||||||
|
.shadow(radius: /*@START_MENU_TOKEN@*/10/*@END_MENU_TOKEN@*/)
|
||||||
|
.padding(.bottom, 20)
|
||||||
|
Text("Sarsoo Music Tools")
|
||||||
|
.font(.largeTitle)
|
||||||
|
TextField("Username", text: /*@START_MENU_TOKEN@*//*@PLACEHOLDER=Value@*/.constant("")/*@END_MENU_TOKEN@*/)
|
||||||
|
SecureField("Password", text: /*@START_MENU_TOKEN@*/ /*@PLACEHOLDER=Value@*/.constant("Apple")/*@END_MENU_TOKEN@*/)
|
||||||
|
HStack {
|
||||||
|
Button(action: /*@START_MENU_TOKEN@*/{}/*@END_MENU_TOKEN@*/) {
|
||||||
|
Text("Log In")
|
||||||
|
|
||||||
|
}
|
||||||
|
.padding(.trailing, 20.0)
|
||||||
|
Button(action: /*@START_MENU_TOKEN@*/{}/*@END_MENU_TOKEN@*/) {
|
||||||
|
Text("Register")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct LoginScreen_Previews: PreviewProvider {
|
||||||
|
static var previews: some View {
|
||||||
|
LoginScreen()
|
||||||
|
}
|
||||||
|
}
|
@ -1,8 +1,8 @@
|
|||||||
//
|
//
|
||||||
// SwiftUIView.swift
|
// PlaylistList.swift
|
||||||
// Music Tools
|
// Music Tools
|
||||||
//
|
//
|
||||||
// Created by Ellie McCarthy on 17/02/2020.
|
// Created by Andy Pack on 17/02/2020.
|
||||||
// Copyright © 2020 Sarsoo. All rights reserved.
|
// Copyright © 2020 Sarsoo. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// PlaylistRow.swift
|
// PlaylistRow.swift
|
||||||
// Music Tools
|
// Music Tools
|
||||||
//
|
//
|
||||||
// Created by Ellie McCarthy on 17/02/2020.
|
// Created by Andy Pack on 17/02/2020.
|
||||||
// Copyright © 2020 Sarsoo. All rights reserved.
|
// Copyright © 2020 Sarsoo. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// PlaylistView.swift
|
// PlaylistView.swift
|
||||||
// Music Tools
|
// Music Tools
|
||||||
//
|
//
|
||||||
// Created by Ellie McCarthy on 16/02/2020.
|
// Created by Andy Pack on 16/02/2020.
|
||||||
// Copyright © 2020 Sarsoo. All rights reserved.
|
// Copyright © 2020 Sarsoo. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// ContentView.swift
|
// RootView.swift
|
||||||
// Music Tools
|
// Music Tools
|
||||||
//
|
//
|
||||||
// Created by Andy Pack on 16/02/2020.
|
// Created by Andy Pack on 16/02/2020.
|
||||||
@ -7,44 +7,69 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
import Alamofire
|
||||||
|
|
||||||
struct RootView: View {
|
struct RootView: View {
|
||||||
@State private var selection = 0
|
@State private var selection = 0
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
TabView(selection: $selection){
|
TabView(selection: $selection){
|
||||||
List(/*@START_MENU_TOKEN@*/0 ..< 5/*@END_MENU_TOKEN@*/) { item in
|
NavigationView {
|
||||||
Text("Playlists")
|
List(/*@START_MENU_TOKEN@*/0 ..< 5/*@END_MENU_TOKEN@*/) { item in
|
||||||
.font(.title)
|
Text("Playlist")
|
||||||
|
.font(.title)
|
||||||
|
|
||||||
|
}
|
||||||
|
.navigationBarTitle(Text("Playlists").font(.title))
|
||||||
}
|
}
|
||||||
.tabItem {
|
.tabItem {
|
||||||
VStack {
|
VStack {
|
||||||
Image("first")
|
Image(systemName: "music.note.list")
|
||||||
Text("Playlists")
|
Text("Playlists")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.tag(0)
|
.tag(0)
|
||||||
Text("Tags")
|
//
|
||||||
.font(.title)
|
//
|
||||||
.tabItem {
|
NavigationView {
|
||||||
VStack {
|
List(/*@START_MENU_TOKEN@*/0 ..< 5/*@END_MENU_TOKEN@*/) { item in
|
||||||
Image("second")
|
Text("Tag")
|
||||||
Text("Tags")
|
.font(.title)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.tag(1)
|
.navigationBarTitle(Text("Tags"))
|
||||||
|
}
|
||||||
|
.tabItem {
|
||||||
|
VStack {
|
||||||
|
Image(systemName: "sum")
|
||||||
|
Text("Tags")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.tag(1)
|
||||||
|
//
|
||||||
|
//
|
||||||
Text("Settings")
|
Text("Settings")
|
||||||
.font(.title)
|
.font(.title)
|
||||||
.tabItem {
|
.tabItem {
|
||||||
VStack {
|
VStack {
|
||||||
Image("first")
|
Image(systemName: "slider.horizontal.3")
|
||||||
Text("Settings")
|
Text("Settings")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.tag(2)
|
.tag(2)
|
||||||
|
}.onAppear {
|
||||||
|
self.fetch()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func fetch() {
|
||||||
|
let net: BasicAuthNetwork = BasicAuthNetwork(username: "", password: "")
|
||||||
|
net.authedRequest(path: "api/playlist",
|
||||||
|
method: Alamofire.HTTPMethod.get,
|
||||||
|
parameters: ["name": ""],
|
||||||
|
encoder: nil,
|
||||||
|
headers: nil)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct RootView_Previews: PreviewProvider {
|
struct RootView_Previews: PreviewProvider {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// Music_ToolsTests.swift
|
// Music_ToolsTests.swift
|
||||||
// Music ToolsTests
|
// Music ToolsTests
|
||||||
//
|
//
|
||||||
// Created by Ellie McCarthy on 16/02/2020.
|
// Created by Andy Pack on 16/02/2020.
|
||||||
// Copyright © 2020 Sarsoo. All rights reserved.
|
// Copyright © 2020 Sarsoo. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// Music_ToolsUITests.swift
|
// Music_ToolsUITests.swift
|
||||||
// Music ToolsUITests
|
// Music ToolsUITests
|
||||||
//
|
//
|
||||||
// Created by Ellie McCarthy on 16/02/2020.
|
// Created by Andy Pack on 16/02/2020.
|
||||||
// Copyright © 2020 Sarsoo. All rights reserved.
|
// Copyright © 2020 Sarsoo. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user