December 2018
Intermediate to advanced
414 pages
10h 19m
English
To add an executable target to our package, we will edit the Package.swift file to add a new short section under targets (the new target definition in bold):
.target( name: "swURL", dependencies: []), .target( name: "swURLCli", dependencies: ["swURL"]), .testTarget( name: "swURLTests", dependencies: ["swURL"]),
Then, we create a new swURLCli directory under the Sources directory to contain the new swURLCli executable source files. Finally, add a main.swift file in swURLCli with the following content:
import Foundationimport swURLstruct Todo: Decodable { let userId: Int let id: Int let title: String let completed: Bool}func doTask(completion: @escaping (_ data: Todo?, _ error: Error?) -> Void) { let group = DispatchGroup() ...Read now
Unlock full access