今日已更新 339 条资讯 | 累计 19899 条内容
关于我们

标签:#Swift

找到 33 篇相关文章

AI 资讯

Swift VSX Support, Biome Type Inference, Agent Guardrails

This week's tooling news clusters around a recurring theme: removing dependencies that were never really necessary. Biome ditches the TypeScript compiler for type-aware linting. Swift developers stop caring which editor they're in. And the most interesting finding of the week is that a 1990s text-retrieval algorithm outperforms GPT-4 at catching lying agents. Here's what's worth your attention. Swift Extension Lands on Open VSX Registry The official Swift extension is now published to the Open VSX Registry, which means Cursor, VSCodium, AWS Kiro, and any other LSP-compatible editor that doesn't use the proprietary VS Code Marketplace can now auto-install it without you doing anything. Code completion, debugging, and the test explorer just work. This matters because the Swift toolchain has always been Xcode-or-fight. Any serious cross-platform Swift work meant manually tracking down extensions, pinning versions, and hoping nothing broke when someone cloned the repo on a different machine. Agentic IDEs that provision their own extensions automatically—like Cursor and Kiro—now get Swift support without intervention. Verdict: Ship. If you're already in an Open VSX-compatible editor, there's nothing to configure. Zero blocking concerns; this is a pure reduction in setup friction. Biome v2 Adds Type Inference Without TypeScript Biome v2 ships its own type inference engine, decoupling type-aware linting rules from the TypeScript compiler entirely. The headline number is 75% detection parity on floating promise rules compared to typescript-eslint—lower recall, but at meaningfully lower install weight and CI overhead. Multi-file analysis also lands in v2, unlocking rules that require cross-module context that were structurally impossible in v1. The real value proposition isn't feature parity—it's dependency elimination. Pulling TypeScript out of your lint pipeline reduces cold-start times in CI and removes a whole class of version-mismatch bugs between typescript , @typescri

2026-06-19 原文 →
AI 资讯

Weekly Dev Log 2026-W10

🗓️ This Week While organizing ideas for my first iOS app , I remembered an old web app idea called ToneDrill , which I had casually built before to help practice note names on a guitar fretboard🎸. I decided to try turning it into an iOS app 🛠️. I clarified the purpose of ToneDrill , its minimum requirements , and its core features , then organized them in Notion 📝. I was curious to see how well Codex could implement an iOS app from those minimum requirements , so I gave it a try right away💡. I reviewed the SwiftUI code generated by Codex and worked through the app logic to understand how it was implemented 🔍. For now, I was able to create a working app, which felt like a meaningful step forward 🚶. I created the top page UI design for my portfolio website in Figma 🎨. I focused on keeping the structure simple and implementation-friendly, and designed the UI with reusable components for each major part. Based on what I learned from my previous failed attempt, I tried again to see how well Codex could implement a prototype from the Figma UI design (You can read about my previous attempt that didn’t go so well here😅.) Worked on the AI Threat Modelling room from the AI Security Learning Path on TryHackMe this week🤖. 📱 iOS (SwiftUI) Revisited an old web app idea called ToneDrill, which I had previously built casually as a guitar note-training app, and considered turning it into an iOS app. Organized the app idea in Notion, including its purpose, target use case, minimum requirements, and core features. Decided to aim for an MVP-level version first, instead of trying to build a fully featured app from the beginning. Wrote down simple requirements and tested how accurately Codex could implement the initial version of the app. Reviewed the iOS app implementation generated by Codex and examined the code in detail to understand how the logic worked. 🌐 Web Development Posted my weekly dev log on Dev.to📝 Completed the top page UI design for my portfolio website in Figma. Tried us

2026-06-18 原文 →
AI 资讯

WWDC 2026 - Migrate to Swift Testing: What Actually Means for Your Test Suite

