{"id":1477,"date":"2017-05-20T10:38:59","date_gmt":"2017-05-20T01:38:59","guid":{"rendered":"http:\/\/www.chihayafuru.jp\/tech\/?p=1477"},"modified":"2017-05-20T11:23:20","modified_gmt":"2017-05-20T02:23:20","slug":"swift%e3%81%aesingleton%e3%83%91%e3%82%bf%e3%83%bc%e3%83%b3","status":"publish","type":"post","link":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/archives\/1477","title":{"rendered":"Swift\u306eSingleton\u30d1\u30bf\u30fc\u30f3"},"content":{"rendered":"<h2>\u5ba3\u8a00\u30b3\u30fc\u30c9<\/h2>\n<pre class=\"lang:swift decode:true \" title=\"\u5ba3\u8a00\u30b3\u30fc\u30c9\" >class SomeSingletonClass: NSObject {\r\n    private init() {  \u7701\u7565  }\r\n    static let sharedInstance = SomeSingletonClass()    \r\n}<\/pre>\n<h2>\u53c2\u7167\u30b3\u30fc\u30c9<\/h2>\n<pre class=\"lang:swift decode:true \" title=\"\u53c2\u7167\u30b3\u30fc\u30c9\" >var someSingletonInstance : SomeSingletonClass = SomeSingletonClass.sharedInstance<\/pre>\n<ul>\n<li>\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u3092private\u4fee\u98fe\u3057\u3066\u30af\u30e9\u30b9\u306e\u5916\u90e8\u304b\u3089\u53c2\u7167\u3067\u304d\u306a\u3044\u3088\u3046\u306b\u3059\u308b\u3002<\/li>\n<li><code>struct<\/code>\u3092\u4f7f\u3046\u306e\u306f\u53e4\u3044\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u30b9\u30bf\u30a4\u30eb\u3002\u4ee3\u308f\u308a\u306b<code>static let<\/code>\u69cb\u6587\u3092\u4f7f\u3046\u3002<\/li>\n<li><code>static func getSharedInstance()<\/code> \u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3046\u306e\u306f\u3001\u3055\u3089\u306b\u53e4\u3044\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u30b9\u30bf\u30a4\u30eb\u3002\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u5ba3\u8a00\u30b3\u30fc\u30c9 class SomeSingletonClass: NSObject { private init() { \u7701\u7565 } static let sharedInstance = SomeSingletonClas [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[22],"class_list":["post-1477","post","type-post","status-publish","format-standard","hentry","category-memo","tag-swift"],"_links":{"self":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/1477","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/comments?post=1477"}],"version-history":[{"count":5,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/1477\/revisions"}],"predecessor-version":[{"id":1483,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/1477\/revisions\/1483"}],"wp:attachment":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/media?parent=1477"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/categories?post=1477"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/tags?post=1477"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}