Definition text formatting, colorize parts of speech
This commit is contained in:
		@@ -13,6 +13,7 @@
 | 
				
			|||||||
		7E28111C273302860063DC78 /* toki-partsofspeech.json in Resources */ = {isa = PBXBuildFile; fileRef = 7E28111A273302860063DC78 /* toki-partsofspeech.json */; };
 | 
							7E28111C273302860063DC78 /* toki-partsofspeech.json in Resources */ = {isa = PBXBuildFile; fileRef = 7E28111A273302860063DC78 /* toki-partsofspeech.json */; };
 | 
				
			||||||
		7E28111D273302860063DC78 /* toki-dictionary.json in Resources */ = {isa = PBXBuildFile; fileRef = 7E28111B273302860063DC78 /* toki-dictionary.json */; };
 | 
							7E28111D273302860063DC78 /* toki-dictionary.json in Resources */ = {isa = PBXBuildFile; fileRef = 7E28111B273302860063DC78 /* toki-dictionary.json */; };
 | 
				
			||||||
		7E281120273303220063DC78 /* TokiPartsOfSpeechProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E28111F273303220063DC78 /* TokiPartsOfSpeechProvider.swift */; };
 | 
							7E281120273303220063DC78 /* TokiPartsOfSpeechProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E28111F273303220063DC78 /* TokiPartsOfSpeechProvider.swift */; };
 | 
				
			||||||
 | 
							7E28112227330DD30063DC78 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E28112127330DD20063DC78 /* Constants.swift */; };
 | 
				
			||||||
		7E943A21273211C200E7DDF4 /* Toki_TrainerApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E943A20273211C200E7DDF4 /* Toki_TrainerApp.swift */; };
 | 
							7E943A21273211C200E7DDF4 /* Toki_TrainerApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E943A20273211C200E7DDF4 /* Toki_TrainerApp.swift */; };
 | 
				
			||||||
		7E943A23273211C200E7DDF4 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E943A22273211C200E7DDF4 /* ContentView.swift */; };
 | 
							7E943A23273211C200E7DDF4 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E943A22273211C200E7DDF4 /* ContentView.swift */; };
 | 
				
			||||||
		7E943A25273211C300E7DDF4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7E943A24273211C300E7DDF4 /* Assets.xcassets */; };
 | 
							7E943A25273211C300E7DDF4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7E943A24273211C300E7DDF4 /* Assets.xcassets */; };
 | 
				
			||||||
@@ -28,6 +29,7 @@
 | 
				
			|||||||
		7E28111A273302860063DC78 /* toki-partsofspeech.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "toki-partsofspeech.json"; sourceTree = "<group>"; };
 | 
							7E28111A273302860063DC78 /* toki-partsofspeech.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "toki-partsofspeech.json"; sourceTree = "<group>"; };
 | 
				
			||||||
		7E28111B273302860063DC78 /* toki-dictionary.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "toki-dictionary.json"; sourceTree = "<group>"; };
 | 
							7E28111B273302860063DC78 /* toki-dictionary.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "toki-dictionary.json"; sourceTree = "<group>"; };
 | 
				
			||||||
		7E28111F273303220063DC78 /* TokiPartsOfSpeechProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokiPartsOfSpeechProvider.swift; sourceTree = "<group>"; };
 | 
							7E28111F273303220063DC78 /* TokiPartsOfSpeechProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokiPartsOfSpeechProvider.swift; sourceTree = "<group>"; };
 | 
				
			||||||
 | 
							7E28112127330DD20063DC78 /* Constants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; };
 | 
				
			||||||
		7E943A1D273211C200E7DDF4 /* Toki Trainer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Toki Trainer.app"; sourceTree = BUILT_PRODUCTS_DIR; };
 | 
							7E943A1D273211C200E7DDF4 /* Toki Trainer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Toki Trainer.app"; sourceTree = BUILT_PRODUCTS_DIR; };
 | 
				
			||||||
		7E943A20273211C200E7DDF4 /* Toki_TrainerApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Toki_TrainerApp.swift; sourceTree = "<group>"; };
 | 
							7E943A20273211C200E7DDF4 /* Toki_TrainerApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Toki_TrainerApp.swift; sourceTree = "<group>"; };
 | 
				
			||||||
		7E943A22273211C200E7DDF4 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
 | 
							7E943A22273211C200E7DDF4 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
 | 
				
			||||||
@@ -108,6 +110,7 @@
 | 
				
			|||||||
				7E2811122733024F0063DC78 /* Views */,
 | 
									7E2811122733024F0063DC78 /* Views */,
 | 
				
			||||||
				7E281111273302420063DC78 /* Models */,
 | 
									7E281111273302420063DC78 /* Models */,
 | 
				
			||||||
				7E943A24273211C300E7DDF4 /* Assets.xcassets */,
 | 
									7E943A24273211C300E7DDF4 /* Assets.xcassets */,
 | 
				
			||||||
 | 
									7E28112127330DD20063DC78 /* Constants.swift */,
 | 
				
			||||||
				7E943A29273211C300E7DDF4 /* Persistence.swift */,
 | 
									7E943A29273211C300E7DDF4 /* Persistence.swift */,
 | 
				
			||||||
				7E943A2B273211C300E7DDF4 /* Toki_Trainer.xcdatamodeld */,
 | 
									7E943A2B273211C300E7DDF4 /* Toki_Trainer.xcdatamodeld */,
 | 
				
			||||||
				7E943A26273211C300E7DDF4 /* Preview Content */,
 | 
									7E943A26273211C300E7DDF4 /* Preview Content */,
 | 
				
			||||||
