{"id":271,"date":"2023-01-20T16:42:18","date_gmt":"2023-03-20T10:35:45","guid":{"rendered":"https:\/\/www.silicloud.com\/ja\/blog\/index.php\/2023\/11\/30\/%e3%82%b9%e3%82%a6%e3%82%a3%e3%83%95%e3%83%88%e3%81%aeinit\/"},"modified":"2025-07-31T22:12:27","modified_gmt":"2025-07-31T13:12:27","slug":"%e3%82%b9%e3%82%a6%e3%82%a3%e3%83%95%e3%83%88%e3%81%aeinit","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/ja\/blog\/%e3%82%b9%e3%82%a6%e3%82%a3%e3%83%95%e3%83%88%e3%81%aeinit\/","title":{"rendered":"\u30b9\u30a6\u30a3\u30d5\u30c8\u306einit()"},"content":{"rendered":"<p>\u3053\u306eSwift\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001\u91cd\u8981\u306a\u6982\u5ff5\u3067\u3042\u308b\u300cSwift init\u300d\u307e\u305f\u306f\u300cSwift\u306e\u521d\u671f\u5316\u300d\u306b\u3064\u3044\u3066\u8a71\u3057\u5408\u3044\u307e\u3059\u3002\u521d\u671f\u5316\u306f\u3001\u3042\u308b\u578b\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u6210\u3059\u308b\u969b\u306b\u884c\u308f\u308c\u308b\u51e6\u7406\u3067\u3059\u3002<\/p>\n<h2>\u30b9\u30a6\u30a3\u30d5\u30c8\u306e\u521d\u671f\u5316(init)<\/h2>\n<p>\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30bc\u30fc\u30b7\u30e7\u30f3\u306f\u3001\u30af\u30e9\u30b9\u3001\u69cb\u9020\u4f53\u3001\u307e\u305f\u306f\u5217\u6319\u578b\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f7f\u7528\u3059\u308b\u305f\u3081\u306b\u6e96\u5099\u3059\u308b\u30d7\u30ed\u30bb\u30b9\u3067\u3059\u3002\u3053\u306e\u30d7\u30ed\u30bb\u30b9\u3067\u306f\u3001\u305d\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u5404\u683c\u7d0d\u30d7\u30ed\u30d1\u30c6\u30a3\u306b\u521d\u671f\u5024\u3092\u8a2d\u5b9a\u3057\u3001\u65b0\u3057\u3044\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u4f7f\u7528\u53ef\u80fd\u306b\u306a\u308b\u524d\u306b\u5fc5\u8981\u306a\u4ed6\u306e\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3084\u521d\u671f\u5316\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<p>\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u30fc\u306f\u3001Java\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306e\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3068\u4f3c\u3066\u3044\u307e\u3059\u3002\u30bf\u30a4\u30d7\u30bb\u30fc\u30d5\u306a\u8a00\u8a9e\u3067\u3042\u308bSwift\u306f\u3001\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u30fc\u306b\u591a\u304f\u306e\u30eb\u30fc\u30eb\u3092\u8a2d\u3051\u3066\u3044\u307e\u3059\u3002\u3053\u306e\u6982\u5ff5\u3092\u3057\u3063\u304b\u308a\u3068\u628a\u63e1\u3057\u3066\u3044\u306a\u3044\u9650\u308a\u3001\u5b9f\u88c5\u3059\u308b\u3053\u3068\u306f\u56f0\u96e3\u306b\u306a\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<h3>Swift\u306einit()\u306e\u69cb\u6587<\/h3>\n<pre class=\"post-pre\"><code>init() {\r\n    \/\/ initialise the stored properties here.\r\n}\r\n<\/code><\/pre>\n<p>\u4ee5\u4e0b\u306e\u30b5\u30f3\u30d7\u30eb\u30af\u30e9\u30b9\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"post-pre\"><code>class A{\r\n    \r\n    \/\/Compilation error. No initializer is defined.\r\n    var a : Int\r\n    var b : String\r\n    var c : Int?\r\n    let website = \"JournalDev\"\r\n}\r\n<\/code><\/pre>\n<p>\u4e0a\u8a18\u306e\u30af\u30e9\u30b9\u306f\u30b3\u30f3\u30d1\u30a4\u30eb\u3055\u308c\u307e\u305b\u3093\u3002Swift\u306e\u30b3\u30f3\u30d1\u30a4\u30e9\u306f\u3001\u4fdd\u5b58\u3055\u308c\u305f\u30d7\u30ed\u30d1\u30c6\u30a3\u304c\u521d\u671f\u5316\u3055\u308c\u3066\u3044\u306a\u3044\u3053\u3068\u306b\u3064\u3044\u3066\u8b66\u544a\u3092\u51fa\u3057\u3066\u3044\u307e\u3059\u3002\u4fdd\u5b58\u3055\u308c\u305f\u30d7\u30ed\u30d1\u30c6\u30a3\u306f\u672a\u78ba\u5b9a\u306e\u72b6\u614b\u306b\u4fdd\u305f\u308c\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002\u3053\u308c\u306b\u3088\u308a\u30012\u3064\u306e\u53ef\u80fd\u306a\u30aa\u30d7\u30b7\u30e7\u30f3\u304c\u6b8b\u3055\u308c\u307e\u3059\u3002<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u5b9a\u7fa9\u81ea\u4f53\u3067\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u5024\u3092\u6307\u5b9a\u3059\u308b\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u521d\u671f\u5316\u3059\u308b\u305f\u3081\u306b\u3001\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6init()\u3092\u4f7f\u7528\u3059\u308b\u3002<\/ol>\n<p>\u305d\u308c\u305e\u308c\u306e\u624b\u6cd5\u3092\u4e00\u3064\u305a\u3064\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002 (Sorezore no shuh\u014d wo hitotsu zutsu mite ikimashou.)<\/p>\n<pre class=\"post-pre\"><code>class A{\r\n    \r\n    var a : Int = 5\r\n    var b : String = \"Hello. How you're doing\"\r\n    var c : Int?\r\n    let website = \"JournalDev\"\r\n}\r\n<\/code><\/pre>\n<p>\u3053\u3053\u3067\u306f\u3001\u5404\u683c\u7d0d\u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3001Swift\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u3092\u6697\u9ed9\u7684\u306b\u63d0\u4f9b\u3057\u307e\u3059\u3002\u30af\u30e9\u30b9\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u521d\u671f\u5316\u3055\u308c\u308b\u3068\u3001\u30c9\u30c3\u30c8\u6f14\u7b97\u5b50\u3092\u4f7f\u3063\u3066\u3059\u3079\u3066\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u3068\u95a2\u6570\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>var object = A()\r\nobject.a = 10\r\nobject.c = 2\r\n<\/code><\/pre>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3001init()\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3057\u3066\u4fdd\u5b58\u3055\u308c\u305f\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u521d\u671f\u5316\u3059\u308b\u65b9\u6cd5\u304c2\u3064\u76ee\u306e\u65b9\u6cd5\u3067\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>class A{\r\n    \r\n    var a : Int\r\n    var b : String\r\n    var c : Int?\r\n    let website = \"JournalDev\"\r\n    \r\n    init(a: Int, b: String) {\r\n        self.a = a\r\n        self.b = b\r\n    }\r\n}\r\n\r\nvar object = A(a: 5, b: \"Hello World\")\r\n<\/code><\/pre>\n<p>\u6ce8\u610f\uff1aSwift\u306e\u30aa\u30d7\u30b7\u30e7\u30ca\u30eb\u306f\u3001\u30b9\u30c8\u30a2\u30c9\u30d7\u30ed\u30d1\u30c6\u30a3\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u3057\u305f\u304c\u3063\u3066\u3001\u521d\u671f\u5316\u3059\u308b\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u30b9\u30c8\u30a2\u30c9\u30d7\u30ed\u30d1\u30c6\u30a3\u306finit()\u30e1\u30bd\u30c3\u30c9\u5185\u3067self\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u4f7f\u7528\u3057\u3066\u30a2\u30af\u30bb\u30b9\u3055\u308c\u307e\u3059\u3002\u6ce8\u610f\uff1aself\u306f\u3001\u81ea\u5206\u81ea\u8eab\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30e1\u30bd\u30c3\u30c9\u5185\u3067\u73fe\u5728\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u53c2\u7167\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3055\u308c\u307e\u3059\uff08Java\u306ethis\u3068\u540c\u69d8\uff09\u3002\u4e0a\u8a18\u306e\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u306f\u30af\u30e9\u30b9\u306e\u4e3b\u8981\u306a\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u3067\u3059\u3002\u3053\u308c\u306f\u30c7\u30b6\u30a4\u30cd\u30fc\u30c8\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u3068\u3082\u547c\u3070\u308c\u307e\u3059\uff08\u5f8c\u3067\u8a73\u3057\u304f\u8aac\u660e\u3057\u307e\u3059\uff09\u3002\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u3092\u4f7f\u7528\u3059\u308b\u3068\u3001\u5b9a\u6570\u30d7\u30ed\u30d1\u30c6\u30a3\u3082\u5909\u66f4\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>class A{\r\n    \r\n    var a : Int\r\n    var b : String\r\n    var c : Int?\r\n    let website : String\r\n    \r\n    init(a: Int, b: String, website: String) {\r\n        self.a = a\r\n        self.b = b\r\n        self.website = website\r\n    }\r\n}\r\n\r\nvar object = A(a: 5,b: \"Hello World\", website: \"JournalDev\")\r\n<\/code><\/pre>\n<h3>\u69cb\u9020\u4f53\u306e\u30e1\u30f3\u30d0\u30fc\u30ef\u30a4\u30ba\u306a\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u30fc<\/h3>\n<p>\u69cb\u9020\u4f53\u306f\u5024\u306e\u578b\u3067\u3042\u308b\u305f\u3081\u3001\u5fc5\u305a\u3057\u3082\u521d\u671f\u5316\u5b50\u3092\u5b9a\u7fa9\u3059\u308b\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u69cb\u9020\u4f53\u578b\u306f\u3001\u30ab\u30b9\u30bf\u30e0\u306e\u521d\u671f\u5316\u5b50\u3092\u5b9a\u7fa9\u3057\u3066\u3044\u306a\u3044\u9650\u308a\u3001\u81ea\u52d5\u7684\u306b\u30e1\u30f3\u30d0\u30fc\u30ef\u30a4\u30ba\u306e\u521d\u671f\u5316\u5b50\u3092\u53d7\u3051\u53d6\u308a\u307e\u3059\u3002\u4ee5\u4e0b\u306f\u3001\u69cb\u9020\u4f53\u3092\u521d\u671f\u5316\u3059\u308b\u3055\u307e\u3056\u307e\u306a\u65b9\u6cd5\u3092\u8aac\u660e\u3059\u308b\u30b3\u30fc\u30c9\u30b9\u30cb\u30da\u30c3\u30c8\u3067\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>struct Rect{\r\n    var length : Int\r\n    var breadth : Int\r\n}\r\nvar r = Rect(length: 5, breadth: 10)\r\n<\/code><\/pre>\n<pre class=\"post-pre\"><code>struct Rect{\r\n    var length : Int = 5\r\n    var breadth : Int = 10\r\n}\r\n\r\nvar r = Rect()\r\nvar r1 = Rect(length: 10, breadth: 5)\r\n<\/code><\/pre>\n<p>\u4e0a\u8a18\u306e\u30b9\u30cb\u30da\u30c3\u30c8\u3067\u306f\u3001\u683c\u7d0d\u3055\u308c\u305f\u30d7\u30ed\u30d1\u30c6\u30a3\u306b\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u3092\u5272\u308a\u5f53\u3066\u305f\u305f\u3081\u3001\u30e1\u30f3\u30d0\u30fc\u306e\u521d\u671f\u5316\u306a\u3057\u306b\u30c7\u30d5\u30a9\u30eb\u30c8\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u304c\u63d0\u4f9b\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>struct Rect{\r\n    var length : Int\r\n    var breadth : Int\r\n    \r\n    init(length: Int, breadth: Int) {\r\n        self.length =  length + 10\r\n        self.breadth = breadth + 10\r\n    }\r\n}\r\nvar r = Rect(length: 10, breadth: 5)\r\n<\/code><\/pre>\n<p>\u4e0a\u8a18\u306e\u5834\u5408\u3001\u79c1\u305f\u3061\u306f\u72ec\u81ea\u306e\u30ab\u30b9\u30bf\u30e0\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u3092\u5b9a\u7fa9\u3057\u307e\u3057\u305f\u3002\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u306b\u5916\u90e8\u540d\u304c\u5fc5\u8981\u306a\u3044\u5834\u5408\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306b\u30a2\u30f3\u30c0\u30fc\u30b9\u30b3\u30a2\u300c_\u300d\u304c\u4f7f\u7528\u3055\u308c\u3001\u540c\u3058\u3053\u3068\u3092\u793a\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>class A{\r\n    \r\n    var a : Int\r\n    var b : String\r\n    var c : Int?\r\n    let website = \"JournalDev\"\r\n    \r\n    init(_ a: Int, _ b: String) {\r\n        self.a = a\r\n        self.b = b\r\n    }\r\n}\r\n\r\nvar object = A(5,\"Hello World\")\r\n<\/code><\/pre>\n<pre class=\"post-pre\"><code>struct Rect{\r\n    var length : Int\r\n    var breadth : Int\r\n    \r\n    init(_ length: Int, _ breadth: Int) {\r\n        self.length =  length + 10\r\n        self.breadth = breadth + 10\r\n    }\r\n}\r\nvar r = Rect(10, 10)\r\n<\/code><\/pre>\n<h3>Swift\u306e\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u306e\u7a2e\u985e<\/h3>\n<p>\u30af\u30e9\u30b9\u306e\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u306f\u3001\u5927\u307e\u304b\u306b\u4ee5\u4e0b\u306e\u30bf\u30a4\u30d7\u306b\u5206\u985e\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u6307\u5b9a\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6: \u3053\u308c\u306f\u30af\u30e9\u30b9\u306e\u4e3b\u8981\u306a\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u3067\u3059\u3002\u30b9\u30fc\u30d1\u30fc\u30af\u30e9\u30b9\u306e\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u3092\u547c\u3073\u51fa\u3059\u524d\u306b\u3001\u30af\u30e9\u30b9\u3067\u5c0e\u5165\u3055\u308c\u305f\u3059\u3079\u3066\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u5b8c\u5168\u306b\u521d\u671f\u5316\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u30af\u30e9\u30b9\u306f\u8907\u6570\u306e\u6307\u5b9a\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u3092\u6301\u3064\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3059\u3079\u3066\u306e\u30af\u30e9\u30b9\u306f\u5c11\u306a\u304f\u3068\u30821\u3064\u306e\u6307\u5b9a\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u3092\u6301\u3064\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\u4fbf\u5229\u306a\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6: \u3053\u308c\u3089\u306f\u30af\u30e9\u30b9\u306e\u88dc\u52a9\u7684\u306a\u4e8c\u6b21\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u3067\u3059\u3002\u540c\u3058\u30af\u30e9\u30b9\u306e\u6307\u5b9a\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u3092\u547c\u3073\u51fa\u3059\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u308c\u3089\u306f\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u3001\u30ab\u30b9\u30bf\u30e0\u306e\u8a2d\u5b9a\u306b\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u66f8\u5f0f\u306f\u540c\u3058\u3067\u3059\u304c\u3001init\u30ad\u30fc\u30ef\u30fc\u30c9\u306e\u524d\u306b\u4fbf\u5229\u3055\u4fee\u98fe\u5b50\u304c\u7f6e\u304b\u308c\u307e\u3059\u3002<\/ol>\n<pre class=\"post-pre\"><code>class Student{\r\n    \r\n    var name : String\r\n    var degree : String\r\n    \r\n    init(name : String, degree: String) {\r\n        self.name = name\r\n        self.degree = degree\r\n    }\r\n    \r\n    convenience init()\r\n    {\r\n        self.init(name: \"Unnamed\", degree: \"Computer Science\")\r\n    }\r\n    \r\n}\r\nvar student = Student()\r\nstudent.degree \/\/ \"Computer Science\"\r\nstudent.name \/\/ \"Unnamed\"\r\n<\/code><\/pre>\n<p>\u30b3\u30f3\u30d3\u30cb\u30a8\u30f3\u30b9\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u306f\u3001\u4fdd\u5b58\u3055\u308c\u305f\u30d7\u30ed\u30d1\u30c6\u30a3\u306b\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u3092\u5272\u308a\u5f53\u3066\u308b\u969b\u306b\u5f79\u7acb\u3061\u307e\u3059\u3002<\/p>\n<h3>\u30d0\u30ea\u30e5\u30fc\u30bf\u30a4\u30d7\u306e\u305f\u3081\u306e\u30b9\u30a6\u30a3\u30d5\u30c8\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u30c7\u30ea\u30b2\u30fc\u30b7\u30e7\u30f3<\/h3>\n<p>\u540c\u4e00\u306e\u69cb\u9020\u4f53\u5185\u3067\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u3092\u547c\u3073\u51fa\u3059\u3053\u3068\u306b\u3088\u308a\u3001\u30b3\u30fc\u30c9\u306e\u91cd\u8907\u3092\u907f\u3051\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u69cb\u9020\u4f53\u306e\u3088\u3046\u306a\u5024\u578b\u306f\u7d99\u627f\u3092\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u307e\u305b\u3093\u3002\u3057\u305f\u304c\u3063\u3066\u3001\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u3092\u540c\u3058\u69cb\u9020\u4f53\u5185\u304b\u3089\u547c\u3073\u51fa\u3059\u3053\u3068\u304c\u552f\u4e00\u306e\u53ef\u80fd\u306a\u65b9\u6cd5\u3067\u3059\u3002\u4ee5\u4e0b\u306b\u4f8b\u3092\u793a\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>struct Rect{\r\n    var length : Int\r\n    var breadth : Int\r\n    \r\n    init(_ length: Int, _ breadth: Int) {\r\n        self.length =  length\r\n        self.breadth = breadth\r\n    }\r\n    \r\n    init(_ length: Int)\r\n    {\r\n        self.init(length, length)\r\n    }\r\n}\r\nvar r = Rect(10, 5)\r\nvar r1 = Rect(15) \/\/initialises the length and breadth to 15\r\n<\/code><\/pre>\n<h3>\u53c2\u7167\u578b\u306e\u305f\u3081\u306e\u30b9\u30a6\u30a3\u30d5\u30c8\u306e\u521d\u671f\u5316\u5b50\u306e\u59d4\u8b72<\/h3>\n<p>\u30af\u30e9\u30b9\u306f\u53c2\u7167\u578b\u3067\u3042\u308a\u3001\u7d99\u627f\u3092\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u307e\u3059\u3002\u305d\u306e\u305f\u3081\u3001\u521d\u671f\u5316\u5b50\u306f\u30b9\u30fc\u30d1\u30fc\u30af\u30e9\u30b9\u304b\u3089\u4ed6\u306e\u521d\u671f\u5316\u5b50\u3092\u547c\u3073\u51fa\u3059\u3053\u3068\u3082\u3067\u304d\u3001\u3059\u3079\u3066\u306e\u5024\u3092\u9069\u5207\u306b\u7d99\u627f\u304a\u3088\u3073\u521d\u671f\u5316\u3059\u308b\u305f\u3081\u306e\u8cac\u4efb\u3092\u8ffd\u52a0\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u521d\u671f\u5316\u5b50\u306e\u9593\u306e\u95a2\u4fc2\u3092\u51e6\u7406\u3059\u308b\u305f\u3081\u306b\u5b9a\u7fa9\u3055\u308c\u305f\u4e3b\u306a\u30eb\u30fc\u30eb\u306f\u6b21\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/p>\n<ul class=\"post-ul\">\n<li>A designated initializer must call a designated initializer from its immediate superclass.<\/li>\n<li>A convenience initializer must call another initializer from the same class.<\/li>\n<li>A convenience initializer must ultimately call a designated initializer.<\/li>\n<\/ul>\n<p>\u4e0a\u8a18\u306e\u30eb\u30fc\u30eb\u306f\u3001\u4ee5\u4e0b\u306e\u30a4\u30e9\u30b9\u30c8\u3067\u8aac\u660e\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/656481f7daa94e2bdf7b9a73\/39-0.png\" alt=\"swift init, swift initialization delegation flow\" \/><\/div>\n<p>\u6307\u5b9a\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u306f\u5e38\u306b\u4e0a\u4f4d\u306b\u59d4\u8b72\u3057\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002\u30b3\u30f3\u30d3\u30cb\u30a8\u30f3\u30b9\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u306f\u5e38\u306b\u6a2a\u65ad\u7684\u306b\u59d4\u8b72\u3057\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002\u30b5\u30d6\u30af\u30e9\u30b9\u306e\u30b3\u30f3\u30d3\u30cb\u30a8\u30f3\u30b9\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u3067\u306f\u3001super\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n<h3>\u30b9\u30a4\u30d5\u30c8\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u306e\u7d99\u627f\u3068\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9<\/h3>\n<p>Swift\u306e\u30b5\u30d6\u30af\u30e9\u30b9\u306f\u3001\u7279\u5b9a\u306e\u6761\u4ef6\u304c\u6e80\u305f\u3055\u308c\u306a\u3044\u9650\u308a\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u30b9\u30fc\u30d1\u30fc\u30af\u30e9\u30b9\u306e\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u3092\u7d99\u627f\u3057\u307e\u305b\u3093\uff08\u81ea\u52d5\u7684\u306a\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u306e\u7d99\u627f\uff09\u3002\u3053\u308c\u306f\u3001\u30b5\u30d6\u30af\u30e9\u30b9\u3067\u672a\u5b8c\u6210\u306e\u521d\u671f\u5316\u3092\u9632\u3050\u305f\u3081\u306b\u884c\u308f\u308c\u307e\u3059\u3002\u6307\u5b9a\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u3068\u4fbf\u5229\u306a\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u304c\u7d99\u627f\u3055\u308c\u308b\u4ed5\u7d44\u307f\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002\u95a2\u9023\u3059\u308b\u30b5\u30d6\u30af\u30e9\u30b9\u306b\u7d99\u627f\u3055\u308c\u308bVehicle\u306e\u57fa\u672c\u30af\u30e9\u30b9\u3092\u5b9a\u7fa9\u3057\u307e\u3059\u3002\u30af\u30e9\u30b9\u306e\u4e2d\u3067Enum\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\u4ee5\u4e0b\u306b\u57fa\u672c\u30af\u30e9\u30b9Vehicle\u306e\u5b9a\u7fa9\u3092\u793a\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>enum VehicleType : String {\r\n    case twoWheeler = \"TwoWheeler\"\r\n    case fourWheeler = \"FourWheeler\"\r\n}\r\n\r\nclass Vehicle{\r\n    \r\n    var vehicleType : VehicleType\r\n    \r\n    init(vehicleType: VehicleType) {\r\n        self.vehicleType = vehicleType\r\n        print(\"Class Vehicle. vehicleType is \\(self.vehicleType.rawValue)\\n\")\r\n    }\r\n    \r\n    convenience init()\r\n    {\r\n        self.init(vehicleType: .fourWheeler)\r\n    }\r\n}\r\n\r\nvar v = Vehicle(vehicleType: .twoWheeler)\r\n<\/code><\/pre>\n<p>\u30ce\u30fc\u30c8\uff1a\u30b3\u30f3\u30d3\u30cb\u30a8\u30f3\u30b9\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u306f\u3001self.init\u3092\u4f7f\u7528\u3057\u3066\u3001\u540c\u3058\u30af\u30e9\u30b9\u306e\u6307\u5b9a\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u3092\u547c\u3073\u51fa\u3055\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002\u4e0a\u8a18\u30af\u30e9\u30b9\u306e\u30b5\u30d6\u30af\u30e9\u30b9\u3092\u4ee5\u4e0b\u306b\u793a\u3059\u3088\u3046\u306b\u5b9a\u7fa9\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"post-pre\"><code>enum TwoWheelerType : String\r\n{\r\n    case scooty = \"Scooty\"\r\n    case bike = \"Bike\"\r\n}\r\n\r\nclass TwoWheeler : Vehicle{\r\n    \r\n    var twoWheelerType : TwoWheelerType\r\n    var manufacturer : String\r\n    \r\n    init(twoWheelerType : TwoWheelerType, manufacturer : String, vType : VehicleType) {\r\n        self.twoWheelerType = twoWheelerType\r\n        self.manufacturer = manufacturer\r\n        print(\"Class TwoWheeler. \\(self.twoWheelerType.rawValue) manufacturer is \\(self.manufacturer)\")\r\n        super.init(vehicleType: vType)\r\n        \r\n    }\r\n}\r\n<\/code><\/pre>\n<p>\u91cd\u8981\u306a\u30dd\u30a4\u30f3\u30c8\u306b\u3064\u3044\u3066\u6ce8\u610f\u3059\u308b\u3053\u3068\uff1a<\/p>\n<ul class=\"post-ul\">\n<li>The designated initializer of the subclass must initialize its own properties before calling the designated initializer of the superclass.<\/li>\n<li>A subclass can modify inherited properties of the superclass only after the super.init is called.<\/li>\n<\/ul>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u306f\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u30a8\u30e9\u30fc\u3092\u5f15\u304d\u8d77\u3053\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>class TwoWheeler : Vehicle{\r\n    \r\n    var twoWheelerType : TwoWheelerType\r\n    var manufacturer : String\r\n    \r\n    init(twoWheelerType : TwoWheelerType, manufacturer : String, vType : VehicleType) {\r\n        self.twoWheelerType = twoWheelerType\r\n        self.manufacturer = manufacturer\r\n        self.vehicleType = vType \/\/Won't compile\r\n        super.init(vehicleType: vType)\r\n        \/\/self.vehicleType = .fourWheeler \/\/This would work.\r\n        \r\n    }\r\n}\r\n\r\nvar t = TwoWheeler(twoWheelerType: .scooty, manufacturer: \"Hero Honda\", vType: .twoWheeler)\r\n<\/code><\/pre>\n<p>\u524d\u8ff0\u306e\u901a\u308a\u3001\u30b5\u30d6\u30af\u30e9\u30b9\u306b\u306f\u81ea\u52d5\u7684\u306b\u30b9\u30fc\u30d1\u30fc\u30af\u30e9\u30b9\u306e\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u306f\u7d99\u627f\u3055\u308c\u306a\u3044\u305f\u3081\u3001\u4e0b\u8a18\u306e\u521d\u671f\u5316\u306f\u5931\u6557\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>var t = TwoWheeler(vehicleType: .twoWheeler) \/\/manufacturer property isn't initialized.\r\n<\/code><\/pre>\n<p>\u30b5\u30d6\u30af\u30e9\u30b9\u306e\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u3092\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u3059\u308b\u305f\u3081\u306b\u306f\u3001\u30b9\u30fc\u30d1\u30fc\u30af\u30e9\u30b9\u306e\u6307\u5b9a\u3055\u308c\u305f\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u3068\u4e00\u81f4\u3055\u305b\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u306e\u5834\u5408\u3001\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u306b\u306foverride\u30ad\u30fc\u30ef\u30fc\u30c9\u304c\u8ffd\u52a0\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>class TwoWheeler : Vehicle{\r\n    \r\n    var twoWheelerType : TwoWheelerType\r\n    var manufacturer : String\r\n    \r\n    init(twoWheelerType : TwoWheelerType, manufacturer : String, vType : VehicleType) {\r\n        self.twoWheelerType = twoWheelerType\r\n        self.manufacturer = manufacturer\r\n        print(\"Class TwoWheeler. \\(self.twoWheelerType.rawValue) manufacturer is \\(self.manufacturer)\")\r\n        super.init(vehicleType: vType)\r\n        \r\n    }\r\n    \r\n    override init(vehicleType: VehicleType)\r\n    {\r\n        print(\"Class TwoWheeler. Overriden Initializer. \\(vehicleType.rawValue)\")\r\n        self.twoWheelerType = .bike\r\n        self.manufacturer = \"Not defined\"\r\n        super.init(vehicleType: vehicleType)\r\n    }\r\n\r\n\r\n\r\n<\/code><\/pre>\n<p>\u4ee5\u4e0b\u306e\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u306f\u3001\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u540d\u524d\u304c\u7570\u306a\u308b\u305f\u3081\u3001\u30b9\u30fc\u30d1\u30fc\u30af\u30e9\u30b9\u306e\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u3092\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u3057\u3066\u3044\u307e\u305b\u3093\u3002<\/p>\n<pre class=\"post-pre\"><code>\/\/This would give a compile-time error since the parameter v doesn't match with the superclass.\r\noverride init(v: VehicleType)\r\n    {\r\n        self.twoWheelerType = .bike\r\n        self.manufacturer = \"Not defined\"\r\n        super.init(vehicleType: v)\r\n    }\r\n<\/code><\/pre>\n<p>\u30b9\u30fc\u30d1\u30fc\u30af\u30e9\u30b9\u306e\u521d\u671f\u5316\u5b50\u3092\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u3059\u308b\u305f\u3081\u306b\u3001\u30b3\u30f3\u30d3\u30cb\u30a8\u30f3\u30b9\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u3092\u4f7f\u7528\u3059\u308b\u3002<\/p>\n<pre class=\"post-pre\"><code>class TwoWheeler : Vehicle{\r\n    \r\n    var twoWheelerType : TwoWheelerType\r\n    var manufacturer : String\r\n    \r\n    init(twoWheelerType : TwoWheelerType, manufacturer : String, vType : VehicleType) {\r\n        self.twoWheelerType = twoWheelerType\r\n        self.manufacturer = manufacturer\r\n        print(\"Class TwoWheeler. \\(self.twoWheelerType.rawValue) manufacturer is \\(self.manufacturer)\")\r\n        super.init(vehicleType: vType)\r\n        \r\n    }\r\n    \r\n    override convenience init(vehicleType: VehicleType) {\r\n        self.init(twoWheelerType: .bike, manufacturer: \"Not Defined\", vType: .twoWheeler)\r\n        self.vehicleType = vehicleType\r\n    }\r\n}\r\nvar t = TwoWheeler(twoWheelerType: .scooty, manufacturer: \"Hero Honda\", vType: .twoWheeler)\r\nt = TwoWheeler(vehicleType: .twoWheeler)\r\n\r\n\/\/Output\r\nFollowing gets printed on the console:\r\nClass TwoWheeler. Scooty manufacturer is Hero Honda\r\nClass Vehicle. vehicleType is TwoWheeler\r\n\r\nClass TwoWheeler. Bike manufacturer is Not Defined\r\nClass Vehicle. vehicleType is TwoWheeler\r\n\r\n<\/code><\/pre>\n<p>\u4ee5\u4e0b\u306e\u6587\u3092\u65e5\u672c\u8a9e\u3067\u8a00\u3044\u63db\u3048\u308b\uff081\u3064\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u307f\uff09\uff1a<br \/>\n\u4fbf\u5229\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u30fc\u306b\u306f\u3001\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u30ad\u30fc\u30ef\u30fc\u30c9\u304c\u8ffd\u52a0\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u305d\u308c\u306f\u540c\u3058\u30af\u30e9\u30b9\u306e\u6307\u5b9a\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u30fc\u3092\u547c\u3073\u51fa\u3057\u307e\u3059\u3002\u6ce8\u610f\uff1a\u30ad\u30fc\u30ef\u30fc\u30c9\u306e\u9806\u5e8f\u306f\u3001\u4fbf\u5229\u6027\u3068\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u306e\u4e21\u65b9\u306e\u5834\u5408\u3067\u554f\u984c\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<h3>\u5fc5\u8981\u306a\u521d\u671f\u5316\u5b50<\/h3>\n<p>\u4e0a\u8a18\u306e2\u3064\u306e\u30af\u30e9\u30b9\u306eRequired Initializers\u306e\u4f8b\u3092\u4ee5\u4e0b\u306b\u793a\u3059\u3002\u6ce8\u610f\u3059\u3079\u304d\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u306e\u524d\u306b\u66f8\u304f\u3053\u3068\u3067\u3001\u5404\u30b5\u30d6\u30af\u30e9\u30b9\u304c\u305d\u306e\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u3092\u5b9f\u88c5\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3053\u3068\u3092\u793a\u3057\u307e\u3059\u3002\u307e\u305f\u3001\u5fc5\u8981\u306a\u4fee\u98fe\u5b50\u3082\u305d\u308c\u305e\u308c\u306e\u30b5\u30d6\u30af\u30e9\u30b9\u306e\u5b9f\u88c5\u306b\u542b\u307e\u308c\u3066\u3044\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>class Vehicle{\r\n    \r\n    var vehicleType : VehicleType\r\n    \r\n    required init(vehicleType: VehicleType) {\r\n        self.vehicleType = vehicleType\r\n        print(\"Class Vehicle. vehicleType is \\(self.vehicleType.rawValue)\\n\")\r\n    }\r\n    \r\n    convenience init()\r\n    {\r\n        self.init(vehicleType: .fourWheeler)\r\n    }\r\n}\r\n\r\nclass TwoWheeler : Vehicle{\r\n    \r\n    var twoWheelerType : TwoWheelerType\r\n    var manufacturer : String\r\n    \r\n    init(twoWheelerType : TwoWheelerType, manufacturer : String, vType : VehicleType) {\r\n        self.twoWheelerType = twoWheelerType\r\n        self.manufacturer = manufacturer\r\n        print(\"Class TwoWheeler. \\(self.twoWheelerType.rawValue) manufacturer is \\(self.manufacturer)\")\r\n        super.init(vehicleType: vType)\r\n        \r\n    }\r\n    \r\n     required init(vehicleType: VehicleType) {\r\n        self.manufacturer = \"Not Defined\"\r\n        self.twoWheelerType = .bike\r\n        super.init(vehicleType: vehicleType)\r\n    }\r\n}\r\n<\/code><\/pre>\n<p>\u6ce8\u610f\uff1a\u5fc5\u8981\u306a\u4fee\u98fe\u5b50\u3092\u8ffd\u52a0\u3059\u308b\u3068\u3001\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u304c\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u3055\u308c\u308b\u3053\u3068\u3092\u793a\u3057\u307e\u3059\u3002\u3057\u305f\u304c\u3063\u3066\u3001\u4e0a\u8a18\u306e\u5834\u5408\u306f\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u7701\u7565\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u5fc5\u8981\u306a\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u3092\u4f7f\u7528\u3059\u308b\u5834\u5408\u3001\u305d\u308c\u3068\u4fbf\u5229\u306a\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u306f\u72ec\u7acb\u3057\u3066\u304a\u308a\u3001\u4e00\u7dd2\u306b\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002required\u3068convenience\u306e\u4fee\u98fe\u5b50\u3092\u4e00\u7dd2\u306b\u4f7f\u7528\u3059\u308b\u3053\u3068\u3092\u793a\u3059\u305f\u3081\u306b\u3001\u3082\u30461\u3064\u306eVehicle\u306e\u30b5\u30d6\u30af\u30e9\u30b9\u3092\u4f5c\u6210\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"post-pre\"><code>enum FourWheelerType : String\r\n{\r\n    case car = \"Car\"\r\n    case bus = \"Bus\"\r\n    case truck = \"Truck\"\r\n}\r\n\r\n\r\nclass FourWheeler : Vehicle\r\n{\r\n    var fourWheelerType : FourWheelerType\r\n    var name : String\r\n    \r\n    init(fourWheelerType : FourWheelerType, name: String, vehicleType: VehicleType) {\r\n        self.fourWheelerType = fourWheelerType\r\n        self.name = name\r\n        print(\"Class FourWheeler. \\(self.fourWheelerType.rawValue) Model is \\(self.name)\")\r\n        super.init(vehicleType: vehicleType)\r\n        self.vehicleType = vehicleType\r\n    }\r\n    \r\n    required convenience init(vehicleType: VehicleType) {\r\n        self.init(fourWheelerType: .bus, name: \"Mercedes\", vehicleType: vehicleType)\r\n    }\r\n}\r\n\r\n\r\nclass Car : FourWheeler{\r\n    \r\n    var model : String\r\n    \r\n    init(model: String) {\r\n        self.model = model\r\n        print(\"Class Car. Model is \\(self.model)\")\r\n        super.init(fourWheelerType: .car, name: self.model, vehicleType: .fourWheeler)\r\n    }\r\n    \r\n    required init(vehicleType: VehicleType)\r\n    {\r\n        self.model = \"Not defined\"\r\n        print(\"Class Car. Model is \\(self.model)\")\r\n        super.init(fourWheelerType: .car, name: self.model, vehicleType: vehicleType)\r\n    }\r\n    \r\n}\r\n<\/code><\/pre>\n<p>\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u30b9\u30cb\u30da\u30c3\u30c8\u3067\u6ce8\u610f\u3059\u3079\u304d\u91cd\u8981\u306a\u30dd\u30a4\u30f3\u30c8\u306f\u6b21\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<ul class=\"post-ul\">\n<li>Convenience initializers are secondary initializers in a class.<\/li>\n<li>Setting a convenience initializer as required means that implementing it in the subclass is compulsory.<\/li>\n<\/ul>\n<h3>\u81ea\u52d5\u7684\u306a\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u306e\u7d99\u627f<\/h3>\n<p>\u30b9\u30fc\u30d1\u30fc\u30af\u30e9\u30b9\u304b\u3089\u30b5\u30d6\u30af\u30e9\u30b9\u3078\u521d\u671f\u5316\u5b50\u304c\u81ea\u52d5\u7684\u306b\u7d99\u627f\u3055\u308c\u308b\u30b1\u30fc\u30b9\u306f2\u3064\u3042\u308a\u307e\u3059\u3002<\/p>\n<ul class=\"post-ul\">\n<li>Don\u2019t define any designated initializers in your subclass.<\/li>\n<li>Implement all the designated initializers of the superclass. All the convenience initializers would be automatically inherited too.<\/li>\n<\/ul>\n<p>\u4ee5\u4e0b\u306e\u30b9\u30cb\u30da\u30c3\u30c8\u3067\u884c\u52d5\u306e\u6700\u521d\u306e\u30eb\u30fc\u30eb\u304c\u793a\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>class Name {\r\n    \r\n    var name: String\r\n    \r\n    init(n: String) {\r\n        self.name = n\r\n    }\r\n}\r\n\r\nclass Tutorial: Name {\r\n    \r\n    var tutorial : String? = \"Swift Initialization\"\r\n}\r\n\r\nvar parentObject = Name(n: \"Anupam\")\r\nvar childObject = Tutorial(n: \"JournalDev\")\r\n<\/code><\/pre>\n<p>\u4ee5\u4e0b\u306e\u30b9\u30cb\u30da\u30c3\u30c8\u3067\u3001\u884c\u52d5\u306e\u7b2c2\u306e\u30eb\u30fc\u30eb\u304c\u793a\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>class Name {\r\n    \r\n    var name: String\r\n    \r\n    init(n: String) {\r\n        self.name = n\r\n    }\r\n    \r\n    convenience init()\r\n    {\r\n        self.init(n: \"No name assigned\")\r\n    }\r\n}\r\n\r\nclass Tutorial: Name {\r\n    \r\n    var tutorial : String? = \"Swift Tutorial\"\r\n    \r\n    override init(n : String) {\r\n        super.init(n: n)\r\n    }\r\n}\r\n\r\nvar parentObject = Name(n: \"Anupam\")\r\nvar childObject = Tutorial(n: \"JournalDev\")\r\nvar childObject2 = Tutorial()\r\nprint(childObject2.name) \/\/prints \"No name assigned\r\n<\/code><\/pre>\n<p>\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001\u30b9\u30fc\u30d1\u30fc\u30af\u30e9\u30b9\u306e\u30b3\u30f3\u30d3\u30cb\u30a8\u30f3\u30b9\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u306f\u30b5\u30d6\u30af\u30e9\u30b9\u3067\u3082\u81ea\u52d5\u7684\u306b\u5229\u7528\u3067\u304d\u307e\u3059\u3002<\/p>\n<h3>\u30b9\u30a6\u30a3\u30d5\u30c8\u306e\u5931\u6557\u53ef\u80fd\u306a\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6<\/h3>\n<p>\u30af\u30e9\u30b9\u3001\u69cb\u9020\u4f53\u3001\u307e\u305f\u306f\u5217\u6319\u578b\u3067\u3001\u300cinit?\u300d\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u4f7f\u7528\u3057\u3066\u5931\u6557\u53ef\u80fd\u306a\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u3092\u5b9a\u7fa9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u304c\u5931\u6557\u3059\u308b\u3068\u3001\u5931\u6557\u306e\u539f\u56e0\u306b\u306f\u3055\u307e\u3056\u307e\u306a\u3082\u306e\u304c\u3042\u308a\u307e\u3059\u3002\u7121\u52b9\u306a\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u5024\u3001\u5916\u90e8\u30bd\u30fc\u30b9\u306e\u4e0d\u5728\u306a\u3069\u3067\u3059\u3002\u5931\u6557\u53ef\u80fd\u306a\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u306f\u3001\u521d\u671f\u5316\u3059\u308b\u30bf\u30a4\u30d7\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u5024\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u521d\u671f\u5316\u306e\u5931\u6557\u3092\u30c8\u30ea\u30ac\u30fc\u3059\u308b\u305f\u3081\u306b\u3001nil\u304c\u8fd4\u3055\u308c\u307e\u3059\uff08\u305f\u3060\u3057\u3001init\u81ea\u4f53\u306f\u4f55\u3082\u8fd4\u3057\u307e\u305b\u3093\uff09\u3002\u69cb\u9020\u4f53\u306e\u5834\u5408\u306e\u5931\u6557\u53ef\u80fd\u306a\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u3068\u306f\u3069\u306e\u3088\u3046\u306a\u3082\u306e\u304b\u3002<\/p>\n<pre class=\"post-pre\"><code>struct SName {\r\n    let name: String\r\n    init?(name: String) {\r\n        if name.isEmpty { return nil }\r\n        self.name = name\r\n    }\r\n}\r\n\r\nvar name = SName(name: \"JournalDev\")\r\nif name != nil {\r\n    print(\"init success\") \/\/this gets displayed\r\n}\r\nelse{\r\n    print(\"init failed\")\r\n}\r\nname  = SName(name: \"\")\r\n\r\nif name != nil {\r\n    print(\"init success\")\r\n}\r\nelse{\r\n    print(\"init failed\") \/\/this gets displayed\r\n}\r\n\r\n<\/code><\/pre>\n<p>\u5217\u6319\u578b\u3092\u4f7f\u7528\u3057\u305f\u521d\u671f\u5316\u304c\u5931\u6557\u3059\u308b\u5834\u5408<\/p>\n<pre class=\"post-pre\"><code>enum CharacterExists {\r\n    case A, B\r\n    init?(symbol: Character) {\r\n        switch symbol {\r\n        case \"A\":\r\n            self = .A\r\n        case \"B\":\r\n            self = .B\r\n        default:\r\n            return nil\r\n        }\r\n    }\r\n}\r\n\r\n\r\nlet ch = CharacterExists(symbol: \"C\")\r\nif ch != nil {\r\n    print(\"Init failed. Character doesn't exist\")\r\n}\r\n<\/code><\/pre>\n<pre class=\"post-pre\"><code>class CName {\r\n    let name: String\r\n    init?(name: String) {\r\n        if name.isEmpty { return nil }\r\n        self.name = name\r\n    }\r\n}\r\nvar name  = CName(name: \"\")\r\n\r\nif name != nil {\r\n    print(\"init success\")\r\n}\r\nelse{\r\n    print(\"init failed\")\r\n}\r\n<\/code><\/pre>\n<p>\u6ce8\u610f\uff1a\u5931\u6557\u53ef\u80fd\u306a\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u3068\u975e\u5931\u6557\u53ef\u80fd\u306a\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u306f\u3001\u540c\u3058\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u30bf\u30a4\u30d7\u3068\u540d\u524d\u3092\u6301\u3064\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n<h3>\u5931\u6557\u53ef\u80fd\u306a\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u30fc\u3092\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u3059\u308b\u3053\u3068\u3002<\/h3>\n<p>\u30b5\u30d6\u30af\u30e9\u30b9\u3067\u306f\u3001\u5931\u6557\u53ef\u80fd\u306a\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u3092\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u5931\u6557\u53ef\u80fd\u306a\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u306f\u3001\u975e\u5931\u6557\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u3067\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u304c\u3001\u9006\u306f\u3067\u304d\u307e\u305b\u3093\u3002\u4ee5\u4e0b\u306b\u5931\u6557\u53ef\u80fd\u306a\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u3092\u975e\u5931\u6557\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u3067\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u3059\u308b\u4f8b\u304c\u793a\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>class CName {\r\n    let name: String\r\n    init?(name: String) {\r\n        if name.isEmpty { return nil }\r\n        self.name = name\r\n    }\r\n}\r\nvar name  = CName(name: \"\")\r\n\r\nclass SubName : CName{\r\n    \r\n    var age : Int\r\n    override init(name: String)\r\n    {\r\n        self.age = 23\r\n        super.init(name: name)!  \r\n    }\r\n}\r\n<\/code><\/pre>\n<p>\u6ce8\u610f\uff1a\u5f37\u5236\u30a2\u30f3\u30e9\u30c3\u30d7\u306f\u3001\u30b5\u30d6\u30af\u30e9\u30b9\u306e\u975e\u5931\u6557\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u306e\u5b9f\u88c5\u306e\u4e00\u74b0\u3068\u3057\u3066\u3001\u30b9\u30fc\u30d1\u30fc\u30af\u30e9\u30b9\u306e\u5931\u6557\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u3092\u547c\u3073\u51fa\u3059\u305f\u3081\u306b\u4f7f\u7528\u3055\u308c\u307e\u3059\u3002\u3053\u308c\u3067\u3001Swift\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u306f\u7d42\u4e86\u3067\u3059\u3002\u53c2\u8003\u6587\u732e\uff1aApple Docs<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u306eSwift\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001\u91cd\u8981\u306a\u6982\u5ff5\u3067\u3042\u308b\u300cSwift init\u300d\u307e\u305f\u306f\u300cSwift\u306e\u521d\u671f\u5316\u300d\u306b\u3064\u3044\u3066\u8a71\u3057\u5408\u3044\u307e\u3059\u3002\u521d\u671f\u5316\u306f\u3001\u3042\u308b\u578b\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u6210\u3059\u308b\u969b\u306b\u884c\u308f\u308c\u308b\u51e6\u7406\u3067\u3059\u3002 \u30b9\u30a6\u30a3\u30d5\u30c8\u306e\u521d\u671f\u5316(init) [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[26,61],"class_list":["post-271","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-26","tag-61"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u30b9\u30a6\u30a3\u30d5\u30c8\u306einit() - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"\u30b9\u30a6\u30a3\u30d5\u30c8\u306einit()\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/ja\/blog\/\u30b9\u30a6\u30a3\u30d5\u30c8\u306einit\/\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u30b9\u30a6\u30a3\u30d5\u30c8\u306einit()\" \/>\n<meta property=\"og:description\" content=\"\u30b9\u30a6\u30a3\u30d5\u30c8\u306einit()\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/ja\/blog\/\u30b9\u30a6\u30a3\u30d5\u30c8\u306einit\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-03-20T10:35:45+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-07-31T13:12:27+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/656481f7daa94e2bdf7b9a73\/39-0.png\" \/>\n<meta name=\"author\" content=\"\u590f\u6a39, \u98a8\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u57f7\u7b46\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u590f\u6a39, \u98a8\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"32\u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/%e3%82%b9%e3%82%a6%e3%82%a3%e3%83%95%e3%83%88%e3%81%aeinit\/\",\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/%e3%82%b9%e3%82%a6%e3%82%a3%e3%83%95%e3%83%88%e3%81%aeinit\/\",\"name\":\"\u30b9\u30a6\u30a3\u30d5\u30c8\u306einit() - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#website\"},\"datePublished\":\"2023-03-20T10:35:45+00:00\",\"dateModified\":\"2025-07-31T13:12:27+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/4e591db2661c4cc425470b461259391d\"},\"description\":\"\u30b9\u30a6\u30a3\u30d5\u30c8\u306einit()\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/%e3%82%b9%e3%82%a6%e3%82%a3%e3%83%95%e3%83%88%e3%81%aeinit\/#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/ja\/blog\/%e3%82%b9%e3%82%a6%e3%82%a3%e3%83%95%e3%83%88%e3%81%aeinit\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/%e3%82%b9%e3%82%a6%e3%82%a3%e3%83%95%e3%83%88%e3%81%aeinit\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/ja\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u30b9\u30a6\u30a3\u30d5\u30c8\u306einit()\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"ja\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/4e591db2661c4cc425470b461259391d\",\"name\":\"\u590f\u6a39, \u98a8\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/65e0ff40534461b1fa000382dc194e1716f793ab0bcb218ac3c40895551a08c5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/65e0ff40534461b1fa000382dc194e1716f793ab0bcb218ac3c40895551a08c5?s=96&d=mm&r=g\",\"caption\":\"\u590f\u6a39, \u98a8\"},\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/author\/natsukikaze\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/%e3%82%b9%e3%82%a6%e3%82%a3%e3%83%95%e3%83%88%e3%81%aeinit\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u30b9\u30a6\u30a3\u30d5\u30c8\u306einit() - Blog - Silicon Cloud","description":"\u30b9\u30a6\u30a3\u30d5\u30c8\u306einit()\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/ja\/blog\/\u30b9\u30a6\u30a3\u30d5\u30c8\u306einit\/","og_locale":"ja_JP","og_type":"article","og_title":"\u30b9\u30a6\u30a3\u30d5\u30c8\u306einit()","og_description":"\u30b9\u30a6\u30a3\u30d5\u30c8\u306einit()\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002","og_url":"https:\/\/www.silicloud.com\/ja\/blog\/\u30b9\u30a6\u30a3\u30d5\u30c8\u306einit\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-03-20T10:35:45+00:00","article_modified_time":"2025-07-31T13:12:27+00:00","og_image":[{"url":"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/656481f7daa94e2bdf7b9a73\/39-0.png"}],"author":"\u590f\u6a39, \u98a8","twitter_card":"summary_large_image","twitter_misc":{"\u57f7\u7b46\u8005":"\u590f\u6a39, \u98a8","\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593":"32\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/ja\/blog\/%e3%82%b9%e3%82%a6%e3%82%a3%e3%83%95%e3%83%88%e3%81%aeinit\/","url":"https:\/\/www.silicloud.com\/ja\/blog\/%e3%82%b9%e3%82%a6%e3%82%a3%e3%83%95%e3%83%88%e3%81%aeinit\/","name":"\u30b9\u30a6\u30a3\u30d5\u30c8\u306einit() - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#website"},"datePublished":"2023-03-20T10:35:45+00:00","dateModified":"2025-07-31T13:12:27+00:00","author":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/4e591db2661c4cc425470b461259391d"},"description":"\u30b9\u30a6\u30a3\u30d5\u30c8\u306einit()\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/%e3%82%b9%e3%82%a6%e3%82%a3%e3%83%95%e3%83%88%e3%81%aeinit\/#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/ja\/blog\/%e3%82%b9%e3%82%a6%e3%82%a3%e3%83%95%e3%83%88%e3%81%aeinit\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/ja\/blog\/%e3%82%b9%e3%82%a6%e3%82%a3%e3%83%95%e3%83%88%e3%81%aeinit\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/ja\/blog\/"},{"@type":"ListItem","position":2,"name":"\u30b9\u30a6\u30a3\u30d5\u30c8\u306einit()"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#website","url":"https:\/\/www.silicloud.com\/ja\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"ja"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/4e591db2661c4cc425470b461259391d","name":"\u590f\u6a39, \u98a8","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/65e0ff40534461b1fa000382dc194e1716f793ab0bcb218ac3c40895551a08c5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/65e0ff40534461b1fa000382dc194e1716f793ab0bcb218ac3c40895551a08c5?s=96&d=mm&r=g","caption":"\u590f\u6a39, \u98a8"},"url":"https:\/\/www.silicloud.com\/ja\/blog\/author\/natsukikaze\/"},{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/%e3%82%b9%e3%82%a6%e3%82%a3%e3%83%95%e3%83%88%e3%81%aeinit\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/271","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/comments?post=271"}],"version-history":[{"count":1,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/271\/revisions"}],"predecessor-version":[{"id":38491,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/271\/revisions\/38491"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/media?parent=271"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/categories?post=271"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/tags?post=271"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}