Swiftified two iOS class extensions
- plus small API tweak to avoid crash in optimised builds