Create a custom keyboard in Swift3 and press the
button.
MPMusicPlayerController.systemMusicPlayer().nowPlayingItem
I would like to insert the title (.title
) and lyrics (.lyrics
).
like a regular app
Import MediaPlayer
, declare an instance of MPMusicPlayerController
in keyboardViewController
, and call the method specified in the selector when notified by nowPlayingItemDidChange
to retrieve the song information.
Is MediaPlayer not corresponding to the App Extension of the custom keyboard?
Or do I need to do something special?
Alternatively, it would be nice if it could be implemented using the single view app and UIButton and UITextView instead of the custom keyboard to retrieve and pass the information on the host app...
swift ios swift3 ios-app-extension
I've never tried the extension of a custom keyboard, so I'm not sure, but if it doesn't have to be a custom keyboard (only available in my app), I'm doing something similar with the tweets feature of my app SongsInfo.
This app allows you to insert meta-information of songs instead of keyboards by setting UITableView to inputView in UITextView.
Also, remember to include Privacy-Media Library Usage Description in Info.plist.
© 2024 OneMinuteCode. All rights reserved.