This file contains 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 UIKit | |
enum FontStyle { | |
case largeTitle | |
case headline | |
case title2 | |
case title3 | |
case subheadline | |
case body | |
case callout |
This file contains 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
let volumeController = MPVolumeView() | |
// to change volume we need to get slider and set it value | |
let volumeSlider = volumeController.subviews.first as? UISlider | |
volumeSlider?.value = newVolume |
This file contains 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
open class Pet: Codable { | |
public enum Status: String, Codable { | |
case available = "available" | |
case pending = "pending" | |
case sold = "sold" | |
} | |
public var id: Int64? | |
public var category: Category? | |
public var name: String |
This file contains 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
final class LinkLabel: UILabel { | |
private var layoutManager: NSLayoutManager? | |
private var textContainer: NSTextContainer? | |
private var textStorage: NSTextStorage? | |
var tapOnLink: (() -> Void)? | |
override init(frame: CGRect) { | |
super.init(frame: frame) | |
setupView() |
This file contains 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 UIKit | |
private func AutoLocalize(_ string: String?) -> String? { | |
guard let string = string else { | |
return nil | |
} | |
if string.hasPrefix("%") { | |
return NSLocalizedString(string, comment: "") | |
} | |
return string |
This file contains 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
public class DropboxDestination: BaseDestination { | |
private let client: DropboxClient | |
public init(accessToken: String) { | |
client = DropboxClient(accessToken: accessToken) | |
} | |
override public func send(_ level: SwiftyBeaver.Level, msg: String, | |
thread: String, file: String, function: String, | |
line: Int, context: Any?) -> String? { | |
let str = super.send(level, msg: msg, thread: thread, |
This file contains 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
class AutolayoutTextView: UITextView { | |
override func layoutSubviews() { | |
super.layoutSubviews() | |
if bounds.size != intrinsicContentSize { | |
invalidateIntrinsicContentSize() | |
} | |
} | |
This file contains 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 RealmSwift | |
import ObjectMapper | |
import Alamofire | |
enum CRUDState: Int { | |
case normal = 0 | |
case update = 1 | |
} | |
class Reminder: Object, Mappable, NSCopying { |
This file contains 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
static func Medication(_ typeID: Int) -> String { | |
switch typeID { | |
case 1...5: return "aerosol" | |
case 6: return "bar_chewable" | |
case 7...15: return "pellet" | |
case 16: return "cloth" | |
case 17: return "concentrate" | |
case 18...19: return "cream" | |
case 20: return "krystal" | |
case 21: return "disk" |
This file contains 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
const char* cKey = [password cStringUsingEncoding:NSUTF8StringEncoding]; | |
const char* cData = [url cStringUsingEncoding:NSUTF8StringEncoding]; | |
unsigned char cHMAC[CC_SHA256_DIGEST_LENGTH]; | |
CCHmac(kCCHmacAlgSHA256, cKey, strlen(cKey), cData, strlen(cData), cHMAC); | |
NSData* data = [NSData dataWithBytes:cHMAC length:sizeof(cHMAC)]; | |
NSString* signature = [data base64String]; | |
return [NSString stringWithFormat:@"%@:%@", username, signature]; |
NewerOlder