Post

Replies

Boosts

Views

Activity

Can I put a swiftUI container's content in a func/var/let?
I'm trying to find a syntactically correct way to put the contents of a Container in a separate variable (or function). Can anyone steer me in the right direction? thanks, in advance, mike struct ContentView: View { var body: some View { VStack(content: containerContent) .padding() } var containerContent: () -> Content { return { Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) Text("Hello, world!") } } }
1
0
587
Nov ’23
An error occurred while trying to call the requested method validateMetadata. (1272)
I'm getting this error when attempting to upload an iOS app to iTunes Connect. I've tried using Transporter, and get the same result.I've also tried uploading a new version of an app that uploaded correctly in November and got the same result.Does anyone have any suggestions for possible causes for this error?thanks,
6
0
5.5k
Nov ’21
Looking to tweak default behaviour for a SwiftUI NavigationView in a TabView on iPad (in Portrait orientation)
At the top level, my app has a tab bar. the second tab's root view is a list view. When a user taps an item in the list, the app presents a detail view for the list item. The problem I'm currently having is the behaviour the first time the user taps the second tab's button in the tab bar (when running on an iPad in portrait. There is a navBar at the top, but the screen is otherwise empty. (tapping the left button on the navBar shows the list view, which allows the user to select an item which populates the main detail view) Is there some way (in swfitUI) to force the list view to show when in portrait? Alternatively/additionally, is there someway to present some instructional view in the otherwise empty view. (It doesn't appear to be creating a standard detail view here until the user exposes the list and picks an item) Here is some sample code that demonstrates what I'm describing. thanks in advance for any assistance! Mike import SwiftUI struct ContentView: View {     var body: some View {         TabView(){             FirstTabView()                 .tabItem {                     Text("First")                 }                 .tag(0)             SecondTabView()                 .tabItem {                     Text("Second")                 }                 .tag(1)         }     } } struct ContentView_Previews: PreviewProvider {     static var previews: some View {         ContentView()         .previewDevice(PreviewDevice(rawValue: "iPad8,1"))     } } struct FirstTabView: View {     var body: some View {         Text("First View")     } } struct SecondTabView: View {     var body: some View {         NavigationView {             NavigationLink(destination: Text("Detail View")) {                 Text("SummaryView")             }             .navigationBarTitle("Navigation")         }     } }
2
0
957
Aug ’21
Unable to deploy CloudKit Dev Schema to production
This will be the initial production schema for this container. When I attempt to start deployment, the Confirm Deployment dialog appears and spins for a while. It then reports "There was a problem loading the environment's status." When I clear the error the Confirm Deployment dialog reports: "No Changes to Deploy" "The schema in the development environment is the same as production." (spoiler, they are not the same) Any suggestions?
0
0
678
May ’21
In SwiftUI I would like to declare an @ObservedObject var with a type defined in a protocol...
See sample code below... Basically it's a galleryView with a dataSource that can add/remove items dynamically. It works as expected when GalleryView's dataSource variable has a type (that conforms to ObservableObject) However when I change dataSource's type to be a protocol, I can't seem to get my code to compile. Any guidance on how to use a protocol in GalleryView, and continue to keep the UI updating when the model object's item list changes? thanks! Mike protocol GalleryDataSource: ObservableObject {     var itemCount: Int { get }     func item(for index: Int) - String } class GalleryModel: ObservableObject {     static let test1: GalleryModel = GalleryModel(items: ["A","B","C"])     @Published var items: [String]     init(items: [String]) {         self.items = items     } } extension GalleryModel: GalleryDataSource {     var itemCount: Int {         return items.count     }     func item(for index: Int) - String {         return items[index]     } } struct ContentView: View {     var model: GalleryModel = GalleryModel.test1     var body: some View {         VStack {             GalleryView(dataSource: model)             Button("Add Item") {                 model.items.append("\(model.items.count)")             }         }     } } struct GalleryView: View {     @ObservedObject var dataSource: GalleryModel //GalleryDataSource     var body: some View {         ScrollView(.horizontal, content: {             HStack {                 ForEach(0..self.dataSource.itemCount, id:\.self) { index in                     Text(dataSource.item(for: index))                         .padding()                 }             }         })     } }
1
0
4.8k
May ’21
Can I put a swiftUI container's content in a func/var/let?
I'm trying to find a syntactically correct way to put the contents of a Container in a separate variable (or function). Can anyone steer me in the right direction? thanks, in advance, mike struct ContentView: View { var body: some View { VStack(content: containerContent) .padding() } var containerContent: () -> Content { return { Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) Text("Hello, world!") } } }
Replies
1
Boosts
0
Views
587
Activity
Nov ’23
An error occurred while trying to call the requested method validateMetadata. (1272)
I'm getting this error when attempting to upload an iOS app to iTunes Connect. I've tried using Transporter, and get the same result.I've also tried uploading a new version of an app that uploaded correctly in November and got the same result.Does anyone have any suggestions for possible causes for this error?thanks,
Replies
6
Boosts
0
Views
5.5k
Activity
Nov ’21
Looking to tweak default behaviour for a SwiftUI NavigationView in a TabView on iPad (in Portrait orientation)
At the top level, my app has a tab bar. the second tab's root view is a list view. When a user taps an item in the list, the app presents a detail view for the list item. The problem I'm currently having is the behaviour the first time the user taps the second tab's button in the tab bar (when running on an iPad in portrait. There is a navBar at the top, but the screen is otherwise empty. (tapping the left button on the navBar shows the list view, which allows the user to select an item which populates the main detail view) Is there some way (in swfitUI) to force the list view to show when in portrait? Alternatively/additionally, is there someway to present some instructional view in the otherwise empty view. (It doesn't appear to be creating a standard detail view here until the user exposes the list and picks an item) Here is some sample code that demonstrates what I'm describing. thanks in advance for any assistance! Mike import SwiftUI struct ContentView: View {     var body: some View {         TabView(){             FirstTabView()                 .tabItem {                     Text("First")                 }                 .tag(0)             SecondTabView()                 .tabItem {                     Text("Second")                 }                 .tag(1)         }     } } struct ContentView_Previews: PreviewProvider {     static var previews: some View {         ContentView()         .previewDevice(PreviewDevice(rawValue: "iPad8,1"))     } } struct FirstTabView: View {     var body: some View {         Text("First View")     } } struct SecondTabView: View {     var body: some View {         NavigationView {             NavigationLink(destination: Text("Detail View")) {                 Text("SummaryView")             }             .navigationBarTitle("Navigation")         }     } }
Replies
2
Boosts
0
Views
957
Activity
Aug ’21
Unable to deploy CloudKit Dev Schema to production
This will be the initial production schema for this container. When I attempt to start deployment, the Confirm Deployment dialog appears and spins for a while. It then reports "There was a problem loading the environment's status." When I clear the error the Confirm Deployment dialog reports: "No Changes to Deploy" "The schema in the development environment is the same as production." (spoiler, they are not the same) Any suggestions?
Replies
0
Boosts
0
Views
678
Activity
May ’21
In SwiftUI I would like to declare an @ObservedObject var with a type defined in a protocol...
See sample code below... Basically it's a galleryView with a dataSource that can add/remove items dynamically. It works as expected when GalleryView's dataSource variable has a type (that conforms to ObservableObject) However when I change dataSource's type to be a protocol, I can't seem to get my code to compile. Any guidance on how to use a protocol in GalleryView, and continue to keep the UI updating when the model object's item list changes? thanks! Mike protocol GalleryDataSource: ObservableObject {     var itemCount: Int { get }     func item(for index: Int) - String } class GalleryModel: ObservableObject {     static let test1: GalleryModel = GalleryModel(items: ["A","B","C"])     @Published var items: [String]     init(items: [String]) {         self.items = items     } } extension GalleryModel: GalleryDataSource {     var itemCount: Int {         return items.count     }     func item(for index: Int) - String {         return items[index]     } } struct ContentView: View {     var model: GalleryModel = GalleryModel.test1     var body: some View {         VStack {             GalleryView(dataSource: model)             Button("Add Item") {                 model.items.append("\(model.items.count)")             }         }     } } struct GalleryView: View {     @ObservedObject var dataSource: GalleryModel //GalleryDataSource     var body: some View {         ScrollView(.horizontal, content: {             HStack {                 ForEach(0..self.dataSource.itemCount, id:\.self) { index in                     Text(dataSource.item(for: index))                         .padding()                 }             }         })     } }
Replies
1
Boosts
0
Views
4.8k
Activity
May ’21