Skip to content

Instantly share code, notes, and snippets.

View benigumocom's full-sized avatar
🏠
🙆

chanzmao benigumocom

🏠
🙆
View GitHub Profile
@benigumocom
benigumocom / showProductDetailsAndPurchaseExtension.kt
Last active January 4, 2025 05:38
【Kotlin】Android アプリ 課金実装時の ProductDetails や Purchase の内容 https://android.benigumo.com/20250104/billing-params/
fun ProductDetails.showLog() {
Timber.d("ProductDetails")
Timber.d(" productId : ${this.productId}")
Timber.d(" productType : ${this.productType}")
Timber.d(" title : ${this.title}")
Timber.d(" name : ${this.name}")
Timber.d(" description : ${this.description}")
this.subscriptionOfferDetails?.forEachIndexed { index, offer ->
Timber.d(" subscriptionOfferDetails")
Timber.d(" index : $index")
@Composable
fun SettingsScreen(
modifier: Modifier = Modifier,
viewModel: SettingsViewModel = hiltViewModel()
) {
val on = viewModel.on.collectAsState()
LazyColumn{
items(10) {
OutlinedCard(
@benigumocom
benigumocom / AsyncImageEx.swift
Last active October 10, 2024 13:24
SwiftUI・UIKit・AppKitでの画像処理の煩わしさを解消するためのヒント 👉 https://android.benigumo.com/20241010/swiftui-uikit-appkit/
import SwiftUI
struct Sample: View {
@State private var data: Data = .init()
private let urlStrings = [
"https://i.imgur.com/05S3yYZ.png",
"https://i.imgur.com/REuN9RR.png" // removed
]
@benigumocom
benigumocom / DraaggableList.swift
Last active September 12, 2024 10:58
【SwiftUI】Create Draggable Reorder ListView without List 👉 https://android.benigumo.com/20240912/create-draggable-reorder-list-view/
import SwiftUI
struct Fruit: Identifiable, Equatable {
let id = UUID()
let name: String
let color: Color
}
struct DraggableList: View {
@State private var fruits: [Fruit] = [
@benigumocom
benigumocom / SpeechBubble.swift
Last active January 15, 2025 08:01
【SwiftUI】Create Animated Speech Bubble 👉 https://android.benigumo.com/20240827/speech-bubble/
import SwiftUI
struct SpeechBubble: View {
var count: Int
var body: some View {
HStack(spacing: 0) {
Rectangle()
.fill(.red)
.rotationEffect(.degrees(45))
@benigumocom
benigumocom / AnimatedStateButton.swift
Last active August 25, 2024 16:31
【SwiftUI】State 付きボタンのアニメーション記述 👉 https://android.benigumo.com/20240826/state-button/
import SwiftUI
struct AnimatedStateButton: View {
@State private var show1 = false
@State private var show2 = false
@State private var show3 = false
@State private var show4 = false
@State private var show5 = false
@State private var show6 = false
@benigumocom
benigumocom / AnimatedMessage.swift
Last active August 23, 2024 02:31
【SwiftUI】Apple 公式サンプルで Animation と Transition はどのように使われているか 👉 https://android.benigumo.com/20240822/swiftui-animation-transition/
import SwiftUI
// 【SwiftUI】アニメーションの書き方
// https://zenn.dev/maochanz/articles/b3f2b0dcf949c5
//【SwiftUI】トランジションの書き方
// https://zenn.dev/maochanz/articles/0bcd4bfaa43a0d
struct AnimatedMessage: View {
var text: String
import SwiftUI
struct TestTransition: View {
@State private var active = false
var body: some View {
VStack {
if active {
Image(systemName: "face.smiling")
.font(.system(size: 100))
import SwiftUI
struct TextAnimationView: View {
@State private var scale = false
@State private var rotation = false
@State private var opacity = false
@State private var offset = false
var body: some View {
VStack {
@benigumocom
benigumocom / PreviewOneModelView.swift
Last active July 27, 2024 04:03
【SwiftUI + SwiftData】List のアイテムの Preview 👉 https://android.benigumo.com/20240725/preview-one-item/
import SwiftUI
import SwiftData
struct PreviewOneModelView<Model: PersistentModel, Content: View>: View {
var content: (Model) -> Content
@Query private var models: [Model]
var body: some View {
content(models.first!)
}