Need help with xcode

Hi everyone.,

  1. I have a doubt is it possible to run 2targets at a time in xcode ?
  2. Is it possible to use classes of one platform and use it to run test when target platform is something else ?

Hi @vinolin_asokan

Welcome to the community!!

I am not sure I understand the questions.

You CAN run two simulators at the same time, but I believe Xcode will only allow you to run one project at a time. Although I admit have never tried to run two projects at the same time.

Blessings,
—Mark

Hi Mark,
I am running on real device not in simulator.
Reframing questions:

  1. Is it possible to run multiple targets (1-ios, 1-macos) at a time?
  2. (For example Triggering audio file on Mac path on Mac when the project target is iOS.) - so is it possible to use classes of one platform and use it to run test when target platform is iOS?

Hi,

Xcode can only track one device at a time but you can share classes with the latest version of Xcode and Mac OS and iOS. Just ensure you are selected added the target membership. See pict.

You may find that some code will need to be modified to run in both environments.

For example:

#if os(macOS)
        if let ciColor = CIColor(color: NSColor(color)) {
            try container.encode(NSColor(ciColor: ciColor).hexString(), forKey: CodingKeys.color)
        }
        #else
        try container.encode(UIColor(color).hexString(), forKey: CodingKeys.color)
        #endif

MacOS is NSColor and iOS is UIColor.

Blessings,
–Mark

DataController.swift 2020-12-23 10-35-40