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
#!/bin/bash | |
killall Xcode | |
xcrun -k | |
xcodebuild -alltargets clean | |
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache" | |
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang.$(whoami)/ModuleCache" | |
rm -rf ~/Library/Developer/Xcode/DerivedData/* | |
rm -rf ~/Library/Caches/com.apple.dt.Xcode/* | |
open /Applications/Xcode.app |
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
override func viewDidLoad() { | |
NotificationCenter.default.addObserver(self, selector: #selector(LoginViewController.keyboardWillShow), | |
name: NSNotification.Name.UIKeyboardWillShow, | |
object: nil) | |
NotificationCenter.default.addObserver(self, selector: #selector(LoginViewController.keyboardWillHide), | |
name: NSNotification.Name.UIKeyboardWillHide, | |
object: nil) | |
} | |
func keyboardWillShow(notification: NSNotification) { |
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
let alert = UIAlertController(title: "Some title", message: "Some message", preferredStyle: .alert) | |
alert.addAction(UIAlertAction(title: "Yes", style: .default, handler: { (_) in | |
print("Do some staff") | |
})) | |
alert.addAction(UIAlertAction(title: "No", style: .default, handler: nil)) | |
self.present(alert, animated: true, completion: 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
fileprivate var activityIndicator : UIImageView! = UIImageView(image: UIImage.gif(name:"load")) // load.gif file | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
self.activityIndicator.frame = CGRect(x: 0, y: 0, width: 50, height: 50) | |
self.activityIndicator.contentMode = .scaleAspectFit | |
self.activityIndicator.backgroundColor = UIColor.clear | |
} |
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
In console: | |
git config credential.helper | |
You will see: osxkeychain | |
git config credential.helper sourcetree | |
Then if you perform git config credential.helper again | |
You will see: sourcetree |
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
// CGPoint converted to NSValue | |
CGPoint point = CGPointMake(9, 9); | |
NSValue *pointObj = [NSValue valueWithCGPoint:point]; | |
// CGSize converted to NSValue | |
CGSize size = CGSizeMake(100, 100); | |
NSValue *sizeObj = [NSValue valueWithCGSize:size]; | |
// CGRect from CGPoint and CGSize converted to NSValue | |
CGRect rect = CGRectMake(point.x, point.y, size.width, size.height); |
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 ViewController: UIViewController { | |
@IBOutlet weak var textField: UITextField! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
let paddingView = UIView(frame: CGRect(x: 0, y: 0, width: 15, height: textField.frame.height)) |
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
override func viewDidLoad() { | |
super.viewDidLoad() | |
let tap = UITapGestureRecognizer(target: self, action: #selector(self.dismissKeyboard)) | |
tap.cancelsTouchesInView = false | |
self.view.addGestureRecognizer(tap) // Dismiss keyboard | |
} | |
func dismissKeyboard(gestureReconizer: UITapGestureRecognizer) { | |
self.view.endEditing(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
sudo xcode-select --reset | |
swift build | |
// The whole process | |
swift package init --type executable | |
swift build | |
swift run <app-name> |
OlderNewer