Hi there,

I am developing an app that lists maths exercises. My program was working fine but now I am getting this error:

“The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions.”

I have seen this error before when my code gets too long. How do I go about breaking my code up into separate views?

```
import SwiftUI
struct ContentView: View {
var tops = ["Topics", "2D Non-Uniform Acceleration", "2D SUVAT", "Algebra", "Algebra and Functions", "Arcs and Sectors", "Arithmetic Sequence", "Binomial Distribution", "Chain Rule", "Circles", "Composite Functions", "Conditional Probability", "Coordinate Geometry", "Correlation and Regression", "Data Presentation and Interpretation", "Differential Equations", "Differentiation", "Dispersion", "Disprove by Counter Example", "Factorising Cubics", "Forces and Newton's Laws", "Friction", "Friction and Inclined Planes", "Geometric Sequence", "Graph Transformations", "Graphs", "Histogram", "Hypothesis Testing", "IQR", "Implicit Differentiation", "Independent Events", "Inequalities", "Integration", "Integration by Parts", "Integration by Substitution", "Inverse Functions", "Iterative Methods", "Large Data Set", "Linear Interpolation", "Logarithms", "Mappings and Functions", "Mathematical Modelling", "Mean, Median, Mode", "Modelling Exponential Growth and Decay", "Modulus", "Moments", "Mutually Exclusive Events", "Non-Uniform Acceleration", "Numerical Methods", "PMCC", "Parametric Equations", "Partial Fractions", "Pegs and Pulleys", "Probability", "Probability Distributions", "Product Rule", "Projectiles", "Proof", "Proof by Contradiction", "Proof by Exaustion", "Quadratics and Cubics", "Quotient Rule", "R Addition Formulas", "Reaction Forces and Friction", "Representing Data", "SUVAT", "Sequences and Series", "Small Angle Approximations", "Statistical Sampling", "The Binomial Distribution", "The Binomial Expansion", "The Factor Theorem", "The Normal Approximation", "The Normal Distribution", "The Remainder Theorem", "Trapezium Rule", "Tree Diagrams", "Trigonometric Identities", "Trigonometry", "Vectors", "Velocity-Time Graphs", "Venn Diagram"]
@State var selectedTop = "Topics"
var body: some View {
ZStack {
VStack{
NavigationView {
List{
ForEach(questions) { question in
if selectedTop == question.Topic1 || selectedTop == question.Topic2 || selectedTop == question.Topic3 || selectedTop == question.Topic4 {
NavigationLink {
TesterView(question: question)
} label: {
QuestionRow(question: question)
}
}
else if selectedTop == "Topics" {
NavigationLink {
TesterView(question: question)
} label: {
QuestionRow(question: question)
}
}
}
}
.background(.cyan.opacity(0.3))
.scrollContentBackground(.hidden)
.navigationTitle("\(selectedTop)")
.toolbarBackground(
Color.cyan.opacity(0.3),
for: .navigationBar)
.toolbarBackground(.visible, for: .navigationBar)
}
HStack{
Picker("Select a topic", selection: $selectedTop) {
ForEach(tops, id: \.self) {
Text($0)
}
}
}
}
VStack {
HStack {
Spacer()
Image("Launchseeme")
.resizable()
.frame(width:40, height: 40)
.padding(.trailing, 21.0)
}
Spacer()
}
}
.background(.cyan.opacity(0.2))
.preferredColorScheme(.light)
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
```