阅读视图

发现新文章,点击刷新页面。

git hooks配置

背景 用cocoapods管理的iOS项目中需要限制 release 分支直接push 经过一番Google,找到了git hooks限制的方法,但是看了很多文章,发现废话一堆,不能快速的解决我的问题

RunLoop 实现原理

当 APP 没有任何任务的时候,RunLoop 会进入休眠,RunLoop 就告诉 CPU,现在没有事情做,我要去休息,这时 CPU 就会将其资源释放出来去做其他的事情。当下次有任务的时候,例如用户点

我差点失去了巴顿(我的狗狗) - 肘子的 Swift 周报 #98

巴顿已经 13 岁了。尽管大多数时候他都表现出远超同龄狗狗的活力和状态,但随着年龄增长,各种健康问题也随之而来。不久前,巴顿被检查出肺动脉高压,医生给出了针对性的治疗方案。就在我为治疗似乎初见成效而欣慰时,上周一下午,巴顿突然无法站立,大量流口水,表现出明显的心脏不适。

iOS26适配指南之UIButton

在 iOS 26 中,UIButton 迎来了非常实用的更新: Liquid Glass 风格配置方法,让按钮拥有全新的半透明折射质感,完美融入 iOS 26 的视觉系统。

LLVM integrated assembler: Improving sections and symbols

In my previous post, LLVMintegrated assembler: Improving expressions and relocations delvedinto enhancements made to LLVM's expression resolving and relocationgeneration. This post covers recent refinements to MC, focusing onsections and symbols.

Sections

Sections are named, contiguous blocks of code or data within anobject file. They allow you to logically group related parts of yourprogram. The assembler places code and data into these sections as itprocesses the source file.

