Firstly I must state that although I have learned a lot on my 12 month SwifttUI journey, I would still rate my knowledge as beginner! My app has a fair bit of processing to do which to make it work had to split the functions over two views (770 lines approximately) It seems that SwiftUI can’t handle too much in the way of functions in a view? Now that I have got to the stage of trying to streamline my app I would like to eliminate one view if possible but am not sure to go about it Please excuse the formatting at the beginning. I needed to eliminate white space to reduce the character count
FIRST VIEW FUNCTIONS
func makeFirstCardWordLetters () {
| 33 lines removed
makeSecondCardWordLetters()
}
func makeSecondCardWordLetters () {
| 33 lines removed
makeThirdCardWordLetters()
}
func makeThirdCardWordLetters () {
| 33 lines removed
makeFourthCardWordLetters()
}
func makeFourthCardWordLetters () {
| 33 lines removed
makeFifthCardWordLetters ()
func makeFifthCardWordLetters () {
| 33 lines removed
makeSixthCardWordLetters()
func makeSixthCardWordLetters () {
| 33 lines removed
makeFirstCardAnswerClue()
}
func makeFirstCardAnswerClue () {
| 33 lines removed
makeSecondCardAnswerClue()
}
func makeSecondCardAnswerClue () {
| 33 lines removed
makeThirdCardAnswerClue()
}
func makeThirdCardAnswerClue () {
| 33 lines removed
makeFourthCardAnswerClue()
}
func makeFourthCardAnswerClue () {
| 33 lines removed
makeFifthCardAnswerClue ()
}
func makeFifthCardAnswerClue () {
| 33 lines removed
makeSixthCardAnswerClue ()
}
func makeSixthCardAnswerClue () {
| 33 lines removed
replaceConsonantsFromFirstCardAnswerClue()
}
func replaceConsonantsFromFirstCardAnswerClue () {
| 4 lines removed
replaceConsonantsFromSecondCardAnswerClue()
}
func replaceConsonantsFromSecondCardAnswerClue () {
| 4 lines removed
replaceConsonantsFromThirdCardAnswerClue()
}
func replaceConsonantsFromThirdCardAnswerClue () {
| 4 lines removed
replaceConsonantsFromFourthCardAnswerClue()
}
func replaceConsonantsFromFourthCardAnswerClue () {
| 4 lines removed
replaceConsonantsFromFifthCardAnswerClue()
}
func replaceConsonantsFromFifthCardAnswerClue () {
| 4 lines removed
replaceConsonantsFromSixthCardAnswerClue()
}
func replaceConsonantsFromSixthCardAnswerClue () {
| 4 lines removed
removeVowelsFromFirstCardFirstLetters()
}
func removeVowelsFromFirstCardFirstLetters () {
| 4 lines removed
removeVowelsFromFirstCardSecondLetters()
}
func removeVowelsFromFirstCardSecondLetters () {
| 4 lines removed
removeVowelsFromFirstCardThirdLetters()
}
func removeVowelsFromFirstCardThirdLetters () {
| 4 lines removed
removeVowelsFromSecondCardFirstLetters()
}
func removeVowelsFromSecondCardFirstLetters () {
| 4 lines removed
removeVowelsFromSecondCardSecondLetters()
}
func removeVowelsFromSecondCardSecondLetters () {
| 4 lines removed
removeVowelsFromSecondCardThirdLetters()
}
func removeVowelsFromSecondCardThirdLetters () {
| 4 lines removed
removeVowelsFromThirdCardFirstLetters()
}
func removeVowelsFromThirdCardFirstLetters () {
| 4 lines removed
removeVowelsFromThirdCardSecondLetters()
}
func removeVowelsFromThirdCardSecondLetters () {
| 4 lines removed
removeVowelsFromThirdCardThirdLetters()
}
func removeVowelsFromThirdCardThirdLetters () {
| 4 lines removed
removeVowelsFromFourthCardFirstLetters()
}
func removeVowelsFromFourthCardFirstLetters () {
| 4 lines removed
removeVowelsFromFourthCardSecondLetters()
}
func removeVowelsFromFourthCardSecondLetters () {
| 4 lines removed
removeVowelsFromFourthCardThirdLetters()
}
func removeVowelsFromFourthCardThirdLetters () {
| 4 lines removed
removeVowelsFromFifthCardFirstLetters()
}
func removeVowelsFromFifthCardFirstLetters () {
| 4 lines removed
removeVowelsFromFifthCardSecondLetters()
}
func removeVowelsFromFifthCardSecondLetters () {
| 4 lines removed
removeVowelsFromFifthCardThirdLetters()
}
func removeVowelsFromFifthCardThirdLetters () {
| 4 lines removed
removeVowelsFromSixthCardFirstLetters()
}
func removeVowelsFromSixthCardFirstLetters () {
| 4 lines removed
removeVowelsFromSixthCardSecondLetters()
}
func removeVowelsFromSixthCardSecondLetters () {
| 4 lines removed
removeVowelsFromSixthCardThirdLetters()
}
func removeVowelsFromSixthCardThirdLetters () {
| 4 lines removed
cards.sixthCardThirdLetters = result
}
SECOND VIEW FUNCTIONS
shuffleFirstCardLetterClues ()
})
func shuffleFirstCardLetterClues () {
| 13 lines removed
shuffleSecondCardLetterClues()
}
func shuffleSecondCardLetterClues () {
| 12 lines removed
shuffleThirdCardLetterClues()
}
func shuffleThirdCardLetterClues () {
| 12 lines removed
shuffleFourthCardLetterClues()
}
func shuffleFourthCardLetterClues () {
| 12 lines removed
shuffleFifthCardLetterClues()
}
func shuffleFifthCardLetterClues () {
| 12 lines removed
shuffleSixthCardLetterClues()
}
func shuffleSixthCardLetterClues () {
| 12 lines removed
removeCommasFromWordClues()
}
func removeCommasFromWordClues () {
| 38 lines removed
firstCardsJoined()
}
func firstCardsJoined () {
| 5 lines removed
firstCardsLettersJoined()
}
func firstCardsLettersJoined () {
| 4 lines removed
secondCardsJoined()
}
func secondCardsJoined () {
| 5 lines removed
secondCardsLettersJoined()
}
func secondCardsLettersJoined () {
| 5 lines removed
thirdCardsJoined()
}
func thirdCardsJoined () {
| 5 lines removed
thirdCardsLettersJoined()
}
func thirdCardsLettersJoined () {
| 4 lines removed
fourthCardsJoined()
}
func fourthCardsJoined () {
| 5 lines removed
fourthCardsLettersJoined()
}
func fourthCardsLettersJoined () {
| 4 lines removed
fifthCardsJoined()
}
func fifthCardsJoined () {
| 5 lines removed
fifthCardsLettersJoined()
}
func fifthCardsLettersJoined () {
| 3 lines removed
sixthCardsJoined()
}
func sixthCardsJoined () {
| 5 lines removed
sixthCardsLettersJoined()
}
func sixthCardsLettersJoined () {
| 4 lines removed
allCardsJoined()
}
func allCardsJoined () {
| 2 lines removed
gameArray = formArray
}
I have worked it out and in doing so have dispelled the myth I was spreading unknowingly!
I managed to move all the functions to one View.
I am mystified because I am sure Swift wasn’t letting me when I first started building my app (Unfortunately too long ago to know why).
The only difference now is this new View has very little viewable content.