{"id":91,"date":"2024-09-17T11:09:41","date_gmt":"2024-09-17T11:09:41","guid":{"rendered":"https:\/\/xcode15.shimayugu.jp\/?p=91"},"modified":"2024-12-29T06:33:52","modified_gmt":"2024-12-28T21:33:52","slug":"%e6%96%b0swift%e3%81%a7%e8%a1%8c%e3%81%93%e3%81%86-%e7%ac%ac%ef%bc%91%ef%bc%91%e5%9b%9e%e3%80%8c%e3%83%88%e3%83%a9%e3%83%b3%e3%83%97%ef%bc%91%e3%80%8d%e3%80%80%e7%94%b0%e9%83%a8%e4%ba%95%e4%bf%9d","status":"publish","type":"post","link":"https:\/\/xcode15.shimayugu.jp\/?p=91","title":{"rendered":"\u65b0Swift\u3067\u884c\u3053\u3046&#8230;\u7b2c\uff11\uff11\u56de\u300c\u30c8\u30e9\u30f3\u30d7\uff11\u300d\u3000\u7530\u90e8\u4e95\u4fdd"},"content":{"rendered":"\n<p><a href=\"https:\/\/shimayugu.sakura.ne.jp\/?p=2298\"><\/a><a href=\"https:\/\/shimayugu.sakura.ne.jp\/?p=2473\">\u76ee\u6b21<\/a>\u3000<a href=\"https:\/\/xcode15.shimayugu.jp\/?p=547\">\u89e3\u8aac\u7de8<\/a><\/p>\n\n\n\n<p>\u3000\u753b\u9762\u306b\u30e9\u30d9\u30eb\u3092\uff12\u3064\u6a2a\u306b\u4e26\u3079\u3066\u3001\u4e0b\u306b\u30dc\u30bf\u30f3\u30921\u500b\u7528\u610f\u3057\u3066\u4e0b\u3055\u3044\u3002\u305d\u3057\u3066\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u66f8\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-swift\" data-lang=\"Swift\" data-show-lang=\"1\"><code>\/\/\n\/\/  ViewController.swift\n\/\/  Card\n\/\/\n\/\/  Created by \u4fdd Tabei on 2024\/09\/01.\n\/\/\n\nimport UIKit\n\nclass ViewController: UIViewController {\n\n    @IBOutlet weak var lblMark: UILabel!\n    @IBOutlet weak var lblNumber: UILabel!\n    \n    override func viewDidLoad() {\n        super.viewDidLoad()\n        \/\/ Do any additional setup after loading the view.\n    }\n\n    @IBAction func btnGoTouch(_ sender: Any) {\n        let mark = Int.random(in: 0 ..&lt; 4)\n        let number = Int.random(in: 0 ..&lt; 13)\n        switch mark {\n        case 0:\n            lblMark.text = &quot;\u2663\ufe0f&quot;\n        case 1:\n            lblMark.text = &quot;\u2666\ufe0f&quot;\n        case 2:\n            lblMark.text = &quot;\u2665\ufe0f&quot;\n        case 3:\n            lblMark.text = &quot;\u2660\ufe0f&quot;\n        default:\n            lblMark.text = &quot;&quot;\n        }\n        switch number {\n        case 0:\n            lblNumber.text = &quot;A&quot;\n        case 1:\n            lblNumber.text = &quot;2&quot;\n        case 2:\n            lblNumber.text = &quot;3&quot;\n        case 3:\n            lblNumber.text = &quot;4&quot;\n        case 4:\n            lblNumber.text = &quot;5&quot;\n        case 5:\n            lblNumber.text = &quot;6&quot;\n        case 6:\n            lblNumber.text = &quot;7&quot;\n        case 7:\n            lblNumber.text = &quot;8&quot;\n        case 8:\n            lblNumber.text = &quot;9&quot;\n        case 9:\n            lblNumber.text = &quot;T&quot;\n        case 10:\n            lblNumber.text = &quot;J&quot;\n        case 11:\n            lblNumber.text = &quot;Q&quot;\n        case 12:\n            lblNumber.text = &quot;K&quot;\n        default:\n            lblNumber.text = &quot;&quot;\n        }\n    }\n    \n}<\/code><\/pre><\/div>\n\n\n\n<pre class=\"wp-block-preformatted\">\u3000\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br>\u3000\u8272\u3005\u306a\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3\u3092\u8a66\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/pre>\n\n\n\n<p>\u3000\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3\uff12\u3067\u3059\u3002\u30e9\u30d9\u30eb\u3092\uff11\u3064\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-swift\" data-lang=\"Swift\" data-show-lang=\"1\"><code>\/\/\n\/\/  ViewController.swift\n\/\/  Card\n\/\/\n\/\/  Created by \u4fdd Tabei on 2024\/09\/01.\n\/\/\n\nimport UIKit\n\nclass ViewController: UIViewController {\n\n    @IBOutlet weak var lblCard: UILabel!\n    \n    override func viewDidLoad() {\n        super.viewDidLoad()\n        \/\/ Do any additional setup after loading the view.\n    }\n\n    @IBAction func btnGoTouch(_ sender: Any) {\n        let mark = Int.random(in: 0 ..&lt; 4)\n        let number = Int.random(in: 0 ..&lt; 13)\n        \n        var strMark:String\n        var strNumber:String\n        \n        switch mark {\n        case 0:\n            strMark = &quot;\u2663\ufe0f&quot;\n        case 1:\n            strMark = &quot;\u2666\ufe0f&quot;\n        case 2:\n            strMark = &quot;\u2665\ufe0f&quot;\n        case 3:\n            strMark = &quot;\u2660\ufe0f&quot;\n        default:\n            strMark = &quot;&quot;\n        }\n        switch number {\n        case 0:\n            strNumber = &quot;A&quot;\n        case 1:\n            strNumber = &quot;2&quot;\n        case 2:\n            strNumber = &quot;3&quot;\n        case 3:\n            strNumber = &quot;4&quot;\n        case 4:\n            strNumber = &quot;5&quot;\n        case 5:\n            strNumber = &quot;6&quot;\n        case 6:\n            strNumber = &quot;7&quot;\n        case 7:\n            strNumber = &quot;8&quot;\n        case 8:\n            strNumber = &quot;9&quot;\n        case 9:\n            strNumber = &quot;T&quot;\n        case 10:\n            strNumber = &quot;J&quot;\n        case 11:\n            strNumber = &quot;Q&quot;\n        case 12:\n            strNumber = &quot;K&quot;\n        default:\n            strNumber = &quot;&quot;\n        }\n        lblCard.text = strMark + strNumber\n    }\n    \n}<\/code><\/pre><\/div>\n\n\n\n<p>\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<p>\u3000\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3\uff13\u3067\u3059\u3002\u30e9\u30f3\u30c0\u30e0\u306b\u51fa\u3059\u6570\u3092\u30de\u30fc\u30af\u3068\u30ca\u30f3\u30d0\u30fc\u3067\u5206\u3051\u306a\u304f\u3057\u307e\u3057\u305f\u3002\u3053\u3053\u3067\u3001\u201d\/\u201d\u306f\u5546\u3001\u201d%\u201d\u306f\u5270\u4f59\u3092\u6c42\u3081\u307e\u3059\u3002\u30c8\u30e9\u30f3\u30d7\u306e\u5834\u5408\u3001\u4e00\u5ea6\u914d\u3089\u308c\u305f\u30ab\u30fc\u30c9\u306f\u6368\u3066\u3089\u308c\u305f\u30ab\u30fc\u30c9\u3092\u5fa9\u6d3b\u3055\u305b\u305f\u5834\u5408\u4ee5\u5916\u306f\u3082\u3046\u51fa\u3066\u6765\u307e\u305b\u3093\u3002\u305d\u3053\u3067\u30de\u30fc\u30af\u3068\u30ca\u30f3\u30d0\u30fc\u3092\u5206\u3051\u3066\u3044\u308b\u3068\u3001\u4f8b\u3048\u3070\u30cf\u30fc\u30c8\u2764\ufe0f\u306f\u3082\u3046\u51fa\u5c3d\u304f\u3057\u305f\u306e\u306b\u30de\u30fc\u30af\u306e\u30cf\u30fc\u30c8\u2764\ufe0f\u304c\u51fa\u3066\u3057\u307e\u3046\u3068\u3044\u3046\u4e8b\u304c\u8003\u3048\u3089\u308c\u307e\u3059\u3002\u30e9\u30f3\u30c0\u30e0\u306b\u51fa\u3059\u6570\u306f\u4e00\u3064\u306e\u65b9\u304c\u826f\u3044\u3068\u601d\u308f\u308c\u307e\u3059\u3002\u7279\u306b\u30b8\u30e7\u30fc\u30ab\u30fc\u306e\u4e8b\u3092\u8003\u3048\u308b\u3068\u4e00\u3064\u306e\u65b9\u304c\u826f\u3044\u3068\u601d\u308f\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-swift\" data-lang=\"Swift\" data-line=\"20,25,37\" data-show-lang=\"1\"><code>\/\/\n\/\/  ViewController.swift\n\/\/  Card\n\/\/\n\/\/  Created by \u4fdd Tabei on 2024\/09\/01.\n\/\/\n\nimport UIKit\n\nclass ViewController: UIViewController {\n\n    @IBOutlet weak var lblCard: UILabel!\n    \n    override func viewDidLoad() {\n        super.viewDidLoad()\n        \/\/ Do any additional setup after loading the view.\n    }\n\n    @IBAction func btnGoTouch(_ sender: Any) {\n        let card = Int.random(in: 0 ..&lt; 52)\n        \n        let strMark:String\n        let strNumber:String\n        \n        switch card \/ 13 {\n        case 0:\n            strMark = &quot;\u2663\ufe0f&quot;\n        case 1:\n            strMark = &quot;\u2666\ufe0f&quot;\n        case 2:\n            strMark = &quot;\u2665\ufe0f&quot;\n        case 3:\n            strMark = &quot;\u2660\ufe0f&quot;\n        default:\n            strMark = &quot;&quot;\n        }\n        switch card % 13 {\n        case 0:\n            strNumber = &quot;A&quot;\n        case 1:\n            strNumber = &quot;2&quot;\n        case 2:\n            strNumber = &quot;3&quot;\n        case 3:\n            strNumber = &quot;4&quot;\n        case 4:\n            strNumber = &quot;5&quot;\n        case 5:\n            strNumber = &quot;6&quot;\n        case 6:\n            strNumber = &quot;7&quot;\n        case 7:\n            strNumber = &quot;8&quot;\n        case 8:\n            strNumber = &quot;9&quot;\n        case 9:\n            strNumber = &quot;T&quot;\n        case 10:\n            strNumber = &quot;J&quot;\n        case 11:\n            strNumber = &quot;Q&quot;\n        case 12:\n            strNumber = &quot;K&quot;\n        default:\n            strNumber = &quot;&quot;\n        }\n        lblCard.text = strMark + strNumber\n    }\n    \n}<\/code><\/pre><\/div>\n\n\n\n<p>\u3000\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<p>\u3000\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3\uff14\u3067\u3059\u3002\u914d\u5217\u3068\u3044\u3046\u4ed5\u7d44\u307f\u3092\u4f7f\u3063\u3066\u307f\u307e\u3057\u305f\u3002\u30b7\u30f3\u30d7\u30eb\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-swift\" data-lang=\"Swift\" data-show-lang=\"1\"><code>\/\/\n\/\/  ViewController.swift\n\/\/  Card\n\/\/\n\/\/  Created by \u4fdd Tabei on 2024\/09\/01.\n\/\/\n\nimport UIKit\n\nclass ViewController: UIViewController {\n\n    @IBOutlet weak var lblCard: UILabel!\n    \n    override func viewDidLoad() {\n        super.viewDidLoad()\n        \/\/ Do any additional setup after loading the view.\n    }\n\n    let mark: [String] = [&quot;\u2663\ufe0f&quot;,&quot;\u2666\ufe0f&quot;,&quot;\u2764\ufe0f&quot;,&quot;\u2660\ufe0f&quot;]\n    let number: [String] = [&quot;A&quot;,&quot;2&quot;,&quot;3&quot;,&quot;4&quot;,&quot;5&quot;,&quot;6&quot;,&quot;7&quot;,&quot;8&quot;,&quot;9&quot;,&quot;T&quot;,&quot;J&quot;,&quot;Q&quot;,&quot;K&quot;]\n\n    @IBAction func btnGoTouch(_ sender: Any) {\n        let card = Int.random(in: 0 ..&lt; 52)\n        \n        lblCard.text = mark[card \/ 13] + number[card % 13]\n    }\n    \n}<\/code><\/pre><\/div>\n\n\n\n<p>\u3000\u3055\u3066\u554f\u984c\u3067\u3059\u3002\u66f4\u306b\u30b8\u30e7\u30fc\u30ab\u30fc\u3092\u51fa\u3059\u306b\u306f\u3069\u3046\u3059\u308c\u3070\u826f\u3044\u3067\u3057\u3087\u3046\u304b\u3002\u3084\u308a\u65b9\u306f\u3044\u308d\u3044\u308d\u3042\u308b\u3068\u601d\u3044\u307e\u3059\u3002\u305f\u3060\u3044\u305a\u308c\u306b\u305b\u3088\u30b9\u30de\u30fc\u30c8\u3067\u306f\u306a\u304f\u306a\u308b\u3068\u601d\u3044\u307e\u3059\u3002\u30b8\u30e7\u30fc\u30ab\u30fc\u306f\u201dJK\u201d\u3068\u3057\u3066\u4e0b\u3055\u3044\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/shimayugu.sakura.ne.jp\/?p=2298\"><\/a><a href=\"https:\/\/shimayugu.sakura.ne.jp\/?p=2473\">\u76ee\u6b21<\/a>\u3000<a href=\"https:\/\/xcode15.shimayugu.jp\/?p=547\">\u89e3\u8aac\u7de8<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u6b21\u3000\u89e3\u8aac\u7de8 \u3000\u753b\u9762\u306b\u30e9\u30d9\u30eb\u3092\uff12\u3064\u6a2a\u306b\u4e26\u3079\u3066\u3001\u4e0b\u306b\u30dc\u30bf\u30f3\u30921\u500b\u7528\u610f\u3057\u3066\u4e0b\u3055\u3044\u3002\u305d\u3057\u3066\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u66f8\u304d\u307e\u3059\u3002 \u3000\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002\u3000\u8272\u3005\u306a\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3\u3092\u8a66\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002 \u3000\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3\uff12\u3067\u3059\u3002\u30e9\u30d9\u30eb\u3092\uff11\u3064\u306b\u3057\u307e\u3057 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-91","post","type-post","status-publish","format-standard","hentry","category-swift"],"_links":{"self":[{"href":"https:\/\/xcode15.shimayugu.jp\/index.php?rest_route=\/wp\/v2\/posts\/91","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xcode15.shimayugu.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xcode15.shimayugu.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xcode15.shimayugu.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xcode15.shimayugu.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=91"}],"version-history":[{"count":12,"href":"https:\/\/xcode15.shimayugu.jp\/index.php?rest_route=\/wp\/v2\/posts\/91\/revisions"}],"predecessor-version":[{"id":1000,"href":"https:\/\/xcode15.shimayugu.jp\/index.php?rest_route=\/wp\/v2\/posts\/91\/revisions\/1000"}],"wp:attachment":[{"href":"https:\/\/xcode15.shimayugu.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=91"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xcode15.shimayugu.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=91"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xcode15.shimayugu.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=91"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}