Skip to content

Instantly share code, notes, and snippets.

View andresr-dev's full-sized avatar

Andres Raigoza andresr-dev

View GitHub Profile
@andresr-dev
andresr-dev / ios-font-sizes.swift
Created June 17, 2024 01:38 — forked from zacwest/ios-font-sizes.swift
iOS default font sizes - also available on https://www.iosfontsizes.com
let styles: [UIFont.TextStyle] = [
// iOS 17
.extraLargeTitle, .extraLargeTitle2,
// iOS 11
.largeTitle,
// iOS 9
.title1, .title2, .title3, .callout,
// iOS 7
.headline, .subheadline, .body, .footnote, .caption1, .caption2,
]
@andresr-dev
andresr-dev / DrawUIImageBorder.swift
Last active November 27, 2022 18:40 — forked from katiesmillie/add border to an image swift 3
This is how you can add border to a UIImage
import UIKit
extension UIImage {
func addBorder(width: CGFloat, color: UIColor) -> UIImage? {
UIGraphicsBeginImageContext(self.size)
let imageRect = CGRect(x: 0, y: 0, width: self.size.width, height: self.size.height)
self.draw(in: imageRect)
let context = UIGraphicsGetCurrentContext()
let borderRect = imageRect.insetBy(dx: width / 2, dy: width / 2)
@andresr-dev
andresr-dev / combine+result.swift
Created August 2, 2022 21:31 — forked from nrivard/combine+result.swift
Using Result<Success, Failure> with Combine
import Combine
extension Publisher {
/// A single value sink function that coalesces either one `Output` or one `Failure` as a `Result`-type.
public func sink(result: @escaping ((Result<Self.Output, Self.Failure>) -> Void)) -> AnyCancellable {
return sink(receiveCompletion: { completion in
switch completion {
case .failure(let error):
result(.failure(error))
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
mr Marathi
bs Bosnian
ee_TG Ewe (Togo)
ms Malay
kam_KE Kamba (Kenya)
mt Maltese
ha Hausa
es_HN Spanish (Honduras)
ml_IN Malayalam (India)
ro_MD Romanian (Moldova)