Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I have an iOS App and OS X App in the same project?

Tags:

xcode

macos

ios

I've seen this question about whether or not it's possible to make an iOS App and a Mac OS X App in the same project, while I was trying to ask this. I'm not asking about whether or not it's possible. I had to delete and re-install Xcode (because I wanted to update and my MacBook Air's SSD is really low on space), and I came across this screenshot.

Screenshot

Besides the absolutely beautiful 3D scenery on the right side, I looked at the project structure on the left. They have OS X files in one group and iOS files in another.

How would I be able to make my project this organized? As in, how would I go about making a project where I can simply have OS X files and iOS files be simply two different groups of files in the same project, and work on each app almost synchronously?

like image 938
DDPWNAGE Avatar asked Nov 27 '15 08:11

DDPWNAGE


People also ask

Are iOS apps compatible with macOS?

iOS and macOS support many of the same frameworks and features, and most iOS apps run smoothly in macOS. However, you might choose to opt out of running your iOS app in macOS under the following circumstances: You already created a Mac version of your app using AppKit or Mac Catalyst.

Can you use iPhone and iPad apps on Mac?

In the Mac App Store, iPhone and iPad apps that work on Mac computers with Apple silicon are labeled with Designed for iPhone or Designed for iPad. Any iPhone or iPad apps you purchase that work on your Mac with Apple silicon are shown when you view your purchased apps in the App Store.

How do I see my iPhone apps on my Mac?

In the App Store on your Mac, click your name in the bottom-left corner, or click Sign In if you're not already. Your account appears with all of your purchased apps. If you're using a Mac computer with Apple silicon, any iPhone or iPad apps you purchased that work on your Mac are also listed.

Can you run iOS apps on a Mac?

Apple announced its transition to Apple Silicon for its Mac lineup in 2020. In addition to offering a boost in performance and efficiency on the new Macs, this move also opened the possibility to run iOS (and iPadOS) apps on the Mac.

Is it possible to develop iOS apps on Windows?

However, if you wish to develop an iOS app on Windows, you need virtualization software. Using a virtual machine such as VirtualBox and VMware, you get access to virtual Mac OS. Hence, developing iOS apps on Windows will be easier for you.

How do I build an iOS app from an android project?

The workflow to creating Android and iOS apps is relatively simple. In order to create an iOS application in Android Studio, we first need to start with an Android Project. Finally, we configure the Gradle* scripts, build and launch our apps.

Can I develop iOS and Android apps in Android Studio?

You can also develop your Android* and iOS* applications in Android Studio on Windows* but in order to simulate your iOS application, you will need to remotely deploy your app to a Mac system running Xcode* (hence remote build). For this scenario, check our getting started guide with Multi-OS Engine (remote build).


2 Answers

Figure out how to do this, leave some screenshots in case it may help others.

I did the OSX App first, put the common code apart, then click file menu to create the target as iOS App.

enter image description here

Use the common code to build iOS App, Now you can already see the target has both OSX and iOS, remember to add the needed files in the Compile Sources and Resources.

enter image description here

Now you can both choose whether to run on iOS or OSX. Done!

enter image description here

like image 140
XueYu Avatar answered Sep 25 '22 17:09

XueYu


The answer seems quite straight-forward. Xcode allows you to create groups in order to organize files. Each source file can belong to one-or-more targets, so it's just a case of putting all common, iOS-specific and OSX-specific files in their own groups and setting their targets.

- Source
    - Common
        - File1.m       Target: iOS and OSX
        ...
    - iOS
        - File2.m       Target: iOS
        ...
    - OSX
        - File3.m       Target: OSX
        ...
like image 40
trojanfoe Avatar answered Sep 26 '22 17:09

trojanfoe