This is Archived. too old to be used imo.
UPDATE 20190215
As you can guess, I did not really manage to follow up on any open issue that the code has (time constraints)
Also, this code is still swift 2.2 and would need to be converted to swift 4 nowadays.
On any case, I uploaded a compiled version for wohmever would like to use the (incomplete) version (works with US qwerty only, really)
a homemade Mac OS X text replacement / expansion app, templating app, written in SWIFT. functional but needs improvement, now in beta stage.
The only supported keyboard layout for now is English US. I am not sure how to implement different keyboard layouts at this stage.
Some parts of the code still need lots of cloaning, and there is an ObjC bridge I thought I'd have to use but didn't so it is still there...
Important disclaimer:
the software is provided as is, is in beta stage eternally, and the author is not liable for any issue you think this software may case.
more importantly, the author never even opened a book about SWIFT and is conscious this is very bad, he is very sorry for it, too, and the code may be heavily impacted by his ignorance of the matter. All suggestions are hence more than welcome :)
It should be compatible with only Mac OS X 10.11 but I did not try with any other versions.
Status:
the app can now write special characters, but still only US_en layout is supported. as soon as I figure out how to programmatically detect the keyboard layout and identify a conversion algorithm I will switch to multilang, but I have no idea so far when will that happen.
Structure:
mTextXpander reads from an XML file located in your document folder called xpand.xml
it is just a plain text file with xml, defined as follows:
<xml>
<abbreviation>
<shorttext>
hai
</shorttext>
<longtext>
hello world.
</longtext>
</abbreviation>
<abbreviation>
<shorttext>
cu.
</shorttext>
<longtext>
goodbye.
</longtext>
</abbreviation>
</xml>edit function does not really edit but removes an xml entity and re adds it but copies the text for you before presenting you the dialog.
For the keyboard handling part is a mess. read through and sooner or later I will sum it up here too :)
I will write some documentation, but as of now this was mostly result of about a week work out of the blue as a first approach to swift (AND I did not want to spend 5 euros for the funcionality, alas! how tightfisted of me!)
Old SWIFT Code. nowadays probably dead in favour of new SWIFT versions, might need a total rework, hence archiving!