0

I'm writing swift app to record audio/video. Building on OSX 10.13 work, but how I can buid project for 10.12 on the same machine? I have changed macos deployment target to 10.12, Base SDK is set to 10.13 and I get error AVVideoCodecType.h264 is only available on OS X 10.13 or newer. How can I do if statement at compile time to detect osx version?

Thanks.

Matho
  • 125
  • 2
  • 11
  • 1
    @available? https://stackoverflow.com/questions/3339722/how-to-check-ios-version https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Attributes.html – Larme Feb 02 '18 at 11:08
  • Or have a look at Apples [Swift Documentation](https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Attributes.html) – mschmidt Feb 02 '18 at 11:09
  • if i understand correctly, @available is only for runtime. I need something for compile time, as .h264 do not present in osx 10.12 – Matho Feb 02 '18 at 11:23
  • @available does work at runtime. But it tells the compiler... "I only want to execute this code if I'm running on version 10.13". Checking at compile time is a bit pointless. At compile time you are on your computer. Not the user's computer. Use the available syntax. – Fogmeister Feb 02 '18 at 13:41
  • Thanks, you are right – Matho Feb 02 '18 at 13:57

0 Answers0