🐨

AppleIntelligenceのWriting Toolsの機能紹介

2025/02/02に公開

以下の記事でAppleIntelligenceの紹介をしました。
今回はその一つである「Writing Tools」に焦点を当てます。
https://zenn.dev/headwaters/articles/d90998469039fe

機能紹介

テキストを選択するとWritingToolsという選択肢が出ます。


タップすると以下のようなモーダルが登場します。

テストケース

検証にあたって以下の検証文を作りました。

想定

海外のエンジニアと開発のコミュニケーションを取っている時

日本語

PRを確認しました。
3点認識合わせしたいです。
1点目:ローカル環境での動作確認は行いましたか?
2点目:一つのファイルに記載されているコードの量が多いです。他の画面でも活用できそうな関数は別ファイルに切り出したいです。どの関数が別ファイルに切り出せそうですか?
3点目:使っているライブラリが非常にボリュームが大きいようです。あまり難しいロジックではないので、なるべく自前で1から実装したいです。可能ですか?

Google翻訳で作って自分で色々いじった英文

I have check your PR.
I want like to clarify 3 point.
1st point: Have you tested the operation in local environment?
2nd point: There is many code in one file. I would like to extract functions that can be used on other screens into separate files. Which functions do you think can be picked into separate files?
3rd point: The library you are using seems to be very large in volume. The logic is not particularly difficult, so I would like to implement it from scratch mine as much as possible. Is that possible?


1. Proofread(校正)

間違ってる表現を正しく書き換えてくれます。

変換後

I have checked your PR. 
I would like to clarify 3 points.
1st point: Have you tested the operation in a local environment?
2nd point: There is a lot of code in one file. I would like to extract functions that can be used on other screens into separate files. Which functions do you think can be picked into separate files?
3rd point: The library you are using seems to be very large in volume. The logic is not particularly difficult, so I would like to implement it from scratch myself as much as possible. Is this possible?

4点書き換えられました。

書き換えた理由も教えてくれるの助かるな-


え、もしかして間違った情報も書き換えてくれる!?

Swift is an application development language for iOS and MacOS developed by Apple.

Swift is an application development language only Android OS developed by Microsoft.
に変えて試してみる。



...
流石にそれは無理でした

2. Rewrite(書き直し)

こちらは1から書き直してくれます。

変換

I’ve reviewed your PR. I’d like to clarify a few things.

First, have you tested the code in a local environment?

Second, there’s a lot of code in a single file. I’d like to extract functions that can be used on other screens into separate files. Which functions do you think should be separated?

Third, the library you’re using seems quite large. Since the logic isn’t particularly complex, I’d like to implement it myself as much as possible. Is that possible?

3. Friendly

カジュアルな表現に文章を書き換えてくれます。

変換後

I’ve taken a look at your PR. I have a few questions for you.

  1. Have you tested the code in a local environment?

  2. There are a lot of functions in one file. I’d like to split them out into separate files so they can be used on other screens. Which functions do you think should go in separate files?

  3. The library you’re using seems to be quite large. The logic isn’t too complicated, so I’d like to try and implement it myself as much as possible. Is that okay?

4. Professional

業務での連絡や顧客に送ることを想定した感じで書き換えてくれます。

変換後

Hello,

I have reviewed your PR. I would like to clarify three points:

1st point: Have you tested the operation in a local environment?
2nd point: There are many functions in one file. I would like to extract functions that can be used on other screens into separate files. Which functions do you think can be extracted into separate files?
3rd point: The library you are using seems to be very large in volume. The logic is not particularly difficult, so I would like to implement it from scratch myself as much as possible. Is this possible?

5. Concise

簡潔に文をまとめてくれます。

変換後

I’ve reviewed your PR. Here are three clarifications:

  1. Have you tested the code in a local environment?
  2. Many functions are in one file. Can you extract useful functions into separate files?
  3. The library seems large. Since the logic is simple, I’d like to implement it myself. Is that possible?

6. Summary

要約してくれます。
Conciseより簡潔な文章になりました。

変換後