Swift Testing shipped with Xcode 16 back in 2024. Swift Testing was built from the ground up for Swift. That means Swift concurrency is a first-class citizen, test cases run in parallel by default, and the API surface is dramatically smaller than XCTest's forty-plus assertion functions. One macro, #expect , replaces most of them. If you are still on XCTest, you have probably felt the friction: class inheritance for every test suite, function names that must start with test , assertion messages that tell you what the values were but not where the expression came from. Swift Testing fixes all of this. That said, you do not need to migrate everything at once, and WWDC 2026 is emphatic about this. The Migration Strategy: Small Chunks, No Big Bang The session opens with something refreshing: permission to be slow about this. The recommended approach is to leave your existing XCTests where they are and start using Swift Testing only for new tests. Both frameworks can coexist in the same target and even the same file. You do not need a separate test target, and you do not need a migration sprint. The one rule: Swift Testing tests cannot live inside XCTestCase subclasses. Everything else is fair game. Raw Identifiers for Readable Test Names One small quality-of-life improvement worth knowing about from the start: Swift supports raw identifiers using backticks, and Swift Testing takes full advantage of this. import Testing @testable import DemoApp @Test func ` Default climate : tropical ` () async throws { let fruit = Fruit ( name : "Coconut" ) #expect(fruit.climate == .tropical) } No more testDefaultClimateTropical or dealing with camelCase names in test output. The test name is the test name. Interoperability: The Key to Reusing Your Helper Code This is the main new story in WWDC 2026 and the feature that makes incremental migration actually work. The problem: you have test helper functions that wrap XCTFail . You want to call them from new Swift Testing tests. Previously,

2026-06-16 原文 →
AI 资讯

WWDC 2026 - What's New in SwiftUI - A Developer's Breakdown

WWDC26 brought a substantial round of updates to SwiftUI — not a ground-up redesign, but a lot of small limitations removed, new APIs that were clearly driven by real-world pain points, and meaningful performance improvements. This post walks through every major announcement so you know exactly what's available and when to reach for it. Look and Feel: Liquid Glass and the 2027 Releases The most immediately visible change costs you zero code. Apps built with SwiftUI automatically pick up the updated Liquid Glass appearance on the 2027 OS releases. The glass tint responds to the new system-level Liquid Glass slider without any changes on your part. On iPad, windows now dim when inactive, reinforcing which window has focus — again, automatic. On Mac, custom interactive Liquid Glass elements respond more fluidly to the mouse pointer. There are a few opt-in refinements available when you want tighter control: Responding to active state — use the appearsActive environment value to reduce opacity on custom elements when the window is inactive: struct SidebarFooterView : View { @Environment (\ . appearsActive ) private var appearsActive var body : some View { MyAccountView () . opacity ( appearsActive ? 1 : 0.5 ) } } Menu bar icons — the menu bar now shows a minimal set of icons by default. Add .labelStyle(.titleAndIcon) to a specific menu item to make its icon visible: CommandMenu ( "Stickers" ) { Button { openStore () } label : { Label ( "Store" , systemImage : "bag.fill" ) . labelStyle ( . titleAndIcon ) } } Resizability on iPhone iPhone apps become resizable on iOS 27, which matters for iPhone Mirroring and running iPhone apps on iPad. Xcode 27's Live Previews now include resize handles so you can test this interactively without running on a device. If your app mixes UIKit and SwiftUI, check the session "Modernize your UIKit app" for specifics around screen geometry, size classes, and orientation handling. Toolbar APIs The toolbar has been a source of friction on smalle

2026-06-11 原文 →
AI 资讯

Zero Data Leakage: Running Llama-3 Locally on iPhone with MLX-Swift for Ultra-Private Health Logs

Your health data is probably the most sensitive information you own. Yet, most "AI Health Assistants" today require you to ship your symptoms, moods, and medical history to a cloud server. In the era of Edge AI and Privacy-preserving machine learning , this is no longer a trade-off we have to make. By leveraging the MLX Framework and Apple Silicon's unified memory, we can now run on-device LLMs like Llama-3-8B directly on an iPhone. This tutorial explores how to build a 100% offline, local health journal that summarizes your daily wellness without a single byte leaving your device. If you're looking for more production-ready patterns for secure AI, definitely check out the advanced guides over at Wellally Tech Blog . Why MLX-Swift? 🍏 Apple's MLX is a NumPy-like array framework designed specifically for Apple Silicon. When brought into the Swift ecosystem via mlx-swift , it allows us to tap into the GPU and Neural Engine with incredible efficiency. The Architecture: 100% Offline Inference Unlike traditional CoreML conversions that can be rigid, MLX allows for dynamic graph execution. Here is how the data flows from your typed notes to a structured health summary: graph TD A[User Input: Health Notes] --> B[SwiftUI View] B --> C{Privacy Layer} C -->|Local Only| D[MLX-Swift Engine] D --> E[Llama-3-8B Quantized Model] E --> F[Unified Memory / GPU] F --> G[Local Inference] G --> H[Markdown Health Summary] H --> B style C fill:#f9f,stroke:#333,stroke-width:4px style E fill:#00ff0022,stroke:#333 Prerequisites 🛠️ Device : iPhone 15 Pro or later (8GB RAM is highly recommended for Llama-3-8B). Software : Xcode 15.3+, iOS 17.4+. Tech Stack : MLX Framework, SwiftUI, Llama-3-8B (4-bit quantized). Step 1: Setting Up the MLX Engine First, we need to integrate the mlx-swift package. In your Package.swift , add: . package ( url : "https://github.com/ml-explore/mlx-swift-chat" , branch : "main" ) Now, let's initialize the model. Because we are on a mobile device, we must use a quantiz

2026-06-11 原文 →
AI 资讯

Migrating a Real App to Swift 6: Data Races, a Dependency I Had to Evict, and the Compiler That Wouldn't Let Me Lie

Let me start with a confession: I have been writing concurrent code since the only tool in the box was a mutex and a prayer. After a decade of Swift I feel suspicion of any code that touches two threads and claims to be fine. So when Swift 6 showed up promising to prove my concurrency correct at compile time, I had two reactions at once. The grizzled half of me said "sure, kid." The other half — the half that has spent actual weekends chasing a heisenbug that only reproduced on a customer's M1 under sync load — said "...please. Please be real." This is the story of moving Ditto Edge Studio — a SwiftUI debug-and-query tool for the Ditto edge database — to Swift 6's strict concurrency mode. It's a real app: SQLCipher persistence, an embedded MCP server, a SpriteKit presence graph, live sync over Bluetooth and WebSocket. Not a to-do list. The kind of app where concurrency bugs hide in the cracks and wait for a demo. Spoiler: it was worth it. It was also more work than the WWDC talk implied, and the most valuable thing the compiler did happened in the one place I told it to stop looking. Let me show you. First, the Wall: A Dependency That Wasn't Coming to Swift 6 Here's the thing nobody warns you about. Swift 6 language mode isn't really a per-file setting. Your code can be immaculate — every actor isolated, every Sendable accounted for — and you'll still be stuck, because one dependency that isn't Swift 6-ready can hold your entire module hostage. Mine was a code editor. I'd been using a popular SwiftUI editor package for the DQL query editor, and it transitively pulled in a syntax-highlighting library. Both were lovely. Both were also written for a more innocent time, and neither was going to compile under Swift 6 strict concurrency without upstream changes that weren't happening on my timeline. I had the usual three options, and I want to be honest about how tempting the cowardly ones were: Pin the dependency and leave the whole app at Swift 5. Free today, expensive

2026-06-08 原文 →
AI 资讯

I Built a Native macOS Tool to Improve Cloud Gaming Stability

Cloud gaming on macOS has improved a lot over the last few years, but I kept running into the same issues: random ping spikes, micro-stutters, Bluetooth latency, and network interruptions caused by background system services. Instead of tweaking settings manually every time I launched a gaming session, I decided to build a small native macOS utility to automate the process. The result is CloudBoost. The Problem When troubleshooting cloud gaming performance on macOS, I noticed that many issues weren't caused by internet speed. Even with a fast fiber connection, there were occasional interruptions caused by: Background wireless discovery services Network interface transitions Power management behaviors Input device acceleration Memory pressure during long gaming sessions These issues were small individually, but together they created a noticeably less consistent experience. The Approach Rather than creating another "system cleaner" application, I wanted something that would: Apply temporary optimizations only during gaming sessions Avoid permanent system modifications Use native macOS technologies Restore original settings when disabled The application focuses on automation instead of aggressive tuning. Building It CloudBoost was developed using: Swift SwiftUI Native macOS APIs UNIX system utilities already available on macOS The biggest challenge wasn't writing code. It was understanding which system behaviors actually affected cloud gaming and identifying changes that could safely improve consistency without creating side effects. Features Current functionality includes: Network optimization routines Temporary wireless service management Mouse acceleration controls Session-based optimization profiles Automatic restoration of original settings Native menu bar integration Automatic update checking through GitHub releases What I Learned One interesting lesson from this project is that performance optimization is often more about engineering decisions than programming c

