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 ASLabel: UILabel { | |
fileprivate var edgeInsets: UIEdgeInsets = UIEdgeInsets(top: 0, | |
left: 0, | |
bottom: 0, | |
right: 0) | |
@IBInspectable |
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
func animateSelection(_ collectionView: UICollectionView, | |
didSelectItemAt indexPath: IndexPath) { | |
let burgerCell = collectionView.cellForItem(at: indexPath) as! BurgerCollectionViewCell | |
let burgerImageView = burgerCell.thumbnailImageView! | |
let snapshotImageViewFrame = self.view.convert(burgerImageView.frame, | |
from: burgerImageView.superview) | |
let snapshotImageView = burgerImageView.snapshotView(afterScreenUpdates: true)! | |
self.snapshotView = snapshotImageView |
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 UILabel{ | |
func getRealWidth() -> CGFloat?{ | |
guard let font = font else{ | |
return nil | |
} | |
return (text! as NSString).sizeWithAttributes([NSFontAttributeName:font]).width | |
} | |
} | |
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 UIScreen { | |
enum SizeType: CGFloat { | |
case Unknown = 0.0 | |
case iPhone4 = 960.0 | |
case iPhone5 = 1136.0 | |
case iPhone6 = 1334.0 | |
case iPhone6Plus = 1920.0 | |
} |
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 | |
/** | |
Determine whether Optional collection is nil or an empty collection | |
:param: collection Optional collection | |
:returns: true if collection is nil or if it is an empty collection, false otherwise | |
*/ | |
public func isNilOrEmpty<C: CollectionType>(collection: C?) -> C? { | |
switch collection { |
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
# 1. get the xcode plist file path | |
# 2. read server url from plist file | |
# 3. read json settings file name from plist file | |
# 4. create temporary file for curl body response | |
# 5. curl api/settings web service and get http code | |
# 6. if http code is 200, feed the settigns file with new json | |
# 7. clean temp file | |
# 1. info plist path | |
infoplist="${INFOPLIST_FILE}" |
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
set -e | |
DEVICE_PATH="${OBJROOT}/UninstalledProducts/${TARGET_NAME}.framework" | |
SIMULATOR_PATH="${SYMROOT}/../../../../Products/Debug-iphonesimulator/${TARGET_NAME}.framework" | |
ARCHIVE_PATH="${SRCROOT}/_Archive" | |
if [ "${CONFIGURATION}" = "Release" ]; then | |
if [ -d "${DEVICE_PATH}" ]; then | |
if [ -d "${SIMULATOR_PATH}" ]; then | |
rm -rf "${ARCHIVE_PATH}" | |
mkdir "${ARCHIVE_PATH}" |
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 | |
extension UIImage { | |
func fixOrientation() -> UIImage { | |
// No-op if the orientation is already correct | |
if self.imageOrientation == .Up { return self } | |
// We need to calculate the proper transformation to make the image upright. |