Мой второй вопрос здесь, и это весна связана еще раз, ваша помощь очень ценится.Swift/Spring - Неоднозначная ссылка на нижний индекс участника '
Вот строка кода, который получает код выпуска:
var soundID : SystemSoundID = Internal.cache[url] ?? 0
и
Internal.cache[url] = soundID
Issue Код:
Ambiguous reference to member 'subscript'
Дополнительный код:
struct SoundPlayer {
static var filename : String?
static var enabled : Bool = true
private struct Internal {
static var cache = [NSURL:SystemSoundID]()
}
static func playSound(soundFile: String) {
if !enabled {
return
}
if let url = Bundle.main.url(forResource: soundFile, withExtension: nil) {
var soundID : SystemSoundID = Internal.cache[url] ?? 0
if soundID == 0 {
AudioServicesCreateSystemSoundID(url as CFURL, &soundID)
Internal.cache[url] = soundID
}
AudioServicesPlaySystemSound(soundID)
} else {
print("Could not find sound file name `\(soundFile)`")
}
}
static func play(file: String) {
self.playSound(soundFile: file)
}
}
код [яровой] тег для вопросов о платформе Java http://projects.spring.io/spring-framework/. Это действительно то, о чем вы говорите? –
С информацией из предыдущего вопроса вы можете исправить эту проблему самостоятельно. * Подсказка: * Какой тип имеет переменную 'url'? –
Нет, мои извинения, я имел в виду Spring iOS Animation Library для Swift. –