๋ถ„๋ฅ˜ ์ „์ฒด๋ณด๊ธฐ

import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; import java.util.StringTokenizer; class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()," "); System.out.print(st.countTokens()); } } StringTokenizer์—๋Š” count..
public static int search(int[] nums, int target) { int start = 0, end = nums.length - 1; while(start
https://usevia.app/ VIA Your keyboard's best friend usevia.app ๋ณ„๋„ ํ”„๋กœ๊ทธ๋žจ์„ ๋‹ค์šด๋กœ๋“œํ•˜์ง€ ์•Š๊ณ  ์›น ํŽ˜์ด์ง€์—์„œ ํ‚ค ๋งตํ•‘ ํ•  ์ˆ˜ ์žˆ์–ด์š”. ํฌ๋กฌ์„ ๊ถŒ์žฅํ•œ๋‹ค๊ณ  ํ•˜๋Š”๋ฐ ๊ฐ™์€ ๊ณ„์—ด์ธ ์›จ์ผ์—์„œ๋„ ์ž˜ ๋™์ž‘ํ•ฉ๋‹ˆ๋‹ค! ๋งตํ•‘ํ•  ํ‚ค๋ฅผ ๋ˆ„๋ฅธ ๋‹ค์Œ, ์„ค์ •ํ•˜๊ธธ ์›ํ•˜๋Š” ํ‚ค๋ฅผ ๋ˆŒ๋Ÿฌ์ฃผ๋ฉด ๋ฉ๋‹ˆ๋‹ค! ๋งคํฌ๋กœ๋ฅผ ์‚ฌ์šฉํ•˜๋ ค๋ฉด ์šฐ์„  ๋งคํฌ๋กœ๋ฅผ ์ž‘์„ฑํ•ด ์ฃผ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๊ฐ€์žฅ ์™ผ์ชฝ์— MACROS๋ฅผ ๋ˆŒ๋Ÿฌ์ฃผ์„ธ์š”. ์ง€์ •ํ•  ๋งคํฌ๋กœ ๋ฒˆํ˜ธ๋ฅผ ๋ˆŒ๋Ÿฌ์ฃผ๊ณ  ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ ์ค๋‹ˆ๋‹ค. ์ค‘๊ด„ํ˜ธ๋ฅผ ์—ด์–ด์ฃผ์‹œ๊ณ  ์ง€์ •ํ•  ํ‚ค ์ด๋ฆ„์„ ์ž…๋ ฅํ•˜๋ฉด VIA์—์„œ ์‚ฌ์šฉํ•˜๋Š” ๋‹จ์ถ•์–ด๋กœ ๋ณ€๊ฒฝ๋ฉ๋‹ˆ๋‹ค. ๋งฅ์—์„œ ์ปค๋ฉ˜๋“œ๋Š” Left Winow ํ‚ค์™€ ๋™์ผํ•˜๊ธฐ ๋•Œ๋ฌธ์— Ctl + C๋ฅผ ์ง€์ •ํ•˜๋ ค๋ฉด KC_LCUI, KC_C ๋‘ ๊ฐœ๋ฅผ ์ง€์ •ํ•ด ์ฃผ๋ฉด ๋˜์š”. Save ๋ฒ„ํŠผ์„ ๋ฐ˜๋“œ์‹œ..
SwiftUI์—์„œ ํ•˜๋‹จ ํƒญ๋ฐ”๋ฅผ ๊ตฌํ˜„ํ•˜๊ณ  ์‹ถ์„ ๋•Œ TabView๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค. ํ•˜๋‹จ ํƒญ๋ฐ” ๋ฟ๋งŒ ์•„๋‹ˆ๋ผ ์บ๋Ÿฌ์…€ ์Šคํฌ๋กค ๋ทฐ (์˜ˆ๋ฅผ ๋“ค์–ด ๋ฐฐ๋„ˆ)๋„ TabView๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค. ํƒญ ์•„์ดํ…œ์ด ์—†๋Š” ์ปค์Šคํ…€ TabView๋ฅผ ๊ตฌํ˜„ํ–ˆ์„ ๋•Œ ํ•˜๋‹จ์— ์ž๋™์œผ๋กœ ์ƒ๊ธฐ๋Š” More์„ ์ œ๊ฑฐ ํ•˜๊ณ  ์‹ถ์œผ๋ฉด tabViewStyle modifier๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋œ๋‹ค. TabView(selection: viewStore.$selectedCategoryID) { // ์ƒ๋žต } .tabViewStyle(.page(indexDisplayMode: .never))
NavigationStack๊ณผ NavigationSplitView์—์„œ ๋ทฐ ์ด๋™์„ ์œ„ํ•ด NavigationLink๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค. struct Fruit: Identifiable, Hashable { var id = UUID() let name: String let emoji: String func hash(into hasher: inout Hasher) { hasher.combine(name) } } ๋ฆฌ์ŠคํŠธ์— ๋ณด์—ฌ์ฃผ๊ธฐ ์œ„ํ•œ ๊ธฐ๋ณธ ๋ฐ์ดํ„ฐ ๋ชจ๋ธ์„ ์ •์˜ struct FruitDetailView: View { let fruit: Fruit var body: some View { VStack { Text(fruit.emoji) .font(.largeTitle) Text(fruit.name) } } } ๋ฐ์ดํ„ฐ ..
Reduce // Reduce initializer @inlinable public init(_ reduce: @escaping (_ state: inout State, _ action: Action) -> Effect) { self.init(internal: reduce) } Reduce๋Š” Effect์„ ๋ฐ˜ํ™˜ํ•˜๋Š” ํด๋กœ์ ธ๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ์Œ Effect์„ ์‚ฌ์šฉํ•ด์„œ ์ƒํƒœ๋ฅผ ๊ด€๋ฆฌ Reducer ๋‚ด๋ถ€์—์„œ State๋ฅผ ๋ณ€ํ˜•ํ•˜๊ณ  ๊ด€๋ฆฌ Effect๋ฅผ Application์— ํ”ผ๋“œ๋ฐฑ (Side Effect) -> Reducer ๋‚ด๋ถ€์—์„œ Reduce๋ฅผ ๊ฐ€์ง€๊ณ  ์ƒํƒœ๋ฅผ ๊ด€๋ฆฌํ•œ๋‹ค. ์ด๋•Œ effect๋ฅผ ์ผ์œผ์ผœ ํ”ผ๋“œ๋ฐฑ์„ ํ•  ์ˆ˜ ์žˆ๋Š”๋ฐ ์ด๋ฅผ side effect๋ผ๊ณ  ํ•œ๋‹ค. .run Reduce๋Š” Effect์„ ๋ฐ˜ํ™˜ํ•ด์•ผ ํ•œ๋‹ค public..
๋™๊ธฐ & ๋น„๋™๊ธฐ synchronous๋Š” ์ž‘์—…์„ ๋™๊ธฐ์ ์œผ๋กœ ์‹คํ–‰. ์‹คํ–‰ ์ค‘์ธ ์ž‘์—…์ด ๋๋‚  ๋•Œ ๊นŒ์ง€ ๋‹ค๋ฅธ ์ž‘์—…์„ ๊ธฐ๋‹ค๋ฆผ asynchronous๋Š” ๋น„๋™๊ธฐ๋กœ ํ˜„์žฌ ์‹คํ–‰ ์ค‘์ธ ์ž‘์—…์ด ์žˆ์–ด๋„ ๋‹ค๋ฅธ ์ž‘์—…์„ ์‹คํ–‰ ํ•  ์ˆ˜ ์žˆ๋‹ค. ์˜ค๋ž˜ ๊ฑธ๋ฆฌ๋Š” ์ž‘์—…์„ ๋น„๋™๊ธฐ๋กœ ์ฒ˜๋ฆฌํ•ด์„œ ๋ฉ”์ธ ์Šค๋ ˆ๋“œ์—์„œ ํ•„์š”๋กœ ํ•˜๋Š” ์ž‘์—…์ด ๋ฉˆ์ถ”์ง€ ์•Š๊ฒŒ ํ•œ๋‹ค. MainActor UI ๊ด€๋ จ ์ž‘์—…์€ ๋ฉ”์ธ ์Šค๋ ˆ๋“œ์—์„œ ์‹คํ–‰๋˜์–ด์•ผ ํ•˜๋Š”๋ฐ, MainActor๋Š” ์ด๋ฅผ ์‰ฝ๊ฒŒ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ด์ค€๋‹ค. UI ์—…๋ฐ์ดํŠธ์™€ ๊ด€๋ จ๋œ ์ž‘์—…์„ ๋ฉ”์ธ ์Šค๋ ˆ๋“œ์—์„œ ์‹คํ–‰ํ•˜๋„๋ก ๋ณด์žฅํ•œ๋‹ค. ๋น„๋™๊ธฐ ์ž‘์—…์—์„œ ๋ฉ”์ธ ์Šค๋ ˆ๋“œ๋กœ์˜ ์ ‘๊ทผ์„ ์•ˆ์ „ํ•˜๊ฒŒ ๊ด€๋ฆฌํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์Šค๋ ˆ๋“œ ์•ˆ์ •์ ์ด๋ฉฐ DispatchQueue.main.async์™€ ๊ฐ™์€ ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•  ํ•„์š”๊ฐ€ ์—†์–ด ๊ฐ„๊ฒฐํ•œ ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ๋‹ค. struct Def..
fram
'๋ถ„๋ฅ˜ ์ „์ฒด๋ณด๊ธฐ' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก