This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I am trying tool calling in FoundationModels with the following code. When given the prompt “Schedule a meeting for next Wednesday at 10 a.m.”, tool calling is not called, and an unexpected response is returned. The response is "Please provide the name of the calendar where the event should be created.". | |
When the prompt is “Add a meeting to the schedule for next Wednesday at 10:00 a.m.”, the tool is called (although the parameters are incorrect). | |
import Cocoa | |
import FoundationModels | |
import EventKit | |
@main |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I am trying tool calling with the following code. When I give the prompt “Add a meeting to the schedule for next Wednesday at 10:00 a.m.”, the CalendarTool is called, but the date argument passed is incorrect. Since I am expecting next Wednesday, the expected behavior is for it to return “Jul 15th, 2025,” but it returns “2024-10-23T10:00:00.” | |
Also attach the actual project. | |
```swift | |
import Cocoa | |
import FoundationModels | |
import EventKit | |
@main |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When the following code is executed in a project with the deployment target set to iOS 16, the `init` function of `NWConnection` crashes. | |
This issue only occurs on the iOS 26 simulator. There is no problem on the device. | |
```swift | |
import UIKit | |
import Network | |
@main | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | |
UserDefaults.standard.register(defaults: [ | |
"UseFloatingTabBar": false, | |
]) | |
return true | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
** 概要 | |
applelocalization-toolsでシステムの言語ファイルを読み取り、applelocalization-dataのデータを作る。 | |
追加したデータを表示できるようにWebフロントエンド(エンドポイントやドロップダウンメニューを追加する)を修正する。 | |
*** 手順 1〜11 | |
- github.com/kishikawakatsumi/applelocalization-tools | |
- システムに含まれる言語ファイルを読み取りDBの1レコード単位に整形したJSONファイルを作る | |
- JSONファイルからDBにインポートできるデータを作る。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
/// Calculates the `n`th Fibonacci number | |
/// | |
/// This function returns `0` for all negative numbers. | |
func fib(_ n: Int) -> Int { | |
guard n > 0 else { | |
return 0 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
政府が民間の自由な経済活動への介入は原則として慎重であるべきです。報告書で述べられているApp Storeの問題点は政府が規制や介入をしなければならないほどの解決困難であったり多数の被害者が発生しているようなものではありません。 | |
1.OSやブラウザ等の仕様変更等について | |
大規模なソフトウェア製品における本質的な問題です。規制を設けたところで解決する問題ではありません。 | |
報告書ではAppleが必要な情報を適切に提供していないという指摘があるが、これは正しくなく、過去と比較して現在の情報公開の状況は大きく改善されています。 | |
ベータ版についての情報についても、10年前はWWDCの情報は参加者のみがアクセスできましたが、現在はデベロッパーアカウントがあればすべて閲覧可能になっています。デベロッパーアカウントも有料のデベロッパープログラムは必要なく、Apple IDがあればよいので、事実上すべての人間に情報は開示されています。 | |
ベータ版が安定するまでに長い時間がかかり対応する時間が限られているという指摘については先に述べたとおりソフトウェアの本質的な問題です。モバイルデバイスのOSははるかに複雑になっておりむしろ毎年新機能や改善が行われているということは驚愕すべきことです。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SwiftData raises a runtime error when attempting to save a property of CGFloat type, but the compiler cannot validate it. | |
Models with properties of type CGFloat, such as the example below, cannot be saved in SwiftData. It will cause a run-time error. | |
I believe that the compiler should reject such incorrect models. However, such models cannot be made an error at compile-time, so the following documentation statement that SwiftData can safely describe the model layer is highly questionable. | |
> Using modern language features like macros, SwiftData enables you to write code that is fast, efficient, and safe, enabling you to describe the entire model layer (or object graph) for your app. | |
```swift | |
@Model |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If the incorrect code is written when attempting to persist a model containing associations, either run-time errors occur or only the associations are not saved (although they appear to be saved correctly). | |
The latter makes it very difficult to find the problem, as it appears to be working correctly without any errors. | |
Of the four code examples below, only the first one saves the data correctly, including the association. | |
All of the remaining three cases do not work correctly. | |
The important thing is to insert the association source object into the context first. | |
Otherwise, you will get either a run-time error or the unexpected behaviour that only the related objects are not saved. | |
```swift |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Classes qualified with @Model macro allow incomplete initializers | |
The compiler does not throw an error if a class with @Model, as in the following code, implements only an incomplete initializer (in this example, the properties are not initialized at all). | |
This would normally (if the plain class is not macro qualified) result in a compile error "Return from initializer without initializing all stored properties". | |
```swift | |
import SwiftData | |
@Model | |
final class Event { |
NewerOlder