Skip to content

Instantly share code, notes, and snippets.

View treastrain's full-sized avatar
🏠
Learning at home

treastrain / Tanaka Ryoga treastrain

🏠
Learning at home
View GitHub Profile
@treastrain
treastrain / led-flashing.swift
Created October 13, 2020 05:34
Raspberry Pi 4 Model B (ARM 64) + Swift 5.3 で Lチカ
import Foundation
import SwiftyGPIO
print("Hello, happy world!")
let gpios = SwiftyGPIO.GPIOs(for: .RaspberryPi4)
let port_white = gpios[.P24]!
let port_red = gpios[.P22]!
let port_yellow = gpios[.P23]!
@treastrain
treastrain / iOS 14 での Core NFC による交通系ICカードの残高読み取り.swift
Last active July 8, 2020 18:13
iOS 14 での Core NFC による交通系ICカードの残高読み取りサンプル(集まれSwift好き!Swift愛好会スピンオフ WWDC20セッション要約会 @ Online July 9, 2020)
// Created by treastrain on 2020/07/08.
// Copyright © 2020 treastrain / Tanaka Ryoga. All rights reserved.
//
/// 1. プロジェクトの TARGET から開発している iOS Application を選び、Signing & Capabilities で Near Field Communication Tag Reading を有効にする(Near Field Communication Tag Reader Session Formats が entitlements ファイルに含まれている必要がある)。
/// 2. Near Field Communication Tag Reader Session Formats の中に "NFC tag-specific data protocol (TAG)" が含まれていることを確認する。
/// 3. 開発している iOS Application の Info.plist に "Privacy - NFC Scan Usage Description (NFCReaderUsageDescription)" を追加する。
/// 4. 開発している iOS Application の Info.plist に "ISO18092 system codes for NFC Tag Reader Session (com.apple.developer.nfc.readersession.felica.systemcodes)" を追加し、読み取る際に使用する FeliCa システムコード `0003` を記述する。
import UIKit
import CoreNFC
This file has been truncated, but you can view the full file.
[
{
"cjrc_area_code" : null,
"cjrc_station_code" : null,
"cjrc_station_code_hex_str" : null,
"crjc_source" : null,
"crjc_source_url" : null,
"geo_json" : {
"geometry" : {
"coordinates" : [
@treastrain
treastrain / ViewController.swift
Created December 10, 2019 17:19
Core NFC (iOS 13.0 以降) で楽天Edy、nanaco、WAON の残高を読み取る
//
// ViewController.swift
// emoneyReader
//
// Created by treastrain on 2019/12/11.
// Copyright © 2019 treastrain / Tanaka Ryoga. All rights reserved.
//
import UIKit
import CoreNFC
@treastrain
treastrain / Extensions.swift
Last active December 7, 2019 11:21
Core NFC (iOS 13.0 以降) で運転免許証の本籍を読み取る
//
// Extensions.swift
// driversLicenceReader
//
// Created by treastrain on 2019/12/06.
// Copyright © 2019 treastrain / Tanaka Ryoga. All rights reserved.
//
import Foundation