Skip to content

Commit

Permalink
fix load img
Browse files Browse the repository at this point in the history
  • Loading branch information
Fujiki Takeshi committed May 29, 2017
1 parent 79b7f83 commit 072a62a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions SwiftShareBubbles/ShareAttirbute.swift
Expand Up @@ -68,7 +68,12 @@ extension ShareAttirbute {
private static func createButton(bubbleId: Int, imageName: String, color: UIColor) -> ShareAttirbute? {
let classBundle = Bundle(for: SwiftShareBubbles.self)
guard let bundle = Bundle(path: "\(classBundle.bundlePath)/SwiftShareBubbles.bundle") else { return nil }
guard let icon = UIImage(named: "SwiftShareBubbles.bundle/\(imageName)", in: bundle, compatibleWith: nil) else { return nil }
return ShareAttirbute(bubbleId: bubbleId, icon: icon, backgroundColor: color)
if let icon = UIImage(named: "SwiftShareBubbles.bundle/\(imageName)", in: bundle, compatibleWith: nil) {
return ShareAttirbute(bubbleId: bubbleId, icon: icon, backgroundColor: color)
} else if let icon = UIImage(named: imageName, in: bundle, compatibleWith: nil) {
return ShareAttirbute(bubbleId: bubbleId, icon: icon, backgroundColor: color)
} else{
return nil
}
}
}

0 comments on commit 072a62a

Please sign in to comment.