Disable blurhashes in debug builds
This commit is contained in:
parent
949162bcab
commit
122cce3bc7
|
@ -2,9 +2,17 @@
|
|||
/// From https://github.com/woltapp/blurhash/blob/b23214ddcab803fe1ec9a3e6b20558caf33a23a5/Swift/BlurHashDecode.swift
|
||||
import UIKit
|
||||
|
||||
// blurhashes are disabled in debug builds because this code is hideously slow when not optimized by the compiler
|
||||
#if DEBUG
|
||||
fileprivate let blurHashesEnabled = ProcessInfo.processInfo.environment.keys.contains("DEBUG_BLUR_HASH")
|
||||
#else
|
||||
fileprivate let blurHashesEnabled = true
|
||||
#endif
|
||||
|
||||
extension UIImage {
|
||||
public convenience init?(blurHash: String, size: CGSize, punch: Float = 1) {
|
||||
guard blurHash.count >= 6 else { return nil }
|
||||
guard blurHashesEnabled,
|
||||
blurHash.count >= 6 else { return nil }
|
||||
|
||||
let sizeFlag = String(blurHash[0]).decode83()
|
||||
let numY = (sizeFlag / 9) + 1
|
||||
|
|
Loading…
Reference in New Issue