Re: [swift-users] Convenience initializers in structs?

2017-07-18 Thread Chris McIntyre via swift-users
Was it ever explained why the syntax is different? -- Chris McIntyre > On Jul 18, 2017, at 6:46 PM, Jens Persson via swift-users > wrote: > > That is not true. Structs can have delegating initializers but they cannot be > marked with `convenience` (only the

Re: [swift-users] Convenience initializers in structs?

2017-07-18 Thread Slava Pestov via swift-users
Hi Jens, While I’m not familiar with the integer API in the standard library, structs and enums certainly can have convenience initializers. They must delegate to another initializer (either convenience or designated) rather than initializing the fields of the type one by one. Slava > On Jul

[swift-users] Convenience initializers in structs?

2017-07-18 Thread Jens Persson via swift-users
Start a command line project in Xcode 9 beta 3 and copy paste this single line of code into main.swift let _ = UInt8.init(extendingOrTruncating: UInt64(123456)) Now look at Quick Help while placing the cursor on `init` and then on `extendingOrTruncating`. Note that (and how) the documentation