Greetings — I haven't found this specific topic in the archives; apologies
if this has come up before.
Suppose I have a C struct with an embedded char array:
struct fileinfo_t {
char path[256];
};
and I want to convert the path to a Swift String (in order to implement
`description`, say). I
Thanks to Joe and Quinn for their answers. I have a related followup — a
co-worker learning Swift wrote the following function:
func allZerosUUID() -> String {
var allZeros = [UInt8](repeating: 0, count: 32)
return withUnsafePointer(to: &allZeros) { zerosPtr in
retu
hUnsafeBufferPointer { NSUUID(uuidBytes: $0.
> baseAddress).uuidString }
> }
>
>
> On Mar 1, 2017, at 2:35 PM, Russell Finn via swift-users <
> swift-users@swift.org> wrote:
>
> Thanks to Joe and Quinn for their answers. I have a related followup — a
> co-worker
entation details of allZeros array.
>>
>> Here is the correct way to do it:
>>
>> func allZerosUUID() -> String {
>>
>> let allZeros = [UInt8](repeating: 0, count: 32)
>>
>> return allZeros.withUnsafeBufferPointer { NSUUID(uuidBytes: $0.
>&
I'm having an issue with an NSDictionary that is passing through Swift code
and back to Objective-C losing access to a method implemented by a category
on NSDictionary. There is clearly some subtlety about bridged dictionaries
that I'm missing, and I'd appreciate any clarification that the list can
3 PM, Greg Parker wrote:
>
>
> On May 23, 2017, at 1:10 PM, Russell Finn via swift-users <
> swift-users@swift.org> wrote:
>
> I'm having an issue with an NSDictionary that is passing through Swift
> code and back to Objective-C losing access to a method implemented