Hi, I'm working with a very simple app that tries to read a coordinates card and past the data into diferent fields. The card's layout is COLUMNS from 1-10, ROWs from A-J and a two digit number for each cell. In my app, I have field for each of those cells (A1, A2...). I want that OCR to read that card and paste the info but I just cant. I have two problems. The camera won't close. It remains open until I press the button SAVE (this is not good because a user could take 3, 4, 5... pictures of the same card with, maybe, different results, and then? Which is the good one?). Then, after I press save, I can see the OCR kinda works ( the console prints all the date read) but the info is not pasted at all. Any idea? I know is hard to know what's wrong but I've tried chatgpt and all it does... just doesn't work This is the code from the scanview import SwiftUI import Vision import VisionKit struct ScanCardView: UIViewControllerRepresentable { @Binding var scannedCoordinates: [String: String] var useLettersF
Search results for
column
2,047 results found
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Here is what Apple said in reply to my bug report in June. Please know that there is a setting that controls this (which should be off by default). In Xcode > Settings > Text Editing > Editing, it’s called “Automatically reformat when completing code”. I don't know what controls this means. Does on mean add unwanted indentation and off mean do not add unwanted indentation? But regardless, I filed another report regarding this setting having no effect. Apple's reply: It only reformats code that’s wider than the specified column, and only if the code is made up of nested expressions (function calls, etc), that can be wrapped to new lines. In any case, my code never extends to the Reformat code at column location, as shown in my screen recordings. Every line jumps around. Mine go in the opposite direction from yours. But it's never where I want it. Obviously I don't understand the logic that Apple's using for these indentations. But it seems clear that there is only one coding style th
Topic:
Developer Tools & Services
SubTopic:
Xcode
Hi Apple developer, I'm totally new in the development world using SwiftUI with just a little experience of Flutter. Currently I'm struggling with the combination of VStack and the alignment of the sub views. I'm using a LazyVGrid with multiple Rectangles and overlays inside. The overlay contains a VStack with a leading alignment. And here is the problem. I framed them with a border to visualize the limits of these views. But it seams, that the leading alignment is not working properly. There is a large gap on the left side of the Image() and Text() views and I don't know why. I'm very happy for any advice. Here is my code of this view. Thanks a lot! import SwiftUI import SwiftData extension UIScreen { static let screenWidth: CGFloat = UIScreen.main.bounds.size.width static let screenHeight: CGFloat = UIScreen.main.bounds.size.height static let screenSize: CGSize = UIScreen.main.bounds.size } struct TestView: View { let constants: Constants = Constants() let columnCount: Int = 2 let gridSpacing: CGFloat = 10
Topic:
UI Frameworks
SubTopic:
SwiftUI
I also have a similar issue. I'm pretty new to swift so there might be some messy code private var mediaGridView: some View { ScrollView { RefreshControl(coordinateSpace: .named(refresh)) { //some code here } LazyVGrid(columns: gridColumns) { //some code here } .padding(.horizontal, 2) .coordinateSpace(name: grid) .onPreferenceChange(ItemBoundsPreferenceKey.self) { //some code here } .gesture( DragGesture(minimumDistance: 0) .onChanged { gesture in if isSelectionMode { let location = gesture.location if !isDragging { startDragging(at: location, in: itemBounds) } updateSelection(at: location, in: itemBounds) } } .onEnded { _ in endDragging() } ) } .coordinateSpace(name: refresh) } First I catched the issue on an iPhone 11 test device. iPhone 11 on simulator with ios 18 also have this problem while 17.5 simulator won't. If I change .gesture() to .simultaneousGesture() vertical scrolling starts to work again but now scroll also works while dragging my finger so everything on the screen starts to dance.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
I am having problems when I first loads the app. The time it takes for the Items to be sync from my CloudKit to my local CoreData is too long. Code I have the model below defined by my CoreData. public extension Item { @nonobjc class func fetchRequest() -> NSFetchRequest { NSFetchRequest(entityName: Item) } @NSManaged var createdAt: Date? @NSManaged var id: UUID? @NSManaged var image: Data? @NSManaged var usdz: Data? @NSManaged var characteristics: NSSet? @NSManaged var parent: SomeParent? } image and usdz columns are both marked as BinaryData and Attribute Allows External Storage is also selected. I made a Few tests loading the data when the app is downloaded for the first time. I am loading on my view using the below code: @FetchRequest( sortDescriptors: [NSSortDescriptor(keyPath: Item.createdAt, ascending: true)] ) private var items: FetchedResults var body: some View { VStack { ScrollView(.vertical, showsIndicators: false) { LazyVGrid(columns: columns, spacing: 40) { ForEach(
I'm pretty new to Swift and SwiftUI. I'm making my first app for sorting a gallery with some extra features. I was using my own iPhone for testing and just started testing my app on other Apple products. Everything works fine on iPad Air M1, iPhone 15 Pro, iPhone 15 Pro Max, iPhone 13, iPhone XS (Simulator), and iPhone 11 Pro (Simulator). However, when I tried to show my app to a family member with an iPhone 11, I came across an issue. Issue Description: My app takes all photos from iPhone's native gallery, then you can sort it by some spesific filters and delete pictures. It just looks like the native gallery. (I can add photos later if needed) You can just scroll the gallery by swiping up and down. You can press the select button and start selecting pictures to delete. I recently added a drag-to-select-multiple-pictures feature. This makes it feel more like the native iOS experience, eliminating the need to tap each picture individually. However, on the iPhone 11, the moment you open the app, you can't scro
I'm pretty new to Swift and SwiftUI. I'm making my first app for sorting a gallery with some extra features. I was using my own iPhone for testing and just started testing my app on other Apple products. Everything works fine on iPad Air M1, iPhone 15 Pro, iPhone 15 Pro Max, iPhone 13, iPhone XS (Simulator), and iPhone 11 Pro (Simulator). However, when I tried to show my app to a family member with an iPhone 11, I came across an issue. Issue Description: My app takes all photos from iPhone's native gallery, then you can sort it by some spesific filters and delete pictures. It just looks like the native gallery. (I can add photos later if needed) You can just scroll the gallery by swiping up and down. You can press the select button and start selecting pictures to delete. I recently added a drag-to-select-multiple-pictures feature. This makes it feel more like the native iOS experience, eliminating the need to tap each picture individually. However, on the iPhone 11, the moment you open the app, you can't scro
I have a NavigationSplitView with all three columns, and NavigationLinks in the sidebar to present different Lists for the content column. When a list item is selected in the content view, I want to present a view in the detail view. Since different detail views should be presented for different content views, I represent state like this (some details omitted for space): // Which detail view to show in the third column enum DetailViewKind: Equatable { case blank case localEnv(RegistryEntry) case package(SearchResult) } // Which link in the sidebar was tapped enum SidebarMenuItem: Int, Hashable, CaseIterable { case home case localEnvs case remoteEnvs case packageSearch } // Binds to a DetailViewKind, defines the activate SidebarMenuItem struct SidebarView: View { @State private var selectedMenuItem: SidebarMenuItem? @Binding var selectedDetailView: DetailViewKind var body: some View { VStack(alignment: .leading, spacing: 32) { SidebarHeaderView() Divider() // Creates the navigationLi
Topic:
UI Frameworks
SubTopic:
SwiftUI
I'm trying to implement a 3 column NavigationSplitView in SwiftUI on macOS - very similar to Apple's own NavigationCookbook sample app - with the slight addition of multiple sections in the sidebar similar to how the Apple Music App has multiple sections in the sidebar. Note: This was easily possible using the deprecated NavigationLink(tag, selection, destination) API The most obvious approach is to simply do something like: NavigationSplitView(sidebar: { List { Section(Section1) { List(section1, selection: $selectedItem1) { item in NavigationLink(item.label, value: item) } } Section(Section2) { List(section2, selection: $selectedItem2) { item in NavigationLink(item.label, value: item) } } } }, content: { Text(Content View) }, detail: { Text(Detail View) }) But unfortunately, this doesn't work - it doesn't seem to properly iterate over all of the items in each List(data, selection: $selected) or the view is strangely cropped - it only shows 1 item. However if the 1 item is selected, then the appropri
Is this behaviour expected? For example, if I'm using let materials = [SimpleMaterial(color: .red, isMetallic: false)] occlusion works normally, but with let materials = [SimpleMaterial(color: .red.withAlphaComponent(0.5), isMetallic: false)] i can see my cube through real-world objects, like tables, columns, etc. I'm getting the same behaviour if using CustomMaterial from shader and applying customMaterial.blending = .opaque and customMaterial.blending = .transparent(opacity: ) respectively
So the complete code part1: struct ContentView: View { @State var text1: String = // <<-- Declare HERE ; could be an array of String @State private var tipa: [Double] = [] @State private var costa: [Double] = [] @State private var cost = @State private var costt: Double? = 0.0 @State private var paidt: Double? = 0.0 @State private var paid = @State private var tipp = @State private var tipc = @State private var tipaa = @State private var totalCost = @State private var totalTips = @State private var totalCash = @State private var tipcc = @State private var numbc = @State private var deletep = 0 @State private var number = 0 @State private var errorMsg = var body: some View { GeometryReader { g in NavigationStack { VStack { HStack { // No need to manually pad the date out with spaces, which will never be correct. // Just use an HStack and put a Spacer() in, so it goes: |<.....Spacer().....>Date| Spacer() Text(Date().formatted(date: .numeric, time: .omitted)) .foregroundStyle(Color.black)
Topic:
Developer Tools & Services
SubTopic:
Xcode
Okay, well, you went ahead anyway. Here's my update: // ContentView.swift import SwiftUI struct ContentView: View { @State private var tipa: [Double] = [] @State private var costa: [Double] = [] @State private var cost = @State private var costt: Double? = 0.0 @State private var paidt: Double? = 0.0 @State private var paid = @State private var tipp = @State private var tipc = @State private var tipaa = @State private var totalCost = @State private var totalTips = @State private var totalCash = @State private var tipcc = @State private var numbc = @State private var deletep = 0 @State private var number = 0 @State private var errorMsg = var body: some View { GeometryReader { g in NavigationStack { VStack { HStack { // No need to manually pad the date out with spaces, which will never be correct. // Just use an HStack and put a Spacer() in, so it goes: |<.....Spacer().....>Date| Spacer() Text(Date().formatted(date: .numeric, time: .omitted)) .foregroundStyle(Color.black) .fontWeight(.bold) .pad
Topic:
Developer Tools & Services
SubTopic:
Xcode
When I created the first scheme on CK, there was no problem, but once I try to modify the scheme, adding more tables and adding more columns to existing tables, I got the same error. In my case there were some tables created automatically, like Users and CDMR. I just had to add SORTABLE and QUERYABLE to CDMR And it solved the problem. I ended up adding to every single table just in case 😅 Indexes: createdTimestamp: QUERYABLE and SORTABLE 2.modifiedTimestamp: QUERYABLE and SORTABLE recordName: QUERYABLE and SORTABLE I have added the above to all tables
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags:
I am developing a MacOS app with a vertically oriented ScrollView. Inside that View I use a LazyVStack. In the LazyVStack I have a column of images. I want the images to occupy as much of the LazyVStack width as possible so I created a frame for the VStack with a maxWidth: .infinity. When the user grabs the edge of the window and drags it to reduce the window width, the Views of the window adjust themselves to fit the reduced space. This includes reducing the width of the images. I maintain a fixed aspect ratio for the images, so the height of the images is reduced too. My problem arises when the width of the images (and height) reduces to the point where the scroll bar is no longer needed because all of the images fit within the height of the ScrollView, and the ScrollView removes the scroll bar. That triggers a redraw of the images, with a slightly bigger size because the width used by the scroll bar is now available. When the the images get bigger they don't all fit within the height of the Scroll
I'm using Numbers to build a spreadsheet that I'm exporting as a CSV. I then import this file into Create ML to train a word tagger model. Everything has been working fine for all the models I've trained so far, but now I'm coming across a use case that has been breaking the import process: commas within the training data. This is a case that none of Apple's examples show. My project takes Navajo text that has been tokenized by syllables and labels the parts-of-speech. Case that works... Raw text: Naaltsoos yídéeshtah. Tokens column: Naal,tsoos, ,yí,déesh,tah,. Labels column: NObj,NObj,Space,Verb,Verb,VStem,Punct Case that breaks... Raw text: óola, béésh łigaii, tłʼoh naadą́ą́ʼ, wáin, akʼah, dóó á,shįįh Tokens column with tokenized text (commas quoted): óo,la,,, ,béésh, ,łi,gaii,,, ,tłʼoh, ,naa,dą́ą́ʼ,,, ,wáin,,, ,a,kʼah,,, ,dóó, ,á,shįįh (Create ML reports mismatched columns) Tokens column with tokenized text (commas escaped): óo,la,,, ,béésh, ,łi,gaii,,, ,tłʼoh,
Topic:
Machine Learning & AI
SubTopic:
Create ML
Tags:
Natural Language
Machine Learning
Create ML
TabularData