Hello there! I'm trying to create something in SwiftUI, but there's a problem: I can't have 2 cards with the same content, does anyone know a way to have the same emojis in 2 separate cards? Here's my code: import PlaygroundSupport import SwiftUI struct ContentView: View { var emojis: [String] = [🐶, 🐱, 🐱, 🦊, 🦁, 🐝, 🐼, 🐷, 🐮] var body: some View { LazyVGrid(columns: [GridItem(), GridItem(), GridItem()]) { ForEach(emojis, id: .self, content: { emoji in emojiView(content: emoji) }) } } struct emojiView: View { var content: String = var body: some View { ZStack { RoundedRectangle(cornerRadius: 20) .frame(width: 90, height: 120) .foregroundColor(.yellow) Text(content).font(.largeTitle) } } } } PlaygroundPage.current.setLiveView(ContentView())
Search results for
column
2,071 results found
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Someone on another forum tried to help by writing a macro for Excel but I failed to tell him I was using Numbers so, of course, it doesn't work but they did give me a clue in their attempt. I need to write a script that: (I can change the names later) -calls up the document XXX -calls up Sheet1 -copies the value of Sheet1, cell B67 -calls up sheet Sheet2 -pastes the result in cell A3 of Sheet2 -inserts a new column (or row) A on Sheet2 (preserving previous result) -recalculates Sheet1 -copies the result from Sheet1, cell B67 to column A of Sheet2 in cell A3 and do that 2000 times Can any good apple script writers out there help me achieve this? Thanks in advance
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
I'm making a macOS app using SwiftUI. I have a Table view. I have selection enabled but I can't find any way to customize the selection color - it's always blue. My table looks something like this: Table(of: MyObj.self, selection: $selectedID, sortOrder: $sortOrder) { TableColumn(Column Name) { obj in // do some custom view } . . . } rows: { Foreach (model.items) { obj in TableRow(obj) } }
According to the following article: https://serialcoder.dev/text-tutorials/swiftui/navigation-view-style-in-swiftui/ Use the columns navigation view style to have two panels side by side on iPhones with screens big enough to show two panels. NavigationView { … } .navigationViewStyle(.columns)
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
Hi there, I'm working on an app that provides the user a prompt. They have to select the matching button. These butttons are created in three separate rows using three forEach loops acting on a customised button made from a Struct. ForEach(0..<10) { column in AlphabetButton( gameViewModel: gameViewModel, letter: String(alphabetTop[column]), borderColor: $borderColor.wrappedValue, onTap: buttonTapped) }} alphabetTop is an array storing letters used as the buttons label and value, and there are two other arrays with the other letters. What I'm wondering, is if the user presses a button that doesn't match the prompt. How can I make reference to the button that does match the prompt. For example, I want to make the border of that correct button flash Orange if the wrong button is pressed. I am making a keyboard app as a bit of practise in learning SwiftUI, so any assistance you can provide would be most helpful. One potential solution I've thought of, do I make the buttonTapped function, chec
Hi guys, please help me with sqlite database. When I save the data in the table, it always saves the wrong data in the columns. They don't match the submitted data at all. I don't know where I am making a mistake. Thank you! DatabaseManager ViewController
I've commented out much of the code and reduced the table to one column. With approx 1000 items in the table it takes about 900 msec to change the selected item. Measurment is between the time I click on the item and the UI is ready to process the next click. Instruments shows: every time I select an item the foreach loop runs for every row in the table. That accounts for about 200 msec. the remaining portion of the hang is in SwiftUI code. None of my instrumented code is called. I don't know what SwiftUI is doing, but it is doing it slowly.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
This is something I've been struggling with for some time. The hierarchy of my app makes this harder to diagnose. But like you, it was working fine for years. In my case, this app supported three column-layouts prior to the release of column-based split views. In order to do so, we have a concept of a NestedSplitViewController -- which is a UIViewController that owns a UISplitView. We're running into the same issue with Xcode 15 – and can't seem to pin it down.
Topic:
UI Frameworks
SubTopic:
UIKit
Tags:
I am currently trying to build a NavigationManager with programmatic navigation. For that I'm using the NavigationPath combined with NavigationDestination. Sadly facing the following issue: navigationDestionation is not being recognised when located in sheet. Im receiving the following message when trying to update the path of the NavigationStack within the sheet. A NavigationLink is presenting a value of type “PathType” but there is no matching navigationDestination declaration visible from the location of the link. The link cannot be activated. Note: Links search for destinations in any surrounding NavigationStack, then within the same column of a NavigationSplitView. Here is some simplified code snipped of the implementation. struct RootView: View { @State private var isPresented: Bool = true var body: some View { Button(Open Modal, action: { self.isPresented.toggle() }) .sheet(isPresented: self.$isPresented, content: { ModalContent() }) } } private struct ModalContent: View { @State private var p
When I used Context Menu for each photo in three columns. So, the code is like below: List { LazyVGrid(columns: columns) { View() .contextMenu { Button() } } } This just pop up whole list not individual element when I long press the element to see context menu. The whole list is highlighted when context menu appears. How can I make this to highlight individual element not the whole list? If I remove any of List or LazyVGrid the problem fix. But the columns are not in the way I want. Also, I don't want to change List to VStack or ScrollView which don't have refreshControl. Thanks in advance.
just posted a bug to Apple Developer Feedback...this is still an issue in iPadOS 17 App is using a UISplitViewController with the new column style init. Both primary and secondary child view controllers are subclasses of UITableViewController (yes, I need to move to CollectionViewController ASAP)... This bug occurs when I am in landscape and select iPadOS Split View by tapping on the 3 dots menu on top of the screen. As my app slides to the left, this Xcode console occurs. The backtrace from the symbolic break point indicates there are NO calls in my code in the back trace. This is an apple UIKit bug! Workaround for overriding layouSubviews likely to work... here's the backtrace... (lldb) bt thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 4.1 frame #0: 0x00000001942cd8dc UIKitCore`UITableViewAlertForLayoutOutsideViewHierarchy frame #1: 0x0000000193579fd0 UIKitCore`-[UITableView _updateVisibleCellsNow:] + 208 frame #2: 0x0000000193579e34 UIKitCore`-[UITableView layoutSubviews] + 1
Topic:
UI Frameworks
SubTopic:
UIKit
Tags:
I did a very simple test using Metal PerformanceShaders. It is basically a MPSMatrixMultiplication.I compiled it in Terminal with 'swiftc matrixMul.swift'Then you get the executable called matrixMul.Now, execute 'time matrixMul' and after approximately 10 seconds you will get the first then elements of the result matrix prows i/nted on screen.This all works as intended, however I realized in Activity Monitor (and also because of high GPU fan speed), that somehow the GPU isn't fully released. The Activity Monitor through the GPU monitor shows 100% activity for several minutes anfter program exit. Somehow the matrixMul process keeps the GPU busy after program exit. Do I miss some statement in my code which tells the system to free resources?Below is the simple test-code------------------------------------- import Metal import Accelerateimport MetalPerformanceShaderslet n = 8192let rowsA = nlet columnsA = nlet rowsB = nlet columnsB = nlet rowsC = nlet columnsC = nvar arrayA = [Float](repeating: 1, count: rowsA *
Thanks @Starfia, this appears to be a bug. Thanks very much for confirming that – at least it quiets my indecision about how to proceed. That advice just gives me a Content View that conforms to the detail column's resizable area, though, so I don't think it gives me the fixed-sizedness I'm looking for. The closest I've been able to come has been to hard-code the frame of the Navigation Split View itself, but that involves knowing the combined height of all views I might add to the detail column at all times (alongside which the unwanted safe area propagation persists), so it's a whole undertaking. I think for this iteration, I just have to avoid using NavigationSplitView or the Inspector; I have to implement alternatives to those provided functionalities, but the layout issues disappear the moment I sidestep them.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
Hi, colleagues: I've spent days trying to understand this little SwiftUI layout problem, and I've made a minimal test app to explain it. It's based on a Content View of a fixed size. import SwiftUI @main struct TestApp: App { var body: some Scene { WindowGroup { ContentView() } .windowResizability(.contentSize) .windowToolbarStyle(.unified(showsTitle: false)) } } struct ContentView: View { let complaint = What's with the vertical space around me when I'm in a detail column? var body: some View { Text(complaint) .font(.title) .frame(width: 300, height: 300) .background(.blue) } } And here's the result. As expected, the Content View is hugged nicely by the window: My goal is to place a fixed-size view like this in the detail column of a Navigation Split View. So I update the scene's root view: import SwiftUI @main struct TestApp: App { var body: some Scene { WindowGroup { NavigationSplitView( sidebar: { }, detail: { ContentView() } ) } .windowResizability(.contentSize) .windowToolbarStyle(
A fascinating update. I've tried adding the newly-introduced Inspector modifier, which I also intended to use in the app I'm making: import SwiftUI @main struct TestApp: App { @State var isShowingInspector: Bool = true var body: some Scene { WindowGroup { NavigationSplitView( sidebar: { }, detail: { ContentView() } ) .inspector(isPresented: self.$isShowingInspector) { } } .windowResizability(.contentSize) .windowToolbarStyle(.unified(showsTitle: false)) } } struct ContentView: View { let complaint = What's with the vertical space around me when I'm in a detail column? var body: some View { VStack(spacing: 0) { Text(complaint) .font(.title) .ignoresSafeArea() .frame(width: 300, height: 300) .background(.blue) } } } This time, SwiftUI apparently adds entire toolbar's height to the minimum height of the window again! Now the detail column's mysterious vertical space equals twice the height of the toolbar: It doesn't seem to matter whether the Inspector is applied to the Navigation Split Vie
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: