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
// | |
// ThreadSafe.swift | |
// GDICore | |
// | |
// Created by Grant Davis on 1/2/21. | |
// Updated to support `_modify` accessor on 12/5/21. | |
// | |
// Copyright © 2021 Grant Davis Interactive, LLC. All rights reserved. | |
// | |
import Foundation |
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
// Example: | |
// | |
// Widont makes the last space non-breaking | |
// so you don't end up with one word on its | |
// own. | |
// | |
// Widont makes the last space non-breaking | |
// so you don't end up with one word on | |
// its own. | |
// |
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
#define MSDesignatedInitializer(__SEL__) __attribute__((unavailable("Invoke the designated initializer `" # __SEL__ "` instead."))) | |
// Sample usage: | |
- (instancetype)initWithObject:(id)object; | |
- (instancetype)init MSDesignatedInitializer(initWithObject:); // <- This even gets auto-complete. | |
// Now calling init on this class would throw a warning. |
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
@implementation UITextView (RSExtras) | |
static BOOL stringCharacterIsAllowedAsPartOfLink(NSString *s) { | |
/*[s length] is assumed to be 0 or 1. s may be nil. | |
Totally not a strict check.*/ | |
if (s == nil || [s length] < 1) | |
return NO; |
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
- (void)resizeTableViewWithHeightOffset:(CGFloat)offsetHeight | |
animationDuration:(double)animationDuration | |
completion:(void (^)(BOOL))completionHandler | |
{ | |
[UIView animateWithDuration:animationDuration animations:^{ | |
CGRect frame = self.tableView.frame; | |
frame.size.height += offsetHeight; | |
self.tableView.frame = frame; | |
} completion:completionHandler]; | |
} |