2026-06-06 原文 →
AI 资讯

Building an unofficial Dumpert client for Apple TV with Swift 6 and SwiftUI

Dumpert is a Dutch video site I've watched for years, but there's never been an Apple TV app, so I built one. DumpertTV is an unofficial, open-source tvOS client. Here's how it's put together and a few things that were more interesting than I expected. Disclaimer up front: this project is not affiliated with Dumpert or DPG Media B.V. It's an independent app that uses the public Dumpert API. The stack Swift 6 with strict concurrency ( complete mode) across every target SwiftUI for all UI, tvOS 18+ XcodeGen so the .xcodeproj is generated from a project.yml and never committed CloudKit , GroupActivities (SharePlay), Vision , AVKit , Swift Testing One actor for the network, one source of truth for the UI The whole networking layer is an actor . That makes per-request state like ETags and retry bookkeeping thread-safe without a single lock: actor DumpertAPIClient { private var etags : [ URL : String ] = [:] func fetch < T : Decodable > ( _ endpoint : APIEndpoint ) async throws -> T { // Exponential backoff on 5xx + network errors; honours 304 Not Modified. try await fetchWithRetry ( endpoint , attempt : 0 ) } } The UI reads from a single @Observable @MainActor repository injected through the SwiftUI environment — no Combine, no view models competing over the same state: @Observable @MainActor final class VideoRepository { private(set) var hotshiz : [ MediaItem ] = [] let apiClient : APIClientProtocol // protocol-backed for testing } ContentView () . environment ( videoRepository ) Views just read repository.hotshiz ; updates flow automatically. With Swift 6's strict concurrency on, the compiler kept me honest about every actor hop. Things that were trickier than expected tvOS focus + a top tab bar. Getting a Netflix-style hero carousel to behave with the focus engine took real care. It also made automating screenshots interesting — scripted remote input doesn't reliably drive the simulator, so I added #if DEBUG launch-argument hooks to jump straight to any tab/category f

2026-06-04 原文 →
AI 资讯

[iOS] Why Passthrough MP4 Export Failed for iPhone Videos

A user picks a video from Photos. The app turns that video into a file the server can accept. Then it uploads the file. On the surface, this sounds like a simple upload flow. In practice, iOS makes you answer a much more specific question: How do you reliably turn a video from the user's Photo Library into an uploadable MP4 file? At first, I used AVAssetExportPresetPassthrough . It looked like the right default. It preserves the original media as much as possible, avoids unnecessary re-encoding, and is fast when it works. No quality loss, less CPU usage, less battery cost. But some videos failed during export. The error was usually in the AVFoundationErrorDomain Code=-11838 family. Apple describes this error as operationNotSupportedForAsset : an operation was attempted that is not supported for the asset. At first, I suspected an iCloud download issue, a Photos permission edge case, or something retryable inside PHImageManager . That was not the real problem. The actual problem was more fundamental: I was trying to write an iPhone MOV asset into an MP4 file using a passthrough export. The Original Flow The original code was roughly shaped like this: PHImageManager . default () . requestExportSession ( forVideo : asset , options : options , exportPreset : AVAssetExportPresetPassthrough ) { exportSession , info in exportSession ? . outputURL = outputURL exportSession ? . outputFileType = . mp4 exportSession ? . exportAsynchronously { // upload } } The intention was reasonable: Ask Photos for an export session for the PHAsset . Use AVAssetExportPresetPassthrough to preserve the original quality. Write the result as an .mp4 file for upload. Many videos exported successfully this way. That is what made the bug confusing. Some videos worked. Some did not. The hidden assumption was: Any iPhone video can become an MP4 file through a passthrough export. That assumption is not always true. iPhone Videos Are Usually MOV Files To a user, it is just "a video." Internally, an iPh

