Search results for

column

2,061 results found

Post

Replies

Boosts

Views

Activity

Reply to SwiftUI NavigationSplitView on macOS: unwanted vertical space in detail column
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:
Feb ’24
SwiftUI NavigationSplitView on macOS: unwanted vertical space in detail column
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(
3
0
2.4k
Feb ’24
Reply to Add Network Extensions capability to iOS app without joining Apple Developer Program?
So is there a way to add a Network Extensions capability to an iOS app without joining the Apple Developer Program? No. The go-to reference for this is Developer Account Help > Reference > Supported capabilities (iOS). The rightmost column in the table lists the thing you can do with a free account (aka a Personal Team). Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = eskimo + 1 + @ + apple.com
Topic: App & System Services SubTopic: Core OS Tags:
Feb ’24
wwdc2023-10162 SwiftUI cookbook: How to handle MoveCommandDirection in LazyVGrid
I was following the tutorial video to implement arrow key navigation on a LazyVGrid. (starting at 18:50: https://developer.apple.com/videos/play/wwdc2023/10162/?time=1130) In the code tab there is a full code sample but it omits the part where the MoveCommandDirection actually determines what the next grid items to select is. private func selectRecipe( _ direction: MoveCommandDirection, layoutDirection: LayoutDirection ) { // ... } Considering that the LazyVGrid actually uses an adaptive layout, what is the correct way to determine the GridItem above or below the current selected GridItem? this is the full example the tutorial provides: struct ContentView: View { @State private var recipes = Recipe.examples @State private var selection: Recipe.ID = Recipe.examples.first!.id @Environment(.layoutDirection) private var layoutDirection var body: some View { LazyVGrid(columns: columns) { ForEach(recipes) { recipe in RecipeTile(recipe: recipe, isSelected: recipe.id == selection) .id(recipe.id) #if
1
0
483
Feb ’24
Help Debugging Performance of Grid with Many Circles SwiftUI
Hello everyone, I've been trying to improve the performance of a grid view that I've made for an app. Basically, it's like one of those sensory boards and there are circles that, when dragged over, change color and play a little haptic feedback. However, I want the grid to span the entire screen and so by increasing the dimensions of the grid to say, 30x30, I am noticing significant performance decreases. CPU usage increases to 99% and the haptic feedback and animation slow down. I've narrowed down the problem to the drag gesture (not the haptics). Just the drag gesture makes the CPU usage approach 40%. The part where I verify if the drag location is within the bounds of any of the circles increase the CPU though. This is like O(n) but with like 900 grid points doesn't sound like it should be that bad? Is there any way that I can improve the code performance? I've tried putting each row of the grid into a Group and also tried switching to UIKit and using CAReplicatorLayers to construct the grid but ran into a
0
0
1k
Feb ’24
log stream command does not yield any events
We are having some trouble getting log stream to output events in real time from coreaudiod while we are in a zoom call or listening to audio. Repro steps: Open a Terminal window and execute log stream --predicate process=='coreaudiod' Create a zoom call, join it, stay for 10 seconds, leave the meeting Expected: audio events should show in log stream Terminal window Actual: no audio event shows Also, if after this test I execute log show --last 5m process=='coreaudiod' the events are showing; that is proof that coreaudiod actually emitted those events; Does anybody have any idea what could cause this? This happens on Sonoma 14.2.1, on an MBP M2 Max with 64GB memory. What we have looked at already: actually log stream does not show events from a lot of other procs on the machine; executing log stream --timeout 10s --style json | jq .[] | jq .processImagePath | sort | uniq -ic | sort --reverse yields only 3 sources (counts in the first column): 205 /kernel 10 /System/Library/CoreServices/ManagedClien
3
0
1k
Feb ’24
size, color formatting of DatePicker
I'm experimenting with the relatively new (to me) compact DatePicker. I'd like a column of aligned fields, the first two on top are date pickers for user input, the ones below that are dates outputted in textfields calculated from dates input by user. In Interface Builder in Xcode, it looks mostly like I want it, black text centered in white rectangular text fields. But in production on my iPhone, the DatePickers are functional, but they are not centered and they appear on a gray background. I haven't been able to figure out what settings to adjust to make the DatePicker's date centered and on white background. Screenshots attached. Grateful for help. --JS
4
0
1.3k
Feb ’24
Preview Autogenerated Code Error
Hello, Very recently, the following code has automatically appeared at the bottom of three of my SwiftUI View files: @available(iOS 17.0, macOS 14.0, tvOS 17.0, visionOS 1.0, watchOS 10.0, *) struct $s10Accent_Ace33_0BADA584A03144EFDAB57154E6FD3FBALl7PreviewfMf_15PreviewRegistryfMu_: DeveloperToolsSupport.PreviewRegistry { static let fileID: String = Accent_Ace/HistoryView.swift static let line: Int = 47 static let column: Int = 1 static func makePreview() throws -> DeveloperToolsSupport.Preview { DeveloperToolsSupport.Preview { let randomWord1 = FetchWord.getRandomWord() let randomWord2 = FetchWord.getRandomWord() @State var randomWords = [Word(word: randomWord1.0, IPA: randomWord1.1, lineNumber: randomWord1.2), Word(word: randomWord2.0, IPA: randomWord2.1, lineNumber: randomWord2.2)] HistoryView(words: $randomWords) } } } This is from one of my files but it's very similar in the other two. It seems to have something to do with my previews. The problem is that this code generates an error: Ambigu
4
0
1.5k
Jan ’24
Json Data Corrupted Error After Updating macOS to 14.2.1 and Xcode to 15.2 with ixguard Toolchain
After updating my macOS to version 14.2.1 and Xcode to version 15.2, I am encountering an issue when attempting to run my iOS app on a physical iPhone device. The app runs successfully in the simulator, but when deploying to the iPhone, I receive the following error: dataCorrupted(Swift.DecodingError.Context(codingPath: [], debugDescription: The given data was not valid JSON., underlyingError: Optional(Error Domain=NSCocoaErrorDomain Code=3840 Unexpected character 'i' around line 1, column 2. UserInfo={NSJSONSerializationErrorIndex=1, NSDebugDescription=Unexpected character 'i' around line 1, column 2.})))
0
0
663
Jan ’24
SKTextureAtlas Error
I am using the following code to create a texture atlas at runtime using a single .png image sprite sheet: func createSpriteTextureAtlas(atlasNumber atlas:Int, forWorld world:Int) { //load the png file let image = UIImage(named: world(world)_spritesheet(atlas)_2048x2048.png) //create the dictonary var imageDictionary = [String: UIImage]() //iterate through all rows and columns and get the subimage var imageIndex = 0 for row in 0...7 { for column in 0...7 { let sourceRect = CGRect(x:column * 256, y:row * 256, width:256, height:256) let sourceImage = image?.cgImage!.cropping(to: sourceRect) let subImage = UIImage(cgImage: sourceImage!) //add the sub image and name to the dictionary imageDictionary[(imageIndex)] = subImage imageIndex = imageIndex + 1 } } //create the texture atlas using the dictionary spriteTextureAtlas[atlas] = SKTextureAtlas(dictionary: imageDictionary) } I have a different sprite sheet for every world. I made all the sprite sheets myself using the same tool. This code works
2
0
922
Jan ’24
Querying data from one-to-many relationship by aggregate in swiftdata
Hi all, I've been struggling a bit with SwiftData, I have a really simple data model but I need to do a fairly complex query over a one-to-many relationship that results in aggregate values. And I want to be able to sort and filter those aggregates. The model looks like this: @Model class Category { var name: String var items = [Item]() } @Model class Item { var added: Date var checked: Date? } In a typical use case I'd expect their to be at most around 50 categories and perhaps 20 items per category. In my UI I would like to be able to sort categories in a couple of ways: by name, by date added and by date checked with a fallback on date added. Also, in my list view I want to be able to list categories and show the checked date of the most recently checked item. I can think of a couple of solutions here, to start of with I can do all the sorting and filtering client-side. In the list view I could retrieve all the categories and then find the most recently checked item per category and go from there. Another
0
0
492
Jan ’24
#Preview Compiling failed: ambiguous use of operator '=='
My MacOS app only cares about days, not time-of-days, so I made a simple Date Extension: extension Date { static func ==(lhs: Date, rhs: Date) -> Bool { let order = Calendar.current.compare(lhs, to: rhs, toGranularity: .day) return (order == .orderedSame) } } My app compiles fine and works as intended. However, #Preview is failing to build the preview, erroring with: CompileDylibError: Failed to build DayRow.swift Compiling failed: ambiguous use of operator '==' @__swiftmacro_45test_calendarview_PreviewReplacement_DayRow_133_EA4566EE578D744A3A6BCC599B1B43AALl0C0fMf_.swift ------------------------------ @available(iOS 17.0, macOS 14.0, tvOS 17.0, watchOS 10.0, xrOS 1.0, *) struct $s45test_calendarview_PreviewReplacement_DayRow_133_EA4566EE578D744A3A6BCC599B1B43AALl0C0fMf_15PreviewRegistryfMu_: DeveloperToolsSupport.PreviewRegistry { static let fileID: String = test_calendarview_PreviewReplacement_DayRow_1/DayRow.1.preview-thunk.swift static let line: Int = 160 static let column: Int = 1 static func
0
0
408
Jan ’24