R.swift
R.swift copied to clipboard
Support for Data Assets
Introduction
Asset Catalog supports Data Assets from macOS 10.11/iOS 9.0.
Data Assets can use with NSDataAsset
.
Here is a document. https://developer.apple.com/documentation/uikit/nsdataasset
Subject
Now
I'm using animation.gif
in Assets.xcassets
with below.
if let asset = NSDataAsset(name: "animation.gif") {
let data = asset.data
let animationImage = imagesFromAnimationGif(data)
}
func imagesFromAnimationGif(_ data: Data) -> UIImage {
// parse data
}
Hope
I want call animation.gif
via R.swift like below.
let data = R.data.animation_gif
let animationImage = imagesFromAnimationGif(data)
I would also like this feature!
In real programming, usage of Data Assets is immensely rare, and right now, for the first time in 5 years I would've had use of this feature, probably for the last time in my life :)