diff --git a/ProjectClock.xcodeproj/project.pbxproj b/ProjectClock.xcodeproj/project.pbxproj index d06d3aa..84c7dd4 100644 --- a/ProjectClock.xcodeproj/project.pbxproj +++ b/ProjectClock.xcodeproj/project.pbxproj @@ -9,6 +9,7 @@ /* Begin PBXBuildFile section */ 4F8A607125A9160400D88DC3 /* AddAlarmViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F8A607025A9160400D88DC3 /* AddAlarmViewController.swift */; }; 4F8A607525A919E600D88DC3 /* Logic.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F8A607425A919E600D88DC3 /* Logic.swift */; }; + 4F98955225A9260400F51321 /* Net.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F98955125A9260400F51321 /* Net.swift */; }; 4FF0683F25A5F18700304E6B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FF0683E25A5F18700304E6B /* AppDelegate.swift */; }; 4FF0684125A5F18700304E6B /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FF0684025A5F18700304E6B /* SceneDelegate.swift */; }; 4FF0684325A5F18700304E6B /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FF0684225A5F18700304E6B /* ViewController.swift */; }; @@ -20,6 +21,7 @@ /* Begin PBXFileReference section */ 4F8A607025A9160400D88DC3 /* AddAlarmViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddAlarmViewController.swift; sourceTree = ""; }; 4F8A607425A919E600D88DC3 /* Logic.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Logic.swift; sourceTree = ""; }; + 4F98955125A9260400F51321 /* Net.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Net.swift; sourceTree = ""; }; 4FF0683B25A5F18700304E6B /* ProjectClock.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ProjectClock.app; sourceTree = BUILT_PRODUCTS_DIR; }; 4FF0683E25A5F18700304E6B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 4FF0684025A5F18700304E6B /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; @@ -69,6 +71,7 @@ 4FF0684925A5F18800304E6B /* LaunchScreen.storyboard */, 4FF0684C25A5F18800304E6B /* Info.plist */, 4F8A607425A919E600D88DC3 /* Logic.swift */, + 4F98955125A9260400F51321 /* Net.swift */, ); path = ProjectClock; sourceTree = ""; @@ -144,6 +147,7 @@ buildActionMask = 2147483647; files = ( 4F8A607125A9160400D88DC3 /* AddAlarmViewController.swift in Sources */, + 4F98955225A9260400F51321 /* Net.swift in Sources */, 4F8A607525A919E600D88DC3 /* Logic.swift in Sources */, 4FF0684325A5F18700304E6B /* ViewController.swift in Sources */, 4FF0683F25A5F18700304E6B /* AppDelegate.swift in Sources */, diff --git a/ProjectClock/Net.swift b/ProjectClock/Net.swift new file mode 100644 index 0000000..d361b9e --- /dev/null +++ b/ProjectClock/Net.swift @@ -0,0 +1,21 @@ +// +// ProjectClock +// +// Created by Hykilpikonna on 1/8/21. +// + +import Foundation + +let baseUrl = "http://localhost:8080/api/" // TODO: Production settings + +/// Build a URL with the node path and params +func buildUrl(_ node: String, _ params: [String: String]?) -> URL +{ + var url = URLComponents(string: baseUrl + node) + if let params = params + { + url?.queryItems = params.map { URLQueryItem(name: $0, value: $1) } + } + return url!.url! +} +