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
| extension UIView { | |
| var safeTopAnchor: NSLayoutYAxisAnchor { | |
| if #available(iOS 11.0, *) { | |
| return self.safeAreaLayoutGuide.topAnchor | |
| } | |
| return self.topAnchor | |
| } | |
| var safeLeftAnchor: NSLayoutXAxisAnchor { |
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 | |
| protocol Buildable {} | |
| extension Buildable where Self: AnyObject { | |
| /// Syntactic sugar extension to build and setup an object. | |
| /// | |
| /// - Parameter property: The keypath. | |
| /// - Parameter value: The desired value to be setted at the `property` keypath. |
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 UIKit | |
| class TextView: UITextView { | |
| private let placeholderLabel = UILabel() | |
| override init(frame: CGRect, textContainer: NSTextContainer?) { | |
| super.init(frame: frame, textContainer: textContainer) | |
| // Remove the padding top and left of the text view |
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 UIKit | |
| class LeftAlignedCollectionViewFlowLayout: UICollectionViewFlowLayout { | |
| override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? { | |
| let attributes = super.layoutAttributesForElements(in: rect) | |
| var leftMargin = sectionInset.left | |
| var maxY: CGFloat = -1.0 | |
| attributes?.forEach { layoutAttribute in |
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 UIKit | |
| extension UIView { | |
| func subView<T: UIView>(type: T.Type) -> T? { | |
| return subviews.first { | |
| return $0 is T | |
| } as? T | |
| } | |
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 UIKit | |
| open class KeyboardAwareViewController: UIViewController { | |
| private var scrollView: UIScrollView? { | |
| return view.subView(type: UIScrollView.self) | |
| } | |
| override open func viewDidLoad() { | |
| super.viewDidLoad() |
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
| // Copyright 2014 Robert Carr | |
| // Copyright 2016 Alexandr Romanishin | |
| // Licensed under the Apache License, Version 2.0 (the "License"); | |
| // you may not use this file except in compliance with the License. | |
| // You may obtain a copy of the License at | |
| // | |
| // http://www.apache.org/licenses/LICENSE-2.0 | |
| // | |
| // Unless required by applicable law or agreed to in writing, software | |
| // distributed under the License is distributed on an "AS IS" BASIS, |
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
| package com.amay077.android.location; | |
| import java.util.Timer; | |
| import java.util.TimerTask; | |
| import android.location.Location; | |
| import android.location.LocationListener; | |
| import android.location.LocationManager; | |
| import android.os.Bundle; |
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
| # xcode-build-bump.sh | |
| # @desc Auto-increment the build number every time the project is run. | |
| # @usage | |
| # 1. Select: your Target in Xcode | |
| # 2. Select: Build Phases Tab | |
| # 3. Select: Add Build Phase -> Add Run Script | |
| # 4. Paste code below in to new "Run Script" section | |
| # 5. Drag the "Run Script" below "Link Binaries With Libraries" | |
| # 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0) |