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
{ | |
"files.associations": { | |
".eslintrc": "javascriptreact", | |
"./build/**": "plaintext", | |
"./public/az/**": "plaintext" | |
}, | |
"editor.tabSize": 2, | |
"editor.suggestSelection": "first", | |
"editor.codeActionsOnSave": { | |
// For ESLint |
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
if #available(iOS 11, *) { | |
// do nothing | |
} else { | |
let tableInset: () -> UIEdgeInsets = { [weak self] in | |
let frame = self?.navigationController?.navigationBar.frame | |
let topInset = [frame?.origin.y, frame?.height].compactMap { $0 }.reduce(0, +) | |
let bottomInset = self?.tabBarController?.tabBar.frame.height ?? 0 | |
return UIEdgeInsets(top: topInset, left: 0, bottom: bottomInset, right: 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
1. Add symbolic breakpoint | |
2. Symbol: -[UIViewController dealloc] | |
3. Add 2 action, Log Message and Sound | |
4. Edit command on Log Message Action: | |
--- dealloc @(id)[$arg1 description]@ @(id)[$arg1 title]@ |
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
exec > /tmp/${PROJECT_NAME}_archive.log 2>&1 | |
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal | |
if [ "true" == ${ALREADYINVOKED:-false} ] | |
then | |
echo "RECURSION: Detected, stopping" | |
else | |
export ALREADYINVOKED="true" |
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 sizeOfString (string: String, constrainedToWidth width: Double) -> CGSize { | |
let attributes = [NSFontAttributeName:self,] | |
let attString = NSAttributedString(string: string,attributes: attributes) | |
let framesetter = CTFramesetterCreateWithAttributedString(attString) | |
return CTFramesetterSuggestFrameSizeWithConstraints(framesetter, CFRange(location: 0,length: 0), nil, CGSize(width: width, height: DBL_MAX), nil) | |
} |
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
/** | |
* Require | |
* Copyright (c) John Sundell 2017 | |
* Licensed under the MIT license. See LICENSE file. | |
*/ | |
import Foundation | |
public extension Optional { | |
/** |
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 { | |
static func animate(duration: TimeInterval, _ animations: @autoclosure @escaping () -> Void) { | |
UIView.animate(withDuration: duration, animations: { animations() }) | |
} | |
} | |
UIView.animate(duration: 0.1, self.view.backgroundColor = UIColor.red) |
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
class Testing { | |
} | |
private var key: Void? | |
extension Testing { | |
var title: String { | |
get { | |
guard let value = objc_getAssociatedObject(self, &key) as? String else { | |
return "" |
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 | |
@IBDesignable | |
class XibView: UIView { | |
@IBInspectable var nibName: String? | |
private(set) var contentView: UIView? | |
override func awakeFromNib() { | |
super.awakeFromNib() |
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
infix operator |>: AdditionPrecedence | |
func |> <T, U>(value: T, function: ((T) -> U)) -> U { | |
return function(value) | |
} | |
func pow(_ value: Int) -> String { | |
return "ahihi \(value * value)" | |
} | |
let k = 3 |> pow |