Created 2025-02-08T10:16:52Z
Updated 2025-02-08T10:16:52Z
Type Information
Status In Progress

Looking over some older code that supports building for iOS and macOS. There is a section of code in one of the views which presents a detail view for a target OS. However, this either never worked or doesn’t work now since UIDevice is from UIKit and not supported on macOS

  if UIDevice.current.userInterfaceIdiom == .phone {
      phoneDetailView(viewModel)
  } else {
      macDetailView(viewModel)
  }

One solution would be to use the following to check at compile time

let isBuiltForMacOS: Bool = {
    #if os(macOS)
        return true
    #else
        return false
    #endif
}()