Latest 1.0.7
Homepage https://github.com/exchangegroup/AssetFrameworkDemo
License MIT
Platforms ios 8.0
Authors

Distributing image assets with a dynamic framework in iOS with Swift

This demo shows how to distribute image assets with a dynamic framework.

The trick is to to provide the bundle of the framework when referencing the asset.

Here an the example code from the framework that shows an image with name "Ocean":

let bundle = NSBundle(forClass: self)
let image UIImage(named: "Ocean", inBundle: bundle, compatibleWithTraitCollection: nil)

Distributing framework with Carthage

No special setup is needed for distributing your framework with the assets with Carthage.

Yay 💥🐰🐰🐰💥

Distributing framework with CocoaPods

Specify the assets folder location in resources property in the podspec file:

s.resources  = "MyLib/**/*.xcassets"

Setup

There are two ways you can add this demo framework to your project.

Setup with Carthage (iOS 8+)

Add github "marketplacer/AssetFrameworkDemo" ~> 1.0 to your Cartfile and run carthage update.

Setup with CocoaPods (iOS 8+)

If you are using CocoaPods add this text to your Podfile and run pod install.

use_frameworks!
pod 'ImageDemoLib', '~> 1.0'

Usage

Here is how you can get the image from the framework in your app:

import ImageDemoLib
...
imageView.image = MyImage.getImage()

Latest podspec

{
    "name": "ImageDemoLib",
    "version": "1.0.7",
    "license": {
        "type": "MIT"
    },
    "homepage": "https://github.com/exchangegroup/AssetFrameworkDemo",
    "summary": "Demo iOS project that shows how to distribute image assets with dynamic framework on iOS.",
    "authors": {
        "Evgenii Neumerzhitckii": "[email protected]"
    },
    "source": {
        "git": "https://github.com/exchangegroup/AssetFrameworkDemo.git",
        "tag": "1.0.7"
    },
    "source_files": "ImageDemoLib/**/*.swift",
    "resources": "ImageDemoLib/**/*.xcassets",
    "platforms": {
        "ios": "8.0"
    }
}

Pin It on Pinterest

Share This