Skip to content

Instantly share code, notes, and snippets.

View AppCodeZip's full-sized avatar
🏠
Working from home

AppCodeZip AppCodeZip

🏠
Working from home
View GitHub Profile
//
// ChartsDemo-OSX
//
// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda
// Copyright © 2017 thierry Hentic.
// A port of MPAndroidChart for iOS
// Licensed under Apache License 2.0
//
// https://github.com/danielgindi/ios-charts
@AppCodeZip
AppCodeZip / .swift
Created June 25, 2021 17:39
//convert values with Commas as indian rupees
//convert values withCommas as indian rupees
extension Int {
func withCommas() -> String {
let numberFormatter = NumberFormatter()
numberFormatter.numberStyle = .decimal
numberFormatter.locale = Locale(identifier: "en_IN") // English (Indian) locale with english language is used
return numberFormatter.string(from: NSNumber(value:self))!
}
}
@AppCodeZip
AppCodeZip / UIFont.swift
Created June 25, 2021 08:32
Adding a Custom Font to Your IOS App
extension UIFont {
// MARK: Poppins UIFont
static func poppinsBold(size:CGFloat)-> UIFont?{
return UIFont(name: "Poppins-Bold", size: size)
}
static func poppinsLight(size:CGFloat)-> UIFont?{
return UIFont(name: "Poppins-Light", size: size)
}
static func poppinsMedium(size:CGFloat)-> UIFont?{
return UIFont(name: "Poppins-Medium", size: size)
extension UIViewController{
//activityIndicator loader
func loader() -> UIAlertController {
let alert = UIAlertController(title: "", message: "", preferredStyle: .alert)
alert.view.subviews.first?.subviews.first?.subviews.first?.backgroundColor = UIColor("#EBF6FF")
let messageAttributes = [NSAttributedString.Key.font: UIFont.poppinsMedium(size: 20), NSAttributedString.Key.foregroundColor: UIColor("#295084")]
let messageString = NSAttributedString(string: "Please wait...", attributes: messageAttributes as [NSAttributedString.Key : Any])
alert.setValue(messageString, forKey: "attributedMessage")
let width = messageString.size().width + 40