{"id":277,"date":"2021-09-17T15:23:21","date_gmt":"1970-01-01T00:00:00","guid":{"rendered":"http:\/\/swift.tecc0.com\/?p=277"},"modified":"2021-09-17T15:23:21","modified_gmt":"1970-01-01T00:00:00","slug":"post-277","status":"publish","type":"post","link":"https:\/\/swift.tecc0.com\/?p=277","title":{"rendered":"Swift\u3067\u30e1\u30bd\u30c3\u30c9\u3092\u30aa\u30fc\u30d0\u30fc\u30ed\u30fc\u30c9\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"<p>Swift\u3067\u3082\u3082\u3061\u308d\u3093<strong>\u30e1\u30bd\u30c3\u30c9<\/strong>\u306e<strong>\u30aa\u30fc\u30d0\u30fc\u30ed\u30fc\u30c9<\/strong>(\u591a\u91cd\u5b9a\u7fa9)\u304c\u3067\u304d\u308b\u3088\u3002<\/p>\n<h3>Swift\u3067\u30e1\u30bd\u30c3\u30c9\u3092\u30aa\u30fc\u30d0\u30fc\u30ed\u30fc\u30c9\u3059\u308b<\/h3>\n<pre class=\"lang:swift decode:true\">class Deal {\n    \n    func sum (price: Int) -&gt; Int {\n        return price;\n    }\n    \n    func sum (price: Int, tax: Double) -&gt; Int {\n        return Int(Double(price) * tax);\n    }\n    \n    func sum (price: Int, tax: Double, postage: Int) -&gt; Int {\n        return Int(Double(price) * tax + Double(postage));\n    }\n    \n}\n\nlet deal = Deal()\nprint(deal.sum(price: 1000)) \/\/ 1000\nprint(deal.sum(price: 1000, tax: 1.08)) \/\/ 1080\nprint(deal.sum(price: 1000, tax: 1.08, postage: 300)) \/\/ 1380<\/pre>\n<p>\u3053\u3093\u306a\u611f\u3058\u3067\u5f15\u6570\u3092\u5909\u3048\u3066\u3084\u308c\u3070\u3001<strong>\u30e1\u30bd\u30c3\u30c9\u306e\u30aa\u30fc\u30d0\u30fc\u30ed\u30fc\u30c9<\/strong>\u304c\u3067\u304d\u308b\u3088\u3002<\/p>\n<h5>\u304a\u307e\u3051: \u623b\u308a\u5024\u3067\u3082\u30aa\u30fc\u30d0\u30fc\u30ed\u30fc\u30c9\u3067\u304d\u308b<\/h5>\n<pre class=\"lang:swift decode:true \">class Deal {\n    func sum (price: Int) -&gt; Int {\n        return price;\n    }\n    \n    func sum (price: Int) -&gt; String {\n        return String(price) + \"\u5186\";\n    }\n}\n\nlet deal = Deal()\nlet price: Int = deal.sum(price: 100)\nlet priceStr: String = deal.sum(price: 100)\n\nprint(price) \/\/ 100\nprint(priceStr) \/\/ \"100\u5186\"<\/pre>\n<p>\u623b\u308a\u5024\u3067\u3082\u30aa\u30fc\u30d0\u30fc\u30ed\u30fc\u30c9\u3067\u304d\u308b\u3051\u3069\u3001\u305d\u306e\u969b\u306f price: Int, price: String \u307f\u305f\u3044\u306b\u3057\u3063\u304b\u308a\u3068\u578b\u3092\u6307\u5b9a\u3057\u3066\u3042\u3052\u306a\u3044\u3068\u30a8\u30e9\u30fc\u306b\u306a\u308b\u3088\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Swift\u3067\u3082\u3082\u3061\u308d\u3093\u30e1\u30bd\u30c3\u30c9\u306e\u30aa\u30fc\u30d0\u30fc\u30ed\u30fc\u30c9(\u591a\u91cd\u5b9a\u7fa9)\u304c\u3067\u304d\u308b\u3088\u3002 Swift\u3067\u30e1\u30bd\u30c3\u30c9\u3092\u30aa\u30fc\u30d0\u30fc\u30ed\u30fc\u30c9\u3059\u308b class Deal { func sum (price: Int) -&gt; Int { return&#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\/277"}],"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=277"}],"version-history":[{"count":5,"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=\/wp\/v2\/posts\/277\/revisions"}],"predecessor-version":[{"id":790,"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=\/wp\/v2\/posts\/277\/revisions\/790"}],"wp:attachment":[{"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=277"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=277"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=277"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}