We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Landmark.swift 这个文件中 ‘ ImageStore’ 报 ‘Use of unresolved identifier 'ImageStore'’
The text was updated successfully, but these errors were encountered:
查看 ../SwiftUI-Tutorials-master/SwiftUI-Essentials/Models/Data.swift 文件是否存在并且引入到了工程中。
../SwiftUI-Tutorials-master/SwiftUI-Essentials/Models/Data.swift
查看 Data.swift 文件中 ImageStore 相关的代码是否正常,即:
Data.swift
ImageStore
final class ImageStore { typealias _ImageDictionary = [String: CGImage] fileprivate var images: _ImageDictionary = [:] fileprivate static var scale = 2 static var shared = ImageStore() func image(name: String) -> Image { let index = _guaranteeImage(name: name) return Image(images.values[index], scale: CGFloat(ImageStore.scale), label: Text(verbatim: name)) } static func loadImage(name: String) -> CGImage { guard let url = Bundle.main.url(forResource: name, withExtension: "jpg"), let imageSource = CGImageSourceCreateWithURL(url as NSURL, nil), let image = CGImageSourceCreateImageAtIndex(imageSource, 0, nil) else { fatalError("Couldn't load image \(name).jpg from main bundle.") } return image } fileprivate func _guaranteeImage(name: String) -> _ImageDictionary.Index { if let index = images.index(forKey: name) { return index } images[name] = ImageStore.loadImage(name: name) return images.index(forKey: name)! } }
Sorry, something went wrong.
No branches or pull requests
Landmark.swift 这个文件中 ‘ ImageStore’ 报 ‘Use of unresolved identifier 'ImageStore'’
The text was updated successfully, but these errors were encountered: