This file contains 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
# https://misc.flogisoft.com/bash/tip_colors_and_formatting | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/[\1]/p' | |
} | |
COLOR_DEF='%f' | |
COLOR_USR='%F{0}' | |
COLOR_DIR='%F{197}' | |
COLOR_GIT='%F{39}' | |
NEWLINE=$'\n' |
This file contains 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
// MARK: - Extension :: UIScrollViewDelegate :: | |
extension ViewController: UIScrollViewDelegate { | |
func scrollViewDidScroll(_ scrollView: UIScrollView) { | |
//--- Scroll Table Header with Table Scroll ---// | |
if let tableView = scrollView as? UITableView { | |
if let visible = tableView.indexPathsForVisibleRows { | |
if let first = visible.first { |
This file contains 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
// MARK: - Extension :: UIScrollViewDelegate :: | |
extension ViewController: UIScrollViewDelegate { | |
func scrollViewDidScroll(_ scrollView: UIScrollView) { | |
//--- Change Scroll View Indicator Color ---// | |
if #available(iOS 13, *) { | |
let verticalIndicatorView = (scrollView.subviews[(scrollView.subviews.count - 1)].subviews[0]) | |
let horizontalIndicatorView = (scrollView.subviews[(scrollView.subviews.count - 2)].subviews[0]) |
This file contains 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 setupRealmConfiguration() { | |
var realmConfig = Realm.Configuration.defaultConfiguration | |
let paths = NSSearchPathForDirectoriesInDomains(.applicationSupportDirectory, | |
.userDomainMask, | |
true) | |
let applicationSupportDirectoryPath = paths.first | |
if let applicationSupportDirectoryPath = applicationSupportDirectoryPath { | |
let realmPath = applicationSupportDirectoryPath.appending("/default.realm") | |
realmConfig.fileURL = URL(fileURLWithPath: realmPath) | |
Realm.Configuration.defaultConfiguration = realmConfig |
This file contains 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 Realm | |
import RealmSwift | |
/* | |
https://realm.io/docs/swift/latest/ | |
https://github.com/realm/realm-cocoa | |
https://www.raywenderlich.com/9220-realm-tutorial-getting-started | |
https://medium.com/flawless-app-stories/crud-operation-using-realmswift-part-1-17a99de83cc1 | |
https://medium.com/@aliakhtar_16369/realm-notifications-realmswift-part-2-60c66ab99ea9 | |
https://medium.com/@aliakhtar_16369/realm-custom-configuration-and-encryption-realmswift-part-3-f991f090ae22 |
This file contains 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 GooglePlaces | |
//https://developers.google.com/places/ios-sdk/autocomplete | |
class GooglePlacePicker: NSObject { | |
private var getPlaceInfo:((_ place: String?, _ coordinate: CLLocationCoordinate2D?, _ isSuccess: Bool) -> Void)? | |
internal static let shared: GooglePlacePicker = { |
This file contains 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
private func setupLongPressGesture() { | |
let longPressGesture:UILongPressGestureRecognizer = UILongPressGestureRecognizer(target: self, action: #selector(self.handleLongPress)) | |
longPressGesture.minimumPressDuration = 1.0 // 1 second press | |
//longPressGesture.delegate = self | |
self.tblView.addGestureRecognizer(longPressGesture) | |
} | |
@objc func handleLongPress(_ gestureRecognizer: UILongPressGestureRecognizer) { | |
if gestureRecognizer.state == .began { | |
let touchPoint = gestureRecognizer.location(in: self.tblView) |
This file contains 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
@IBOutlet private weak var collectionView: UICollectionView! | |
private func registerNibs() { | |
self.collectionView.register(UINib(nibName: "CollectionViewCell", bundle: nil), forCellWithReuseIdentifier: "CollectionViewCell") | |
} | |
// MARK: - Extension :: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout :: | |
extension MyProfileViewC: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout { |
This file contains 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
@IBOutlet private weak var tblView: UITableView! | |
private func registerNibs() { | |
self.tblView.register(UINib(nibName: "TableHeaderView", bundle: nil), forHeaderFooterViewReuseIdentifier: "TableHeaderView") | |
self.tblView.register(UINib(nibName: "TableFooterView", bundle: nil), forHeaderFooterViewReuseIdentifier: "TableFooterView") | |
self.tblView.register(UINib(nibName: "TableViewCell", bundle: nil), forCellReuseIdentifier: "TableViewCell") | |
} | |
// MARK: - Extension :: UITableViewDelegate, UITableViewDataSource :: | |
extension ViewController: UITableViewDelegate, UITableViewDataSource { |
This file contains 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
//Step 2: Install below given Pod | |
pod 'CCBottomRefreshControl' | |
//Step 2: Add below given line in bridging header file | |
#import <CCBottomRefreshControl/UIScrollView+BottomRefreshControl.h> | |
//Step 3: |
NewerOlder