mbrandonw / presentations

Lots of my presentations.
http://www.fewbutripe.com/talks
73 stars 11 forks source link

Swift Playground #1

Open amadeu01 opened 6 years ago

amadeu01 commented 6 years ago

Hi @mbrandonw

I have been facing some issues with the playground on XCode 9.3. Where I get libc++abi.dylib: terminating with uncaught exception of type NSException

The weirdest this is that sometimes and in other projects, it works (At the very same method). Sometimes, in the same project, however, in distinct playground pages the piece of code works, but in another playground page it simply gives me libc++abi.dylib: terminating with uncaught exception of type NSException

I would like to ask if you have faced those kinds of issues, and If you could resolve it in any way.

I created a gist where I put the code which gives me the error on the playground, here.

I would be more than happy will your help. Thanks in advance.

mbrandonw commented 6 years ago

@amadeu01 Hey sorry for the late response. I haven't used playgrounds for ios development in the past few months, and it seems to have gotten much worse. I'm also seeing this error with just a very basic UITableViewController in a playground :/ I don't know what to do to make them more stable right now, but if I find something I'll report back...

amadeu01 commented 6 years ago

@mbrandonw thanks for replying! 👍

fespinoza commented 6 years ago

i've been using playgrounds a lot for iOS, in Xcode 9.3, the errors that you mention appear often, for example https://github.com/kickstarter/ios-oss/blob/master/Kickstarter-iOS.playground/Sources/playgroundController.swift won't work anymore, because it will result in the same error. Also there are a bunch of strange behaviors when working with playgrounds, but honestly i am not sure how to report them to the correct apple team

amadeu01 commented 6 years ago

hi @mbrandonw

I happy to say that on Xcode 10 the playgrounds come to be much more stable, at least in the cases I've tested. Also, I'm not facing issues such as the Xcode crashing out of nothing.

I found out that using something like

favoriteButton.setImage(#imageLiteral(resourceName: "hear_filled"), for: .selected)

this stuff #imageLiteral(resourceName: "hear_filled") crashes the playground. Do you know how to use resources, like image assets on playgrounds?

I put the storyboard on the app framework so I can access the storyboard assets like

        let bundle = Bundle(for: BeerListView.self)
        return UIStoryboard(name: "Main", bundle: bundle)