{"id":709,"date":"2024-10-18T17:09:45","date_gmt":"2024-10-18T08:09:45","guid":{"rendered":"https:\/\/xcode15.shimayugu.jp\/?p=709"},"modified":"2024-12-29T07:31:44","modified_gmt":"2024-12-28T22:31:44","slug":"%e6%96%b0swift%e3%81%a7%e8%a1%8c%e3%81%93%e3%81%86%e7%ac%ac%ef%bc%97%ef%bc%90%e5%9b%9e%e3%80%8c%e3%83%9d%e3%83%bc%e3%82%ab%e3%83%bc%ef%bc%97%e8%a7%a3%e8%aa%ac%e3%80%8d%e3%80%80%e7%94%b0","status":"publish","type":"post","link":"https:\/\/xcode15.shimayugu.jp\/?p=709","title":{"rendered":"\u65b0Swift\u3067\u884c\u3053\u3046\u2026\u7b2c\uff17\uff10\u56de\u300c\u30dd\u30fc\u30ab\u30fc\uff17\u89e3\u8aac\u300d\u3000\u7530\u90e8\u4e95\u4fdd"},"content":{"rendered":"\n<p><a href=\"https:\/\/shimayugu.sakura.ne.jp\/?p=2473\">\u76ee\u6b21<\/a>\u3000<a href=\"https:\/\/xcode15.shimayugu.jp\/?p=233\">\u901a\u5e38\u7248<\/a><\/p>\n\n\n\n<p>\u3000\u30b9\u30c8\u30ec\u30fc\u30c8\u306e\u5224\u5b9a\u3067\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-swift\" data-lang=\"Swift\" data-line=\"198-227,230-247\" data-show-lang=\"1\"><code>\/\/\n\/\/  ViewController.swift\n\/\/  Poker\n\/\/\n\/\/  Created by \u4fdd Tabei on 2024\/10\/03.\n\/\/\n\nimport UIKit\n\nclass ViewController: UIViewController {\n  \n    override func viewDidLoad() {\n        super.viewDidLoad()\n        \/\/ Do any additional setup after loading the view.\n        \/\/\uff15\u679a\u5206\u306e\u30e9\u30d9\u30eb\u3092\u914d\u7f6e\u3059\u308b\n        for i in 0 ..&lt; 5 {\n            \/\/\u30e9\u30d9\u30eb\u3092\u751f\u6210\u3059\u308b\n            let lbl = UILabel(frame: CGRectMake(0, 0, 50, 21))\n            \/\/\u30e9\u30d9\u30eb\u306e\u4e2d\u5fc3\u3092\u6307\u5b9a\u3059\u308b\n            lbl.center = CGPointMake(100 + 50 * CGFloat(i), 250)\n            \/\/\u30e9\u30d9\u30eb\u306e\u30c6\u30ad\u30b9\u30c8\u914d\u7f6e\u3092\u4e2d\u592e\u306b\u3059\u308b\n            lbl.textAlignment = NSTextAlignment.center\n            \/\/\u30e9\u30d9\u30eb\u306e\u8868\u793a\u3092\u30ab\u30fc\u30c9\u304c\u88cf\u306b\u306a\u3063\u3066\u3044\u308b\u69d8\u306b\u3059\u308b\n            lbl.text = &quot;\u2b1b\ufe0f&quot;\n            \/\/\u30e9\u30d9\u30eb\u914d\u5217\u306b\u8ffd\u52a0\u3059\u308b\n            eachCard += [lbl]\n            \/\/\u30e9\u30d9\u30eb\u3092\u753b\u9762\u4e0a\u306b\u914d\u7f6e\u3059\u308b\n            self.view.addSubview(lbl)\n \n            \/\/\u9078\u629e\u30dc\u30bf\u30f3\u3092\u751f\u6210\u3059\u308b\n            let btn = UIButton(frame: CGRectMake(0, 0, 50, 21)) as UIButton\n            \/\/\u30dc\u30bf\u30f3\u306e\u4e2d\u5fc3\u3092\u6307\u5b9a\u3059\u308b\n            btn.center = CGPointMake(100 + 50 * CGFloat(i), 300)\n            \/\/\u30dc\u30bf\u30f3\u306e\u30bf\u30a4\u30c8\u30eb\u3092\u300coff\u300d\u306b\u3059\u308b\n            btn.setTitle(&quot;off&quot;, for: .normal)\n            \/\/\u30dc\u30bf\u30f3\u306e\u30bf\u30a4\u30c8\u30eb\u306e\u8272\u3092\u30b0\u30ec\u30fc\u306b\u3059\u308b\n            btn.setTitleColor(UIColor.systemGray, for: .normal)\n            \/\/\u30dc\u30bf\u30f3\u304c\u62bc\u3055\u308c\u305f\u6642\u306b\u300cbtnTapped\u300d\u95a2\u6570\u304c\u547c\u3070\u308c\u308b\u3088\u3046\u306b\u3059\u308b\n            btn.addTarget(self, action: #selector(btnTapped), for: .touchUpInside)\n            \/\/\u30dc\u30bf\u30f3\u306e\u30bf\u30b0\u306b\uff10\u304b\u3089\uff14\u306e\u76ee\u5370\u3092\u4ed8\u3051\u308b\n            btn.tag = i\n            \/\/\u9078\u629e\u30dc\u30bf\u30f3\u914d\u5217\u306b\u8ffd\u52a0\u3059\u308b\n            eachButton += [btn]\n            \/\/\u9078\u629e\u30dc\u30bf\u30f3\u3092\u753b\u9762\u4e0a\u306b\u914d\u7f6e\u3059\u308b\n            self.view.addSubview(btn)\n        }\n    }\n\n    \/\/\/\u9078\u629e\u30dc\u30bf\u30f3\u304c\u62bc\u3055\u308c\u305f\u6642\u306b\u52d5\u4f5c\u3059\u308b\u95a2\u6570\n    @objc func btnTapped(sender: UIButton) {\n        \/\/\u3082\u3057\u30bf\u30a4\u30c8\u30eb\u304c\u300coff\u300d\u306a\u3089\n        if sender.currentTitle == &quot;off&quot; {\n            \/\/\u30bf\u30a4\u30c8\u30eb\u3092\u300con\u300d\u306b\u3057\u3066\n            sender.setTitle(&quot;on&quot;, for: .normal)\n            \/\/\u9078\u629e\u30dc\u30bf\u30f3\u306e\u6240\u306e\u30ab\u30fc\u30c9\u3092\u88cf\u306b\u3059\u308b\n            eachCard[sender.tag].text = &quot;\u2b1b\ufe0f&quot;\n        \/\/\u3082\u3057\u30bf\u30a4\u30c8\u30eb\u304c\u300con\u300d\u306a\u3089\n        } else {\n            \/\/\u30bf\u30a4\u30c8\u30eb\u3092\u300coff\u300d\u306b\u3057\u3066\n            sender.setTitle(&quot;off&quot;, for: .normal)\n            \/\/\u9078\u629e\u30dc\u30bf\u30f3\u306e\u6240\u306e\u30ab\u30fc\u30c9\u3092\u8868\u306b\u3059\u308b\n            \/\/\u30ab\u30fc\u30c9\u756a\u53f7\u306f\u30bf\u30b0\u306b\u5165\u308c\u3066\u3042\u308b\n            let card = eachCard[sender.tag].tag\n            \/\/\u30ab\u30fc\u30c9\u4e00\u6642\u4fdd\u6301\u5909\u6570\n            var strCard: String\n            \/\/\u30b8\u30e7\u30fc\u30ab\u30fc\u306e\u5834\u5408\n            if card == 52 {\n                strCard = &quot;JK&quot;\n            \/\/\u30b8\u30e7\u30fc\u30ab\u30fc\u4ee5\u5916\u306e\u5834\u5408\n            } else {\n                \/\/\u30ab\u30fc\u30c9\u4e00\u6642\u4fdd\u6301\u5909\u6570\u306b\u30de\u30fc\u30af\u3068\u30ca\u30f3\u30d0\u30fc\u3092\u4fdd\u6301\n                strCard = mark[card \/ 13] + number[card % 13]\n            }\n            \/\/\u9078\u629e\u30dc\u30bf\u30f3\u306e\u6240\u306e\u30ab\u30fc\u30c9\u3092\u8868\u793a\n            eachCard[sender.tag].text = strCard\n        }\n    }\n\n    \/\/\/\u30de\u30fc\u30af\u4fdd\u6301\u914d\u5217\n    let mark: [String] = [&quot;\u2663\ufe0f&quot;,&quot;\u2666\ufe0f&quot;,&quot;\u2764\ufe0f&quot;,&quot;\u2660\ufe0f&quot;]\n    \/\/\/\u30ca\u30f3\u30d0\u30fc\u4fdd\u6301\u914d\u5217\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    \/\/\/\u30ab\u30fc\u30c9\u679a\u6570\u4fdd\u6301\u5b9a\u6570\n    enum EnumCard {\n        static let Count = 52\n    }\n\n    \/\/\/\u65e2\u306b\u51fa\u3066\u3044\u308b\u304b\u30c1\u30a7\u30c3\u30af\u3059\u308b\u3001\u51fa\u3066\u3044\u305f\u3089true\n    \/\/\/\u51fa\u3066\u3044\u306a\u304b\u3063\u305f\u3089false\u3001\u3068\u308a\u3042\u3048\u305a\n    \/\/\/EnumCard.Count\u679a\u5206false\u3067\u57cb\u3081\u308b\n    var check = [Bool](repeating: false, count: EnumCard.Count)\n\n    \/\/\/\u6b8b\u308a\u679a\u6570\u3092\u4fdd\u6301\u3059\u308b\u5909\u6570\n    var count = EnumCard.Count\n\n    \/\/\/\u30e9\u30d9\u30eb\u914d\u5217\n    var eachCard: [UILabel] = []\n\n    \/\/\/\u9078\u629e\u30dc\u30bf\u30f3\u914d\u5217\n    var eachButton: [UIButton] = []\n\n    \/\/\/\u30ab\u30fc\u30c9\u3092\u5f15\u3044\u3066i\u3067\u6307\u5b9a\u3057\u305f\u4f4d\u7f6e\u306b\u51fa\u3059\n    func put(i: Int) {\n        \/\/\u4eca\u56de\u5f15\u3044\u305f\u30ab\u30fc\u30c9\u3092\u7279\u5b9a\u3059\u308b\u5909\u6570\n        var card = 0\n        \/\/\u4e71\u6570\u3092\uff10\u304b\u3089\u6b8b\u308a\u679a\u6570\u2212\uff11\u306e\u7bc4\u56f2\u3067\u767a\u751f\u3055\u305b\u308b\n        let randInt = Int.random(in: 0 ..&lt; count)\n        \/\/\u767a\u751f\u3055\u305b\u305f\u4e71\u6570\u5206\u30eb\u30fc\u30d7\n        for j in 0 ... randInt {\n            \/\/\u30ab\u30fc\u30c9\u304c\u65e2\u306b\u51fa\u3066\u3044\u305f\u3089card + 1\n            while check[card] {\n                card += 1\n            }\n            \/\/j\u304crandInt\u306b\u9054\u3057\u3066\u3044\u306a\u3051\u308c\u3070card + 1\n            if j &lt; randInt {\n                card += 1\n            }\n        }\n        \/\/\u65b0\u305f\u306b\u51fa\u305f\u30ab\u30fc\u30c9\u65e2\u306b\u51fa\u3066\u3044\u308b\u3068\u30de\u30fc\u30af\u3059\u308b\n        check[card] = true\n        \n        \/\/\u6b8b\u308a\u679a\u6570\u3092\uff11\u6e1b\u7b97\n        count -= 1\n        \n        \/\/\u30ab\u30fc\u30c9\u4e00\u6642\u4fdd\u6301\u5909\u6570\n        var strCard: String\n        \/\/\u30b8\u30e7\u30fc\u30ab\u30fc\u306e\u5834\u5408\n        if card == 52 {\n            strCard = &quot;JK&quot;\n        \/\/\u30b8\u30e7\u30fc\u30ab\u30fc\u4ee5\u5916\u306e\u5834\u5408\n        } else {\n            \/\/\u30ab\u30fc\u30c9\u4e00\u6642\u4fdd\u6301\u5909\u6570\u306b\u30de\u30fc\u30af\u3068\u30ca\u30f3\u30d0\u30fc\u3092\u4fdd\u6301\n            strCard = mark[card \/ 13] + number[card % 13]\n        }\n        \/\/i\u306e\u5024\u306b\u3088\u3063\u3066\u8868\u793a\u4f4d\u7f6e\u306b\u30ab\u30fc\u30c9\u8868\u793a\n        eachCard[i].text = strCard\n        \/\/\u8868\u793a\u3057\u305f\u30e9\u30d9\u30eb\u306etag\u306bcard\u3092\u4fdd\u5b58\u3057\u3066\u304a\u304f\n        eachCard[i].tag = card\n    }\n\n    \/\/\/\u5f79\u5224\u5b9a\u95a2\u6570\n    func flush() {\n        \/\/\u30c1\u30a7\u30c3\u30af\u5909\u6570\n        var ck = 0\n        \/\/\u57fa\u6e96\u30ab\u30fc\u30c9\n        for i in 0 ..&lt; 4 {\n            \/\/\u6bd4\u8f03\u30ab\u30fc\u30c9\n            for j in i + 1 ..&lt; 5 {\n                \/\/\u30ca\u30f3\u30d0\u30fc\u304c\u540c\u3058\u306a\u3089\n                if eachCard[i].tag % 13 == eachCard[j].tag % 13 {\n                    \/\/\u30c1\u30a7\u30c3\u30af\u5909\u6570\u3092\uff0b\uff11\u3059\u308b\n                    ck += 1\n                }\n            }\n        }\n        \/\/\u30da\u30a2\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u4fdd\u6301\u5909\u6570\n        var msg: String\n        \/\/\u30c1\u30a7\u30c3\u30af\u5909\u6570\u306e\u5024\u306b\u3088\u308a\u30da\u30a2\u540d\u3092\u6307\u5b9a\u3059\u308b\n        switch ck {\n        case 1:\n            msg = &quot;\u30ef\u30f3\u30da\u30a2&quot;\n        case 2:\n            msg = &quot;\u30c4\u30fc\u30da\u30a2&quot;\n        case 3:\n            msg = &quot;\u30b9\u30ea\u30fc\u30ab\u30fc\u30c9&quot;\n        case 4:\n            msg = &quot;\u30d5\u30eb\u30cf\u30a6\u30b9&quot;\n        case 6:\n            msg = &quot;\u30d5\u30a9\u30fc\u30ab\u30fc\u30c9&quot;\n        default:\n            msg = &quot;&quot;\n        }\n        \/\/\u30da\u30a2\u306a\u3089\n        if ck &gt; 0 {\n            \/\/\u30da\u30a2\u30c0\u30a4\u30a2\u30ed\u30b0\u3092\u8868\u793a\n            let alert = UIAlertController()\n            alert.title = &quot;\u30da\u30a2&quot;\n            alert.message = msg + &quot;\u3067\u3059&quot;\n            alert.addAction(UIAlertAction(title: &quot;OK&quot;, style: .default))\n            present(alert, animated: true, completion: nil)\n        \/\/\u30da\u30a2\u4ee5\u5916\n        } else {\n            \/\/\u30d5\u30e9\u30c3\u30b7\u30e5\u5909\u6570\u3068\u308a\u3042\u3048\u305a\u30d5\u30e9\u30c3\u30b7\u30e5\n            var chk = true\n            \/\/\uff11\u756a\u76ee\uff08\uff10\u306e\u4f4d\u7f6e\uff09\u306e\u30de\u30fc\u30af\u3092\u53d6\u5f97\uff08\uff10\u301c\uff13\uff09\n            let mark: Int = eachCard[0].tag \/ 13\n            \/\/\uff12\u756a\u76ee\u304b\u3089\uff15\u756a\u76ee\u306e\u4f4d\u7f6e\u306e\u30de\u30fc\u30af\u3068\u6bd4\u8f03\n            for i in 1 ..&lt; 5 {\n                \/\/\uff11\u756a\u76ee\u306e\u30de\u30fc\u30af\u3068\uff12\u301c\uff15\u756a\u76ee\u306e\u30de\u30fc\u30af\u3092\u6bd4\u8f03\u3057\u3066\u9055\u3063\u3066\u3044\u305f\u3089\n                if mark != eachCard[i].tag \/ 13 {\n                    \/\/\u30d5\u30e9\u30c3\u30b7\u30e5\u5909\u6570\u3092false\uff08\u30d5\u30e9\u30c3\u30b7\u30e5\u3067\u306f\u306a\u3044\uff09\u306b\n                    chk = false\n                    \/\/\u30eb\u30fc\u30d7\u3092\u7d42\u4e86\n                    break\n                }\n            }\n            \/\/\u6700\u5c0f\u5024\u5909\u6570\u3092\u5ba3\u8a00\n            var min = 0\n            \/\/\u6700\u5927\u5024\u5909\u6570\u3092\u5ba3\u8a00\n            var max = 0\n            \/\/\uff11\u756a\u76ee\u306e\u30ab\u30fc\u30c9\u306e\u30ca\u30f3\u30d0\u30fc\u3092\u6700\u5c0f\u5024\u306b\n            min = eachCard[0].tag % 13\n            \/\/\uff11\u756a\u76ee\u306e\u30ab\u30fc\u30c9\u306e\u30ca\u30f3\u30d0\u30fc\u3092\u6700\u5927\u5024\u306b\n            max = eachCard[0].tag % 13\n            \/\/\uff12\u756a\u76ee\u304b\u3089\uff15\u756a\u76ee\u307e\u3067\u30eb\u30fc\u30d7\n            for i in 1 ..&lt; 5 {\n                \/\/\u5909\u6570\u306b\u305d\u306e\u30ab\u30fc\u30c9\u306e\u30ca\u30f3\u30d0\u30fc\u3092\u5165\u308c\u308b\n                let val = eachCard[i].tag % 13\n                \/\/\u5909\u6570\u304c\u6700\u5c0f\u5024\u3088\u308a\u5c0f\u3055\u3044\u6642\n                if val &lt; min {\n                    \/\/\u6700\u5c0f\u5024\u3092\u5909\u6570\u306b\n                    min = val\n                }\n                \/\/\u5909\u6570\u304c\u6700\u5927\u5024\u3088\u308a\u5927\u304d\u3044\u6642\n                if max &lt; val {\n                    \/\/\u6700\u5927\u5024\u3092\u5909\u6570\u306b\n                    max = val\n                }\n            }\n            \/\/\u30b9\u30c8\u30ec\u30fc\u30c8\u5909\u6570\u3068\u308a\u3042\u3048\u305a\u30b9\u30c8\u30ec\u30fc\u30c8\u3067\u306a\u3044\n            var chk2 = false\n            \/\/\u6700\u5927\u5024\u3068\u6700\u5c0f\u5024\u306e\u5dee\u304c\u4e01\u5ea6\uff14\u306e\u6642\n            if max - min == 4 {\n                \/\/\u30b9\u30c8\u30ec\u30fc\u30c8\u5909\u6570\u3001\u30b9\u30c8\u30ec\u30fc\u30c8\u306b\n                chk2 = true\n            }\n            \/\/\u30b9\u30c8\u30ec\u30fc\u30c8\u3001\u30d5\u30e9\u30c3\u30b7\u30e5\u30c0\u30a4\u30a2\u30ed\u30b0\u3092\u8868\u793a\n            let alert = UIAlertController()\n            \/\/\u30d5\u30e9\u30c3\u30b7\u30e5\u3067\u30b9\u30c8\u30ec\u30fc\u30c8\u306a\u3089\n            if chk && chk2 {\n                alert.title = &quot;\u30b9\u30c8\u30ec\u30fc\u30c8\u30d5\u30e9\u30c3\u30b7\u30e5&quot;\n                alert.message = &quot;\u30b9\u30c8\u30ec\u30fc\u30c8\u30d5\u30e9\u30c3\u30b7\u30e5\u3067\u3059&quot;\n            \/\/\u30d5\u30e9\u30c3\u30b7\u30e5\u306a\u3089\n            } else if chk {\n                alert.title = &quot;\u30d5\u30e9\u30c3\u30b7\u30e5&quot;\n                alert.message = &quot;\u30d5\u30e9\u30c3\u30b7\u30e5\u3067\u3059&quot;\n            \/\/\u30b9\u30c8\u30ec\u30fc\u30c8\u306a\u3089\n            } else if chk2 {\n                alert.title = &quot;\u30b9\u30c8\u30ec\u30fc\u30c8&quot;\n                alert.message = &quot;\u30b9\u30c8\u30ec\u30fc\u30c8\u3067\u3059&quot;\n            }\n            \/\/\u30d5\u30e9\u30c3\u30b7\u30e5\u5909\u6570\u304ctrue\u307e\u305f\u306f\u30b9\u30c8\u30ec\u30fc\u30c8\u5909\u6570\u304ctrue\n            if (chk || chk2) {\n                alert.addAction(UIAlertAction(title: &quot;OK&quot;, style: .default))\n                present(alert, animated: true, completion: nil)\n            }\n        }\n    }\n\n    \/\/\/\u958b\u59cb\u30dc\u30bf\u30f3\u62bc\u4e0b\u6642\u51e6\u7406\n    @IBAction func btnGoTouch(_ sender: Any) {\n        \/\/\u30ea\u30bb\u30c3\u30c8\n        \/\/\u5168\u30ab\u30fc\u30c9\u51fa\u3066\u3044\u306a\u3044\u4e8b\u306b\n        for i in 0 ..&lt; EnumCard.Count {\n            check[i] = false\n        }\n        \/\/\u6b8b\u308a\u679a\u6570\uff15\uff12\u679a\n        count = EnumCard.Count\n        \/\/\uff15\u679a\u5f15\u304f\n        for i in 0 ..&lt; 5 {\n            \/\/\u30ab\u30fc\u30c9\u3092\u5f15\u3044\u3066i\u306e\u4f4d\u7f6e\u306b\u51fa\u529b\u3059\u308b\n            put(i: i)\n        }\n        \/\/\u5f79\u5224\u5b9a\n        flush()\n    }\n    \n    \/\/\/\u518d\u914d\u5e03\u30dc\u30bf\u30f3\u62bc\u4e0b\u6642\u51e6\u7406\n    @IBAction func btnReTouch(_ sender: Any) {\n        \/\/\uff15\u679a\u5206\u8abf\u3079\u308b\n        for i in 0 ..&lt; 5 {\n            \/\/\u9078\u629e\u30dc\u30bf\u30f3\u306e\u30bf\u30a4\u30c8\u30eb\u304con\u306a\u3089\n            if eachButton[i].currentTitle == &quot;on&quot; {\n                \/\/\u30ab\u30fc\u30c9\u3092\u5f15\u3044\u3066i\u306e\u4f4d\u7f6e\u306b\u51fa\u529b\u3059\u308b\n                put(i: i)\n                \/\/\u9078\u629e\u30dc\u30bf\u30f3\u306e\u30bf\u30a4\u30c8\u30eb\u3092off\u306b\u3059\u308b\n                eachButton[i].setTitle(&quot;off&quot;, for: .normal)\n            }\n        }\n        \/\/\u5f79\u5224\u5b9a\n        flush()\n    }\n}<\/code><\/pre><\/div>\n\n\n\n<p>\u3000\u4eca\u56de\u3001\u30b9\u30c8\u30ec\u30fc\u30c8\u306e\u5224\u5b9a\u304c\u52a0\u308f\u308a\u307e\u3057\u305f\u304c\u3001\u30ab\u30fc\u30c9\u30ca\u30f3\u30d0\u30fc\u306e\u6700\u5927\u5024\u3068\u6700\u5c0f\u5024\u3092\u6c42\u3081\u3066\u3001\u305d\u306e\u5dee\u304c\uff14\u306e\u5834\u5408\u30b9\u30c8\u30ec\u30fc\u30c8\u3068\u3057\u307e\u3057\u305f\u3002\u3053\u308c\u306f\u30da\u30a2\u304c\u3042\u3063\u305f\u5834\u5408\u3001\u2663\ufe0f\uff15\u2666\ufe0f\uff16\u2764\ufe0f\uff16\u2663\ufe0f\uff17\u2660\ufe0f\uff19\u3068\u3044\u3046\u69d8\u306b\u7c21\u5358\u306b\u5dee\u304c\uff14\u306e\u3082\u306e\u304c\u51fa\u6765\u3066\u3057\u307e\u3044\u307e\u3059\u3002\u3053\u3053\u3067\u30da\u30a2\u304c\u306a\u3044\u3068\u3059\u308b\u3068\u2663\ufe0f\uff15\u2666\ufe0f\uff16\u2663\ufe0f\uff17\u2764\ufe0f\uff18\u2660\ufe0f\uff19\u306e\u69d8\u306b\u3001\u5dee\u304c\uff14\u306a\u3089\u30b9\u30c8\u30ec\u30fc\u30c8\u3068\u3044\u3046\u4e8b\u304c\u51fa\u6765\u307e\u3059\u3002\u524d\u56de\u30d5\u30e9\u30c3\u30b7\u30e5\u3068\u30da\u30a2\u3092\u5165\u308c\u66ff\u3048\u307e\u3057\u305f\u304c\u3001\u30d5\u30e9\u30c3\u30b7\u30e5\u306e\u5224\u5b9a\u90e8\u5206\u306b\u30b9\u30c8\u30ec\u30fc\u30c8\u3092\u52a0\u3048\u308b\u70ba\u306b\u3001\u307e\u305a\u30da\u30a2\u3092\u8abf\u3079\u3066\u3001\u30da\u30a2\u3067\u306a\u3044\u5834\u5408\u306b\u30d5\u30e9\u30c3\u30b7\u30e5\u3068\u30b9\u30c8\u30ec\u30fc\u30c8\u3092\u8abf\u3079\u308b\u3088\u3046\u306b\u3057\u306a\u3044\u3068\u30b9\u30c8\u30ec\u30fc\u30c8\u306e\u5224\u5b9a\u304c\u51fa\u6765\u306a\u3044\u4e8b\u304b\u3089\u5165\u308c\u66ff\u3048\u305f\u306e\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3000\u30b9\u30c8\u30ec\u30fc\u30c8\u3068\u30d5\u30e9\u30c3\u30b7\u30e5\u306f\u4e26\u7acb\u3059\u308b\u306e\u3067\u3001\u30b9\u30c8\u30ec\u30fc\u30c8\u3068\u30d5\u30e9\u30c3\u30b7\u30e5\u306f\u4e00\u7dd2\u306b\u8abf\u3079\u305f\u65b9\u304c\u826f\u3044\u3067\u3059\u3002\u4eca\u56de\u30b9\u30c8\u30ec\u30fc\u30c8\u30d5\u30e9\u30c3\u30b7\u30e5\u3068\u3044\u3046\u5f79\u3082\u5224\u5b9a\u51fa\u6765\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u3000chk &amp;&amp; chk2 \u306e &amp;&amp; \u306fAND\u6761\u4ef6\u3067\u3001chk\u3001chk2 \u5171\u306b true \u306e\u5834\u5408\u3060\u3051 true \u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3000chk || chk2 \u306e || \u306fOR\u6761\u4ef6\u3067\u3001chk\u3001chk2 \u306e\u5c11\u306a\u304f\u3068\u3082\u3069\u3061\u3089\u304b\u4e00\u65b9\u304c true \u306a\u3089 true \u306b\u306a\u308a\u307e\u3059\u3002\u3053\u3053\u3067 (chk || chk2)\u3068\u62ec\u5f27\u3092\u4ed8\u3051\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u304c\u3001\u62ec\u5f27\u304c\u306a\u304f\u3066\u3082\u5927\u4e08\u592b\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3000\u5224\u5b9a\u90e8\u5206\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3059\u308c\u3070\u30b7\u30f3\u30d7\u30eb\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>            \/\/\u30e1\u30c3\u30bb\u30fc\u30b8\u4fdd\u6301\u5909\u6570\n            var msg: String = &quot;&quot;\n            \/\/\u30b9\u30c8\u30ec\u30fc\u30c8\u306a\u3089\n            if chk2 {\n                \/\/\u30e1\u30c3\u30bb\u30fc\u30b8\u5909\u6570\u3092\u30b9\u30c8\u30ec\u30fc\u30c8\u306b\n                msg = &quot;\u30b9\u30c8\u30ec\u30fc\u30c8&quot;\n            }\n            \/\/\u30d5\u30e9\u30c3\u30b7\u30e5\u306a\u3089\n            if chk {\n                \/\/\u30e1\u30c3\u30bb\u30fc\u30b8\u5909\u6570\u306b\u30d5\u30e9\u30c3\u30b7\u30e5\u3092\u8ffd\u52a0\u3059\u308b\n                msg += &quot;\u30d5\u30e9\u30c3\u30b7\u30e5&quot;\n            }\n            \/\/\u30d5\u30e9\u30c3\u30b7\u30e5\u5909\u6570\u304ctrue\u307e\u305f\u306f\u30b9\u30c8\u30ec\u30fc\u30c8\u5909\u6570\u304ctrue\n            if chk || chk2 {\n                \/\/\u30b9\u30c8\u30ec\u30fc\u30c8\u3001\u30d5\u30e9\u30c3\u30b7\u30e5\u30c0\u30a4\u30a2\u30ed\u30b0\u3092\u8868\u793a\n                let alert = UIAlertController()\n                alert.title = msg\n                alert.message = msg + &quot;\u3067\u3059&quot;\n                alert.addAction(UIAlertAction(title: &quot;OK&quot;, style: .default))\n                present(alert, animated: true, completion: nil)\n            }<\/code><\/pre><\/div>\n\n\n\n<p>\u3000\u30b9\u30c8\u30ec\u30fc\u30c8\u30d5\u30e9\u30c3\u30b7\u30e5\u3068\u3044\u3046\u5f79\u306f\u3001\u30b9\u30c8\u30ec\u30fc\u30c8\u304c\u5148\u306b\u6765\u308b\u306e\u3067\u3001\u307e\u305a\u30b9\u30c8\u30ec\u30fc\u30c8\u304b\u5224\u65ad\u3057\u3001\u6b21\u306b\u30d5\u30e9\u30c3\u30b7\u30e5\u304b\u5224\u65ad\u3057\u3066\u3001\u30e1\u30c3\u30bb\u30fc\u30b8\u5909\u6570\u306b\u8ffd\u52a0\u3059\u308b\u69d8\u306b\u3059\u308c\u3070\u3001\u30d5\u30e9\u30c3\u30b7\u30e5\u306e\u5834\u5408\u306f\u7a7a\u767d\u6587\u5b57\u5217\u306b\u30d5\u30e9\u30c3\u30b7\u30e5\u3092\u8ffd\u52a0\u3057\u3066\u30d5\u30e9\u30c3\u30b7\u30e5\u306b\u3001\u30b9\u30c8\u30ec\u30fc\u30c8\u30d5\u30e9\u30c3\u30b7\u30e5\u306e\u5834\u5408\u306f\u30b9\u30c8\u30ec\u30fc\u30c8\u306b\u30d5\u30e9\u30c3\u30b7\u30e5\u3092\u8ffd\u52a0\u3057\u3066\u30b9\u30c8\u30ec\u30fc\u30c8\u30d5\u30e9\u30c3\u30b7\u30e5\u306b\u306a\u308a\u307e\u3059\u3002msg += &#8220;\u30d5\u30e9\u30c3\u30b7\u30e5&#8221; \u306f msg = msg + &#8220;\u30d5\u30e9\u30c3\u30b7\u30e5&#8221; \u3068\u3044\u3046\u306e\u3092\u7701\u7565\u3057\u305f\u5f62\u3067\u3059\u3002\u6574\u6570\u578b\u3060\u3051\u3067\u306a\u304f\u6587\u5b57\u5217\u578b\u3067\u3082\u4f7f\u3048\u307e\u3059\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/shimayugu.sakura.ne.jp\/?p=2473\">\u76ee\u6b21<\/a>\u3000<a href=\"https:\/\/xcode15.shimayugu.jp\/?p=233\">\u901a\u5e38\u7248<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u6b21\u3000\u901a\u5e38\u7248 \u3000\u30b9\u30c8\u30ec\u30fc\u30c8\u306e\u5224\u5b9a\u3067\u3059\u3002 \u3000\u4eca\u56de\u3001\u30b9\u30c8\u30ec\u30fc\u30c8\u306e\u5224\u5b9a\u304c\u52a0\u308f\u308a\u307e\u3057\u305f\u304c\u3001\u30ab\u30fc\u30c9\u30ca\u30f3\u30d0\u30fc\u306e\u6700\u5927\u5024\u3068\u6700\u5c0f\u5024\u3092\u6c42\u3081\u3066\u3001\u305d\u306e\u5dee\u304c\uff14\u306e\u5834\u5408\u30b9\u30c8\u30ec\u30fc\u30c8\u3068\u3057\u307e\u3057\u305f\u3002\u3053\u308c\u306f\u30da\u30a2\u304c\u3042\u3063\u305f\u5834\u5408\u3001\u2663\ufe0f\uff15\u2666\ufe0f\uff16\u2764\ufe0f\uff16\u2663\ufe0f\uff17\u2660\ufe0f\uff19\u3068\u3044\u3046 [&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-709","post","type-post","status-publish","format-standard","hentry","category-swift"],"_links":{"self":[{"href":"https:\/\/xcode15.shimayugu.jp\/index.php?rest_route=\/wp\/v2\/posts\/709","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=709"}],"version-history":[{"count":9,"href":"https:\/\/xcode15.shimayugu.jp\/index.php?rest_route=\/wp\/v2\/posts\/709\/revisions"}],"predecessor-version":[{"id":1067,"href":"https:\/\/xcode15.shimayugu.jp\/index.php?rest_route=\/wp\/v2\/posts\/709\/revisions\/1067"}],"wp:attachment":[{"href":"https:\/\/xcode15.shimayugu.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=709"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xcode15.shimayugu.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=709"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xcode15.shimayugu.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=709"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}