Live data from Hacker News

What's new in Xcode 7

developer.apple.com

171–179 of 179 posts

Re: What's new in Xcode 7

#171
post #45

Earlier quoted context omitted.

Agreed. Also, it does look different aka innovative to me: func loadData() throws { } func test() { do { try loadData() } catch { print(error) } } I guess that you have to prefix any statement that might throw with 'try', and cannot prefix other statements with it. If so, their motto really seems to be 'explicit over implicit'. I'm not sure that is an improvement, but I'm not sure that it is bad, either, provided t…

Doesn't that mean typing try a million times instead of putting potentially throwable calls inside one try block and a bunch of different catch handlers? I wonder why they insist on that. Perhaps it is easier to parse?

I suspect it's useful to visually signal that the call can fail, and make it obvious what's happening; after all, the "throws" annotation is at the target site, not on the caller end.

You need to prefix anything that throws with a "try":

    func mightThrow() throws {
      try mightAlsoThrow();
    }
Other than that, it looks exactly like C++ exceptions: Propagation happens along the chain of functions marked as "throws", until a "catch" handler intercepts it.

"try" is an expression, by the way, so you can do things like:

    let line = try file.readline()
There's also a "try!" statement that throws a runtime exception if the inner statement throws.

Re: What's new in Xcode 7

#172
post #168
post #145

Earlier quoted context omitted.

I guess that is just required for interoperability with Swift. Generics don't make much sense in Objective-C dynamic model.

Funny you should mention that. Quoting Apple's own docs: > Objective-C lightweight generics are ignored by Swift. Any other types using lightweight generics are imported into Swift as if they were unparameterized.[1] So it doesn't look like the goal here is Swift interop. [1]: Excerpt from Using Swift with Cocoa and Objective-C (Swift 2 Prerelease) https://itunes.apple.com/us/book/using-swift-cocoa-objective...

From the talks today it seems Swift interoperability was indeed the purpose.

Re: What's new in Xcode 7

#173
post #132

Earlier quoted context omitted.

Obj-C already had try / catch, it just wasn't considered idiomatic to the platform. Amazon caught a bunch of flak when they wrote an Obj-C interface to AWS and all of the error handling was try/catch instead of NSError (probably, they just line-for-line transliterated their Java interface).

"The standard Cocoa convention is that exceptions signal programmer error and are not intended to be recovered from. Making code exceptions-safe by default would impose severe runtime and code size penalties on code that typically does not actually care about exceptions safety. Therefore, ARC-generated code leaks by default on exceptions, which is just fine if the process is going to be immediately terminated anyway.…

ARC was short lived and is deprecated.

Re: What's new in Xcode 7

#174
post #98

Can I use it on my old mac mini 2011 with 2gb ram and Mavericks? I really want to start using Swift. And no, can't upgrade.

You say you can't upgrade the computer, but surely you could throw some extra memory in. You could increase it to 8GB for around US$60 and benefit from a substantial improvement in performance across the board.

Re: What's new in Xcode 7

#175
post #130
post #86

Earlier quoted context omitted.

Sure, cheap/thrifty whatever. However, I'd rather pay for the dev account when I actually need it. I don't see a huge benefit to paying $100/year while in development. I can accomplish everything I want without it. Once I'm ready to publish the app in the app store, I'll gladly pay $100/year.

And you don't consider showing clients to be "needing it"? If I were a client, I'd be questioning how serious you were.

Ya I could see that, however I should note the app is only a part of a bigger picture of products. I've also been developing it for the past 4-5 months but only started showing it to people lately. So perhaps now would be a good time to buy a dev account but I still haven't felt the big need. To each their own.

Re: What's new in Xcode 7

#176
post #132

Earlier quoted context omitted.

"The standard Cocoa convention is that exceptions signal programmer error and are not intended to be recovered from. Making code exceptions-safe by default would impose severe runtime and code size penalties on code that typically does not actually care about exceptions safety. Therefore, ARC-generated code leaks by default on exceptions, which is just fine if the process is going to be immediately terminated anyway.…

ARC was short lived and is deprecated.

Am I missing something? ARC is the default when you start any ObjC-based Xcode project. It's not deprecated.

Re: What's new in Xcode 7

#177
post #51

Earlier quoted context omitted.

Along those lines, John S. just tweeted " ARM Macs… " [1], which is interesting, as he also got the Open Sourcing of Swift right a couple of days ago. [1] https://twitter.com/siracusa/status/608029277963972608

Interesting, although the open sourcing of swift feels more obvious than arm macs. Bitcode and app thinning are currently ios+watchos only. I think it sounds more likely for ios and especially the watch changing architectures in the future rather than a non-x86/64 osx. But I'm probably wrong. What would be the selling points for an ARM MAC? Access to the iOS app store software library? (unlikely) Better battery usage…

You control the whole tech stack thus a good selling point would be a longer lasting battery.

Perhaps it's also a shot in front of Intel's bow.

Re: What's new in Xcode 7

#179

Earlier quoted context omitted.

Is that right? As of Mavericks, OS X by default refuses to run applications that are not signed with a 99$/year Apple certificate.

I'll admit that the right-click workaround is a minor speedbump but it does work. And Developer ID certificates are valid much longer than a year, I believe mine expires in 2019. They aren't revoked if you stop paying for program membership, and the expiration applies to the signing operation, apps you've signed in the past will continue to work after the certificate expires.

So technically, changing the time settings, you could continue signing code forever?
Post reply on HN