Skip to content

Commit

Permalink
🔧 fix(project.pbxproj): add Mood.swift to project file
Browse files Browse the repository at this point in the history
🔧 fix(project.pbxproj): add Mood.swift to project file
🔧 fix(project.pbxproj): add Mood.swift to project file
🔧 fix(project.pbxproj): add Mood.swift to project file
🔧 fix(project.pbxproj): add Mood.swift to project file
🔧 fix(project.pbxproj): add Mood.swift to project file
🔧 fix(project.pbxproj): add Mood.swift to project file
🔧 fix(project.pbxproj): add Mood.swift to project file
🔧 fix(project.pbxproj): add Mood.swift to project file
🔧 fix(project.pbxproj): add Mood.swift to project file
🔧 fix(project.pbxproj): add Mood.swift to project file
🔧 fix(project.pbxproj): add Mood.swift to project file
🔧 fix

🐛 fix(DynamicTableVerbs.swift): fix indentation and spacing issues
✨ feat(DynamicTableVerbs.swift): refactor code to separate headers and rows for different tenses and reflexive/non-reflexive verbs
  • Loading branch information
andskur committed Jan 20, 2024
1 parent 63c6b1c commit 78d7c6c
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 228 deletions.
6 changes: 6 additions & 0 deletions OldNorseDictionary.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
A15829532A67DBCB00BD97D4 /* Case.swift in Sources */ = {isa = PBXBuildFile; fileRef = A15829522A67DBCB00BD97D4 /* Case.swift */; };
A15829572A67DE7300BD97D4 /* Person.swift in Sources */ = {isa = PBXBuildFile; fileRef = A15829562A67DE7300BD97D4 /* Person.swift */; };
A15829592A68249100BD97D4 /* Number.swift in Sources */ = {isa = PBXBuildFile; fileRef = A15829582A68249100BD97D4 /* Number.swift */; };
A15ECE882B5C58DE003BFDFF /* Mood.swift in Sources */ = {isa = PBXBuildFile; fileRef = A15ECE872B5C58DE003BFDFF /* Mood.swift */; };
A15ECE892B5C58DE003BFDFF /* Mood.swift in Sources */ = {isa = PBXBuildFile; fileRef = A15ECE872B5C58DE003BFDFF /* Mood.swift */; };
A1C92F8D2ABCBEEB0015F5C0 /* DynamicTable.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1C92F8C2ABCBEEB0015F5C0 /* DynamicTable.swift */; };
A1EED5F52AB4B04D00FDD617 /* Gender.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1EED5F42AB4B04D00FDD617 /* Gender.swift */; };
A1EED5F62AB4B04D00FDD617 /* Gender.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1EED5F42AB4B04D00FDD617 /* Gender.swift */; };
Expand Down Expand Up @@ -98,6 +100,7 @@
A15829522A67DBCB00BD97D4 /* Case.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Case.swift; sourceTree = "<group>"; };
A15829562A67DE7300BD97D4 /* Person.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Person.swift; sourceTree = "<group>"; };
A15829582A68249100BD97D4 /* Number.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Number.swift; sourceTree = "<group>"; };
A15ECE872B5C58DE003BFDFF /* Mood.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Mood.swift; sourceTree = "<group>"; };
A1C92F8C2ABCBEEB0015F5C0 /* DynamicTable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DynamicTable.swift; sourceTree = "<group>"; };
A1EED5F42AB4B04D00FDD617 /* Gender.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Gender.swift; sourceTree = "<group>"; };
A1F2B8502A76696F003EBF17 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
Expand Down Expand Up @@ -187,6 +190,7 @@
A15829582A68249100BD97D4 /* Number.swift */,
A1EED5F42AB4B04D00FDD617 /* Gender.swift */,
A13F2D552B323072003B1692 /* Tense.swift */,
A15ECE872B5C58DE003BFDFF /* Mood.swift */,
);
path = Models;
sourceTree = "<group>";
Expand Down Expand Up @@ -400,6 +404,7 @@
A1C92F8D2ABCBEEB0015F5C0 /* DynamicTable.swift in Sources */,
A158294D2A66DDCB00BD97D4 /* WordDetailView.swift in Sources */,
A15829512A66DE4600BD97D4 /* WordSearchController.swift in Sources */,
A15ECE882B5C58DE003BFDFF /* Mood.swift in Sources */,
A15829572A67DE7300BD97D4 /* Person.swift in Sources */,
A15829532A67DBCB00BD97D4 /* Case.swift in Sources */,
A15829432A66BEF700BD97D4 /* Word.swift in Sources */,
Expand All @@ -424,6 +429,7 @@
A1F6CDDA2A75A970006F020E /* WordSearchController.swift in Sources */,
A13F2D572B323072003B1692 /* Tense.swift in Sources */,
A1F6CDDD2A75AB1A006F020E /* Case.swift in Sources */,
A15ECE892B5C58DE003BFDFF /* Mood.swift in Sources */,
A1F6CDDC2A75AB18006F020E /* Conjugation.swift in Sources */,
A1F6CDDB2A75AB16006F020E /* Word.swift in Sources */,
A1F2B8592A7672B4003EBF17 /* WordService.swift in Sources */,
Expand Down
20 changes: 20 additions & 0 deletions Source/Models/Mood.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// Mood.swift
// OldNorseDictionary
//
// Created by Andrey Skurlatov on 20.1.24..
//

