Ember,一款我为了辅助功能而开发的 iOS 原生 Hacker News 阅读器。
Ember, a native iOS Hacker News reader I built around accessibility

原始链接: https://github.com/DatanoiseTV/ember-hackernews

Ember 是一款专为 iOS 18 原生打造的 Hacker News 客户端,完全采用 SwiftUI 构建,无需任何第三方依赖。它提供卓越的用户体验,支持自定义信息流筛选、全文搜索、离线书签以及阅读进度跟踪。其精心设计包含六种强调色主题、流畅的动画效果以及经过手动调校的自适应色彩系统。 Ember 的一大亮点在于其对无障碍功能的重视。它超越了常规标准,确保信息传达绝不单纯依赖色彩(而是通过图标、形状和文字提示),并全面支持旁白(VoiceOver)、动态字体(Dynamic Type)和“减弱动态效果”设置。智能化的引导流程会在首次启动时检测系统级别的无障碍设置,从而自动完成应用配置。 在技术层面,Ember 充分利用了 Observation、`async/await` 等现代 Apple 框架,并开发了自定义的 HTML 转 AttributedString 解析器,以实现评论线程的快速原生渲染。该项目采用模块化设计,使用 XcodeGen 进行配置,并以 MIT 协议开源,是一款独立、非官方的工具。

抱歉。
相关文章

原文
  • Every feed — Top, New, Best, Ask HN, Show HN, and Jobs, switchable from a pinned filter bar.
  • Native comment threads — Hacker News comment HTML is parsed into native text with tappable links, italics, block quotes, and code blocks. Threads are collapsible with depth indicators, and the whole tree loads in a single request.
  • Smart onboarding — a short first-run flow that reads your device's appearance and accessibility settings, pre-configures the app to match, and shows a live preview as you choose a theme, accent, and home feed.
  • Search — full-text search across Hacker News by relevance or recency.
  • Saved for later — bookmark any story; saved stories are stored on device and work offline.
  • Read tracking — visited stories are dimmed so you can pick up where you left off.
  • In-app reading — open links in an in-app Safari view with optional Reader mode, or hand off to your default browser.
  • Profiles — view any user's karma, join date, about, and recent submissions.
  • Thoughtful design — a warm, hand-tuned color system, full light/dark support, six accent themes, haptics, and fluid animations.

Accessibility is a first-class part of Ember, with particular care for color vision.

  • Never color alone. Status is always carried by an icon, shape, or text in addition to color — points and comment counts pair an SF Symbol with their value, read state shows a checkmark, and selection states use rings and checkmarks.
  • Color-blind friendly cues. A dedicated setting (auto-enabled when the system "Differentiate Without Color" is on) adds explicit non-color indicators throughout.
  • VoiceOver. Story rows, comments, and controls expose meaningful labels, hints, traits, and custom actions; each story reads as a single coherent element.
  • Dynamic Type. Typography scales with the system text size, and layouts — including comment indentation — adapt at accessibility sizes.
  • Reduce Motion. Animations and the loading shimmer are minimized when Reduce Motion is enabled.
  • Underlined links. Links in comments can be underlined so they remain identifiable without relying on color.
  • The onboarding adapts. On first launch Ember detects VoiceOver, Reduce Motion, Differentiate Without Color, Bold Text, and large text, turns on the matching options, and tells you exactly what it changed.

Ember is pure SwiftUI with no third-party dependencies.

  • UI: SwiftUI, targeting iOS 18.
  • State: the Observation framework (@Observable) for view models and stores.
  • Concurrency: async/await networking; feed pages fetch concurrently with TaskGroup and tolerate individual missing items.
  • Persistence: UserDefaults for settings and read state; a JSON file for saved stories.
  • Data sources:
Sources/
  App/              App entry, root tab view, environment wiring, in-app Safari
  Models/           HNItem, HNUser, Feed, Algolia models
  Networking/       HNService protocol, live client, mock for previews
  Stores/           Settings, bookmarks, read state
  DesignSystem/     Theme, typography, haptics, reusable components
  Utilities/        HTML comment renderer, relative time
  Features/
    Feed/           Feed list, filter bar, view model
    StoryDetail/    Story header + threaded collapsible comments
    Search/         Search with relevance/recency
    Saved/          Bookmarks
    Settings/       Appearance, reading, accessibility, data, about
    User/           Profiles
    Onboarding/     Smart first-run personalization
Resources/          Assets, app icon, Info.plist
Tools/              Icon generator, screenshot device-framer
  • macOS with Xcode 16 or newer (built and tested against Xcode 26 / iOS 26 SDK).
  • XcodeGen to generate the project: brew install xcodegen.
# 1. Generate the Xcode project from project.yml
xcodegen generate

# 2. Open it
open Ember.xcodeproj

# 3. Select the Ember scheme and an iPhone simulator, then Run.

Or build from the command line:

xcodegen generate
xcodebuild -project Ember.xcodeproj -scheme Ember \
  -sdk iphonesimulator \
  -destination 'platform=iOS Simulator,name=iPhone 17 Pro' build

The generated Ember.xcodeproj is intentionally git-ignored — regenerate it with xcodegen generate after pulling.

swift Tools/GenerateIcon.swift                                   # app icon
swift Tools/FrameScreenshot.swift in.png docs/screenshots/x.png  # device-framed screenshot
  • The comment HTML renderer is a small purpose-built parser for the limited tag set Hacker News emits (<p>, <i>, <b>, <a>, <pre><code>, <br>, and entities), producing native AttributedString blocks rather than relying on a web view.
  • The full comment tree is fetched from Algolia in one request and flattened into a list with depth, so collapsing a thread is instant.
  • Colors are appearance-adaptive tokens defined in code, so light and dark are both deliberately tuned rather than auto-derived.

Ember is an independent project and is not affiliated with Hacker News or Y Combinator.

Released under the MIT License.

联系我们 contact @ memedata.com