Search results for

column

2,071 results found

Post

Replies

Boosts

Views

Activity

[iOS 18.2 Beta] LazyVGrid within NavigationStack breaks animations
Hello. There seems to be a bug specifically in the iOS 18.2 (both Beta 1 and 2) and not seen in the previous versions. The bug is: when LazyVGrid is nested inside NavigationStack and some elements of the LazyVGrid have animations, navigating into any nested view and then going back to the initial view with the LazyVGrid causes all animations to stop working. Here is the example code inline: struct ContentView: View { @State private var count: Int = 0 var body: some View { NavigationStack { LazyVGrid( columns: Array( repeating: GridItem(spacing: 0), count: 1 ), alignment: .center, spacing: 0 ) { VStack { Text(String(count)) .font(.system(size: 100, weight: .black)) .contentTransition(.numericText()) .animation(.bouncy(duration: 1), value: count) Button(Increment) { count += 1 } NavigationLink(destination: { Text(Test) }, label: { Text(Navigate) }) } } } .padding() } } Once you run the application on iOS 18.2 Beta (I've tried on a real device only), the steps to reproduce are: Tap on the Increment butt
8
0
1.1k
Nov ’24
HStack required to get columns in a Grid
I've looked at lots of Grid examples. I've seen it documented that views within a GridRow are treated as if they were in an HStack. That's not happening for me. I have to explicitly put them into an HStack or they are treated as new rows. Here's my code: @State private var gridRows : Int = 4 @State private var gridCols : Int = 2 @State private var myItems : [Int] = Array(0...8) var body: some View { Group { if myItems.count > 0 { ScrollView([.vertical]) { Grid(alignment: .leading) { ForEach(0..<<--- { ForEach(0..
Topic: UI Frameworks SubTopic: SwiftUI
2
0
339
Nov ’24
Errors reported by content of WKWebView (via window.onerror) are censored to "Script error.""
Script error. We've decided to implement certain highly-dynamic content in out iOS codebase using web technologies, here's what we're doing: We download a zip file containing html, javascript, and images. We unzip the archive, construct a WKWebView, and load the content using webView.loadFileURL(indexHtmlUrl, allowingReadAccessTo: parentDirectory) This works fine, but we'd also like to be notified on any rendering errors that might be raised, so we can fix them. let errorHandlerScriptString = (function() { var oldLog = console.log; console.log = function(message) { window.webkit.messageHandlers.consoleLog.postMessage(message); oldLog.apply(console, arguments); } })(); // don't even allow asking for location permissions navigator.geolocation.getCurrentPosition = function(success, error, options) { error({ PERMISSION_DENIED: 1, code: 1 }); }; window.onerror = (msg, url, line, column, error) => { const message = { message: msg, url: url, line: line, column: column, error: JSON.stri
Topic: Safari & Web SubTopic: General Tags:
2
0
636
Nov ’24
Reply to Mac Issue with Developer ID certificate and Sign in with Apple capability
Sign in with Apple is not supported in Developer ID apps. The go-to reference for this stuff is Developer Account Help > Reference > Supported capabilities (macOS). Note that Sign in with Apple is not available in the Developer ID column. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = eskimo + 1 + @ + apple.com
Nov ’24
Page view in SwiftUI
I have an app for musicians that works with Songs and Setlists. The logical structure is as follows: A Setlist contains Songs. A Song has Sections, which include Lines (chords & lyrics). I want to view my Setlist in a Page View, similar to a book where I can swipe through pages. In this view, the Song Sections are wrapped into columns to save screen space. I use a ColumnsLayout to calculate and render the columns, and then a SplitToPages modifier to divide these columns into pages. Problem: The TabView sometimes behaves unexpectedly when a song spans multiple pages during rendering. This results in a transition that is either not smooth or stops between songs. Is there a better way to implement this behavior? Any advice would be greatly appreciated. struct TestPageView: View { struct SongWithSections: Identifiable { var id = UUID() var title: String var section: [String] } var songSetlistSample: [SongWithSections] { var songs: [SongWithSections] = [] //songs for i in 0...3 { var
0
0
396
Nov ’24
Reply to Error I can't seem to fix
You haven't posted enough context. If you click on the Report navigator icon (the rightmost icon at the top of the left column in Xcode, which looks like a hierarchical list), you can see the full build log, which should help you to fix errors like these. With what you've posted, we can't see the name of the first missing file. The second missing file may be missing because the first is missing, and that in turn may be due to something reported only as a warning in the detailed build log.
Oct ’24
Reply to macos menu bar color picker not working properly
First of all, thank you for your response. Since I have just started with SwiftUI, please don't mind my beginner mistakes regarding the color selection. I have shared all my codes import SwiftUI import AppKit struct RenkSecimi: View { @Binding var renk1: Color @Binding var renk2: Color @ObservedObject var short : TimerModel @State private var renkGoster = false var body: some View { Form { VStack(alignment: .center, spacing: 20) { HStack(alignment: .center) { ColorPicker(Color 1,selection: $renk2) .padding() .background(.gray) .clipShape(RoundedRectangle(cornerRadius: 10)) .shadow(radius: 2) .onTapGesture { renkGoster.toggle() } ColorPicker(Color 2, selection: $renk1) .padding() .background(.gray) .clipShape(RoundedRectangle(cornerRadius: 10)) .shadow(radius: 2) .onTapGesture { renkGoster.toggle() } } VStack(spacing: 10){ Picker(Short Break, selection: $short.shortBreakDuration) { ForEach(5...11, id: .self) { i in Text((i) Dk).tag(i * 60) } .onChange(of: short.shortBreakDuration) { oldValue, newValue in short
Oct ’24
How can I get a tab-bar styled ornament on the trailing edge of a view controller?
I've got a UIKit app with a collapsible trailing-edge child view controller, implemented sort of like UISplitViewController but it's got a bunch of custom behavior - moving to the bottom edge in portrait orientation, etc. It exposes a couple of different app functions via a UITabBar on the bottom edge on iOS. When I run the app on visionOS, that tab bar transforms to a leading-edge ornament. This would be great, but that means it tries to overlap the trailing-edge content of its parent view controller, which isn't ideal. Is there a way to get the tab bar to lay out on the trailling edge of the child view controller? Or can I create a custom ornament that has the same auto-expand behavior as the tab bar, where it shows a vertical column of icons that expands to show titles when you're gazing at it?
1
0
499
Oct ’24
Text-shadow + column-count adds unexpected whitespace at beginning of second column
Howdy! On Safari, when using the column-count CSS property to split text into multiple columns, I've noticed that when applying a text-shadow, there is an unexpected whitespace created above all subsequent columns. I've put together a codepen demonstrating the issue and its reproducibility on Safari (using latest as of this posting: Version 17.6 (19618.3.11.11.5)) Codepen: https://codepen.io/cubepresser/pen/ExqvzjL Expected behavior: Actual: I tested this on the latest versions of Chrome, Firefox and Edge. This bug does not occur. Expected behavior is that there should not be an extra line added to the beginning of the second column, third column, etc. Here's some code if that codepen link doesn't work: HTML: 0000000000111111111122222222223333333333 CSS: #example { font-family: monospace; max-width: 20ch; column-count: 2; column-gap: 0; word-break: break-all; line-break: anywhere; text-shadow: 0 0 4px black; }
1
0
793
Oct ’24
Reply to text context with column-count value is 2 and text-shadow' blur is greater then 0, the second column will be bring down
Howdy! This bug still occurs on Safari. I've put together a codepen demonstrating the issue and its reproducibility on Safari (using latest as of this posting: Version 17.6 (19618.3.11.11.5)) Codepen: https://codepen.io/cubepresser/pen/ExqvzjL I tested this on the latest versions of Chrome, Firefox and Edge. This bug does not occur. Expected behavior is that there should not be an extra line added to the beginning of the second column, third column, etc. Here's some code if that codepen link doesn't work: HTML: 0000000000111111111122222222223333333333 CSS: #example { font-family: monospace; max-width: 20ch; column-count: 2; column-gap: 0; word-break: break-all; line-break: anywhere; text-shadow: 0 0 4px black; }
Topic: Safari & Web SubTopic: General Tags:
Oct ’24
Center alignment in row of LazyVGrid
I am creating a LazyVGrid with 2 columns. I want it so that if there is only one item in a row, then it goes to the center of the row. I tried using an HStack with a Spacer, but it doesn't push it to the center. How do I do it? ForEach(pets) { pet in VStack { Image(pet.species.rawValue) .resizable() .frame(width: 80, height: 80) Text(pet.name) .poppinsBold(size: 16) } } HStack { if pets.hasEvenNumber { Spacer(minLength: 0) } Button { addPetSheet = true } label: { VStack { ZStack { Circle() .frame(width: 70, height: 70) .foregroundStyle(.gray) Image(systemName: plus) .foregroundStyle(.white) .font(.title) } Text(Add) .poppinsBold(size: 16) } } } }
Topic: Design SubTopic: General Tags:
0
0
488
Oct ’24
Reply to How SwiftUI Table sorting work with multiple KeyPathComparator ?
@cp-divyesh-v I would recommend you review Building a Great Mac App with SwiftUI sample code. It has an example that walks you through how you should create sortable columns. However here's an example : struct Plant: Identifiable { var id = UUID() var variety: String var daysToMaturity: Int var datePlanted: Date var harvestDate: Date var lastWateredOn: Date var favorite: Bool } @Observable class DetailManager { var sortOrder: [KeyPathComparator] = [ .init(.daysToMaturity, order: SortOrder.reverse), .init(.variety, order: SortOrder.reverse) ] var data = [ Plant(variety: Tomato, daysToMaturity: 80, datePlanted: Date(), harvestDate: Date(), lastWateredOn: Date(), favorite: true), Plant(variety: Carrot, daysToMaturity: 60, datePlanted: Date(), harvestDate: Date(), lastWateredOn: Date(), favorite: false), Plant(variety: Pepper, daysToMaturity: 90, datePlanted: Date(), harvestDate: Date(), lastWateredOn: Date(), favorite: false) ] var plants: [Plant] { data.sorted(using: sortOrder) } } struct GardenDetailT
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Oct ’24
Reply to NavigationSplitView does not properly show detail pages on macOS 15
This was release noted here: https://developer.apple.com/documentation/macos-release-notes/macos-15-release-notes (Search 127626852) Behavior was changed because the composition is undefined on iOS and was undefined on macOS, but happened to work in some cases. This change was made behind a link check, so hopefully you are only seeing this when compiling against the newest Sequoia toolchains. View-destination links (e.g. NavigationLinks that take a View as their destination) and value-destination links (e.g. NavigationLinks that take a value argument) cannot be mixed. By attaching an id to the link, you are wiring the link up to the Lists selection, and thus trying to drive navigation that way. The correct way to do this in releases including and prior to iOS 15 and macOS 18 is by switching over the selection in the NavigationSplitView's subsequent column: NavigationSplitView { List(selection: $selection) { NavigationLink(Value-destination link, value: 5) } } detail: { if let selection { SelectedDest
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Oct ’24