{"id":631,"date":"2021-09-17T15:22:17","date_gmt":"1970-01-01T00:00:00","guid":{"rendered":"http:\/\/swift.tecc0.com\/?p=631"},"modified":"2021-09-17T15:22:17","modified_gmt":"1970-01-01T00:00:00","slug":"post-631","status":"publish","type":"post","link":"https:\/\/swift.tecc0.com\/?p=631","title":{"rendered":"Swift\u3067\u30a2\u30af\u30bb\u30b9\u4fee\u98fe\u5b50(internal, private, fileprivate, public, open)\u3092\u8a2d\u5b9a\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"<p>\u5c0f\u3055\u3044\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3084\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u5165\u9580\u306e\u9803\u306f\u3042\u307e\u308a\u6c17\u306b\u3057\u306a\u304f\u3066\u3082\u826f\u3044\u3051\u3069\u3001\u6163\u308c\u3066\u304d\u305f\u308a\u3001\u5927\u304d\u3044\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u3084\u308b\u3068\u304d\u306b\u306f\u610f\u8b58\u3092\u3057\u3066\u304a\u3053\u3046\u3002<\/p>\n<p>\u4eca\u56de\u306fSwift\u3067\u4f7f\u30465\u3064\u306e<strong>\u30a2\u30af\u30bb\u30b9\u4fee\u98fe\u5b50<\/strong>\u306b\u3064\u3044\u3066\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>Swift\u3067\u30a2\u30af\u30bb\u30b9\u4fee\u98fe\u5b50(internal, private, fileprivate, public, open)\u3092\u8a2d\u5b9a\u3059\u308b<\/h2>\n<p>\u3061\u306a\u307f\u306b<strong>fileprivate<\/strong> \u3068<strong>open<\/strong> \u306fSwift3.0\u304b\u3089\u65b0\u3057\u304f\u52a0\u308f\u3063\u305f\u30a2\u30af\u30bb\u30b9\u4fee\u98fe\u5b50\u3060\u3088\u3002<\/p>\n<h3>internal<\/h3>\n<p>internal\u306f\u4f7f\u3046\u3053\u3068\u306f\u591a\u3044\u3051\u3069\u5b9f\u306f\u3042\u307e\u308a\u76ee\u306b\u3057\u306a\u3044\u3082\u306e\u3002<\/p>\n<p>\u306a\u305c\u306a\u3089\u30c7\u30d5\u30a9\u30eb\u30c8(\u8a18\u8ff0\u3092\u7701\u7565\u3057\u305f\u5834\u5408)\u306e\u4fee\u98fe\u5b50\u304cinternal\u3060\u304b\u3089\u3060\u3088\u3002<\/p>\n<pre class=\"lang:swift decode:true \">class Say {\r\n    let message = \"\u3053\u3093\u306b\u3061\u306f\"\r\n    func hello() {\r\n        print(message)\r\n    }\r\n}\r\n\r\ninternal class Say {\r\n    internal let message = \"\u3053\u3093\u306b\u3061\u306f\"\r\n    internal func hello() {\r\n        print(message)\r\n    }\r\n}<\/pre>\n<p>\u3064\u307e\u308a\u3001\u4e0a\u8a182\u3064\u306f\u540c\u3058\u610f\u5473\u3060\u3088\u3002<\/p>\n<p>\u7279\u306b\u554f\u984c\u306a\u3051\u308c\u3070\u4e0a\u3092\u4f7f\u3046\u3088\u3002<\/p>\n<p>&nbsp;<\/p>\n<h3>private<\/h3>\n<p>\u30af\u30e9\u30b9\u306a\u3069\u306e\u5ba3\u8a00\u5185\u306e\u307f\u304b\u3089\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3002<\/p>\n<pre class=\"lang:swift decode:true \">private class Say {\r\n    private let message = \"\u3053\u3093\u306b\u3061\u306f\"\r\n    private func hello() {\r\n        print(message)\r\n    }\r\n}<\/pre>\n<p>\u4e0a\u8a18\u306e\u66f8\u304d\u65b9\u3060\u3068\u5b9f\u7528\u6027\u306f\u306a\u3044\u3051\u3069\u3001\u5225\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5316\u542b\u3081\u3001\u30a2\u30af\u30bb\u30b9\u304c\u3067\u304d\u306a\u304f\u306a\u308b\u3088\u3002<\/p>\n<p>let\u3092\u4f7f\u3046\u306e\u3082\u305d\u3046\u3060\u3051\u3069\u3001<strong>\u5909\u66f4\u3055\u308c\u305f\u304f\u306a\u3044\u3082\u306e\u306b\u9069\u5207\u306a\u30a2\u30af\u30bb\u30b9\u4fee\u98fe\u5b50\u3092\u5272\u308a\u632f\u308b<\/strong>\u306e\u304c\u5927\u4e8b\u3060\u3088\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u305f\u3068\u3048\u3070<\/p>\n<pre class=\"lang:swift decode:true\">class Say {\r\n    private static var message = \"\u3053\u3093\u306b\u3061\u306f\"\r\n    func hello() {\r\n        print(Say.message)\r\n    }\r\n}\r\n\r\nlet say = Say()\r\nsay.hello() \/\/ \"\u3053\u3093\u306b\u3061\u306f\"\r\n\r\nprint(Say.message) \/\/ Error<\/pre>\n<p>\u3053\u3093\u306a\u611f\u3058\u3067\u30af\u30e9\u30b9\u30d7\u30ed\u30d1\u30c6\u30a3\u306bprivate\u3092\u8a2d\u5b9a\u3059\u308b\u3068\u30a8\u30e9\u30fc(\u30a2\u30af\u30bb\u30b9\u4e0d\u53ef)\u306b\u306a\u308b\u3088\u3002<\/p>\n<p>\u3082\u3057\u3001\u30af\u30e9\u30b9\u5185\u3067\u3082\u5909\u66f4\u3055\u308c\u305f\u304f\u306a\u3044\u3068\u304d\u306flet\u3092\u4f7f\u3046\u307b\u3046\u304c\u826f\u3044\u3057\u3001\u306a\u308b\u3079\u304f<strong>\u53b3\u3057\u3044\u30a2\u30af\u30bb\u30b9\u4fee\u98fe\u5b50(private &gt; fileprivate &gt; internal &gt; public &gt; open)<\/strong>\u3067\u4f5c\u3063\u3066\u3044\u304f\u306e\u304c\u57fa\u672c\u3060\u3088\u3002<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #ff0000;\">Read only<\/span>\u306b\u3057\u305f\u3044\u5834\u5408\u306b\u306f\u4ee5\u4e0b\u3082\u53c2\u8003\u306b\u3057\u3066\u307f\u3088\u3046\u3002<\/p>\n<p><a href=\"https:\/\/swift.tecc0.com\/?p=268\">https:\/\/swift.tecc0.com\/?p=268<\/a><\/p>\n<p>&nbsp;<\/p>\n<h3>fileprivate<\/h3>\n<p>\u3055\u3063\u304d\u306e\u30af\u30e9\u30b9\u30d7\u30ed\u30d1\u30c6\u30a3\u3092private \u304b\u3089 fileprivate \u306b\u5909\u3048\u308b\u3068\u3001\u30a8\u30e9\u30fc\u304c\u6d88\u3048\u308b\u3088\u3002<\/p>\n<pre class=\"lang:swift decode:true\">class Say {\r\n    fileprivate static var message = \"\u3053\u3093\u306b\u3061\u306f\"\r\n    func hello() {\r\n        print(Say.message)\r\n    }\r\n}\r\n\r\nlet say = Say()\r\nsay.hello() \/\/ \"\u3053\u3093\u306b\u3061\u306f\"\r\n\r\nprint(Say.message) \/\/ \"\u3053\u3093\u306b\u3061\u306f\"<\/pre>\n<p><strong>fileprivate<\/strong> \u306f\u305d\u306e\u540d\u306e\u901a\u308a\u3001\u540c\u4e00\u30d5\u30a1\u30a4\u30eb\u5185\u304b\u3089\u306e\u307f\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u30a2\u30af\u30bb\u30b9\u4fee\u98fe\u5b50\u3060\u3088\u3002<\/p>\n<p>&nbsp;<\/p>\n<h3>public<\/h3>\n<p>\u5225\u306e\u30bf\u30fc\u30b2\u30c3\u30c8\u5185\u304b\u3089\u3067\u3082\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308b\u3088\u3002<\/p>\n<p>override\u306f\u53ef\u80fd\u3060\u3051\u3069\u3001\u7d99\u627f\u304c\u3067\u304d\u306a\u3044\u3088\u3002<\/p>\n<p>&nbsp;<\/p>\n<h3>open<\/h3>\n<p>public\u306e\u30a2\u30af\u30bb\u30b9\u7bc4\u56f2\u306b\u52a0\u3048\u3001\u7d99\u627f\u3082\u3067\u304d\u308b\u3088\u3002<\/p>\n<p>public\u3084open\u306f\u57fa\u672c\u7684\u306b\u306fFramework\u306a\u3093\u304b\u306b\u8a2d\u5b9a\u3059\u308b\u30a2\u30af\u30bb\u30b9\u6a29\u3060\u3088\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u3069\u308c\u3092\u4f7f\u3046\u304b\u306f\u5b9f\u969b\u306b\u696d\u52d9\u306a\u3069\u3067\u4f7f\u3063\u3066\u307f\u308b\u306e\u304c1\u756a\u306a\u306e\u3067\u3001\u3060\u3093\u3060\u3093\u3068\u6163\u308c\u3066\u3044\u304f\u306e\u304c\u826f\u3044\u304b\u3068\u601d\u3046\u3088\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5c0f\u3055\u3044\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3084\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u5165\u9580\u306e\u9803\u306f\u3042\u307e\u308a\u6c17\u306b\u3057\u306a\u304f\u3066\u3082\u826f\u3044\u3051\u3069\u3001\u6163\u308c\u3066\u304d\u305f\u308a\u3001\u5927\u304d\u3044\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u3084\u308b\u3068\u304d\u306b\u306f\u610f\u8b58\u3092\u3057\u3066\u304a\u3053\u3046\u3002 \u4eca\u56de\u306fSwift\u3067\u4f7f\u30465\u3064\u306e\u30a2\u30af\u30bb\u30b9\u4fee\u98fe\u5b50\u306b\u3064\u3044\u3066\u3002 &nbsp; Swift\u3067&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[17],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=\/wp\/v2\/posts\/631"}],"collection":[{"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=631"}],"version-history":[{"count":5,"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=\/wp\/v2\/posts\/631\/revisions"}],"predecessor-version":[{"id":636,"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=\/wp\/v2\/posts\/631\/revisions\/636"}],"wp:attachment":[{"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=631"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=631"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=631"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}