0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Swift Tips

Last updated at Posted at 2025-02-09

Viewのbodyプロパティが再描画される

?を使うと、リターンではなく、スキップされる

func cancelTaskIfNeeded() {
    var task: Task<Void, Never>? = nil
    print("Before cancel")
    task?.cancel()  // taskがnilなので何も起きない
    print("After cancel")
}
cancelTaskIfNeeded()

結果

Before cancel
After cancel

※rustの場合はNoneで即時リターンなので、そこは違う点。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?