R.swift icon indicating copy to clipboard operation
R.swift copied to clipboard

Support for Data Assets

Open 417-72KI opened this issue 6 years ago • 2 comments

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)

417-72KI avatar Sep 28 '18 03:09 417-72KI

I would also like this feature!

giulio92 avatar Nov 21 '18 21:11 giulio92

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 :)

isaac-weisberg avatar Jul 16 '21 10:07 isaac-weisberg