Skip to content

Instantly share code, notes, and snippets.

Avatar

Nick Kohrn nickkohrn

  • New Albany, OH
View GitHub Profile
@nickkohrn
nickkohrn / SubscriptedTextView
Created Jul 17, 2020
A SwiftUI View used to display strings with subscripted text
View SubscriptedTextView
import SwiftUI
struct SubscriptedTextView: View {
// MARK: Properties
let abbreviation: String
var body: some View {
subscriptedText()
@nickkohrn
nickkohrn / CurrencyService.swift
Last active Jul 15, 2017
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.
View CurrencyService.swift
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
View Keybase.md

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: