Skip to content

Instantly share code, notes, and snippets.

View ablyGurjitSingh's full-sized avatar
😇

Gurjit Singh ablyGurjitSingh

😇
  • Mohali Punjab India
View GitHub Profile
@ablyGurjitSingh
ablyGurjitSingh / UIFont+ItalicExtension.swift
Created March 31, 2021 12:01
Swift System Italic font with weights Helper.
extension UIFont {
class func italicSystemFont(ofSize size: CGFloat, weight: UIFont.Weight = .regular)-> UIFont {
let font = UIFont.systemFont(ofSize: size, weight: weight)
switch weight {
case .ultraLight, .light, .thin, .regular:
return font.withTraits(.traitItalic, ofSize: size)
case .medium, .semibold, .bold, .heavy, .black:
return font.withTraits(.traitBold, .traitItalic, ofSize: size)
default: