Re: [swift-users] appending packed bytes to [UInt8]

2018-01-10 Thread Kelvin Ma via swift-users
I thought tuples, like structs do *not* have fixed layout. And they get padded too. On Wed, Jan 10, 2018 at 5:01 PM, Nevin Brackett-Rozinsky < nevin.brackettrozin...@gmail.com> wrote: > Conversely, since I’m pretty sure the memory layout of a *tuple* is > guaranteed to be as it appears, I would

Re: [swift-users] appending packed bytes to [UInt8]

2018-01-10 Thread Kelvin Ma via swift-users
I’ve asked similar questions in the past and everyone said this is not valid Swift, not the least because the compiler can pad structs and rearrange its layout. For example if there were only 3 UInt8s, the stride should be 15, not 16 as they need to be packed densely. since they are misaligned you

Re: [swift-users] appending packed bytes to [UInt8]

2018-01-10 Thread Nevin Brackett-Rozinsky via swift-users
Conversely, since I’m pretty sure the memory layout of a *tuple* is guaranteed to be as it appears, I would probably start with something like this: typealias Vec3rgba = (x: Float, y: Float, z: Float, r: Int8, g: Int8, b: Int8, a: Int8) Nevin On Wed, Jan 10, 2018 at 4:27 PM, Jens Persson via

Re: [swift-users] defaultCalendarForNewEvents is defined as optional however can't use optional binding to check if it's nil

2018-01-10 Thread Filiz Topatan via swift-users
You were right! I was using Swift 3.2 and not Swift 4.0. Thank you! Filiz On Wed, Jan 10, 2018 at 10:25 AM, Jordan Rose via swift-users < swift-users@swift.org> wrote: > Nothing specific. A lot of minor issues were corrected in the Xcode 9 > release with a nod towards maintaining source

Re: [swift-users] appending packed bytes to [UInt8]

2018-01-10 Thread Jens Persson via swift-users
I'm not sure what you mean by "I need the buffer to be a vector /.../" but perhaps this may be of some help: struct S { var x: Float var y: Float var z: Float var r: UInt8 var g: UInt8 var b: UInt8 var a: UInt8 } var buf = S(x: 0.1, y: 1.2, z: 2.3, r: 11, g: 22, b: 33,

[swift-users] appending packed bytes to [UInt8]

2018-01-10 Thread Kelvin Ma via swift-users
I want to create a buffer with the layout 0 4 8 12 13 14 15 16 [ x:Float | y:Float | z:Float | r:UInt8 | g:UInt8 | b:UInt8 | _:UInt8 ] Normally, I’d use UnsafeRawBufferPointer for this, but I need the buffer to be a vector (i.e. with

Re: [swift-users] Discourse forum rollout next week!

2018-01-10 Thread Charles Srstka via swift-users
:thumbsup: Charles > On Jan 10, 2018, at 2:22 PM, Nicole Jacque via swift-users > wrote: > > Hi All- > > First of all, a big thank you to everyone who has provided feedback on our > prototype Discourse forum. We are ready to move forward with the transition! > The

[swift-users] Discourse forum rollout next week!

2018-01-10 Thread Nicole Jacque via swift-users
Hi All- First of all, a big thank you to everyone who has provided feedback on our prototype Discourse forum. We are ready to move forward with the transition! The schedule will be: 1/17 ~ 6PM Pacific: We will be putting the mailing lists into suspend mode in order to do the final export of

[swift-users] Using String

2018-01-10 Thread Michael Ilseman via swift-users
Hello, I just sent an email to swift-dev titled "State of String: ABI, Performance, Ergonomics, and You!” at https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20180108/006407.html, whose gist can be found at https://gist.github.com/milseman/bb39ef7f170641ae52c13600a512782f

[swift-users] protocol conformance question

2018-01-10 Thread Swarbrick, Frank via swift-users
Is there a way I can specify that all integer types conform to MyProtocol without naming them explicitly like this?? protocol MyProtocol {} extension String: MyProtocol {} extension Int: MyProtocol {} extension UInt8: MyProtocol {} [...] I tried the following: extension FixedWidthInteger:

Re: [swift-users] defaultCalendarForNewEvents is defined as optional however can't use optional binding to check if it's nil

2018-01-10 Thread Jordan Rose via swift-users
Nothing specific. A lot of minor issues were corrected in the Xcode 9 release with a nod towards maintaining source compatibility, and most of them weren't release-noted. Jordan > On Jan 10, 2018, at 10:21, Filiz Kurban wrote: > > Thanks for your response. I will

Re: [swift-users] defaultCalendarForNewEvents is defined as optional however can't use optional binding to check if it's nil

2018-01-10 Thread Filiz Kurban via swift-users
Thanks for your response. I will check that now! In the meantime, is there a release note that states this? I have a stackover flow question on this and would love to resolve it. On Wed, Jan 10, 2018 at 10:13 AM, Jordan Rose via swift-users < swift-users@swift.org> wrote: > Hi, Filiz. Are you

Re: [swift-users] defaultCalendarForNewEvents is defined as optional however can't use optional binding to check if it's nil

2018-01-10 Thread Jordan Rose via swift-users
Hi, Filiz. Are you sure you're using Swift 4 and not the Swift 3 compatibility mode? 'defaultCalendarForNewEvents' was marked non-optional in Swift 3 by accident and that was fixed in Swift 4. Jordan > On Jan 10, 2018, at 08:59, Filiz Kurban via swift-users > wrote: >

[swift-users] defaultCalendarForNewEvents is defined as optional however can't use optional binding to check if it's nil

2018-01-10 Thread Filiz Kurban via swift-users
Hello, I'm adding a new functionality in my app, which is the ability to add an event in the default calendar set up on the phone. In the implementation, I get the permission and am ready to add the event. I check to see if there is an actual default calendar through the use of optional binding,