This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Perform URL request | |
// http://itunes.apple.com/lookup?bundleId=YOUR_APP_BUNDLE_ID | |
// TXT-file with JSON data will be downloaded | |
// Parse it, fetch version key-value | |
// "version":"1.5" | |
// Compare it with your current app version | |
let appVersion = Bundle.main.infoDictionary["CFBundleShortVersionString"] as? String | |
let buildNumber = Bundle.main.infoDictionary["CFBundleVersion"] as? String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import var CommonCrypto.CC_MD5_DIGEST_LENGTH | |
import func CommonCrypto.CC_MD5 | |
import typealias CommonCrypto.CC_LONG | |
import Foundation | |
import UIKit | |
enum UserCredentialError: Error, LocalizedError { | |
case invalidEmail |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// More info here | |
// https://marcosantadev.com/calayer-auto-layout-swift/ | |
class LayerContainerView: UIView { | |
override public class var layerClass: Swift.AnyClass { | |
return CAGradientLayer.self | |
} | |
override func awakeFromNib() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
enum CodingError: LocalizedError, Error { | |
case unableToDecode(key: String, type: String) | |
var errorDescription: String? { | |
switch self { | |
case .unableToDecode(let key, let type): | |
return Localizable.errorParsingKey(key, type) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Alamofire | |
import Foundation | |
import Moya | |
extension MoyaProvider { | |
convenience init(handleRefreshToken: Bool) { | |
if handleRefreshToken { | |
self.init(requestClosure: MoyaProvider.endpointResolver(), | |
manager: DefaultAlamofireManager.sharedManager, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@UIApplicationMain | |
final class AppDelegate: UIResponder { | |
override init() { | |
RealmDAO.shared.configureMigration() | |
super.init() | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
// IMPORTANT: check APS environment (production or sandbox) in your app .entitlements file | |
extension Data { | |
func hexString() -> String { | |
return self.map{ String(format: "%02.2hhx", $0) }.joined() | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SnapKit | |
import UIKit | |
class AnimationView: UIView { | |
private let duration: Double = 3.0 | |
private var percent: Double = 0.0 | |
private var displayLink: CADisplayLink? | |
private var start: CFAbsoluteTime = CFAbsoluteTime.zero | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Output version & build number to the APP_VERSION label on LaunchScreen.storyboard | |
versionNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${INFOPLIST_FILE}") | |
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${INFOPLIST_FILE}") | |
sed -i "" -e "/userLabel=\"APP_VERSION\"/s/text=\"[^\"]*\"/text=\"Version: $versionNumber ($buildNumber)\"/" "$PROJECT_DIR/LaunchScreen.storyboard" |