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
write this code in method. | |
let message = messages[indexPath.row] | |
if indexPath.row == 0 { | |
return NSAttributedString(string: message.date.dateString(), attributes: [NSAttributedStringKey.font : UIFont.systemFont(ofSize: 13.0, weight: .bold)]) | |
}else { | |
let previousMessage = messages[indexPath.row - 1] | |
if Calendar.current.isDate(previousMessage.date, inSameDayAs: message.date) { | |
return nil |
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 SystemConfiguration | |
import Foundation | |
import JSQMessagesViewController | |
import SDWebImage | |
import MobileCoreServices | |
import Alamofire | |
class ChatViewController: JSQMessagesViewController,UIImagePickerControllerDelegate,UINavigationControllerDelegate { |
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
// MonthYearPicker.swift | |
import UIKit | |
class MonthYearPickerView: UIPickerView, UIPickerViewDelegate, UIPickerViewDataSource { | |
var months: [String]! | |
var years: [Int]! |
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 printItem(_ data: Data, withFilePath filePath: String){ | |
printController = UIPrintInteractionController.shared | |
printController?.delegate = self | |
let printInfo = UIPrintInfo.printInfo() | |
printInfo.outputType = .general | |
printInfo.jobName = "QR Code Image" | |
printInfo.duplex = .longEdge | |
printController?.printInfo = printInfo |
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
// Extension Used for showing Country,City from lat long | |
extension UIViewController{ | |
func fetchCountryAndCity(location: CLLocation, completion: @escaping (String, String) -> ()) { | |
CLGeocoder().reverseGeocodeLocation(location) { placemarks, error in | |
if let error = error { | |
print(error) | |
} else if let country = placemarks?.first?.country, | |
let city = placemarks?.first?.locality { |
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 Foundation | |
import CoreData | |
class DataManager:NSObject{ | |
// MARK: - Core Data stack | |
lazy var persistentContainer: NSPersistentContainer = { | |
let container = NSPersistentContainer(name: "MyDownloadCoreData") |
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
// | |
// ChatViewController.swift | |
// pukkading | |
// | |
// Created by Vikas Pundora on 23/07/18. | |
// Copyright © 2018 Twist. All rights reserved. | |
// | |
import UIKit | |
import SystemConfiguration |
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
// | |
// ChatViewController.swift | |
// pukkading | |
// | |
// Created by Vikas Pundora on 23/07/18. | |
// Copyright © 2018 Twist. All rights reserved. | |
// | |
import UIKit | |
import SystemConfiguration |
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
// Code for checking when cell is selected for CollectionView | |
let cell = collectionView.cellForItem(at: indexPath) | |
if cell?.isSelected == true{ | |
// cell is selected | |
} | |
else{ | |
// cell is not selected |
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 | |
struct RequestType { | |
static let POST = "POST" | |
static let GET = "GET" | |
} | |
enum HtttpType: String { | |
case POST = "POST" | |
case GET = "GET" |
OlderNewer