Added hexString property for UIColor
This commit is contained in:
parent
0df9be960f
commit
ddd008398f
|
|
@ -1,5 +1,8 @@
|
|||
# Changelog
|
||||
|
||||
### 0.9.18
|
||||
- **Add**: `hexString` property for `UIColor` that returns hex representation of color as string.
|
||||
|
||||
### 0.9.17
|
||||
- **Fix**: SpinnerView infinity animation.
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import UIKit
|
|||
public typealias SearchResultsController = UIViewController & SearchResultsViewController
|
||||
|
||||
/// Class that allows to enter text for search and then displays search results in table view
|
||||
open class BaseSearchViewController<Item,
|
||||
open class BaseSearchViewController < Item,
|
||||
ItemViewModel,
|
||||
ViewModel,
|
||||
CustomView: UIView & TableViewHolder>: BaseCustomViewController<ViewModel, CustomView>
|
||||
|
|
|
|||
|
|
@ -126,3 +126,24 @@ public extension UIColor {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public extension UIColor {
|
||||
|
||||
/// Hex representation of UIColor as String
|
||||
var hexString: String {
|
||||
var red: CGFloat = 0
|
||||
var green: CGFloat = 0
|
||||
var blue: CGFloat = 0
|
||||
var alpha: CGFloat = 0
|
||||
|
||||
getRed(&red, green: &green, blue: &blue, alpha: &alpha)
|
||||
|
||||
let intRepresentation = alpha == 1
|
||||
? Int(red * 255) << 16 | Int(green * 255) << 8 | Int(blue * 255) << 0
|
||||
: Int(red * 255) << 24 | Int(green * 255) << 16 | Int(blue * 255) << 8 | Int(alpha * 255) << 0
|
||||
|
||||
return alpha == 1
|
||||
? String(format: "#%06x", intRepresentation)
|
||||
: String(format: "#%08x", intRepresentation)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.9.17</string>
|
||||
<string>0.9.18</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.9.17</string>
|
||||
<string>0.9.18</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.9.17</string>
|
||||
<string>0.9.18</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ private extension ApiUploadRequestParameters {
|
|||
fileExtension as CFString,
|
||||
nil)?.takeRetainedValue(),
|
||||
let mimeType = UTTypeCopyPreferredTagWithClass(utiType,
|
||||
kUTTagClassMIMEType)?.takeRetainedValue() as? String else {
|
||||
kUTTagClassMIMEType)?.takeRetainedValue() as String? else {
|
||||
|
||||
assertionFailure("Unable to get mime type from file name")
|
||||
throw UploadParametersError.unableGetMimeType
|
||||
|
|
|
|||
Loading…
Reference in New Issue