Closed.
Post
Replies
Boosts
Views
Activity
Closed.
Closed.
Closed
Closed
That's how I am pushing buttons in my game.
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
if let touch = touches.first {
let position = touch.location(in: self)
let node = self.atPoint(position)
switch node {
case meow1off:
if let musicURL = Bundle.main.url(forResource: self.meows[0], withExtension: "mp3") {
self.meow1Sound = SKAudioNode(url: musicURL)
self.addChild(self.meow1Sound)
}
case meow2off:
if let musicURL = Bundle.main.url(forResource: self.meows[1], withExtension: "mp3") {
self.meow2Sound = SKAudioNode(url: musicURL)
self.addChild(self.meow2Sound)
}
...
}
}
Thank you very much! I got another problem: Cast from '[AnyObject]' to unrelated type '[CKRecord.ID : Int]' always fails
Here:
operation.queryCompletionBlock = { (cursor, error) in
let moreComing = (cursor == nil) ? false : true
completionHandler(results as [AnyObject] as! [CKRecord.ID: Int], moreComing, error as NSError?)
if let cursor = cursor {
self.continueCheckedInProfilesCount(with: cursor, results: results, completionHandler: completionHandler)
}
}
@Published var checkedInProfiles: [CKRecord.ID: Int] = [:] ...
func getCheckedInCounts() { ckController.database.fetchCheckedInProfilesCount(with: RecordType.profile) { (results, moreComing, error) in DispatchQueue.main.async { [self] in checkedInProfiles = results } } }