I have some Swift code that doesn't seem to work ...
// earlier, in Obj C... typedef struct _Room { uint8_t *map; int width; int height; } Room;
The room is part of the kick in the game with roguelike, if you're interested. I am trying to rewrite a couple of parts in Swift. Here's a code that looks broken, and what I hope I do as comments:
let ptr = UnsafePointer<UInt8>(room.map)
Something is wrong here, because simple tests show that the pointValue value is not what I know, I look at the map by setting a very simple location (1, 1) to a known value. It seems pretty obvious that Swift shouldn't do this kind of thing, but it's a conversion to learn Way of Swift when I know the syntax well.
I expect the error is indicated in the quick code, as it all worked in the objective version of C. Where is the error?
source share