News for hackers. Stuff that matters.
Re:Scripting in Swift by marvel_boy on Sunday July 05, 2015 @02:12PM (#9834344)
I usually use bash or ruby to do scripting, but I think is a good idea to use the power of Swift to this task.
Re:Scripting in Swift by timanglade on Sunday July 05, 2015 @02:17PM (#9834361)
Yeah, I’m actually surprised Apple hasn’t made a play for this from day 1 since developing iOS/OS X often leads to writing/maintaining a bunch of home-made or 3rd-party scripts (usually in Ruby), making app development require not only knowing Objective-C & Cocoa but also some scripting language. After all if Swift is all about making it easier for more people to build apps more easily, this seems like a worthwhile use-case to go after.
Re:Scripting in Swift by zw on Sunday July 05, 2015 @06:44PM (#9835403)
The Swift standard library is not yet up to snuff for that, you still need to know Cocoa to do basically anything high-level. Thankfully I know Foundation better than I do straight-up POSIX, so that's tenable for me, but it's not for most people who want something script-y.
Re:Scripting in Swift by tempodox on Monday July 06, 2015 @04:42AM (#9837674)
Not only that, but you also need to know the hocus pocus to bridge between (Obj)C and Swift. And let's not forget that the Cocoa header files are browsable, thus enabling “discoverability”, while Swift is completely obscure in that respect.
Re:Scripting in Swift by coldtea on Sunday July 05, 2015 @05:50PM (#9835177)
>Yeah, I’m actually surprised Apple hasn’t made a play for this from day 1 since developing iOS/OS X often leads to writing/maintaining a bunch of home-made or 3rd-party scripts (usually in Ruby), making app development require not only knowing Objective-C & Cocoa but also some scripting language.

Define "often".

Besides, Swift wasn't even that ready for application develoment from day 1.

Re:Scripting in Swift by timanglade on Sunday July 05, 2015 @06:04PM (#9835234)
I actually can’t recall the last time I looked at an iOS app that didn’t use a build script, Rakefile or Cocoapods/Carthage (the latter of which is mostly written in Swift, it should be noted).

It’s true that Apple has to prioritize though!

Re:Scripting in Swift by seivan on Sunday July 05, 2015 @05:34PM (#9835113)
I recently used someones template tool to generate some methods in Swift but with some erb-like syntax to actual Swift code.

It was actually more pleasant than I thought, and I usually use Ruby for this. Might do this more often in the future.

But Ruby still has the benefit with gem install that can get you anything from a twitter client to an IRC-bot lib.