-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix converting NSNotification.Name to String error #63
Conversation
This is an attempt to fix the "Cannot convert value of type 'NSNotification.Name' to expected argument type 'String'" issue. Although appending '.rawValue' resolves the error, it would probably be more elegant if that line is just: name: UIAccessibility.differentiateWithoutColorDidChangeNotification
@chrs1885 Is this something you've encountered at your end? Perhaps this is coming up only on Xcode 13? |
@chrs1885 just a friendly ping :) |
@dehlen @edwellbrook @Deathqon thought I'd send a friendly ping to other potential maintainers just in case. |
@acosmicflamingo thanks for contributing and sry for not reading ti earlier 🍻 |
@chrs1885 no worries at all! I appreciate that you even replied, but am happier to have this merged in develop now 😄 it was something I had to manually do every time I obliterated DerivedData and Xcode would fetch sources from upstream via SPM 😜 |
@acosmicflamingo What are you using the library for? Any feature requests? 😀 |
@chrs1885 I'm creating my own "CosmicFlamingoKit" to make my own apps and I have a "CFKAccessibilityLibrary" that uses your library as the backend. Since you asked however.......... :D It would be cool to add a few cases to CapableFeature enum (accessibilitySize, highContrast, and darkMode), although there might be a reason it is currently not supported (or perhaps I just didn't read the documentation that well!). I'm doing this to get around it:
As you can see, I have a CFA11y class where I can do something like call CFA11y.isEnabled(.reduceMotion). However, I didn't see accessibilitySize, highContrast, or darkMode in CapableFeature enum, which is why I had to write my own enum comprising these cases in CFA11yFeature and a function that uses this type as the feature parameter. That way, I can still use the 'isEnabled' function and not worry about what's going on in the backend. If this seems like an endeavor worth pursuing, I could try and implement this on Capable framework's side and create a PR instead of just telling you "This is what I want. Good luck" LOL what are your thoughts? |
Hi @acosmicflamingo, sorry for not being more responsive :) First and foremost, thanks for the MR, I just released 2.0.1 🥳 Feel free to add those features as part of a new merge request. 🍻 |
@chrs1885 thank you; I'm so glad to hear! :D I will certainly do so! |
This is an attempt to fix the "Cannot convert value of type 'NSNotification.Name' to expected argument type 'String'" issue.
Although appending '.rawValue' resolves the error, it would probably be more elegant if that line is just:
name: UIAccessibility.differentiateWithoutColorDidChangeNotification
Issue information
Right now, I'm getting the following issue when I try and build Capable as a SPM dependency:
"Cannot convert value of type 'NSNotification.Name' to expected argument type 'String'".
Goal
Try and get Capable to compile when used as SPM dependency.
Implementation
Added .rawValue so NSNotification.Name is passed the string value.
Testing
Code compiles after making the change.