I always get errors whenever I use the normal for loop and the repeat loop.
As for now, YES.Is ForEach loop the only loop that's allowed inside a view?
To allow declarative syntax inside a view, view construction is made under the context of ViewBuilder.
The current implementation of ViewBuilder is based on @_functionBuilder, which is an Apple's original enhancement to Swift and does not permit for-in loop or repeat inside it.
It will be replaced by Swift Standard @resultBuilder in the near future. The new @resultBuilder would accept for-in loops in some specific cases, but it would not allow repeat inside.
SE-0289 Result builders
If you have some view construction logic in mind using for-in or repeat, you should better be accustomed to replace it using ForEach. No new feature would be added to @resultBuilder in the near future.