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
| // this method for trim text that have a lot of whitespace and newline to show just only max 2 lines and remove leading and traling of whitespace and new lines | |
| func trimJustTwoUnderlines() -> String { | |
| let characters = Array(self) | |
| var newText: [String.Element] = [] | |
| var tempLineCounts: Int = 0 | |
| if characters.count > 1 { | |
| for index in 0...characters.count-1 { |
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 textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { | |
| if textView.text.count > 1 { | |
| let last2characters = String(textView.text.suffix(2)) | |
| let array = last2characters.components(separatedBy: CharacterSet.newlines) | |
| print("line count :\(array.count)") | |
| if array.count > 2 && text == "\n" { |
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
| public func SetColorUINavigation (NavColor navColor : UIColor , StatusBarStyle style : UIStatusBarStyle, StatusBarColor statusBarColor : UIColor) { | |
| UINavigationBar.appearance().backgroundColor = navColor | |
| let statusBar: UIView = UIApplication.shared.value(forKey: "statusBar") as! UIView | |
| if statusBar.responds(to: #selector(setter: UIView.backgroundColor)) { | |
| statusBar.backgroundColor = statusBarColor | |
| UIApplication.shared.statusBarStyle = style | |
| } | |
| } |
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 | |
| import UIKit | |
| extension UITextView{ | |
| func setPlaceholder(PlaceholderText text : String) { | |
| let placeholderLabel = UILabel() |
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 MobileCoreServices | |
| import UIKit | |
| class CameraHandler: NSObject { | |
| private let imagePicker = UIImagePickerController() | |
| private let isPhotoLibraryAvailable = UIImagePickerController.isSourceTypeAvailable(.photoLibrary) | |
| private let isSavedPhotoAlbumAvailable = UIImagePickerController.isSourceTypeAvailable(.savedPhotosAlbum) | |
| private let isCameraAvailable = UIImagePickerController.isSourceTypeAvailable(.camera) | |
| private let isRearCameraAvailable = UIImagePickerController.isCameraDeviceAvailable(.rear) |