-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#26 color hold to select view and size pop chars across devices
- Loading branch information
1 parent
cd5ad21
commit b6b0424
Showing
6 changed files
with
187 additions
and
145 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
// | ||
// KeyAltChars.swift | ||
// | ||
// Functions and variables to create alternate key views. | ||
// | ||
|
||
import UIKit | ||
|
||
/// Sets the alternates for certain keys given the chosen keyboard. | ||
func setKeyboardAlternateKeys() { | ||
if DeviceType.isPhone { | ||
keysWithAlternates += symbolKeysWithAlternatesLeft | ||
keysWithAlternates += symbolKeysWithAlternatesRight | ||
keysWithAlternates.append(currencySymbol) | ||
keysWithAlternatesLeft += symbolKeysWithAlternatesLeft | ||
keysWithAlternatesRight += symbolKeysWithAlternatesRight | ||
keysWithAlternatesRight.append(currencySymbol) | ||
} | ||
|
||
keyAlternatesDict = [ | ||
"a": aAlternateKeys, | ||
"e": eAlternateKeys, | ||
"е": еAlternateKeys, // Russian е | ||
"i": iAlternateKeys, | ||
"o": oAlternateKeys, | ||
"u": uAlternateKeys, | ||
"ä": äAlternateKeys, | ||
"ö": öAlternateKeys, | ||
"y": yAlternateKeys, | ||
"s": sAlternateKeys, | ||
"l": lAlternateKeys, | ||
"z": zAlternateKeys, | ||
"d": dAlternateKeys, | ||
"c": cAlternateKeys, | ||
"n": nAlternateKeys, | ||
"ь": ьAlternateKeys, | ||
"/": backslashAlternateKeys, | ||
"?": questionMarkAlternateKeys, | ||
"!": exclamationAlternateKeys, | ||
"%": percentAlternateKeys, | ||
"&": ampersandAlternateKeys, | ||
"'": apostropheAlternateKeys, | ||
"\"": quotationAlternateKeys, | ||
"=": equalSignAlternateKeys, | ||
currencySymbol: currencySymbolAlternates | ||
] | ||
} | ||
|
||
var alternatesKeyView: UIView! | ||
var keyCancelled = false | ||
var keysWithAlternates = [String]() | ||
var alternateKeys = [String]() | ||
|
||
// Variables for alternate key view appearance. | ||
var alternateBtnStartX = CGFloat(0) | ||
var alternatesViewWidth = CGFloat(0) | ||
var alternateKeyWidth = CGFloat(0) | ||
var alternatesViewX = CGFloat(0) | ||
var alternatesViewY = CGFloat(0) | ||
var alternatesBtnHeight = CGFloat(0) | ||
var alternatesCharHeight = CGFloat(0) | ||
|
||
// The main currency symbol that will receive the alternates view for iPhones. | ||
var currencySymbol: String = "" | ||
var currencySymbolAlternates = [String]() | ||
let dollarAlternateKeys = ["¢", "₽", "₩", "¥", "£", "€"] | ||
let euroAlternateKeys = ["¢", "₽", "₩", "¥", "£", "$"] | ||
let roubleAlternateKeys = ["¢", "₩", "¥", "£", "$", "€"] | ||
let kronaAlternateKeys = ["¢", "₽", "¥", "£", "$", "€"] | ||
|
||
// Symbol keys that have consistent alternates for iPhones. | ||
var symbolKeysWithAlternatesLeft = ["/", "?", "!", "%", "&"] | ||
let backslashAlternateKeys = ["\\"] | ||
let questionMarkAlternateKeys = ["¿"] | ||
let exclamationAlternateKeys = ["¡"] | ||
let percentAlternateKeys = ["‰"] | ||
let ampersandAlternateKeys = ["§"] | ||
var symbolKeysWithAlternatesRight = ["'", "\"", "="] | ||
let apostropheAlternateKeys = ["`", "´", "'"] | ||
let quotationAlternateKeys = ["«", "»", "„", "“", "\""] | ||
let equalSignAlternateKeys = ["≈", "±", "≠"] | ||
var keysWithAlternatesLeft = [String]() | ||
var keysWithAlternatesRight = [String]() | ||
var keyAlternatesDict = [String: [String]]() | ||
var aAlternateKeys = [String]() | ||
var eAlternateKeys = [String]() | ||
var еAlternateKeys = [String]() // Russian е | ||
var iAlternateKeys = [String]() | ||
var oAlternateKeys = [String]() | ||
var uAlternateKeys = [String]() | ||
var yAlternateKeys = [String]() | ||
var äAlternateKeys = [String]() | ||
var öAlternateKeys = [String]() | ||
var sAlternateKeys = [String]() | ||
var lAlternateKeys = [String]() | ||
var zAlternateKeys = [String]() | ||
var dAlternateKeys = [String]() | ||
var cAlternateKeys = [String]() | ||
var nAlternateKeys = [String]() | ||
var ьAlternateKeys = [String]() |
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
Oops, something went wrong.