Closed alexliubj closed 8 years ago
You can inherit from Jukebox
and make it singleton.
Same Issue any one can Help. Create Singleton but I can't.
I am waiting the solution here. Let me know if any has been able to create singleton for this.
I solved this problem using code below,
import Jukebox
class JukeBoxManager{
static let sharedInstance = JukeBoxManager()
var jukebox : Jukebox!
init(){
}
}
@firatyenidunya I am very new to Swift. Would you please provide some example the its usages?
How can I know my music is playing as a background music in my application? For e.g, I push from page 1 to page 2 which is my details page. I popup the music player in page2 and then play a sound (sound A). When I pop back to page 1, I still want my music is playing. When I come back to page 2 from page 1 again, I click the popup button for music player, I want it showing the current sound I was playing and show the status like 50% whatever (still sound A) but not init a new music player.
Please advise, it sounds like use this music player as a global singleton instance but I don't know how to implement it.
Thanks,