PR review complete; clarifications needed on local testing, code organization, and library usage.

7. Key Point

文から要点を掴んで相手側にわかりやすい感じで書き換えてくれます。
ただ、会話を想定している場合は意図する文章にはならなさそうなので資料作成の時とかですかね。

変換後

• Code Review Feedback: The reviewer has checked the PR and has three points to clarify.
• Local Environment Testing: The reviewer asks if the PR has been tested in a local environment.
• Code Organization and Library Usage: The reviewer suggests separating reusable functions into separate files and implementing the logic from scratch instead of using a large library.

8. List

箇条書きに書き換えてくれます。
こちらも資料作成とか、議事録の時に有用そう。

変換後

• I have checked your PR.
• I would like to clarify 3 points.
• 1st point: Have you tested the operation in local environment?
• 2nd point: There is many code in one file.
• I would like to extract functions that can be used on other screens into separate files.
• Which functions do you think can be picked into separate files?
• 3rd point: The library you are using seems to be very large in volume.
• The logic is not particularly difficult, so I would like to implement it from scratch myself as much as possible.
• possible?

9. Table

どうやらまだ使えないっぽい

実装は至ってシンプル

簡単に組み込むことができます。

WritingToolsView.swift
import SwiftUI

struct WritingToolView: View {
    @State var textFieldTextAutomatic = "Swift is an application development language only Android OS developed by Microsoft."
    @State var textFieldTextComplete = "Swift is an application development language only Android OS developed by Microsoft."
    @State var textFieldTextLimited = "Swift is an application development language only Android OS developed by Microsoft."
    @State var textFieldTextDisabled = "Swift is an application development language only Android OS developed by Microsoft."
    
    var body: some View {
        VStack {
            TextEditor(text: $textFieldTextAutomatic).writingToolsBehavior(.automatic).frame(height: 100).padding(.horizontal).border(.red)
            TextEditor(text: $textFieldTextComplete).writingToolsBehavior(.complete).frame(height: 100).padding(.horizontal).border(.green)
            TextEditor(text: $textFieldTextLimited).writingToolsBehavior(.limited).frame(height: 100).padding(.horizontal).border(.blue)
            TextEditor(text: $textFieldTextDisabled).writingToolsBehavior(.disabled).frame(height: 100).padding(.horizontal).border(.gray)
        }.padding()
    }
}

カスタマイズ

エンジニア側で設定できるのはwritinToolsBehaviorメソッドの引数一つで、automatic or complete or limited or disabledの4種類のみ。
「フレンドリーのみ使えるようにする~」とか「ユーザーが入力してたら勝手に校正されるようにする~」といったことは現状できません。(APIとして提供されてない)

公式Docsには以下のように記載されてます。

  • automatic...An appropriate editing experience will be provided based on context, which may include disabling the writing tools.(コンテキストに基づいて最適な編集エクスペリエンスを提供、状況によっては機能が無効になるケースもある)
  • complete...The complete inline-editing experience is provided if possible.(完全なインライン編集エクスペリエンスを提供)
  • limited...The limited, overlay-panel experience is provided if possible.(オーバーレイエクスペリエスを提供)
  • disabled...The writing tools are disabled.(機能が無効になる)

https://developer.apple.com/documentation/swiftui/writingtoolsbehavior

ちょっとイマイチわからないので実際に動かしてみます。

automatic

普通に使えました。
状況に応じて色々変わることを確認したかったのですが、再現ができませんでした。

complete

「automatic」と同じでした。

limited

automaticcompleteは違うところがわかりました。
AppleIntelligenceが新しく生成した文章が画面に反映される前に確認モーダルが出るようです。
個人的にこっちの方が好みだなと思いました。

Disabled

確かに「writingTools」がなくなった

とても簡単

iOS18以降かつ現在は英語しか使えませんが、今年中にどんどん言語がサポートされていくようです。
実装はとても簡単なのでアプリ内でTextFieldを使ってる場合は是非組み込んでみてはいかがでしょう。

ヘッドウォータース

Discussion