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
// KeyboardAvoidable | |
// Roy McKenzie | |
protocol KeyboardAvoidable: class { | |
func addKeyboardObservers(customBlock: ((CGFloat) -> Void)?) | |
func removeKeyboardObservers() | |
var layoutConstraintsToAdjust: [NSLayoutConstraint] { get } | |
} | |
var KeyboardShowObserverObjectKey: UInt8 = 1 |
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
@IBDesignable class PLToggleControl: UIControl { | |
var items = [String]() | |
var labels = [UILabel]() | |
var activeLineView = UIView() | |
@IBInsepctable var activeTextColor: UIColor = .whiteColor() | |
@IBInspectable var inactiveTextColor: UIColor = .grayColor() | |
@IBInspectable var buttonColor: UIColor = .blackColor() | |
@IBInspectable var activeLineColor: UIColor = .blackColor() |
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 | |
typealias KeyboardHeightDuration = (height: CGFloat, duration: Double) | |
// New notification type | |
let RemoveKeyboardNotifications = "RemoveKeyboardNotifications" | |
protocol KeyboardAvoidable: class { | |
var layoutConstraintsForKeyboard: [NSLayoutConstraint] { get } | |
func addKeyboardObservers() |
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
platform :ios do | |
lane :beta do | |
# ... | |
increment_build_number(xcodeproj: "ProjectName.xcodeproj", | |
build_number: date_based_build_number) | |
end | |
# Generate todays date formatted for version | |
def today_formatted | |
Date.today.strftime('%Y%m%d') |
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 CloudKit | |
// Create subscription with an internal identifier | |
let subscription = CKDatabaseSubscription(subscriptionID: "internalSubscriptionIdentifier") | |
// Create an operation to save the subscription | |
let operation = CKModifySubscriptionsOperation(subscriptionsToSave: [subscription], | |
subscriptionIDsToDelete: nil) | |
// Add the operation to the private database | |
CKContainer.default() |
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 | |
import CloudKit | |
import RealmSwift | |
/// Handles common methods for subscriptions across multiple databases | |
enum CloudKitDatabaseSubscription: String { | |
case `private` | |
case `public` | |
} |
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 DataDisplayViewController: UIViewController { | |
private var realmNotificationToken: NotificationToken? | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
startRealmNotification() | |
} | |
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 | |
import UserNotifications | |
import CloudKit | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
func application(_ application: UIApplication, | |
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool { | |
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
protocol CloudKitSyncable { | |
var id: String { get } | |
var recordID: CKRecordID { get } | |
var synced: Date? { get } | |
var modified: Date { get } | |
var deleted: Date? { get } | |
var record: CKRecord { get } | |
var recordChangeTag: String? { get } | |
var recordOwnerName: String? { get } | |
} |
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 | |
import UserNotifications | |
import PropellerPromise | |
struct NotificationPermissionController { | |
static var permissionsEnabled: Bool { | |
guard let settings = UIApplication.shared.currentUserNotificationSettings else { | |
return false | |
} |
OlderNewer