From c6c429d3f79754a67fae7aa5ce0a5ffc64794622 Mon Sep 17 00:00:00 2001 From: Peter Prokop Date: Sun, 1 Nov 2015 11:41:54 +0300 Subject: [PATCH] Fix missing images issue, update .podspec --- StarryStars.podspec | 5 +++-- StarryStars/RatingView.swift | 10 ++++++---- StarryStarsExample/Base.lproj/Main.storyboard | 8 -------- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/StarryStars.podspec b/StarryStars.podspec index 583dc02..110c981 100644 --- a/StarryStars.podspec +++ b/StarryStars.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'StarryStars' - s.version = '0.0.1' + s.version = '0.0.2' s.license = 'MIT' s.summary = 'iOS GUI library for displaying and editing ratings' s.homepage = 'https://github.com/peterprokop/SwiftOverlays' @@ -8,5 +8,6 @@ Pod::Spec.new do |s| s.source = { :git => 'https://github.com/peterprokop/StarryStars.git', :tag => s.version.to_s } s.ios.deployment_target = '8.0' s.requires_arc = 'true' - s.source_files = 'StarryStars/*' + s.source_files = 'StarryStars/*.swift' + s.resource_bundle = { 'StarryStars' => 'StarryStars/Assets.xcassets' } end diff --git a/StarryStars/RatingView.swift b/StarryStars/RatingView.swift index db9e4e0..7c7860d 100644 --- a/StarryStars/RatingView.swift +++ b/StarryStars/RatingView.swift @@ -13,7 +13,7 @@ protocol RatingViewDelegate { @IBDesignable public class RatingView: UIView { - + @IBInspectable var starCount: Int = 5 @IBInspectable var offImage: UIImage? @IBInspectable var onImage: UIImage? @@ -54,14 +54,16 @@ public class RatingView: UIView { } func customInit() { + let bundle = NSBundle(forClass: RatingView.self) + if offImage == nil { - offImage = UIImage(named: "starBigOff")! + offImage = UIImage(named: "starBigOff", inBundle: bundle, compatibleWithTraitCollection: self.traitCollection) } if onImage == nil { - onImage = UIImage(named: "starBig")! + onImage = UIImage(named: "starBig", inBundle: bundle, compatibleWithTraitCollection: self.traitCollection) } if halfImage == nil { - halfImage = UIImage(named: "starBigHalf")! + halfImage = UIImage(named: "starBigHalf", inBundle: bundle, compatibleWithTraitCollection: self.traitCollection) } guard let offImage = offImage else { diff --git a/StarryStarsExample/Base.lproj/Main.storyboard b/StarryStarsExample/Base.lproj/Main.storyboard index d89bd50..b793967 100644 --- a/StarryStarsExample/Base.lproj/Main.storyboard +++ b/StarryStarsExample/Base.lproj/Main.storyboard @@ -25,9 +25,6 @@ - - - @@ -69,9 +66,4 @@ - - - - -