Sharing Code between iOS and macOS
summary
MindNode’s team shares model and much controller logic between iOS and macOS, using a central drag controller to unify pan/drag behavior and avoid duplicated view-controller code; they add a macOS target, hit thousands of compile errors and spend weeks until it compiles to an empty window, then incrementally fix platform issues. Use typealias shimming plus protocols/extensions to map UIView↔NSView differences, and implement drawing with Core Animation/Core Graphics so canvas, PDFs and exports stay identical; macOS ultimately brings significant revenue.
AI-written summary · about
chapters (12)
- 0:00Introduction
- 4:02Why share code
- 7:59Benefits of code sharing
- 10:28Pragmatic approach to code
- 12:37Model layer sharing
- 13:40Controller layer sharing
- 16:27Avoid massive view controllers
- 19:18View layer challenges
- 21:25Using shimming technique
- 25:10Core graphics and animation
- 27:18Key takeaways summary
- 28:23MacOS revenue surprise
