Skip to content

Instantly share code, notes, and snippets.

View fumiyasac's full-sized avatar
🎯
Focusing

Fumiya Sakai fumiyasac

🎯
Focusing
View GitHub Profile
// ==========
// 5/10登壇補足資料
// 👉 UICollectionView内のサムネイル画像が浮かび上がる様なCustomTransitionをPush/Popの画面遷移に実装するコード例
// ==========
// 1. DetailTransitionクラス実装例
import Foundation
import UIKit
class DetailTransition: NSObject {
// ==========
// 5/10登壇補足資料
// 👉 画面がCrossFadeして切り替わる様なCustomTransitionをPresent/Dismissの画面遷移に実装するコード例
// ==========
import Foundation
import UIKit
class NewsTransition: NSObject {
@fumiyasac
fumiyasac / UseCaseExample.swift
Last active December 3, 2022 11:59
Firebase Realtime Database & FireStorage async/await Examples (Vol.1)
// ==========
// Firebaseに関する実装Tips集
// 👉 業務などで利用した経験の中でほんの少し役に立ったものを紹介しています。
// ==========
// ----------
/* 1. Realtime Database & FireStorageでShardingを実施する場合 */
// Situation:
// 例えば用途に応じてDBやStorageの接続先を変えたい様な場合に利用する(ここでの例はStagingとProductionで分ける場合)
// Document:
@fumiyasac
fumiyasac / recipe_book_meals.swift
Created December 23, 2020 16:10
UI実装であると嬉しいレシピブックまかない編掲載サンプル変更点
// UI実装であると嬉しいレシピブックまかない編掲載サンプル変更点
// 1. 掲載サンプル第2章に関する変更点のご紹介
// Parchmentを利用したタブ型UI表示に関連する処理の変更点
// PagingViewControllerDelegate及びPagingViewControllerInfiniteDataSourceの変更に加えて以前に<T>記載があった部分に変更があります。
final class ArticleViewController: UIViewController {
// MEMO: ライブラリ「Parchment」におけるタブ要素データを格納する配列
private var articleCategoryPageItemSet: [ArticleCategoryPageItem] = []
@fumiyasac
fumiyasac / recipe_book_vol2.swift
Last active December 23, 2020 16:10
UI実装であると嬉しいレシピブックVol.2掲載サンプル変更点
// UI実装であると嬉しいレシピブックVol.2掲載サンプル変更点
// 1. 掲載サンプル第2章に関する変更点のご紹介
// Alamofireを利用したAPI通信に関連する処理の変更点
// 主な変更箇所については、下記の2点となります。
// - UserAgentに付加する情報の組み立て
// - Promise型のデータを返却するための共通処理
class ArticleAPIManager {
@fumiyasac
fumiyasac / recipe_book_ios14.swift
Created December 23, 2020 14:24
UI実装であると嬉しいレシピブック掲載サンプル変更点(iOS14対応箇所)
// UI実装であると嬉しいレシピブック掲載サンプル変更点(iOS14対応箇所)
// 1. UINavigationController左上にある戻るボタンをロングタップした際に一気に最初の画面に戻る機能への対応
// 本書の中では、UINavigationControllerExtension.swiftに該当箇所があります。
// 戻るボタンの「戻る」テキストを削除した状態にするメソッド
func removeBackButtonText() {
self.navigationController!.navigationBar.tintColor = UIColor(code: "#ffffff")
if #available(iOS 14.0, *) {
self.navigationItem.backButtonDisplayMode = .minimal
import UIKit
import PlaygroundSupport
protocol WaterfallLayoutDelegate: AnyObject {
    func numberOfColumns() -> Int
    func columnsSize(at indexPath: IndexPath) -> CGSize
    func columnSpace() -> CGFloat
}
final class WaterfallLayoutViewController: UIViewController, UICollectionViewDataSource {
@fumiyasac
fumiyasac / DependenciesForDomains.swift
Created May 24, 2020 09:32
PropertyWrapperを利用したDependendyInjectionの例(各ドメイン側)
// (1) APIRequestManager.swift
// Infra層部分
import Foundation
import RxSwift
// MARK: - Protocol
protocol APIRequestProtocol {
func getAnnoucements() -> Single<AnnouncementListResponse>
@fumiyasac
fumiyasac / DependenciesDefinition.swift
Created May 24, 2020 09:13
PropertyWrapperを利用したDependendyInjectionの例(実装側)
// (1) DependenciesDefinition.swift
// それぞれのクラスの依存関係を定義する
import Foundation
final class DependenciesDefinition {
// MARK: - Function
// MEMO: PropertyWrapperを利用したDependencyInjectionを実施する
func inject() {
@fumiyasac
fumiyasac / Dependencies.swift
Last active June 17, 2020 13:03
PropertyWrapperを利用したDependendyInjectionの例(定義側)
import Foundation
// MEMO: Swift5.1から登場した「Property Wrappers」を利用したDependency Injectionの実装例
// https://stackoverflow.com/questions/61316547/nested-dependency-injection-through-property-wrapper-crashes
// 補足: Property Wrappersについて
// https://dev.classmethod.jp/articles/property-wrappers/
enum Dependencies {
// MARK: - Struct (for Name of Dependencies)