<div dir="ltr">MIDIMetaEvent and MIDIEventUserData are both examples of framework provided types which rely on flexible member arrays. Their last member is (officially) an array of UInt8 with 1 element. In practice, developers are meant to allocate enough space for an array of the necessary length along with the rest of the struct.<div><br></div><div>These members come into swift as single element tuples. I propose either automatic import of these as Array or UnsafeReference.</div><div><br></div><div>Example of the current situation:</div><div><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)">/*!</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)"><span class="" style="white-space:pre">        </span>@struct<span class="" style="white-space:pre">                </span>MIDIMetaEvent</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)"><span class="" style="white-space:pre">        </span>@discussion<span class="" style="white-space:pre">        </span>The parameters to specify a MIDI meta event</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)">*/</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="color:rgb(187,44,162)">public</span> <span style="color:rgb(187,44,162)">struct</span> MIDIMetaEvent {</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px"> </p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"> <span style="color:rgb(187,44,162)">public</span> <span style="color:rgb(187,44,162)">var</span> metaEventType: <span style="color:rgb(112,61,170)">UInt8</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"> <span style="color:rgb(187,44,162)">public</span> <span style="color:rgb(187,44,162)">var</span> unused1: <span style="color:rgb(112,61,170)">UInt8</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"> <span style="color:rgb(187,44,162)">public</span> <span style="color:rgb(187,44,162)">var</span> unused2: <span style="color:rgb(112,61,170)">UInt8</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"> <span style="color:rgb(187,44,162)">public</span> <span style="color:rgb(187,44,162)">var</span> unused3: <span style="color:rgb(112,61,170)">UInt8</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"> <span style="color:rgb(187,44,162)">public</span> <span style="color:rgb(187,44,162)">var</span> dataLength: <span style="color:rgb(112,61,170)">UInt32</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"> <span style="color:rgb(187,44,162)">public</span> <span style="color:rgb(187,44,162)">var</span> data: (<span style="color:rgb(112,61,170)">UInt8</span>)</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(187,44,162)"><span style="color:rgb(0,0,0)"> </span>public<span style="color:rgb(0,0,0)"> </span>init<span style="color:rgb(0,0,0)">()</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"> <span style="color:rgb(187,44,162)">public</span> <span style="color:rgb(187,44,162)">init</span>(metaEventType: <span style="color:rgb(112,61,170)">UInt8</span>, unused1: <span style="color:rgb(112,61,170)">UInt8</span>, unused2: <span style="color:rgb(112,61,170)">UInt8</span>, unused3: <span style="color:rgb(112,61,170)">UInt8</span>, dataLength: <span style="color:rgb(112,61,170)">UInt32</span>, data: (<span style="color:rgb(112,61,170)">UInt8</span>))</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">}</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px"><br></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)">/*!</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)"><span class="" style="white-space:pre">        </span>@struct<span class="" style="white-space:pre">                </span>MusicEventUserData</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)"><span class="" style="white-space:pre">        </span>@discussion<span class="" style="white-space:pre">        </span>Provides a general struct for specifying a user defined event. </p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)"><span class="" style="white-space:pre">        </span>@field<span class="" style="white-space:pre">                </span>length</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)"><span class="" style="white-space:pre">                                        </span>the size in bytes of the data</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)"><span class="" style="white-space:pre">        </span>@field<span class="" style="white-space:pre">                </span>data</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)"><span class="" style="white-space:pre">                                        </span>size bytes of user defined event data</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)">*/</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="color:rgb(187,44,162)">public</span> <span style="color:rgb(187,44,162)">struct</span> MusicEventUserData {</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px"> </p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"> <span style="color:rgb(187,44,162)">public</span> <span style="color:rgb(187,44,162)">var</span> length: <span style="color:rgb(112,61,170)">UInt32</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"> <span style="color:rgb(187,44,162)">public</span> <span style="color:rgb(187,44,162)">var</span> data: (<span style="color:rgb(112,61,170)">UInt8</span>)</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(187,44,162)"><span style="color:rgb(0,0,0)"> </span>public<span style="color:rgb(0,0,0)"> </span>init<span style="color:rgb(0,0,0)">()</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"> <span style="color:rgb(187,44,162)">public</span> <span style="color:rgb(187,44,162)">init</span>(length: <span style="color:rgb(112,61,170)">UInt32</span>, data: (<span style="color:rgb(112,61,170)">UInt8</span>))</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">}</p></div><div><br></div></div>