Re: [swift-users] Proper Way to make Errors in Swift 3

2016-09-29 Thread Ronak via swift-users
Ahh..thanks for the reply Zach. I didn’t actually see your reply until now. I’ll see how I can adjust my code. Thanks for this! > On Sep 29, 2016, at 4:38 PM, Zach Waldowski wrote: > > Error types themselves shouldn’t generally cross into Objective-C, because > you don’t get interop; for tha

Re: [swift-users] Proper Way to make Errors in Swift 3

2016-09-29 Thread Ronak via swift-users
Hi, I’ve actually switched our implementation to: /// The type of an error code. @objc public enum FoundationErrorCode: Int { /// An ARCOperationCondition failed during evaluation case operationConditionFailed = 1 /// An ARCOperation failed during execution case operationExe

Re: [swift-users] Proper Way to make Errors in Swift 3

2016-09-29 Thread Zach Waldowski via swift-users
Error types themselves shouldn’t generally cross into Objective-C, because you don’t get interop; for that, we have Error, which crosses the bridge as NSError. If it’s instructive to think of it this way, both Objective-C and Swift should define errors in their best native way, and use NSError.

Re: [swift-users] private vs. fileprivate on global declaration in Swift3?

2016-09-29 Thread Michael Ilseman via swift-users
All access control modifiers have a degenerate case (roughly) equivalent to another one, and the typical wisdom for which to choose is to analyze your intent and perhaps future intent. “fileprivate” and “private” are identical at global scope. “internal” and “fileprivate” are identical in single

Re: [swift-users] SwiftPM: How to verify that PKG_CONFIG_PATH is being used

2016-09-29 Thread Ankit Agarwal via swift-users
Hi, SwiftPM finds the first matching .pc file in the list of search paths, unfortunately the environment variable PKG_CONFIG_PATH was last in the list. It was corrected in this commit: https://github.com/apple/swift-package-manager/commit/ac0479653032ded2efa1d71ab290d5b8d66c0e82 Can you try with a

[swift-users] SwiftPM: How to verify that PKG_CONFIG_PATH is being used

2016-09-29 Thread Jerry Carter via swift-users
Newbie question. How can I tell that PKG_CONFIG_PATH is being respected? I am using Swift 3.0 (swiftlang-800.0.49) under OS X. I do not have pkg-config installed. I have specified the PKG_CONFIG_PATH environment variable and have validated the .pc files at that location. The project builds

Re: [swift-users] RawRepresentable bug or intended?

2016-09-29 Thread Jordan Rose via swift-users
> On Sep 28, 2016, at 23:00, Adrian Zubarev via swift-users > wrote: > > struct B : RawRepresentable { > > let rawValue: Int > > // init?(rawValue: Int) { > // > // self.rawValue = rawValue > // } > > static let c: B = B(rawValue: 0) > static let d: B = B(ra

[swift-users] Proper Way to make Errors in Swift 3

2016-09-29 Thread Ronak via swift-users
Hello all, We are proceeding to update all of our Swift code to Swift 3 now and had a few questions about the proper way to implement Errors. We need these entities to be available in Objective-C and they are actively being used in Swift classes marked as @objc. I read: https://github.com/app

[swift-users] Swift 3 version of creating a string from a pointer, length and encoding?

2016-09-29 Thread John Brownie via swift-users
Next question in my migration. How do I do what this did in Swift 2.2? let theData = String.init(bytes: data.memory, length: length, encoding: NSUTF8StringEncoding) The only initialisers that have a length are init?(bytesNoCopy: UnsafeMutableRawPointer, length: Int, encoding: String.Encoding

Re: [swift-users] Updating C-wrapper to Swift 3

2016-09-29 Thread Quinn "The Eskimo!" via swift-users
On 28 Sep 2016, at 18:39, Michael Ilseman wrote: > Could you share the generated interface for these functions, so that we can > see how they are being imported into Swift? Based on some random expat docs I found on the ’net [1], I grabbed the relevant declarations and put them in a bridging

Re: [swift-users] private vs. fileprivate on global declaration in Swift3?

2016-09-29 Thread Quinn "The Eskimo!" via swift-users
On 28 Sep 2016, at 17:18, Nevin Brackett-Rozinsky via swift-users wrote: > To answer the original question: at file scope the access modifiers `private` > and `fileprivate` have exactly the same effect. It does not matter which of > them you use there. Right, but that doesn’t tell you which

Re: [swift-users] private vs. fileprivate on global declaration in Swift3?

2016-09-29 Thread Clément NONN via swift-users
fileprivate and private aren’t the same thing : try this on a playground : class Foo { fileprivate let test = "test" private let test2 = "test2" } let foo = Foo() foo.test foo.test2 You can see that foo.test work because his scope is the file whereas test2 doesn’t compile : er

[swift-users] where to get the spiral for playgrounds example?

2016-09-29 Thread Mr Bee via swift-users
Hi, I just realized that the official Swift page here:  https://developer.apple.com/swift/ has a spiral drawing example for the Playgrounds (look at the first big picture on top of the page). It seems like an interesting example to play with, especially for my kids.  However, when I looked at the