SvenTiigi / WhatsNewKit

Showcase your awesome new app features 📱
https://sventiigi.github.io/WhatsNewKit/
MIT License
3.87k stars 190 forks source link

WhatsNew.Text from NSAttributedString Availability Issue #54

Closed iosdeveloper closed 2 years ago

iosdeveloper commented 2 years ago

WhatsNewKit Environment

What did you do?

Try to create an instance of WhatsNew.Text from a NSAttributedString with iOS deployment target 14.0:

WhatsNew.Text(NSAttributedString())

What did you expect to happen?

No build error. NSAttributedString should be available on iOS 3.2+.

What happened instead?

'(init(_:)' is only available in iOS 15.0 or newer

SvenTiigi commented 2 years ago

Hi @iosdeveloper,

WhatsNewKit is currently using the Text.init(_ attributedContent: AttributedString) initializer which is only available >= iOS 15.0

A fallback for < iOS 15.0 is currently not implemented when initializing a WhatsNew.Text instance with a AttributedString or NSAttributedString.

iosdeveloper commented 2 years ago

Ah, that makes sense. I'm trying to use this from UIKit and have to be backwards compatible one major iOS version. I will just make it plain text only as a fallback then.

iosdeveloper commented 2 years ago

@SvenTiigi Unfortunately I'm seeing a crash when running my iOS app on Mac due to the #available(iOS 15.0, *) checks failing. The issue was acknowledged by an Apple engineer in the forums: https://developer.apple.com/forums/thread/691559?answerId=690192022#690192022 The solution is also mentioned there. Can we update the check in Text+WhatsNewText.swift accordingly?

SvenTiigi commented 2 years ago

This problem should be fixed with Xcode 13.2

https://developer.apple.com/documentation/xcode-release-notes/xcode-13_2-release-notes

Fixed an issue that caused availability checks in iPhone and iPad apps running on a Mac with Apple silicon to always return true, which caused iOS apps running in macOS Big Sur to see iOS 15 APIs as available, resulting in crashes. These availability checks now return the correct result for apps compiled with Xcode 13.2. (83378814)
iosdeveloper commented 2 years ago

That works, thanks. I found another issue for "iOS app on Mac". The Continue button doesn't dismiss the WhatsNewViewController. Manually calling dismiss(animated:) in onDismiss for the primary action works. Not necessarily your fault though, as it works on iOS.