Search code examples
objective-cmacosuiviewuikit

MacOS - UIKit/UIKit.h not found


Try to

#import <UIKit/UIKit.h>

And get error:

UIKit/UIKit.h file not found

What is it and how fix it ?))) Try to import Foundation - all ok )


Solution

  • Originally for macOS you could only use AppKit as an UI framwork, which is quite different from UIKit, so you couldn't reuse iOS code for macOS.

    So you have to learn a much different framerwork with NSView base view instead of UIView and a lot of differences.

    But then apple supported porting iOS apps to macOS. To do this you need to create an iOS app(if you don't have one) and turn on that option in the settings. Check out more at Running Your iOS Apps on macOS

    You would still need to do a lot a work in making your app for macOS comfortable for users, but if you have no background in AppKit, probably it's still easier to go for UIKit