{"id":401,"date":"2021-09-17T15:22:52","date_gmt":"1970-01-01T00:00:00","guid":{"rendered":"http:\/\/swift.tecc0.com\/?p=401"},"modified":"2021-09-17T15:22:52","modified_gmt":"1970-01-01T00:00:00","slug":"post-401","status":"publish","type":"post","link":"https:\/\/swift.tecc0.com\/?p=401","title":{"rendered":"Swift\u306eswitch\u6587\u3067enum(\u5217\u6319\u578b)\u3092\u4f7f\u3046\u65b9\u6cd5"},"content":{"rendered":"<p>Swift\u3067\u3082<strong>Switch<\/strong>\u6587\u304c\u3042\u308a\u3001<strong>enum<\/strong>\u304c\u3042\u308b\u3002<\/p>\n<p>\u305d\u3053\u3067\u5b9a\u756a\u306e\u4f7f\u3044\u65b9\u304c<strong>switch\u306ecase\u3067enum\u3092\u4f7f\u3046<\/strong>\u65b9\u6cd5\u3002<\/p>\n<p>&nbsp;<\/p>\n<h3>Swift\u306eswitch\u6587\u3067enum(\u5217\u6319\u578b)\u3092\u4f7f\u3046<\/h3>\n<pre class=\"lang:swift decode:true \">enum Fruits: String {\r\n    case Apple = \"\u308a\u3093\u3054\"\r\n    case Banana = \"\u3070\u306a\u306a\"\r\n    case Orange = \"\u304a\u308c\u3093\u3058\"\r\n}\r\n\r\nlet fruits: Fruits\r\nfruits = Fruits.Orange\r\n\r\nswitch fruits {\r\n    case .Apple:\r\n        print(Fruits.Apple.rawValue)\r\n    case .Banana:\r\n        print(Fruits.Banana.rawValue)\r\n    case .Orange:\r\n        print(Fruits.Orange.rawValue)\r\n}\r\n\/\/ \"\u304a\u308c\u3093\u3058\"<\/pre>\n<p>enum\u3092\u4f7f\u3063\u305fswitch\u6587\u306f\u3053\u3093\u306a\u5f62\u3067\u66f8\u3051\u308b\u3002<\/p>\n<p>enum\u304c\u308f\u304b\u3089\u306a\u3044\u4eba\u306f\u3001enum\u5358\u4f53\u306e\u8aac\u660e\u304c\u3042\u308b\u306e\u3067\u4ee5\u4e0b\u306e\u8a18\u4e8b\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3088\u3046\u3002<\/p>\n<blockquote class=\"wp-embedded-content\"><p><a href=\"https:\/\/swift.tecc0.com\/?p=100\">Swift\u3067enum(\u5217\u6319\u578b)\u3092\u4f7f\u3046\u65b9\u6cd5 (rawValue)<\/a><\/p><\/blockquote>\n<p><script type='text\/javascript'><!--\/\/--><![CDATA[\/\/><!--\t\t!function(a,b){\"use strict\";function c(){if(!e){e=!0;var a,c,d,f,g=-1!==navigator.appVersion.indexOf(\"MSIE 10\"),h=!!navigator.userAgent.match(\/Trident.*rv:11.\/),i=b.querySelectorAll(\"iframe.wp-embedded-content\");for(c=0;c<i.length;c++){if(d=i[c],!d.getAttribute(\"data-secret\"))f=Math.random().toString(36).substr(2,10),d.src+=\"#?secret=\"+f,d.setAttribute(\"data-secret\",f);if(g||h)a=d.cloneNode(!0),a.removeAttribute(\"security\"),d.parentNode.replaceChild(a,d)}}}var d=!1,e=!1;if(b.querySelector)if(a.addEventListener)d=!0;if(a.wp=a.wp||{},!a.wp.receiveEmbedMessage)if(a.wp.receiveEmbedMessage=function(c){var d=c.data;if(d)if(d.secret||d.message||d.value)if(!\/[^a-zA-Z0-9]\/.test(d.secret)){var e,f,g,h,i,j=b.querySelectorAll('iframe[data-secret=\"'+d.secret+'\"]'),k=b.querySelectorAll('blockquote[data-secret=\"'+d.secret+'\"]');for(e=0;e<k.length;e++)k[e].style.display=\"none\";for(e=0;e<j.length;e++)if(f=j[e],c.source===f.contentWindow){if(f.removeAttribute(\"style\"),\"height\"===d.message){if(g=parseInt(d.value,10),g>1e3)g=1e3;else if(~~g<200)g=200;f.height=g}if(\"link\"===d.message)if(h=b.createElement(\"a\"),i=b.createElement(\"a\"),h.href=f.getAttribute(\"src\"),i.href=d.value,i.host===h.host)if(b.activeElement===f)a.top.location.href=d.value}else;}},d)a.addEventListener(\"message\",a.wp.receiveEmbedMessage,!1),b.addEventListener(\"DOMContentLoaded\",c,!1),a.addEventListener(\"load\",c,!1)}(window,document);\/\/--><!]]><\/script><iframe loading=\"lazy\" sandbox=\"allow-scripts\" security=\"restricted\" src=\"https:\/\/swift.tecc0.com\/?p=100&#038;embed=true\" width=\"600\" height=\"338\" title=\"&#8220;Swift\u3067enum(\u5217\u6319\u578b)\u3092\u4f7f\u3046\u65b9\u6cd5 (rawValue)&#8221; &#8212; Swift4 Web\u5165\u9580\u66f8\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" class=\"wp-embedded-content\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Swift\u3067\u3082Switch\u6587\u304c\u3042\u308a\u3001enum\u304c\u3042\u308b\u3002 \u305d\u3053\u3067\u5b9a\u756a\u306e\u4f7f\u3044\u65b9\u304cswitch\u306ecase\u3067enum\u3092\u4f7f\u3046\u65b9\u6cd5\u3002 &nbsp; Swift\u306eswitch\u6587\u3067enum(\u5217\u6319\u578b)\u3092\u4f7f\u3046 enum Fruits: Str&#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\/401"}],"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=401"}],"version-history":[{"count":1,"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=\/wp\/v2\/posts\/401\/revisions"}],"predecessor-version":[{"id":402,"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=\/wp\/v2\/posts\/401\/revisions\/402"}],"wp:attachment":[{"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=401"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=401"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=401"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}