@@ -203,6 +206,7 @@
 | 
				
			|||||||
				7E2811172733027F0063DC78 /* TokiDictionary.swift in Sources */,
 | 
									7E2811172733027F0063DC78 /* TokiDictionary.swift in Sources */,
 | 
				
			||||||
				7E943A21273211C200E7DDF4 /* Toki_TrainerApp.swift in Sources */,
 | 
									7E943A21273211C200E7DDF4 /* Toki_TrainerApp.swift in Sources */,
 | 
				
			||||||
				7E2811182733027F0063DC78 /* TokiJSONLoader.swift in Sources */,
 | 
									7E2811182733027F0063DC78 /* TokiJSONLoader.swift in Sources */,
 | 
				
			||||||
 | 
									7E28112227330DD30063DC78 /* Constants.swift in Sources */,
 | 
				
			||||||
			);
 | 
								);
 | 
				
			||||||
			runOnlyForDeploymentPostprocessing = 0;
 | 
								runOnlyForDeploymentPostprocessing = 0;
 | 
				
			||||||
		};
 | 
							};
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										26
									
								
								Toki Trainer/Constants.swift
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								Toki Trainer/Constants.swift
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,26 @@
 | 
				
			|||||||
 | 
					//
 | 
				
			||||||
 | 
					//  Constants.swift
 | 
				
			||||||
 | 
					//  Toki Trainer
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//  Created by Avery Ada Pace on 11/2/21.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import Foundation
 | 
				
			||||||
 | 
					import UIKit
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct K {
 | 
				
			||||||
 | 
					    static let posColors = [
 | 
				
			||||||
 | 
					        "n": UIColor.systemGreen,
 | 
				
			||||||
 | 
					        "mod": UIColor.systemYellow,
 | 
				
			||||||
 | 
					        "sep": UIColor.systemPurple,
 | 
				
			||||||
 | 
					        "vt": UIColor.systemBlue,
 | 
				
			||||||
 | 
					        "vi": UIColor.systemCyan,
 | 
				
			||||||
 | 
					        "interj": UIColor.systemRed,
 | 
				
			||||||
 | 
					        "prep": UIColor.systemBrown,
 | 
				
			||||||
 | 
					        "conj": UIColor.systemBrown,
 | 
				
			||||||
 | 
					        "kama": UIColor.systemBrown,
 | 
				
			||||||
 | 
					        "cont": UIColor.systemBrown,
 | 
				
			||||||
 | 
					        "oth": UIColor.systemBrown,
 | 
				
			||||||
 | 
					        "extra": UIColor.systemBrown
 | 
				
			||||||
 | 
					    ]
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -20,7 +20,13 @@ struct ContentView: View {
 | 
				
			|||||||
                ForEach(entry.definitions, id: \.pos) { definition in
 | 
					                ForEach(entry.definitions, id: \.pos) { definition in
 | 
				
			||||||
                    HStack(alignment: .top) {
 | 
					                    HStack(alignment: .top) {
 | 
				
			||||||
                        Text(definition.pos)
 | 
					                        Text(definition.pos)
 | 
				
			||||||
 | 
					                            .frame(width: 60, height: 22, alignment: .center)
 | 
				
			||||||
 | 
					                            .background(Color(K.posColors[definition.pos]!))
 | 
				
			||||||
 | 
					                            .cornerRadius(5.0)
 | 
				
			||||||
 | 
					                            .padding(4)
 | 
				
			||||||
                        Text(definition.definition)
 | 
					                        Text(definition.definition)
 | 
				
			||||||
 | 
					                            .fixedSize(horizontal: false, vertical: true)
 | 
				
			||||||
 | 
					                            .padding(4)
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }}
 | 
					                }}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user