Post

Replies

Boosts

Views

Activity

Reply to low-level graphic programming in C++
Metal runtime is strongly and tightly coupled with the Apple's UI frameworks -- intended to be used with ObjC or Swift. So, you should better give up the option -- hack my way to Metal in C++. Meaning use openGL anyway and cry when it will no longer works ? (meh) would be the only options if you insist on denying to learn ObjC or Swift. And Deprecated in Apple's frameworks means that it is not recommended to use it any more and will be removed at any time in the future. So, if your M1 Mac can run OpenGL apps currently, it would work for a while -- an unpredictable period. It may be months or less, or years.
Topic: Graphics & Games SubTopic: General Tags:
Oct ’21
Reply to How to add a search bar to a list?
I may be mistaking what you mean by doesn't work, so assume showing a search bar would be your primitive purpose here. Please try something like this: struct ContentView: View { var body: some View { NavigationView { TabView{ VStack{ List{ Text("aaa") Text("bbb") Text("ccc") } } .tabItem({ Text("tab1") }) VStack{ Text("tab2") } .tabItem({ Text("tab2") }) } .searchable(text: .constant("")) //<- `searchable` added to `TabView` } } } In your code, TabView is the only child view of NavigationView. And searchable modifier needs to be placed on any of the direct child view of NavigationView, or on the NavigationView itself.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Oct ’21
Reply to Static method 'buildBlock' requires that 'Group' conform to 'View'
As far as I read the messages, it looks like you have another type named Group (which is an NSManagedObject -- Core Data entity) in your project. Please try something like this: struct LostFindView: View { var body: some View { VStack { SwiftUI.Group { //<- Text("1") Text("2") Text("3") Text("4") Text("5") Text("6") Text("7") Text("8") Text("9") Text("10") } Text("11") } } } Please use Code Block when you show some code, better read the hint from @robnotyou.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’21
Reply to Cannot find 'PhotogrammetrySession' in scope
I am running xcode 13, and I am on MacOS 12.0 Beta (21A5522h). If you are using the released version of Xcode 13, it does not contain macOS SDK 12, which is needed to build the object capture command line program example. https://developer.apple.com/download/release/ Xcode 13 Xcode 13 includes everything you need to create and submit apps to the App Store for all Apple platforms. It Includes the SDKs for iOS 15, iPadOS 15, watchOS 8, tvOS 15, and macOS Big Sur. To continue developing apps for macOS Monterey, use Xcode 13 beta 5. If you want to try it now, you need to get Xcode 13 beta 5. Or else, you may need to wait till the new version of Xcode 13, that contains macOS SDK 12, will be released.
Topic: Graphics & Games SubTopic: General Tags:
Sep ’21
Reply to UITableView refresh issue
Thanks for showing your code. There are many things I do not see, but as far as I check the currently shown parts of your code, you need to keep two properties glimpse and lastDocument consistent. When you remove all the elements from glimpse, you need to set lastDocument to nil. glimpse.removeAll(keepingCapacity: false) lastDocument = nil //<- There may be other parts you need to fix, frankly I do not understand why the app crashes because the indexPath.row is out of range. But please try adding one line shown above and tell us what happens.
Topic: UI Frameworks SubTopic: UIKit Tags:
Sep ’21
Reply to Error with: Binding, ForEach and TextField
I guess, what is bad in your code is that TextField changes the value used as id:. Please try something like this: struct RowModel: Identifiable { let id = UUID() var name: String } struct ContentView: View { @State var rows: [RowModel] = [ RowModel(name: "Orange"), RowModel(name: "Apple"), ] var body: some View { NavigationView { List { ForEach($rows) { $row in TextField("Fruit", text: $row.name) } } .navigationTitle("Fruit List") } .navigationViewStyle(.stack) } } It is not clearly documented how SwiftUI works, but with TextField changing the value used as id:, whole the row is redrawn which may cause the keyboard unfocuses the Field.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’21