import Foundation

enum Mood: String, CaseIterable, Codable {
case indicative
case subjunctive


func Title(reflexive: Bool) -> String {
var title = self.rawValue

return title
}
}
10 changes: 10 additions & 0 deletions Source/Models/Tense.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,14 @@ import Foundation
enum Tense: String, CaseIterable, Codable {
case past
case present

func Title(reflexive: Bool) -> String {
var title = self.rawValue.capitalized

if reflexive {
title = "Reflexive " + title
}

return title
}
}
11 changes: 10 additions & 1 deletion Source/Models/Word.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1696,6 +1696,15 @@ struct Word: Codable, Identifiable {
return genitiveCase
}

func generateConjugation(person: Person, number: Number, tense: Tense, reflexive: Bool) -> String? {
if reflexive {
return generateConjugationReflexive(person: person, number: number, tense: tense)
} else {
return generateConjugationNonReflexive(person: person, number: number, tense: tense)
}

}

func generateConjugationReflexive(person: Person, number: Number, tense: Tense) -> String? {
switch tense {
case .past:
Expand Down Expand Up @@ -1773,7 +1782,7 @@ struct Word: Codable, Identifiable {
}


func generateConjugation(person: Person, number: Number, tense: Tense) -> String? {
func generateConjugationNonReflexive(person: Person, number: Number, tense: Tense) -> String? {
switch tense {
case .past:
return generateConjugationPast(person: person, number: number)
Expand Down
26 changes: 13 additions & 13 deletions Source/Services/WordService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,19 @@ class WordService {


// verbs
let firstSingularMatchesQuery = word.generateConjugation(person: .first, number: .singular, tense: .present)?.lowercased().contains(query) == true
let secondSingularMatchesQuery = word.generateConjugation(person: .second, number: .singular, tense: .present)?.lowercased().contains(query) == true
let thirdSingularMatchesQuery = word.generateConjugation(person: .third, number: .singular, tense: .present)?.lowercased().contains(query) == true
let firstPluralMatchesQuery = word.generateConjugation(person: .first, number: .plural, tense: .present)?.lowercased().contains(query) == true
let secondPluralMatchesQuery = word.generateConjugation(person: .second, number: .plural, tense: .present)?.lowercased().contains(query) == true
let thirdPluralMatchesQuery = word.generateConjugation(person: .third, number: .plural, tense: .present)?.lowercased().contains(query) == true

let firstSingularMatchesQueryPast = word.generateConjugation(person: .first, number: .singular, tense: .past)?.lowercased().contains(query) == true
let secondSingularMatchesQueryPast = word.generateConjugation(person: .second, number: .singular, tense: .past)?.lowercased().contains(query) == true
let thirdSingularMatchesQueryPast = word.generateConjugation(person: .third, number: .singular, tense: .past)?.lowercased().contains(query) == true
let firstPluralMatchesQueryPast = word.generateConjugation(person: .first, number: .plural, tense: .past)?.lowercased().contains(query) == true
let secondPluralMatchesQueryPast = word.generateConjugation(person: .second, number: .plural, tense: .past)?.lowercased().contains(query) == true
let thirdPluralMatchesQueryPast = word.generateConjugation(person: .third, number: .plural, tense: .past)?.lowercased().contains(query) == true
let firstSingularMatchesQuery = word.generateConjugationNonReflexive(person: .first, number: .singular, tense: .present)?.lowercased().contains(query) == true
let secondSingularMatchesQuery = word.generateConjugationNonReflexive(person: .second, number: .singular, tense: .present)?.lowercased().contains(query) == true
let thirdSingularMatchesQuery = word.generateConjugationNonReflexive(person: .third, number: .singular, tense: .present)?.lowercased().contains(query) == true
let firstPluralMatchesQuery = word.generateConjugationNonReflexive(person: .first, number: .plural, tense: .present)?.lowercased().contains(query) == true
let secondPluralMatchesQuery = word.generateConjugationNonReflexive(person: .second, number: .plural, tense: .present)?.lowercased().contains(query) == true
let thirdPluralMatchesQuery = word.generateConjugationNonReflexive(person: .third, number: .plural, tense: .present)?.lowercased().contains(query) == true

let firstSingularMatchesQueryPast = word.generateConjugationNonReflexive(person: .first, number: .singular, tense: .past)?.lowercased().contains(query) == true
let secondSingularMatchesQueryPast = word.generateConjugationNonReflexive(person: .second, number: .singular, tense: .past)?.lowercased().contains(query) == true
let thirdSingularMatchesQueryPast = word.generateConjugationNonReflexive(person: .third, number: .singular, tense: .past)?.lowercased().contains(query) == true
let firstPluralMatchesQueryPast = word.generateConjugationNonReflexive(person: .first, number: .plural, tense: .past)?.lowercased().contains(query) == true
let secondPluralMatchesQueryPast = word.generateConjugationNonReflexive(person: .second, number: .plural, tense: .past)?.lowercased().contains(query) == true
let thirdPluralMatchesQueryPast = word.generateConjugationNonReflexive(person: .third, number: .plural, tense: .past)?.lowercased().contains(query) == true

// reflexive verbs
let firstSingularMatchesQueryR = word.generateConjugationReflexive(person: .first, number: .singular, tense: .present)?.lowercased().contains(query) == true
Expand Down
Loading

0 comments on commit 78d7c6c

Please sign in to comment.