The test is pretty simple:
let bundleId = NSBundle.mainBundle().bundleIdentifier ?? "" if bundleId.hasPrefix("com.apple.dt"){
But I think you already saw the problem as soon as you did this ... import will stop the assembly elsewhere. I suspect that you are trying to build a playground for the structure you created (if not, I'm not quite sure how the code is divided). The way I solved this as part of the framework was to provide an extra hook call for the value I wanted to get ... so for example
In Framework
public defaultUrlHook : (()->NSURL)? = nil internal var defaultUrl : NSURL { return defaultUrlHook?() ?? NSURL.fileURLWithPath("data.csv") }
In the playground
import XCPlayground import YourFramework defaultUrlHook = { ()->NSURL in return XCPlaygroundSharedDataDirectoryURL.URLByAppendingPathComponent("data.csv") }
source share