Re: [swift-users] ideas to remove NSCoding as requirement in UIView subclasses

2016-10-10 Thread Lou Zell via swift-users
gt; Apple not part of Swift itself or libraries like Foundation. >> >> >> -- >> Adrian Zubarev >> Sent with Airmail >> >> Am 8. Oktober 2016 um 18:32:50, Lou Zell via swift-users ( >> swift-users@swift.org) schrieb: >> >> Oh wow, I stum

Re: [swift-users] ideas to remove NSCoding as requirement in UIView subclasses

2016-10-08 Thread Lou Zell via swift-users
Oh wow, I stumbled on this immediately after posting: For anyone else that fills their NSCoding initializers with assert(false), switch them to fatalError("message") On Sat, Oct 8, 2016 at 9:22 AM, Lou Zell wrote: > Hi all, > > For better or worse I still hand code most of my views. I am getting

[swift-users] ideas to remove NSCoding as requirement in UIView subclasses

2016-10-08 Thread Lou Zell via swift-users
Hi all, For better or worse I still hand code most of my views. I am getting frustrated by the constant compiler error that I haven't updated "required init(coder:)", which is something that will never be executed in my case. Is there some hacky mechanism that I could use to create a subtype that

Re: [swift-users] Linux Swift: Strange bug found in a simple arithmetic

2016-09-07 Thread Lou Zell via swift-users
Also hoping someone more knowledgeable can explain why these seemingly simple cases do in fact take so long! :) ___ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users

Re: [swift-users] Linux Swift: Strange bug found in a simple arithmetic

2016-09-07 Thread Lou Zell via swift-users
> > It's certainly an interesting compiler issue, probably to do with the type > analysis I've for sure hit this before and now see with a little help to the compiler the compile time drops dramatically:​ Float(abs(Double(0) - Double(0))) repl.swift:50:1: error: expression was too complex to be

Re: [swift-users] Can we `override var hashValue`?

2016-09-06 Thread Lou Zell via swift-users
> > My question is, apple equals banana, but their hashValues (in their own > types) don't. What's wrong here? ​ Hi Zhao. In addition to what Jordan and Dmitri have said, I think part of the confusion is that you are assuming hash values are implicitly used in an equality check. They are not.

Re: [swift-users] Function to unsafe pointer and back

2016-09-02 Thread Lou Zell via swift-users
On Thu, Sep 1, 2016 at 1:48 PM, Andrew Trick wrote: > > Also, in the first case the UnsafePointer points to local memory that > holds the function value. In the second case, you’re trying to load a > function value from the address of the function body. > > Beginning to see... On Fri, Sep 2, 201

Re: [swift-users] Function to unsafe pointer and back

2016-09-01 Thread Lou Zell via swift-users
> > As to your real question, what’s your high-level goal? Swift doesn’t > really do pointers to functions [1] but it does provide lots of other > excellent ‘treat code as data’ features. If you can explain more about > your goal, perhaps we can direct you to a better path. > ​ Curiosity got the

[swift-users] Function to unsafe pointer and back

2016-08-31 Thread Lou Zell via swift-users
Hi all, In both examples below I'm attempting to call a function from the function's address. The first example works but the second doesn't. I suspect I'm missing something fundamental about function invocations. Can someone explain why the second example fails? First: func doNothing() {} fu

Re: [swift-users] Mapping a Dictionary to a Dictionary?

2016-08-29 Thread Lou Zell via swift-users
> > I’m talking about a function that does for Dictionaries what map() does > for Arrays: it transforms every key and value in the input Dictionary > (through a caller-provided function), producing a new Dictionary. > > You could use this to take a dictionary [String:String] that maps user IDs > to

Re: [swift-users] XCTest from repl

2016-08-11 Thread Lou Zell via swift-users
26dea8fa3f541999d6f4405b6/Sources/XCTest/Private/XCTestCaseSuite.swift#L31>. >I think you may see the testIt() output by adding the following: > > class MyTest : XCTestCase { +static var allTests = {+return [+ > ("testIt", testIt),+ ]+}()

[swift-users] XCTest from repl

2016-08-08 Thread Lou Zell via swift-users
Greetings, I am close to getting XCTests running in the swift repl, but for some reason my tests are never invoked. Does anyone have a suggestion or see something wrong with the test setup? $ xcrun swift -F /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Libra

Re: [swift-users] C Pointers and Memory

2016-07-30 Thread Lou Zell via swift-users
On Fri, Jul 29, 2016 at 8:40 PM, Chris McIntyre via swift-users < swift-users@swift.org> wrote: > Hi guys, > > I’m having issues with Swift pointers. I feel like the Interactive With C > APis document only gets you half way there. > > For example, look at this from the docs > > If you have declare