Skip to content

Instantly share code, notes, and snippets.

View kipsong133's full-sized avatar

Woo Sung Kim kipsong133

View GitHub Profile
@kipsong133
kipsong133 / swiftui_multipleline_textfield_textview_texteditor_placeholder.swift
Created March 10, 2024 08:21
[SwiftUI][Placeholder][Hinttext] TextEditor(TextView, multiple line textfiled) Placeholder View #SwiftUI
import SwiftUI
struct UplodePostView: View {
@State private var text: String = ""
var body: some View {
NavigationView {
Form {
Section {
TextEditorWithPlaceholder(text: $text, placeholder: "Write something...")
@kipsong133
kipsong133 / swiftui_keyboardabove_button_done.swift
Created March 8, 2024 14:20
[SwiftUI][floatingButtonButton][doneButon] 키보드 위에 버튼두기 #SwiftUI
.toolbar {
ToolbarItemGroup(placement: .keyboard) {
Spacer()
Button(action: {
keyboardFocused = false
}, label: {
Text("Done")
})
}
@kipsong133
kipsong133 / swiftui_uinavigationcontroller_extension.swft
Created March 8, 2024 13:41
[SwiftUI][Debug] NavigationView/Stack Gesture 동작안할때, #SwiftUI
import UIKit
extension UINavigationController: UIGestureRecognizerDelegate {
override open func viewDidLoad() {
super.viewDidLoad()
interactivePopGestureRecognizer?.delegate = self
}
public func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
return viewControllers.count > 1
}
@kipsong133
kipsong133 / swiftui_listbackground_ios15.swift
Created March 8, 2024 09:17
[SwiftUI][Modifier]List Background color change #SwiftUI
import SwiftUI
/// 예제
/// List { ... }
/// .modifier(ListBackgroundModifier())
/// .background(Color.red) // 원하는 색상 적용
struct ListBackgroundModifier: ViewModifier {
@ViewBuilder
func body(content: Content) -> some View {
@kipsong133
kipsong133 / result_type_dart.dart
Last active March 1, 2024 01:25
result_type_dart
// Dart에서 ResultType 사용하기
// 출처: https://codewithandrea.com/articles/flutter-exception-handling-try-catch-result-type/
/* 1. 최초 정의 */
/// Base Result class
/// [S] represents the type of the success value
/// [E] should be [Exception] or a subclass of it
sealed class Result<S, E extends Exception> {
const Result();
}
import 'dart:isolate';
import 'dart:math';

void main() async {
  Stopwatch stopwatch = Stopwatch()..start(); // 시간 측정 시작
  print('메인 Isolate에서 주식 데이터 처리 시작');
  ReceivePort receivePort = ReceivePort();
  // Isolate를 생성하고, 주식 데이터 처리 작업을 위임합니다.
 await Isolate.spawn(processStockData, receivePort.sendPort);

import 'dart:math';

void main() { Stopwatch stopwatch = Stopwatch()..start(); // 시간 측정 시작 print('메인 Isolate에서 주식 데이터 처리 시작'); // 주식 데이터를 가져옵니다. List stockData = fetchStockData(); // 데이터 처리 로직을 수행합니다. 예를 들어, 평균 가격을 계산합니다. double averagePrice = processStockData(stockData); // 처리된 데이터를 출력합니다.

@kipsong133
kipsong133 / flutter_isoloate_example1.md
Last active February 27, 2024 04:42
flutter_isolate_example_1.dart
import 'dart:isolate';

String mainIsolate = '';
String newIsolate = '';
String get isMainIsolate =>
    (mainIsolate == Isolate.current.hashCode.toString()) ? '🔴' : '🔵';

void main() async {
 mainIsolate = Isolate.current.hashCode.toString();
@kipsong133
kipsong133 / grid_paper_example.dart
Last active November 21, 2023 01:20
grid_paper_example.dart
import 'package:flutter/material.dart';
void main() {
runApp(const ExampleApp());
}
class ExampleApp extends StatelessWidget {
const ExampleApp({super.key});
@override
@kipsong133
kipsong133 / tech_spec_github_issue_template.md
Created November 14, 2023 00:12
[Github][Issue][Template][TechSpec][Docs] 깃헙 이슈 테크스팩 탬플릿 #Example #example
name about title labels assignees
테크스팩
요구사항에 대한 분석 혹은 요청사항에 대한 내용을 기술합니다.

요약 (Summary)