[swift-users] Am I missing something on how the Package Manager works?

Daryle Walker darylew at mac.com
Mon Aug 21 00:55:03 CDT 2017

I’ve tried to make a command-line program with the Swift Package Manager, and use Foundation for networking (on macOS):

import Foundation
import Commander
import HeliumLogger
import LoggerAPI

enum ReturnCode: Int32 {
    case badUrlString = 10, retrievalError
let main = command { (urlArgument: String) in
    guard let url = URL(string: urlArgument) else {
        Log.error("Argument \"\(urlArgument)\" cannot be converted to a URL.")
    let session = URLSession(configuration: .ephemeral)
    let task = session.dataTask(with: url, completionHandler: { (data, response, error) in
        if let error = error {
            Log.error("Retrieval Error: \(error)")
        guard let data = data else {
            print("(no data)")
        print("Hi there")
    print("Hello world")

All I got from “swift build” and the Xcode project it made for me is just the “Hello world” message. The task block was ignored. Did I get calling it wrong?

Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170821/0fa7f3b6/attachment.html>

More information about the swift-users mailing list