0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[swift] 型とその要素のデフォルトのアクセスレベル

Posted at

理解していなかったのでメモ。

アクセスレベルの種類

  • open
  • public
  • internal
  • fileprivate
  • private

型のデフォルトアクセスレベル

  • internal

型のアクセスレベルとその要素のデフォルトアクセスレベル

要素
open internal
public internal
internal internal
fileprivate fileprivate
private private

ユニットテストの場合

ユニットテスト側でimportする際に@testableをつけると、テスト対象クラスがinternalでもユニットテスト側で読み込める。
@testable import MyClass

参照

0
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?