Search results for

column

2,061 results found

Post

Replies

Boosts

Views

Activity

Data storage for a Matrix struct when working with Accelerate
I have a Matrix structure as defined below for working with 2D numerical data in Accelerate. The underlying numerical data in this Matrix struct is stored as an Array. struct Matrix { let rows: Int let columns: Int var data: [T] init(rows: Int, columns: Int, fill: T) { self.rows = rows self.columns = columns self.data = Array(repeating: fill, count: rows * columns) } init(rows: Int, columns: Int, source: (inout UnsafeMutableBufferPointer) -> Void) { self.rows = rows self.columns = columns self.data = Array(unsafeUninitializedCapacity: rows * columns) { buffer, initializedCount in source(&buffer) initializedCount = rows * columns } } subscript(row: Int, column: Int) -> T { get { return self.data[(row * self.columns) + column] } set { self.data[(row * self.columns) + column] = newValue } } } Multiplication is implemented by the functions shown below. import Accelerate infix operator .* func .* (lhs: Matr
3
0
949
Jun ’24
Reply to Data storage for a Matrix struct when working with Accelerate
I would also like to mention that running the code below gives me almost identical elapsed times for the matrix array and matrix buffer solutions. So, at least for this case, I'm not seeing any performance differences between the two approaches. func runBenchmark1() { print(Benchmark matrix multiplication) for _ in 1...3 { let tic = Date.now let n = 8_000 let a = Matrix(rows: n, columns: n, fill: 1.5) let b = Matrix(rows: n, columns: n, fill: 2.8) let c = a * b let toc = tic.timeIntervalSinceNow.magnitude let elapsed = String(format: %.4f, toc) print(Elapsed time is (elapsed) sec, first element is (c[0, 0])) } }
Topic: Programming Languages SubTopic: Swift Tags:
Jun ’24
Apple Pay Registration Error
We are getting this error when processing our registration. Payment Services Exception Domain check failed with the following errors. No domains were registered.nDomain verification failed for pspId=1A014B2EC09DB380EE1D51FE4D116C801F62F29D74F2D93269FE554CA2E34656 domain=patient.moolah.cc url=/.well-known/apple-developer-merchantid-domain-association errorMessage=com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 4559 path $, statusCode: 400}
1
0
1k
Jun ’24
Reply to About NavigationLink Inside NavigationSplitView's Sidebar
Hi @kittens , You're seeing this behavior because the NavigationSplitView is collapsing down to a stack and showing content based on the content of the split view's columns. Here, it's showing the sidebar, and then navigating to the detail view, so the back button is taking you back to the sidebar no matter what. To change this to the behavior you are looking for, you can put a NavigationStack in the detail view. For example: NavigationSplitView { Text(Here is the FirstView) NavigationLink(Go to SecondView) { SecondView() } } detail: { NavigationStack { Text(nothing selected yet) } } Hope this helps, Sydney
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’24
Xcode 13: Active breakpoint turns to an outline when app is run.
I'm working on several apps that were developed on Xcode 12.5. Using Xcode 13.1, I set a breakpoint, which correctly appears as the blue marker in the left-hand column of the editor. When I run the apps (in a simulator), the breakpoint turns to an outline of a breakpoint marker, with a dotted blue outline and a white interior. The apps do not stop at the breakpoint. Breakpoints work as expected on an app started in Xcode 13.1. I've dug through the docs but find nothing that describes what the outline breakpoint means or how to make it work. I've done all the standard stuff: cleaned the build folder, deleted derived data. What does the outline breakpoint marker mean, and how do I get breakpoints working in Xcode 13.1 when debugging code developed originally on Xcode 12.5? Thanks in advance for any help. John
19
0
19k
Jun ’24
UICollectionView minimumLineSpacing bug
I'm creating a horizontal scroll view through the collection view. I used flowlayout for layout, and I set the scroll direction to horizontal. I found a bug in this situation. If the width of the item is different, line spacing is not applied, but item spacing is applied. Since it is a horizontal scroll, line spacing should be applied in the direction of the column, but item spacing is applied. Does anyone know anything about this? // // ViewController.swift // minimumLineSpacingTest // // Created by Hoonki chae on 2023/07/12. // import UIKit class TestCell: UICollectionViewCell { } class ViewController: UIViewController { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) override func viewDidLoad() { super.viewDidLoad() self.view.backgroundColor = .white self.collectionView.frame = .init(origin: .init(x: 0, y: 100), size: .init(width: self.view.frame.width, height: 50)) self.view.addSubview(self.collectionView) self.collectionView.backgroundColor
Topic: UI Frameworks SubTopic: UIKit Tags:
1
0
594
Jul ’23
tvOS Context Menu on LazyVGrid is selecting item below.
Context menu on tvOS LazyVGrid selecting wrong item. It works fine if selecting items on last row. Testing on code from https://developer.apple.com/videos/play/wwdc2024/10207/ I just added contextMenu LazyVGrid(columns: columns, spacing: 40) { ForEach(sortedMatchingAssets) { asset in Button {} label: { asset.landscapeImage .resizable() .aspectRatio(16 / 9, contentMode: .fit) .contextMenu { Button(Test) {} } Text(asset.title) } .buttonStyle(.borderless) } } Attached video with the bug - https://www.icloud.com/iclouddrive/020zq2PxZ_E_1Pr0vE86-8aww#Screen_Recording_2024-06-13_at_9.26.15%E2%80%AFPM
2
0
604
Jun ’24
How to implement multiple selection types in NavigationSplitView?
In the sidebar column of the NavigationSplitView I'd like to have several sections. All the items are fetched with Core Data. View all photos (Photos entity in Core Data) Folder (Folder entity in Core Data) Folder A Folder B Folder C Tags (Tag entity in Core Data) Cat Dog In the content view, I'd like show the items based on the selection in the sidebar. I tried the following with some success but I think there should be another way of doing this. NavigationSplitView() { List(selection: $navigationModel.selectedCategory, content: { NavigationLink(value: Category(type: .all, predicate: NSPredicate(value: true), title: View all items) ) { Text(View all items) } Section { ForEach(folders){ folder in NavigationLink(value: Category(type: .folder, predicate: NSPredicate(format: folder == %@, folder), title: folder.name) ) { FolderRow(folder: folder) // ... and so on. Another section for tags And in the content: ZStack{ List(selection: $navigationModel.selectedPhoto) { ContentView(photos: FetchRequest( sort
2
0
1k
Jun ’24
How to: Compositional layout with self-sizing rows of N columns where the height of each item is set to the tallest item in its row
Paging Steve Breen! 😄 I've seen this question asked a zillion times but I've never seen an answer. Is it possible to configure compositional layout to give you a grid of N columns (say 2 or 3) where each item in each row/group self-size their height, but the heights of those items are then set to be the height of the tallest item in their row. This is easy to do if you ignore the self-sizing requirement (just use a fixed or absolute item height), but on the surface this doesn't even appear to be possible if you require self-sizing. What I've Tried Configuring a layout where the items are set to a fractional height of 1.0 and their group is set to an estimated height (ex: 100). I was hoping compositional layout would interpret this as, Please self-size the height of the group and make each item 100% of that height. Unfortunately, compositional layout just uses the estimate you provide for the height as the actual height and no self-sizing occurs at all. Sad panda. 🐼 Use visibleItemsInvalidationHandl
Topic: UI Frameworks SubTopic: UIKit Tags:
4
0
5.5k
Jun ’24
Xcode - Sqlite versions
In Xcode (Mac OS Catalina), when trying to create an application to access a database, I receive syntax errors, resulting from the installed version of SQlite (below 3.30) does not allowing generation of virtual columns. After updating to 3.46 the version installed on system, this does not occur if I execute such queries directly in SQlite, via Terminal. How do I get Xcode to access and use the system updated version ? Thanks in advance
2
0
739
May ’24
Reply to App primary language doesn't appears in Appstore
Xcode creates one .lproj folder for each localization when compiling your String Catalog, so you can still check the existence of en.lproj by looking into your app bundle. Note that Xcode creates the .lproj folder only when the localization contains at least one localized string. As an example, if you select your String Catalog in Xcode, and see that the strings under the Enlgish (en) column are all gray, Xcode won't create en.lproj for you. So be sure that you add at least one localized string (which will then be shown in black) for your English localization. Best, —— Ziqiao Chen  Worldwide Developer Relation.
May ’24
Magnification gesture to scale ScrollView's content.
Hello! I am trying out new SwiftUI and I have to say that I love it, but I've got some problems implementing few features. First issue is that I am not sure how can I scale content of ScrollView, to make content of that View smaller, but there would be more subviews visible. Here's my code: @State private var scale: CGFloat = 1.0 var body: some View { ScrollView([.horizontal]) { HStack(alignment: .top) { ForEach(0..<5, id: .self) { _ in ScrollView(.vertical) { LazyVGrid(columns: [GridItem(.fixed(300), spacing: 10)], spacing: 10) { ForEach(0..<5, id: .self) { _ in Rectangle() .frame(width: 300, height: 300, alignment: .center) } } } .padding(.leading, 10) } } .scaleEffect(scale) } .gesture( MagnificationGesture() .onChanged { value in scale = value.magnitude }) } } If You paste that code to a project, You will see that app scales whole ScrollView, not its content. And when we're talking about gestures, I would really appreciate if someone would share here how can I prioritize the gestures. Thank
2
0
2.6k
Nov ’21
App sandbox extension revoked on Ventura
Hi everyone, first-time caller, long-ti... wait, no, I just got here. :) I am relatively new to all things Apple, so apologies in advance if it takes me a few goes to properly explain things. We have a framework, which includes an API, an XPC service, etc, and we have a device driver. We also have some sample apps that use the framework, and if they have the app sandbox capability, then we expect them to use the XPC Service instead of accessing our driver directly. This works fine on Monterey and presumably has worked fine on all previous versions of MacOS. Something seems to have changed on Ventura, and we don't understand what. When we build the same app on Ventura, it appears to be in the sandbox (according to the Sandbox column in Activity Monitor), but in the Console there is this line (twice): default Revoking sandbox extension; key = 0 Which we suspect is linked to the fact that the app then does not use the XPC Service, and instead accesses the driver directly, much to our surprise. Softwar
6
0
989
May ’24
MACMAIL V10 is considered as an absolute nightmare - need to find a way to revert mail client to V3 in all future updates
Almost everyone I know absolutely HATES the macmail V10 update in big sur. So many conveniences and ease of operation that were available in 10.11.16 are gone. The icons are greyed out, the column layout is abysmal, the search engine does not function, way too many additional steps are now required to do the same job the V3 did with ease.. The standard question I hear is WHY would apple change what worked perfectly for so many and make a great mail system user unfriendly? There is an old adage that I keep hearing repeated If it ain't broke - don't fix it! The question I keep hearing is can anyone figure out a way to remove V10 from big sure and revert the mail system back to V3? There should be either an option or a way to revert the mail system back to what is loved by so many, without affecting the integrity of the security changes needed in big sur to make it safer.
1
0
705
May ’24
SwiftUI Toolbar inconsistent behavior on MacOS
Overview I'm facing an issue where the MacOS Toolbar shows overall inconsistent behavior when switching from 3 columns to 2 columns NavigationSplitViews. I'd like to know if this is somehow expected or possible fixes for this issue. Details I'm using the code available at this WWDC22 session to reproduce the issue: https://developer.apple.com/documentation/swiftui/bringing_robust_navigation_structure_to_your_swiftui_app This same inconsistent behavior is also appearing on another project. Steps to reproduce: Open the application and select the 3 columns option Select any item on the sidebar. Notice how the toolbar is displayed. There is no divider and the primary action placement on the far-right of the Toolbar. Click on it and select now 2 columns. Notice how the toolbar is displayed. Now the primary action is no longer on the far right of the toolbar, but on the right of what would be the content view. Besides that, a divider is now appearing. Click again on the wand and
1
0
363
Dec ’23