Post

Replies

Boosts

Views

Activity

Reply to Weird problem with my custom view in SwiftUI
I made some tests. It seems that padding on ScrollView is creating the issue. This code work. no ScrollView, padding applies to HStack var body: some View { ScrollView { VStack { // ScrollView(.horizontal) { HStack { LeagueSelectorButton(text: "Premier League", leagueID: 39, isSelected: $isSelected) } // } // .scrollIndicators(.hidden) .padding() This one doesn't: padding applies to ScrollView var body: some View { ScrollView { VStack { ScrollView(.horizontal) { HStack { LeagueSelectorButton(text: "Premier League", leagueID: 39, isSelected: $isSelected) } } // .scrollIndicators(.hidden) .padding() This works as well: ScrollView but padding moved as HStack modifier: var body: some View { ScrollView { VStack { ScrollView(.horizontal) { HStack { LeagueSelectorButton(text: "Premier League", leagueID: 39, isSelected: $isSelected) } .padding() // <<-- Works if padding here } .scrollIndicators(.hidden) // .padding() // <<-- Does not work if padding here
Topic: UI Frameworks SubTopic: SwiftUI
Jul ’24
Reply to Xcode Version 15.4 (15F31d) is consistently changing "class" and "struct" to "enum"
Cat typing would have been a good explanation 🐱 More seriously. I have not met such issues recently. But I remember, with older versions of Xcode to have faced issues with files that seemed to change in my back or not to take into account I had made. If I remember correctly, it happened when I reopened a file through the "history" via tabs and not via the file list on the left pane. Then Xcode would reload an older version. A solution is often to call Clean Build Folder in the Product menu. Hope that helps.
Jul ’24
Reply to can't post a question on this forum.
So, you have written something that is considered (for good reason or not) as sensitive… I handle such a situation by dichotomy: I copy the post in Text Edit to save it. I keep only the first half in the post, to see if it is accepted. if it fails, you know where the problem is. If it works, then edit your post and copy half of the second half if it works, then edit to add the end. It should fail, but you know where is the sensitive language
Jul ’24
Reply to Using Older version of Xcode
It is possible to use Xcode on an older Mac (I do it on a 2015 iMac with Monterrey and Xcode 14.2). But I cannot publish on AppStore with it (you can with Xcode 15.2): as of April 2024 all iOS and iPadOS apps submitted to the App Store must be built with a minimum of Xcode 15 and the iOS 17 SDK. So, sooner or later you will unfortunately have to upgrade to a new Mac (which is a pity when the old one still working perfectly and there is no iMac 27" in the lineup). PS: I use this site to download any version of Xcode: https://xcodereleases.com
Jul ’24
Reply to Why can't SwiftUI state be changed in the middle of view updates?
What @MobileTen said. Plus what you hinted yourself. Authorising this could create infinite loop or a lot of other side effects. As it is impossible to predict and handle all the cases, it is forbidden. In addition, that's fundamentally contrary to SwiftUI principle (we like it or not is not the question) which building principles have been explained by MobileTen. Contracticting the fundamental principles of an architecture would have been the wrong way to go. However, depending on what you want to do exactly, there are several ways to achieve similar result. Here are some examples: struct ContentView: View { @State private var dummy = "OK" var body: some View { Text(dummy) .onAppear() { DispatchQueue.main.asyncAfter(deadline: .now() + 5) { dummy = "changed after 5s" } } Button(action: { self.dummy = "Changed" }) { Text("Change") } } }
Topic: UI Frameworks SubTopic: SwiftUI
Jul ’24
Reply to Weird problem with my custom view in SwiftUI
I made some tests. It seems that padding on ScrollView is creating the issue. This code work. no ScrollView, padding applies to HStack var body: some View { ScrollView { VStack { // ScrollView(.horizontal) { HStack { LeagueSelectorButton(text: "Premier League", leagueID: 39, isSelected: $isSelected) } // } // .scrollIndicators(.hidden) .padding() This one doesn't: padding applies to ScrollView var body: some View { ScrollView { VStack { ScrollView(.horizontal) { HStack { LeagueSelectorButton(text: "Premier League", leagueID: 39, isSelected: $isSelected) } } // .scrollIndicators(.hidden) .padding() This works as well: ScrollView but padding moved as HStack modifier: var body: some View { ScrollView { VStack { ScrollView(.horizontal) { HStack { LeagueSelectorButton(text: "Premier League", leagueID: 39, isSelected: $isSelected) } .padding() // <<-- Works if padding here } .scrollIndicators(.hidden) // .padding() // <<-- Does not work if padding here
Topic: UI Frameworks SubTopic: SwiftUI
Replies
Boosts
Views
Activity
Jul ’24
Reply to Xcode Version 15.4 (15F31d) is consistently changing "class" and "struct" to "enum"
Cat typing would have been a good explanation 🐱 More seriously. I have not met such issues recently. But I remember, with older versions of Xcode to have faced issues with files that seemed to change in my back or not to take into account I had made. If I remember correctly, it happened when I reopened a file through the "history" via tabs and not via the file list on the left pane. Then Xcode would reload an older version. A solution is often to call Clean Build Folder in the Product menu. Hope that helps.
Replies
Boosts
Views
Activity
Jul ’24
Reply to can't post a question on this forum.
So, you have written something that is considered (for good reason or not) as sensitive… I handle such a situation by dichotomy: I copy the post in Text Edit to save it. I keep only the first half in the post, to see if it is accepted. if it fails, you know where the problem is. If it works, then edit your post and copy half of the second half if it works, then edit to add the end. It should fail, but you know where is the sensitive language
Replies
Boosts
Views
Activity
Jul ’24
Reply to Using Older version of Xcode
It is possible to use Xcode on an older Mac (I do it on a 2015 iMac with Monterrey and Xcode 14.2). But I cannot publish on AppStore with it (you can with Xcode 15.2): as of April 2024 all iOS and iPadOS apps submitted to the App Store must be built with a minimum of Xcode 15 and the iOS 17 SDK. So, sooner or later you will unfortunately have to upgrade to a new Mac (which is a pity when the old one still working perfectly and there is no iMac 27" in the lineup). PS: I use this site to download any version of Xcode: https://xcodereleases.com
Replies
Boosts
Views
Activity
Jul ’24
Reply to Help
AFAIK, there are: 17.6: https://www.macrumors.com/2024/07/10/apple-releases-ios-17-6-public-beta-3/ 18: 3rd beta (I guess that's the one you are looking for): https://www.macrumors.com/2024/07/08/apple-seeds-ios-18-beta-3/
Replies
Boosts
Views
Activity
Jul ’24
Reply to Why can't SwiftUI state be changed in the middle of view updates?
What @MobileTen said. Plus what you hinted yourself. Authorising this could create infinite loop or a lot of other side effects. As it is impossible to predict and handle all the cases, it is forbidden. In addition, that's fundamentally contrary to SwiftUI principle (we like it or not is not the question) which building principles have been explained by MobileTen. Contracticting the fundamental principles of an architecture would have been the wrong way to go. However, depending on what you want to do exactly, there are several ways to achieve similar result. Here are some examples: struct ContentView: View { @State private var dummy = "OK" var body: some View { Text(dummy) .onAppear() { DispatchQueue.main.asyncAfter(deadline: .now() + 5) { dummy = "changed after 5s" } } Button(action: { self.dummy = "Changed" }) { Text("Change") } } }
Topic: UI Frameworks SubTopic: SwiftUI
Replies
Boosts
Views
Activity
Jul ’24