Utility.swift 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //
  2. // Utility.swift
  3. // CockFight
  4. //
  5. // Created by Visoth Phon on 3/20/21.
  6. import Foundation
  7. import UIKit
  8. class Utility: NSObject {
  9. static let CustomURLScheme = "smartOfficeChatUrlScheme://"
  10. struct URL{
  11. //Base URL
  12. static let BASEURL = "http://68.183.196.200:1000"
  13. static let SOCKET_URL = "http://68.183.196.200:2000"
  14. static let LOGIN = "v1/users/login"
  15. // static let GET_MASTER_DATA_LOTO = "v2/mobile/getMasterDataLoto"
  16. //
  17. // static let GET_LIST_17_LOTO = "v2/mobile/getList17LotoRamdomResult"
  18. }
  19. static func getHeader() -> Dictionary<String, String> {
  20. let token = (UserDefaults.standard.object(forKey:"token") == nil) ? "" : UserDefaults.standard.object(forKey:"token") as! String
  21. let header = ["Content-Type": "application/json", "Authorization":token]
  22. return header
  23. }
  24. static func roundCornerView(view : UIView, borderColor: UIColor, borderSize : CGFloat){
  25. view.layer.cornerRadius = borderSize
  26. view.layer.borderColor = borderColor.cgColor
  27. view.clipsToBounds = true
  28. }
  29. static func roundCornerTextField(txtField : UITextField, roundSize : CGFloat){
  30. txtField.backgroundColor = UIColor.white
  31. txtField.layer.cornerRadius = roundSize
  32. txtField.layer.borderWidth = 1.0
  33. }
  34. static func roundCornerButton(btn : UIButton, roundSize : CGFloat){
  35. btn.layer.cornerRadius = roundSize
  36. }
  37. }