Swift 3と、Xcode 8

swift3

いまや、5つの異なるアクセスレベル、open、public、internal、fileprivate、そしてprivateが存在します。

swift4

% swift
Welcome to Apple Swift version 3.0 (swiftlang-800.0.46.2 clang-800.0.38). Type :help for assistance.
  1> var list = [10, 11, 12]
list: [Int] = 3 values {
  [0] = 10
  [1] = 11
  [2] = 12
}
  2> list.insert(99, at: 1)
  3> print(list)
[10, 99, 11, 12]
  4> public   var r = 1
r: Int = 1
  5> internal let s = 2
s: Int = 2
  6> fileprivate func myfunc() {}
  7> private     func urfunc() {}

あなたは、IBM Swift Sandboxを訪問すれば、Swift 3をインストールせずに試すことができます。

swift5

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.