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 UIFontDescriptor { | |
static let fontSizeTable: [UIFont.TextStyle: [UIContentSizeCategory: CGFloat]] = [ | |
.largeTitle: [ | |
.accessibilityExtraExtraExtraLarge: 60, | |
.accessibilityExtraExtraLarge: 56, | |
.accessibilityExtraLarge: 52, | |
.accessibilityLarge: 48, | |
.accessibilityMedium: 44, | |
.extraExtraExtraLarge: 40, | |
.extraExtraLarge: 38, |
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
UIFont.familyNames.forEach({ familyName in | |
let fontNames = UIFont.fontNames(forFamilyName: familyName) | |
print(familyName, fontNames) | |
}) |
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
post_install do |installer| | |
installer.pods_project.build_configurations.each do |config| | |
config.build_settings.delete('CODE_SIGNING_ALLOWED') | |
config.build_settings.delete('CODE_SIGNING_REQUIRED') | |
end | |
end |
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
disabled_rules: # rule identifiers to exclude from running | |
- line_length | |
- vertical_whitespace | |
- trailing_whitespace | |
excluded: # paths to ignore during linting. Takes precedence over `included`. | |
- Carthage | |
- Pods |
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
## Build generated | |
build/ | |
DerivedData/ | |
## Various settings | |
*.pbxuser | |
!default.pbxuser | |
*.mode1v3 | |
!default.mode1v3 |
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
// split / join for attributed string | |
extension Sequence where Iterator.Element: NSAttributedString { | |
func joined(separator: NSAttributedString = NSAttributedString(string: "")) -> NSAttributedString { | |
var isFirst = true | |
return self.reduce(NSMutableAttributedString()) { | |
(r, e) in | |
if isFirst { | |
isFirst = false | |
} |
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 String { | |
func localized(bundle: Bundle = .main, tableName: String = "Localizable") -> String { | |
return NSLocalizedString(self, tableName: tableName, bundle: bundle, value: "**\(self)**", comment: "") | |
} | |
} | |
// if string is not localized it will print **key** on debug |
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
https://github.com/lyft/set-simulator-location |
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
// angle between two points | |
extension CGPoint { | |
func angle(to point: CGPoint) -> CGFloat { | |
let p = CGPoint(x: point.x - x, y: point.y - y) | |
return atan2(p.y, p.x) | |
} | |
} | |
// radians and degrees convertion |
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
// Pythagorean theorem | |
// √(x1 - x2)2 + (y1 - y2)2 | |
// | |
extension CGPoint { | |
func distance(from point: CGPoint) -> CGFloat { | |
let xDist = point.x - x | |
let yDist = point.y - y | |
return sqrt((xDist * xDist) + (yDist * yDist)) | |
} | |
} |