Skip to content

Instantly share code, notes, and snippets.

@shingohry
shingohry / ___FILEBASENAME___View.swift
Created September 24, 2024 12:48
Xcode file template (edited)
//___FILEHEADER___
import SwiftUI
struct ___FILEBASENAMEASIDENTIFIER___: View {
var body: some View {
Text("___VARIABLE_productName:identifier___")
}
}
@shingohry
shingohry / ___FILEBASENAME___.swift
Last active September 24, 2024 12:49
Xcode file template (original)
//___FILEHEADER___
import SwiftUI
struct ___FILEBASENAMEASIDENTIFIER___: View {
var body: some View {
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
}
}
@shingohry
shingohry / TemplateInfo.plist
Last active September 24, 2024 12:51
Xcode file template (edited)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SupportsSwiftPackage</key>
<true/>
<key>Kind</key>
<string>Xcode.IDEFoundation.TextSubstitutionFileTemplateKind</string>
<key>Description</key>
<string>A SwiftUI custom view with text</string>
@shingohry
shingohry / TemplateInfo.plist
Last active September 24, 2024 12:49
Xcode file template (original)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SupportsSwiftPackage</key>
<true/>
<key>Kind</key>
<string>Xcode.IDEFoundation.TextSubstitutionFileTemplateKind</string>
<key>Description</key>
<string>A SwiftUI custom view with text</string>
@shingohry
shingohry / UsePocketAuthenticationAPIExample.swift
Last active March 7, 2022 15:25
Use Pocket Authentication API in iOS App
import UIKit
import AuthenticationServices
import Combine
class ViewController: UIViewController {
// you must add a URL scheme to your Info.plist
let callbackURLScheme = "pocketsample"
let callbackURL = "pocketsample:authorizationFinished"
@shingohry
shingohry / ViewController.swift
Created June 11, 2019 17:13
NetworkingWithCombine
import UIKit
import Combine
/*
# References
- [ra1028/SwiftUI-Combine: This is an example project of SwiftUI and Combine using GitHub API.](https://github.com/ra1028/SwiftUI-Combine)
- [marty-suzuki/GitHubSearchWithSwiftUI: SwiftUI and Combine based GitHubSearch example.](https://github.com/marty-suzuki/GitHubSearchWithSwiftUI)
- [DataTaskPublisherを作ってみた](https://gist.github.com/yamoridon/16c1cc70ac46e50def4ca6695ceff772)
- [【iOS】Combineフレームワークまとめ(2019/6/9時点) - Qiita](https://qiita.com/shiz/items/5efac86479db77a52ccc)
*/
@shingohry
shingohry / ResultActivity.kt
Last active January 7, 2019 07:42
ResultActivity
package com.example.myfirstapp
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.widget.TextView
class ResultActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@shingohry
shingohry / MainActivity.kt
Last active January 7, 2019 07:38
MainActivity
package com.example.myfirstapp
import android.content.Intent
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.widget.Button
import android.widget.EditText
class MainActivity : AppCompatActivity() {
@shingohry
shingohry / Snapshotter.swift
Last active September 9, 2020 05:56
create Snapshot of entire SpreadsheetView (SpreadsheetView: https://github.com/kishikawakatsumi/SpreadsheetView)
class Snapshotter {
static func createSnapshot(spreadsheetView: SpreadsheetView) -> UIImage? {
guard let rootView = spreadsheetView.subviews[0] as? UIScrollView,
let overlayView = spreadsheetView.subviews[1] as? UIScrollView else { return nil }
let bounds = spreadsheetView.bounds
let contentSize = overlayView.contentSize
let contentOffset = rootView.contentOffset
let numberOfColumns = Int(contentSize.width / bounds.width)
@shingohry
shingohry / app.js
Last active June 18, 2018 14:59
Send iOS 12 grouped remote notifications with node-apn
// References:
// https://developer.apple.com/videos/play/wwdc2018/711/
// https://github.com/node-apn/node-apn/blob/master/doc/notification.markdown#convenience-setters
// https://eladnava.com/send-push-notifications-to-ios-devices-using-xcode-8-and-swift-3/
var apn = require('apn');
// Set up apn with the APNs Auth Key
var apnProvider = new apn.Provider({
token: {