← Back to Upcase

Swift Sequences

(Edward Loveall) #1

Thanks for the post @gfontenot. I’m still reading over it to grock it. I was wondering if there was any advantage to this over using Process.arguments to get the arguments instead.

(Gordon Fontenot) #2

Do you mean NSProcessInfo? I’m using C_ARGV as a bit of an artificial restriction on myself because I want to see how far I can get without importing Foundation.

(Edward Loveall) #3

No, just Process.arguments. Looks like you can also do NSProcessInfo.processInfo().arguments but that does need Foundation. Process doesn’t. Here’s the entire contents of my main.swift file for playing around:


Obviously this doesn’t make for a good blog post or help anyone understand Sequences.

(Gordon Fontenot) #4

Oh, wow. Didn’t know about Process. That’s neat. There is far too little documentation right now. Thanks!

(Gordon Fontenot) #5

In fact, Process doesn’t even show up in the generated header. How did you find out about that?

(Edward Loveall) #6

Dave DeLong replied to me on StackOverflow: http://stackoverflow.com/questions/24110731/how-to-i-access-argv-and-argc-in-swift/24110744

(Gordon Fontenot) #7

Ha. So apparently he’s the only one that knows about that Struct. He pinged us on Twitter about it too.