1
2
3
4
5
6
7
8
9
10
11
12
class MCSection {
...
enum SectionVariant {
SV_COFF = 0,
SV_ELF,
SV_GOFF,
SV_MachO,
SV_Wasm,
SV_XCOFF,
SV_SPIRV,
SV_DXContainer,
};

In LLVM 20, the MCSectionclass used an enum called SectionVariant todifferentiate between various object file formats, such as ELF, Mach-O,and COFF. These subclasses are used in contexts where the section typeis known at compile-time, such as in MCStreamer and MCObjectTargetWriter.This change eliminates the need for runtime type information (RTTI)checks, simplifying the codebase and improving efficiency.

Additionally, the storage for fragments' fixups (adjustments toaddresses and offsets) has been moved into the MCSectionclass.

Symbols

Symbols are names that represent memory addresses or values.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class MCSymbol {
protected:
/// The kind of the symbol. If it is any value other than unset then this
/// class is actually one of the appropriate subclasses of MCSymbol.
enum SymbolKind {
SymbolKindUnset,
SymbolKindCOFF,
SymbolKindELF,
SymbolKindGOFF,
SymbolKindMachO,
SymbolKindWasm,
SymbolKindXCOFF,
};

/// A symbol can contain an Offset, or Value, or be Common, but never more
/// than one of these.
enum Contents : uint8_t {
SymContentsUnset,
SymContentsOffset,
SymContentsVariable,
SymContentsCommon,
SymContentsTargetCommon, // Index stores the section index
};

Similar to sections, the MCSymbolclass also used a discriminator enum, SymbolKind, to distinguishbetween object file formats. This enum has also been removed.

Furthermore, the MCSymbol class had anenum Contents to specify the kind of symbol. This name wasa bit confusing, so it has been renamedto enum Kind for clarity.

A special enumerator, SymContentsTargetCommon, which wasused by AMDGPU for a specific type of common symbol, has also been removed.The functionality it provided is now handled by updatingELFObjectWriter to respect the symbol's section index(SHN_AMDGPU_LDS for this special AMDGPU symbol).

sizeof(MCSymbol) has been reduced to 24 bytes on 64-bitsystems.

The previous blog post LLVMintegrated assembler: Improving expressions and relocationsdescribes other changes:

  • The MCSymbol::IsUsed flag was a workaround fordetecting a subset of invalid reassignments and is removed.
  • The MCSymbol::IsResolving flag is added to detectcyclic dependencies of equated symbols.

WWDC 2025 Build a SwiftUI app with the new design

Build a SwiftUI app with the new design

WWDC 2025推出了liquid glass这种重磅级的新设计,怎样在swiftUI开发中用上这些新特性,给你的用户带来耳目一新的视觉盛宴呢,今天我们来聊一下

总结起来就是这个 session 展示了如何用 Liquid Glass 与新 SwiftUI API 重塑 App 结构(导航、标签页、工具栏、搜索、控件),在 iOS 26 和 macOS Tahoe 上实现更轻盈、动态、统一的用户体验。

具体来讲就是以Liquid Glass为中心,在不同场景包括NavigationSplitView, Inspector, TabView, Sheets, Toolbar和不同控件按钮、滑块、菜单的结合,呈现新的设计效果

1. 新设计的核心理念

  • Liquid Glass 是 iOS 26 和 macOS Tahoe 的全新自适应材质,用于 控制和导航元素
  • 它结合玻璃的光学特性和液体的流动感,创造出轻盈、动态的视觉效果,帮助内容成为界面的主角。
  • 在交互时(比如切换、滑动、点击),控件会“活起来”,提供流体化的反馈。

2. 应用结构更新

  • NavigationSplitView:侧边栏采用 Liquid Glass,浮动在内容上,配合新的 backgroundExtensionEffect 可避免图片被裁剪。

  • Inspector:对比侧边栏,采用更细腻的分层效果,与所选内容建立视觉联系。

  • TabView

    • 新的 Tab Bar 可 悬浮在内容之上,并通过 tabBarMinimizeBehavior 设置滚动时的折叠/展开行为。
    • tabViewBottomAccessory 允许在 Tab Bar 下方附加额外控件(如播放控件)。
  • Sheets

    • 默认带有 Liquid Glass 背景。
    • 支持 部分高度,边缘自动与屏幕圆角对齐。
    • 转换到全屏时会逐渐过渡为不透明背景。
    • 新的 导航缩放过渡 让 Sheet/对话框看起来从按钮“流出”。

3. 工具栏 (Toolbars)

  • 工具栏表面为 Liquid Glass,自适应底层内容。
  • 项目可自动分组,也可用 ToolbarSpacer 控制分组间距。
  • badge 修饰符为工具栏按钮提供消息提醒。
  • sharedBackgroundVisibility 可以将项目单独分组,避免背景混淆。
  • 图标更偏向单色,减少干扰;但仍可通过 tint 传达语义。
  • 滚动边缘效果 (scrollEdgeEffect) 自动处理内容与浮动控件之间的可读性,可通过 scrollEdgeEffectStyle 调整。

4. 搜索体验

  • 提供 两大模式

    1. 工具栏内搜索:iPhone 显示在底部,iPad/Mac 显示在右上角。
    2. 独立的搜索页面:可在 TabView 中定义 search 角色。
  • 新的 searchToolbarBehavior API 可精细控制搜索的折叠/展开方式。

  • 搜索框本身置于 Liquid Glass 表面,激活时与内容保持自然过渡。


5. 标准控件的更新

  • 按钮 (Buttons)

    • 默认采用 胶囊形状,与系统圆角保持一致。
    • 新增 extra-large 尺寸,强调主操作。
    • 新的 glassglassProminent 样式将 Liquid Glass 引入按钮。
  • 滑块 (Sliders)

    • 支持 刻度 (tick marks) ,可自动或手动配置。
    • neutralValue 参数允许定义中点值(如播放速度调节)。
  • 菜单 (Menus)

    • 图标统一在左侧,iOS 与 macOS 行为一致。
  • 一致性特性

    • 新的 corner concentricity 概念:控件自动与容器(如 Sheet)保持圆角同心。

6. 自定义 Liquid Glass

  • 使用 glassEffect 修饰符为自定义控件加上 Liquid Glass。
  • 通过 GlassEffectContainer 管理多个玻璃元素,确保光影一致。
  • 使用 glassEffectIDnamespace 配合,可以实现 流体化的玻璃转场(比如徽章展开/收缩)。
  • interactive 修饰符让自定义玻璃控件具备触摸反馈(缩放、弹性、闪光)。
  • 支持 tint 高亮关键控件,但应避免过度装饰。

7. 最佳实践与采纳策略

  • 使用 Xcode 26 SDK 构建,许多 UI 更新自动获得。
  • 检查 App 结构,移除不必要的背景,避免与系统滚动边缘效果冲突。
  • 优先使用系统控件 来获得一致性和自动适配。
  • 在必要时才引入自定义 Liquid Glass 元素,让 App 的独特之处得到凸显。
❌