2026-06-03 原文 →
开发者

Key point in Do List 100 v2.0 Brings Due Dates, Auto-Progress and Full iPad & Mac Support

Hi everybody. We have created this app around two months and this is third version with fixed bugs. Now it is amazing app that synchronization your tasks throughs iPhone iPad Mac via iCloud with no Sign In! And in pocket you will already have a useful notes. It was a huge code work. Hours and hours. Such a pleasure. What I want to note here for you fellas, we were going from these scheme: What's really happening The self-overwrite loop User edits subtask title ↓ onChange fires → scheduleSave() → debounce 1s ↓ ...debounce fires → DataManager.save() writes todos.json to iCloud ↓ NSMetadataQuery detects file change on disk ↓ ↑ └── todosChanged() ───────┘ ↓ taskManager.loadTodos() ↓ self.todos = loadedTodos ← 💥 replaces entire array mid-edit The core problem is that NSMetadataQuery watches the file at the OS level. It has no concept of who made the change — your own app writing the file looks identical to another device syncing a change over iCloud. So every save you make triggers a reload that cancels whatever the user is currently doing. Why subtask titles are worst affected A TextField bound to $subtask.title is live — it reflects the array value character by character. The moment self.todos = loadedTodos runs, SwiftUI throws away the in-memory array and rebuilds from the freshly decoded JSON. If the save hasn't happened yet (debounce still counting down), the loaded file has the old title, and the field visually snaps back. Progress sliders have the same issue but it's less noticeable because a slider value is a Double — the snap-back is a jump rather than disappearing characters. Why it only shows up on real devices The simulator runs everything on the same Mac so iCloud writes are near-instant and the race window is tiny. On a real device the file system is slower and iCloud sync adds latency, making the timing gap between "user is editing" and "reload fires" much more visible. The three fixes needed Fix 1 — Ignore self-triggered reloads in DataManager Track a isS

2026-06-03 原文 →
AI 资讯

Weekly Dev Log 2026-W07

🗓️ This Week Completed two more sections of the SwiftUI tutorial 🦾 As I continue working through the tutorial, I can feel my understanding of SwiftUI fundamentals becoming more solid 🔥 It was my first time posting a standalone article about reverse engineering📝 If you're interested, feel free to check it out 👇 A Curious Journey Into Reverse Engineering an AI-Generated Python .exe Umitomo Umitomo Umitomo Follow May 26 A Curious Journey Into Reverse Engineering an AI-Generated Python .exe # beginners # reversing # security # python 5 reactions Comments Add Comment 5 min read I started creating UI designs for my future portfolio website in Figma. I was able to roughly sketch out the overall structure of the site, but I also realized how difficult it is to create modern and stylish UI designs. (It really made me realize I don’t have much design sense yet 😂💦) While struggling with the design process, I came across several articles about Figma MCP . That made me interested in exploring how generative AI could help with UI design ideas, so I decided to start researching Figma MCP further. Completed Securing AI Systems room from the AI Security Learning Path on TryHackMe this week🤖 📱 iOS (SwiftUI) Worked through the SwiftUI tutorial and completed "Create an Algorithm for Badges" and "Add inclusive features" 🌐 Web Development Posted my weekly dev log on Dev.to and a standalone article about my first attempt at reverse engineering 📝 Created rough portfolio website UI layouts in Figma Used shadcn/ui component library design templates in Figma Started learning UI design in Figma using community resources 🔐 Security (TryHackMe) Completed Securing AI Systems room (part of the AI Security Learning Path) on TryHackMe. 💡 Key Takeaways 📱 SwiftUI Learning Add inclusive features Learned that SwiftUI automatically adapts UI elements for Light and Dark Mode by default. Learned how to preview and compare Light and Dark Mode layouts in the Xcode canvas. Understood that system-provided sema

2026-05-29 原文 →