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
| NotificationCenter.default.addObserver(self, selector: #selector(keyboardWasShown(notification:)), name: NSNotification.Name.UIKeyboardWillShow, object: nil) | |
| NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillBeHidden(notification:)), name: NSNotification.Name.UIKeyboardWillHide, object: 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
| /* 1. Extending protocol from default implementation */ | |
| extension SomeType { | |
| // new functionality to add to SomeType goes here | |
| } | |
| /* 2. Adopting Multiple Protocols */ | |
| extension SomeType: SomeProtocol, AnotherProtocol { | |
| // implementation of protocol requirements goes here | |
| } |
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
| //To show touch impression in simulator | |
| //Note: Restart simulator after executing | |
| defaults write com.apple.iphonesimulator ShowSingleTouches 1 | |
| //To record video in the simulator | |
| //Note : Close simulator and run command | |
| xcrun simctl io booted recordVideo ~/Desktop/record_file_name.mp4 | |
| //To show hidden files in the mac |
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/sh | |
| #*****Reading ******# | |
| #From user | |
| read -p "Enter Name: " userName | |
| echo $userName | |
| #From text file - line by line | |
| while read line; do | |
| echo $line |
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/sh | |
| #Script will print all the keys in the Localization.string file from Xcode. | |
| #First we have to copy the content and paste into a text file. | |
| echo "***START***" | |
| #Read line by line | |
| while read line; do | |
| #Convert string (by split with ;) to array | |
| IFS='=' read -ra itemArray <<< "$line" | |
| #Print first item in the array | |
| for i in "${itemArray[0]}"; do |
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 12.0, *) { | |
| _yourOTPTextField.textContentType = .oneTimeCode | |
| } |
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 styles: [UIFontTextStyle] = [ | |
| // iOS 11 | |
| .largeTitle, | |
| // iOS 9 | |
| .title1, .title2, .title3, .callout, | |
| // iOS 7 | |
| .headline, .subheadline, .body, .footnote, .caption1, .caption2, | |
| ] | |
| for style in styles { |
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
| //Custom class | |
| class ExclusiveCollectionView : UIView, UICollectionViewDelegate, UICollectionViewDataSource { | |
| @IBOutlet weak var exCollectionView: UICollectionView! | |
| //Inits | |
| class func instanceFromNib() -> ExclusiveCollectionView { | |
| return UINib(nibName: "ExclusiveCollectionView", bundle: nil).instantiate(withOwner: nil, options: nil)[0] as! ExclusiveCollectionView | |
| } |
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 | |
| import WebKit | |
| class ViewController: UIViewController, WKNavigationDelegate { | |
| @IBOutlet weak var demoWebView: WKWebView! | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| let url = URL(string: "https://ioscreator.com")! |
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
| /* Sample code to connect MySQL DB in NodeJS | |
| * Table name: user | |
| * Test Result : Pass | |
| * Pre-requesties : NodeJS installed with Express, MySql dependencies. | |
| */ | |
| var express = require("express") | |
| var mysql = require('mysql') | |
| var app = express() |