pointfreeco / episode-code-samples

💾 Point-Free episode code.
https://www.pointfree.co
MIT License
939 stars 289 forks source link

UIApplication.shared.windows deprecated in iOS 15 #99

Closed dmeehan1968 closed 2 years ago

dmeehan1968 commented 2 years ago

The following line throws a deprecation warning in iOS 15.

https://github.com/pointfreeco/episode-code-samples/blob/2f1621f25c33dfb826b71adbbb09ed09dc1165bc/0086-swiftui-snapshot-testing/PrimeTime/CounterTests/CounterTests.swift#L13

This can be updated to:

guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
      let window = windowScene.windows.first
      else { return }
stephencelis commented 2 years ago

Hi @dmeehan1968! Episode code samples are a bit "frozen in time" for now. You should always be able to open them up in the version of Xcode that was available at the time, though! Hopefully most code samples can be modernized with just a little work, though :smile:

I'm going to convert this to a discussion, since we don't intend to update old code samples at this time, but thanks for taking the time to chat about it!