Skip to content

Instantly share code, notes, and snippets.

View nickkohrn's full-sized avatar

Nick Kohrn nickkohrn

  • Lima, OH
  • 13:20 (UTC -04:00)
View GitHub Profile

Keybase proof

I hereby claim:

  • I am nickkohrn on github.
  • I am nickkohrn (https://keybase.io/nickkohrn) on keybase.
  • I have a public key ASARV_fuy9441BsWcBeiF9QGLYlBK2xPbOD088fRMhF0_wo

To claim this, I am signing this object:

@nickkohrn
nickkohrn / CurrencyService.swift
Last active July 15, 2017 16:00
This gist provides code for handling appropriate live-formatting of currency input for the current locale with respect to the placement of the currency's symbol.
internal final class CurrencyService {
// MARK: - Currency Symbol Position
internal static var currencySymbolPosition: CurrencySymbolPosition {
let currencyFormat = CFNumberFormatterGetFormat(CFNumberFormatterCreate(nil, Locale.current as CFLocale, .currencyStyle)) as NSString
let positiveNumberFormat = currencyFormat.components(separatedBy: ";")[0] as NSString
let currencySymbolLocation = positiveNumberFormat.range(of: "¤").location
let position: CurrencySymbolPosition = currencySymbolLocation == 0 ? .before : .after
return position
@nickkohrn
nickkohrn / SubscriptedTextView
Created July 17, 2020 23:14
A SwiftUI View used to display strings with subscripted text
import SwiftUI
struct SubscriptedTextView: View {
// MARK: Properties
let abbreviation: String
var body: some View {
subscriptedText()