8
Comments
  • 1
    I've never written in Swift. Are swift pointers any different from C pointers?
  • 1
    @olback yes. Basically, Apple thinks that pointers can pose a security threat if used maliciously so they made it extremely hard to use pointers. You barely need it in day-to-day Swift life though.
  • 2
    @OmerFlame I mean they're not wrong about pointers.
  • 0
    @RememberMe I know, but sometimes when you must use pointers to propagate changes from view controller to view controller it gets stupidly difficult because you have to mess around with UnsafeMutablePointer. If that value is nullable then you must mess around with UnsafeMutableRawPointer. They made it really hard...
  • 1
    @OmerFlame wtf? Stop using pointers to propagate changes. You have so many mechanisms to pick from:
    Closures, delegation pattern, notification center, Combine.

    Heck... you can even use KVO. Still better than abusing pointers.

    You know about keypaths, right? I feel like they can be used instead of what you are doing with pointers.
  • 1
    @Lensflare Combine basically uses pointers that have a “didSet” block. Seriously.
  • 1
    @OmerFlame everything is basically using pointers under the hood. That’s abstraction ^^
Add Comment