Skip to content

Instantly share code, notes, and snippets.

@rijieli
rijieli / q&a.md
Created June 15, 2025 09:59 — forked from samhenrigold/q&a.md
WWDC25 Camera/Photos Group Lab Q&A

What’s the first class way to use PhotoKit to reimplement a high performance photo grid? We’ve been using a LazyVGrid and the photos caching manager, but are never able to hit the holy trinity (60hz, efficient memory footprint, minimal flashes of placeholder/empty cells)

A few things. It sounds like you're using the PHCachingImageManager already, which is definitely recommended.

One kind of specific note there—you want to use that to get media content delivered before you need to display it. So, for example, let's say you're showing a large grid of photos. You can be prefetching before and after, in expectation that the user's going to scroll. Or, if you're in a one-up situation, prefetching left and right so that you know the user is likely going to swipe, and you can quickly deliver those images to the screen and cache them.

Another thing you should really make sure you're doing is specifying the size you need for the grid size. For example, if your app supports showing a smaller grid

(Summary generated by ChatGPT based on the automatic transcription. Transcript is attached to this Gist)

Q: What's the best approach to updating my app's UI for the new design?

A:

I think the best approach is to start from either the top down or the bottom up---however you perceive the hierarchy of your application. Focus on the big structural parts, since they tend to be most affected by the design and are often reflected in your code structure. Start there, then focus on the smaller elements.

Follow-up (Mohammed):

and definitely have the expertise to answer any questions that you have for us. So, to kick things off, in some of the design sessions, and keynote, and so, too, we were talking a little bit about the way in which liquid glass can really help with navigation, focus, in the UI, and there's some questions, just kind of, you know, can we expand on that? Can we elaborate a little bit on that notion? And I think maybe, Chabam, that might be a good one for you to take. Yeah, yeah, absolutely. So with liquid glass, you know, we really tried to clarify the navigation layer in our apps. So liquid glass introduces a single floating plane that acts as an navigation layer for your app. buttons in that floating pane sort of seamlessly morph in mitosis as you move between different sections of the app, and when you look at things like controls, controls can also temporarily lift into that glass steam. If you watch some of the design sessions, you know, we go into not overusing glass or not using glass on top of glass, but
Also, if you have a bug or a feature request, please go to bugreporter.apple.com. Today we want to focus on questions that will help the broader audience. So, please send us your questions using the Slido panel here in WebEx. Once our moderators approve the questions, they'll appear for everyone to up vote, so we can narrow in on the questions that are of most interest to all of you. So let's jump in. I'm going to claim moderator privilege and start with a couple of questions that I'm particularly interested in. So the first thing I would like to talk about to get the ball rolling is, I just want to ask each of you what your favorite new Swift UI API is this year. Summer, why don't you kick us off? All right, I'm gonna have to go with our new rich text editor. was a big labor of love for my team, and it was super fun, 'cause we got to work cross functionally with foundation, text kit, cortex, UAKit, app kit, everybody. Excellent. Nick, how about you? Uh, for me, this is definitely a safe area bar, kind of an
@rijieli
rijieli / _WWDC25 AI-ML Group Lab.md
Created June 15, 2025 09:58 — forked from samhenrigold/_WWDC25 AI-ML Group Lab.md
WWDC25 Machine Learning and AI Frameworks group lab

(Summary generated by ChatGPT based on the automatic transcription. Transcript is attached to this Gist)

Panelists:

  • Host: Shashank

  • Panelists: Michael, Erik, Richard, Ronan


@rijieli
rijieli / IntelligenceUIPlatterView.swift
Created February 15, 2025 10:01 — forked from stephancasas/IntelligenceUIPlatterView.swift
A SwiftUI expression of Apple Intelligence' NSIntelligenceUIPlatterView — used to accent intelligence-enabled UI components.
//
// IntelligenceUIPlatterView.swift
//
// Created by Stephan Casas on 2/13/25.
//
import SwiftUI
import AppKit
import Combine
@available(iOS 15.0, *)
public struct RichTextEditor : SwiftUICore.View {
public init(text: SwiftUICore.Binding<Foundation.AttributedString>)
@_Concurrency.MainActor @preconcurrency public var body: some SwiftUICore.View {
get
}
@available(iOS 15.0, *)
public typealias Body = @_opaqueReturnTypeOf("$s7SwiftUI14RichTextEditorV4bodyQrvp", 0) __
}
@available(*, unavailable)
@rijieli
rijieli / HelloAnimation.swift
Created February 24, 2024 09:14 — forked from amosgyamfi/HelloAnimation.swift
HelloAnimation.swift
//
// HelloAnimation.swift
// OpenvisionOS
//
// Created by Amos Gyamfi on 17.2.2024.
//
import SwiftUI
struct HelloAnimation: View {
@rijieli
rijieli / gist:58abc113d032bd48ddd815b65d853582
Last active February 16, 2024 15:55 — forked from bakertim/gist:68a4c5778fb561ea34a4
Set iOS Build Number to Git Commit Count
# source http://blog.jaredsinclair.com/post/97193356620/the-best-of-all-possible-xcode-automated-build
#
# Set the build number to the current git commit count.
# If we're using the Dev scheme, then we'll suffix the build
# number with the current branch name, to make collisions
# far less likely across feature branches.
# Based on: http://w3facility.info/question/how-do-i-force-xcode-to-rebuild-the-info-plist-file-in-my-project-every-time-i-build-the-project/
#
git=`sh /etc/profile; which git`
@rijieli
rijieli / whenHovered.md
Created February 15, 2024 09:19 — forked from importRyan/whenHovered.md
Reliable SwiftUI mouse hover

Reliable mouseEnter/Exit for SwiftUI

Kapture 2021-03-01 at 14 43 39

On Mac, SwiftUI's .onHover closure is not always called on mouse exit, particularly with high cursor velocity. A grid of targets or with finer target shapes will often have multiple targets falsely active after the mouse has moved on.

It is easy to run back to AppKit's safety. Below is a SwiftUI-like modifier for reliable mouse-tracking. You can easily adapt it for other mouse tracking needs.

import SwiftUI