Search results for

column

2,071 results found

Post

Replies

Boosts

Views

Activity

Reply to Correct way to label TextField inside Form in SwiftUI
I've never needed to do this, but I've had a quick look, and this seems reasonable: var body: some View { VStack(alignment: .leading) { Form { Text(First Name) TextField(, text: $firstName, prompt: Text(Required)) Text(Last Name) .padding(.top, 10) TextField(, text: $lastName, prompt: Text(Required)) Text(Email) .padding(.top, 10) TextField(, text: $email, prompt: Text(Required)) Text(Job) .padding(.top, 10) TextField(, text: $job, prompt: Text(Required)) Text(Role) .padding(.top, 10) TextField(, text: $role, prompt: Text(Required)) } .formStyle(.columns) .padding(.horizontal, 16) .padding(.vertical, 16) Spacer() } } The key is .formStyle(.columns).
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’25
Correct way to label TextField inside Form in SwiftUI
Hello everyone. I'm building a simple Form in a Multiplatform App with SwiftUI. Originally I had something like this. import SwiftUI struct OnboardingForm: View { @State var firstName: String = @State var lastName: String = @State var email: String = @State var job: String = @State var role: String = var body: some View { Form { TextField(First Name, text: $firstName, prompt: Text(Required)) TextField(Last Name, text: $lastName, prompt: Text(Required)) TextField(Email, text: $email, prompt: Text(Required)) TextField(Job, text: $job, prompt: Text(Required)) TextField(Role, text: $role, prompt: Text(Required)) } } } #Preview { OnboardingForm() } In macOS it looks ok but then in iOS it looks like this: and it's impossible to know what each field is for if all the prompts are the same. I tried adding LabeledContent around each text field and that solves it for iOS but then on macOS it looks like this: The labels are shown twice and the columns are out of alignment. I think I could get around it by d
2
0
1k
Feb ’25
NSLayoutManager laying out overlapping text into the same NSTextContainer even when there are more containers available.
In summation: I have a nasty bug where my layout manager is laying out text visually overlapping on top of other text, i.e., into a container that it should have left in the rear view as it continues to lay out into ensuing containers. Details below... I'm coding a word processing app with some custom pagination that involves multiple pages, within which there can be multiple NSTextView/NSTextContainer pairs that represent single column or dual column runs of text. I generate pagination data by using a measuring NSLayoutManager. This process ensures that no containers overlap, and that they are sized correctly for their associated ranges of text (i.e., non-overlapping, continuous ranges from a single NSTextStorage). I determine frame sizes by a series of checks, most importantly, by finding the last glyph in a column. Prior to the code below, remainingColumnRange represents the remaining range of my textStorage that is of a consistent column type (i.e., single, left column
4
0
1k
Jan ’25
Reply to Embedding a NavigationSplitView inside a NavigationStack
NavigationSplitView and TabView are top level navigation containers and could have unexpected behaviors when they're not implemented as such. on iOS, a NavigationSplitView collapses all of its columns into a stack.So it's best practice to prefer using a split view in a regular — not a compact — environments. Please file an enhancement request using Feedback Assistant. Once you file the request, please post the FB number here. If you're not familiar with how to file enhancement requests, take a look at Bug Reporting: How and Why?
Topic: UI Frameworks SubTopic: SwiftUI
Jan ’25
Reply to Multiple PushProviders Instantiated at one time
I’m not super familiar with app push providers, but there’s one thing I want to check up front. You wrote: [quote='773468021, dtanmasimo, /thread/773468, /profile/dtanmasimo'] I see logs for my push provider initializing but I don't see it de-initializing. [/quote] Are you sure they’re all from the same process? I’ve hit situations like this — with other NE provider types, mind you — where the process died and was restarted, but the logging didn’t make that obvious. I generally do all my logging with the system log (see Your Friend the System Log) which records the pid with each log entry. So, all I need to do to rule this out is to show that column in Console. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = eskimo + 1 + @ + apple.com
Jan ’25
Reply to 400 : bad gateway error when requesting analytics reports
Ok, so, after a bit of back and forth, here's where I stand : curl --location 'https://api.appstoreconnect.apple.com/v1/analyticsReportRequests' --header 'Content-Type: application/json' --header 'Authorization: Bearer [my_token]' --data '{ type: analyticsReportRequests, attributes: { accessType: ONGOING }, relationships: { app : { data : { type : apps, id : [my_appid] } } } }' I have changed up my request such that it now looks like this, and I've got a new issue : { errors: [ { id: [id], status: 422, code: ENTITY_UNPROCESSABLE, title: The request entity is not a valid request document object, detail: Unexpected or invalid value at 'type'., meta: { position: { row: 2, column: 22 } } } ] } Doesn't really feel like I've made any progress, but I'm now getting a 422 error response, and I really don't see any way out of this. Any help at all would be appreciated.
Jan ’25
Reply to Subscription Paywall Stuck on 'Loading Subscription': Works in Debug, Stuck in TestFlight/Production
Subscriptions are approved in App Store Connect. Do you mean that the status of your subscriptions is Approved in App Store Connect? For more information about status, see In-app purchase statuses. SubscriptionStoreView(productIDs: subscriptionsManager.products.map { $0.id }) Can you add logs to inspect the values of the product identifiers you are using in your app? Compare these values to the ProductID column of your in-app purchases in App Store Connect. Confirm the following: The country or region of the account currently logged on your device matches one of the countries or regions you selected for your in-app purchase in App Store Connect. In App Store Connect, the status of your Paid Apps Agreement is Active. In App Store Connect, the status of your banking and tax information is Active. For more information, see Manage banking information, Manage tax information, and View agreements status. If the status of your subscriptions is Approved in App Store Connect, they are available in App Store
Jan ’25
Reply to How to find the camera transform (or view matrix) in the world coordinate from a camera frame
Hi @hale_xie I did some prototyping over the weekend and came up with something that's close, but not perfect. Specifically, there's increasing misalignment as the angle between an object and the camera increases. I'd appreciate it if you file a feedback request to request an abstraction to simplify offline rendering with passthrough. Be sure to detail your use case. Now on to the solution which uses ProjectiveTransformCameraComponent instead of PerspectiveCamera. Here's a class to render a scene with passthrough. Construct it with the root entity you want to render. When CameraFrameProvider delivers an update, call render to obtain a UIImage of the scene. import SwiftUI import RealityKit import ARKit @MainActor final class EntityToImage { let renderer:RealityRenderer? let cameraEntity = Entity() init(root: Entity) { renderer = try? RealityRenderer() renderer?.entities.append(root) renderer?.entities.append(cameraEntity) } private func computeProjectionMatrix( intrinsics: simd_float3x3, extrinsics: simd_float
Topic: Spatial Computing SubTopic: ARKit Tags:
Jan ’25
Reply to Trying to better understand CGAffineTransform.... and need a bit of guidance.
Here are some tidbits about affine transforms on Apple platforms that I have collected over the years. I hope they are helpful for you. This might be overkill for your particular question (as it appears to have received some pretty good answers already), but I'm putting it on the forums in case it's useful to anyone else. Documentation Core Graphics affine transform is defined here: CGAffineTransform There is also a detailed discussion here: Quartz 2D Programming Guide: Transforms Core Animation includes a unit based coordinate system discussed here: Core Animation Programming Guide: Core Animation Basics Foundation also has an affine transform: Foundation: AffineTransform Accelerate also includes simd based affine transforms used with 3D coordinaes: Accelerate: Working with Matrices A technote about debugging coordinate space issues: TN3124: Debugging coordinate space issues Understanding affine transforms There are many interesting discussions of affine transforms and how to use them available elsewhere. I'
Topic: Graphics & Games SubTopic: General Tags:
Jan ’25
OCR does not work
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
0
0
591
Jan ’25
Reply to Need to know how to stop indentation
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
Jan ’25
VStack Alignment Issue
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
1
0
383
Jan ’25
Reply to SwiftUI Gestures prevent scrolling with iOS 18
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:
Jan ’25
CoreData + CloudKit
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(
1
0
932
Jan ’25
SwiftUI - Drag gesture blocks scroll gesture only on iPhone 11
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
1
0
838
Jan ’25