Post

Replies

Boosts

Views

Activity

Variable fonts in iOS 14
The following code allows to create a font with different weights. func makeFont(weight: CGFloat, size: CGFloat) -> UIFont { 		var attributesDict = [String: Any]() 		attributesDict["Weight"] = weight 		/* Rubik-Light - is a variable font */ 		let fontDescriptor = UIFontDescriptor( 				fontAttributes: [ 						UIFontDescriptor.AttributeName.name : "Rubik-Light", 						kCTFontVariationAttribute as UIFontDescriptor.AttributeName : attributesDict 				] 		) 		return UIFont(descriptor: fontDescriptor, size: size) } It works fine on ios 13 and below, but doesn't work on iOS 14. Is there any solution?
1
0
2.3k
Dec ’20