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 | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var isFullScreen = false | |
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { | |
// create notifications from wherever to signal fullscreen |
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
extension UITextView { | |
func sizeThatWillFitAllText()->CGFloat { | |
return self.sizeThatFits((self.frame.size)).height | |
} | |
} | |
self.textViewHeightConstraintOutlet.constant = desiredTextViewHeight < CGFloat(75) ? desiredTextViewHeight : CGFloat(75) | |
let textViewWantsHeightObservable = self.textViewHeightConstraintOutlet |
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
// instead of creating and destroying constraints all the time we can just | |
// add multiple constraints on the same object and then change the priority | |
// and indicate which one is active | |
if feedItem!.prototypeUpdate?.media.count <= 1 { | |
mediaViewWidthConstraintLarge.priority = 995 | |
mediaViewWidthContraint.priority = 999 | |
mediaViewWidthConstraintLarge.isActive = true | |
mediaViewWidthContraint.isActive = false | |
} else { | |
mediaViewWidthConstraintLarge.priority = 999 |
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
extension UIView { | |
class func loadFromNibNamed(nibNamed: String, bundle : Bundle? = nil) -> UIView? { | |
return UINib( | |
nibName: nibNamed, | |
bundle: bundle | |
).instantiate(withOwner: nil, options: nil)[0] as? UIView | |
} | |
} |
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
//section model file | |
import RxDataSources | |
enum CommentTableSectionModel { | |
case section(comment: Comment, items: [CommentTableSectionModelItem]) | |
} | |
extension CommentTableSectionModel: SectionModelType { |
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
// MAKE SURE YOU HAVE TOP TO BOTTOM CONSTRAINTS SET ON ALL OF THE OBJECTS IN THE HEADER VIEW!!! | |
// better as an extension | |
func sizeHeaderToFit() { | |
if let tableViewHeader = self.tableHeaderView { | |
let headerView = tableViewHeader | |
headerView.setNeedsLayout() | |
headerView.layoutIfNeeded() |
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
{ [weak self] (_) in | |
guard let _ = self else { return } | |
self!. | |
} |
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
Fixes for animation tutorial |
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 index = updates.index(where: {$0.id == self.prototypeUpdate?.id}) |
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
// there are cases where you just need to update the display and not the data | |
// for example if you change the constants on a constraint | |
self!.tableView?.beginUpdates() | |
self!.tableView?.endUpdates() |
OlderNewer