์ „์ฒด ๊ธ€ 29

[IOS/Swift] ์ฝ˜ํ…์ธ  ๊ฒ€์ƒ‰ ์•ฑ ๊ตฌํ˜„ - 4. ๋กœ๊ทธ์ธ UI ๊ตฌํ˜„

Swift UI - 4. ๋กœ๊ทธ์ธ UI ํ™”๋ฉด ๊ตฌํ˜„ ์ด์ „์— ๊ตฌํ˜„ํ•œ ํšŒ์›๊ฐ€์ž…์œผ๋กœ ํšŒ์›์ด ๋“ฑ๋ก๋˜์—ˆ๋‹ค(DRF๋กœ ํšŒ์›๊ฐ€์ž… API๋ฅผ ๊ตฌํ˜„) ์ด์ œ ๋“ฑ๋ก๋œ ํšŒ์›์œผ๋กœ ๋กœ๊ทธ์ธ์„ ์ง„ํ–‰ํ•˜๊ณ  ํ‚ค์ฒด์ธ์„ ์ด์šฉํ•ด์„œ Access Token ๋ฐ Refresh Token์„ ์ €์žฅํ•˜์—ฌ ์•ฑ ์‚ฌ์šฉ ์ค‘ ๋กœ๊ทธ์ธ ์ƒํƒœ๋ฅผ ์œ ์ง€ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•ด๋ณด์ž. // // LoginView.swift // mbtiPlayground // // Created by ๋ฐ•์ข…ํ›„ on 2022/03/16. // import SwiftUI struct LoginView: View { @State private var email: String = "" @State private var password: String = "" @State private var loginStatus: ..

IOS(Swift) 2022.04.04

[IOS/Swift] ์ฝ˜ํ…์ธ  ๊ฒ€์ƒ‰ ์•ฑ ๊ตฌํ˜„ - 3. ํšŒ์›๊ฐ€์ž… UI ๊ตฌํ˜„

Swift UI ๋ฅผ ์‚ฌ์šฉํ•œ ํšŒ์›๊ฐ€์ž… ๋ฐ ๋กœ๊ทธ์ธ ํ™”๋ฉด ๊ตฌํ˜„ - ๋ฐฑ์—”๋“œ๋Š” Django RestFramework ์‚ฌ์šฉ ๊ตฌํ˜„ ์˜ˆ์‹œ - ํšŒ์›๊ฐ€์ž… ํšŒ์› ๊ฐ€์ž…์€ 4๊ฐœ ํ•ญ๋ชฉ (๋‹‰๋„ค์ž„, ์ด๋ฉ”์ผ, ๋น„๋ฐ€๋ฒˆํ˜ธ(+๋น„๋ฐ€๋ฒˆํ˜ธ ํ™•์ธ), MBTI ํ•ญ๋ชฉ)์„ ์ž…๋ ฅ๋ฐ›๋Š” ํ™”๋ฉด์„ ๋งŒ๋“ ๋‹ค. ์—ฌ๊ธฐ์„œ MBTI ํ•ญ๋ชฉ์€ HTML์—์„œ ๋งํ•˜๋Š” ์…€๋ ‰ํŠธ ๋ฐ•์Šค UI๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ MBTI๋ฅผ ์„ ํƒํ•˜๋„๋ก ํ•˜์˜€๋‹ค. // // SignUpView.swift // mbtiPlayground // // Created by ๋ฐ•์ข…ํ›„ on 2022/03/16. // import SwiftUI struct SignUpView: View { @Environment(\\.presentationMode) var presentationMode: Binding @State private v..

IOS(Swift) 2022.04.04

[IOS/Swift] ์ฝ˜ํ…์ธ  ๊ฒ€์ƒ‰ ์•ฑ ๊ตฌํ˜„ - 2. ์ฑ„ํŒ…๋ฐฉ UI ๊ตฌํ˜„

์ „ํŽธ์— ์ด์–ด์„œ ์ฑ„ํŒ…๋ฐฉ UI๋ฅผ ๊ตฌํ˜„ํ•ด๋ณด๊ฒ ๋‹ค. ์ฑ„ํŒ…๋ฐฉ์€ ํด๋Ÿฝํ•˜์šฐ์Šค ์•ฑ์˜ UI๋ฅผ ์ฐธ๊ณ ํ•˜์—ฌ ๋งŒ๋“ค์—ˆ๋‹ค. ๊ฒฐ๊ณผ๋ฌผ ํ™”๋ฉด ๊ฒฐ๊ณผ๋ฌผ ์˜ˆ์‹œ ์ฑ„ํŒ…๋ฐฉ ์ƒ์„ธ ํ™”๋ฉด ๊ตฌํ˜„ ์ฑ„ํŒ…๋ฐฉ์—๋Š” ๊ฐ ์œ ์ €๋ณ„ ํ”„๋กœํ•„ ์‚ฌ์ง„์ด ๋“ค์–ด๊ฐ€์•ผ ํ•œ๋‹ค. ๊ทธ๋ ‡๊ธฐ ๋•Œ๋ฌธ์— ํ”„๋กœํ•„ ํ™”๋ฉด๋„ ๊ตฌํ˜„ํ•ด๋ณด์ž ํ”„๋กœํ•„ ํ™”๋ฉด ๊ตฌํ˜„ ํ”„๋กœํ•„ ํ™”๋ฉด์˜ ํ”„๋กœํ•„ ์‚ฌ์ง„์€ ์ถ”ํ›„ Amazon S3 ๋ฅผ ํ™œ์šฉํ•ด ๊ด€๋ฆฌํ•  ์˜ˆ์ •์ด๋‹ค. (REST API๋กœ ๊ด€๋ จ URL ์„ ๋ฐ›์„ ์˜ˆ์ •). ๊ทธ๋ž˜์„œ ์ด๋ฏธ์ง€ URL ๋กœ ํ”„๋กœํ•„ ์‚ฌ์ง„์„ ๋ณด์—ฌ์ค„ ์ˆ˜ ์žˆ๋Š” UI ๊ฐ€ ๋ณ„๋„๋กœ ํ•„์š”ํ•˜๋‹ค. Swift ์—์„œ๋Š” AsyncImage๋ฅผ ์‚ฌ์šฉํ•ด์„œ ์ด๋ฏธ์ง€์˜ url๋กœ(html ์—์„œ image ํƒœ๊ทธ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ๊ณผ ์œ ์‚ฌ) ์‚ฌ์ง„์„ ๋ณด์—ฌ์ค„ ์ˆ˜ ์žˆ๋‹ค. ์•„๋ž˜ ์ฝ”๋“œ๋ฅผ ๊ตฌํ˜„ํ•˜๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค. import SwiftUI struct ProfileItem: Vi..

IOS(Swift) 2022.03.05

[IOS/Swift] ์ฝ˜ํ…์ธ  ๊ฒ€์ƒ‰ ์•ฑ ๊ตฌํ˜„ - 1. ์ฝ˜ํ…์ธ  UI ๊ตฌํ˜„

ํ˜„์žฌ ์‚ฌ๋‚ด์—์„œ ํ‚ค์›Œ๋“œ๋ฅผ ๊ฒ€์ƒ‰ํ•˜์—ฌ ๊ด€๋ จ ์ฝ˜ํ…์ธ ๋ฅผ ๋ณด์—ฌ์ฃผ๋Š” ์•ฑ์„ ๊ตฌํ˜„ํ•˜๊ณ  ์žˆ๋‹ค. ๊ธฐ์ˆ  ๊ธฐํš - ์•ฑ์— ๋“ค์–ด๊ฐˆ ๊ธฐ์ˆ  ๋ชฉ๋ก ๊ฒ€์ƒ‰ ๋ฐ ๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ ํ™•์ธ ๊ฒ€์ƒ‰ ํ‚ค์›Œ๋“œ ๊ด€๋ จ ์ฝ˜ํ…์ธ (ํ…์ŠคํŠธ ์ฝ˜ํ…์ธ  ๋˜๋Š” ์ฑ„ํŒ…๋ฐฉ) ํ…์ŠคํŠธ ์ฝ˜ํ…์ธ  ์Œ์„ฑ ์ฑ„ํŒ…๋ฐฉ ๋กœ๊ทธ์ธ ์ฒซ๋ฒˆ์งธ๋กœ ํ…์ŠคํŠธ ์ฝ˜ํ…์ธ ์™€ ๊ด€๋ จ UI๋ฅผ ๊ตฌํ˜„ํ•ด๋ณด์ž. ํ…์ŠคํŠธ ์ฝ˜ํ…์ธ  UI ๊ตฌํ˜„ ํ…์ŠคํŠธ ์ฝ˜ํ…์ธ  ์ƒ์„ธํ™”๋ฉด ๊ตฌํ˜„ ํ…์ŠคํŠธ ์ฝ˜ํ…์ธ  ์ƒ์„ธํ™”๋ฉด์— ๋“ค์–ด๊ฐˆ ์š”์†Œ๋Š” ์ œ๋ชฉ, ์ถœ์ฒ˜, ์ž‘์„ฑ์ผ, MBTI ํƒ€์ž…, ๊ทธ๋ฆฌ๊ณ  ์ฝ˜ํ…์ธ  ๋‚ด์šฉ์ด๋‹ค. ์ด๋ฅผ ์Šค์œ„ํ”„ํŠธ UI๋กœ ๊ตฌํ˜„ํ•˜๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค. import SwiftUI struct ContentDetail: View { var contItem: ContentDetailData var body: some View { VStack(alignment: .leading){ Gro..

IOS(Swift) 2022.03.05

[Elastic Search] ๊ฒ€์ƒ‰ ๊ตฌํ˜„ํ•˜๊ธฐ(with Fast API)

ES๋กœ ๊ฒ€์ƒ‰์—”์ง„์„ ๊ตฌํ˜„ํ•˜์˜€๋‹ค. ๊ตฌํ˜„๋œ ๊ฒ€์ƒ‰ ์—”์ง„์„ ์‹ค์ œ ์„œ๋น„์Šค์ฒ˜๋Ÿผ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด REST API๋ฅผ ๊ตฌํ˜„ํ•ด๋ณด์ž. REST API์˜ ๋กœ์ง์€ ๋‹จ์ˆœํ•˜๊ฒŒ ๋ณธ๋‹ค๋ฉด 2๋‹จ๊ณ„์ด๋‹ค. 1. ์‚ฌ์šฉ์ž๊ฐ€ ๊ฒ€์ƒ‰ ํ‚ค์›Œ๋“œ๋ฅผ ์ž…๋ ฅํ•œ๋‹ค. 2. ๊ฒ€์ƒ‰ ํ‚ค์›Œ๋“œ์— ํ•ด๋‹นํ•˜๋Š” ๋ฌธ์„œ๋ฅผ ์ฐพ๋Š”๋‹ค. ์‚ฌ์šฉ์ž ์ž…๋ ฅ ๊ตฌํ˜„ ์‚ฌ์šฉ์ž ์ž…๋ ฅ ๊ตฌํ˜„์—์„œ ๊ณ ๋ คํ•  ์ ์€ ๋‹จ์ˆœํ•˜๊ฒŒ ํ•˜๋‚˜์˜ ํ‚ค์›Œ๋“œ๋งŒ ์ž…๋ ฅ๋ฐ›์•„์„œ ๋ฌธ์„œ๋ฅผ ์ƒ์„ธํ•˜๊ฒŒ ๊ฒ€์ƒ‰ํ•  ์ˆ˜๋Š” ์—†๋‹ค๋Š” ๊ฒƒ์ด๋‹ค. ์œ ์‚ฌ์–ด, ์ œ์™ธ์–ด, ์—ฌ๋Ÿฌ ํ‚ค์›Œ๋“œ, And ์กฐ๊ฑด, Or ์กฐ๊ฑด ๋“ฑ ๋‹ค์–‘ํ•œ ์กฐ๊ฑด์œผ๋กœ ๊ฒ€์ƒ‰์ด ๊ฐ€๋Šฅํ•˜๋ฉด ์‚ฌ์šฉ์ž์—๊ฒŒ ๋” ์ข‹์€ ๊ฒ€์ƒ‰ ์‹œ์Šคํ…œ์ด ๋  ์ˆ˜ ์žˆ๋‹ค. ๊ทธ๋ž˜์„œ ๊ฒ€์ƒ‰ ํ‚ค์›Œ๋“œ์—์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก ํŠน์ˆ˜ ์ปค๋งจ๋“œ๋ฅผ ์ •๋ฆฌํ•ด๋ณด์•˜๋‹ค. ๋‹จ์ผ ๊ฒ€์ƒ‰: search= ์˜ˆ) ๋งจํˆฌ๋งจ ์œ ์‚ฌ์–ด ๊ฒ€์ƒ‰: search= ์˜ˆ) ๋งจํˆฌ๋งจ +์•„๋””๋‹ค์Šค => ๋งจํˆฌ๋งจ์ด ํฌํ•จ๋œ ๋ฌธ์„œ์—์„œ..

Elastic Search 2022.02.15

[Elastic Search] Nori Tokenizer & Filter ์ ์šฉ๊ธฐ

์ด์ „ ๊ธ€์—์„œ Elastic Search์˜ ์ฟผ๋ฆฌ๋“ค์„ ๊ณต๋ถ€ํ•˜๋ฉด์„œ ์กฐ๊ธˆ ๋” ์ž์„ธํ•˜๊ฒŒ ๋ฐ์ดํ„ฐ ์กฐํšŒ๋ฅผ ํ•ด๋ณด๊ณ  ์‹ถ์—ˆ๋‹ค. ๊ทธ๋ž˜์„œ ์ €์žฅ๋œ ํ…์ŠคํŠธ๋“ค์— ํ•œ๊ธ€ ํ˜•ํƒœ์†Œ ๋ถ„์„๊ธฐ๋ฅผ ์ ์šฉํ•˜์—ฌ ๊ฒ€์ƒ‰์„ ์ข€ ๋” ์ž์„ธํžˆ ํ•  ์ˆ˜ ์žˆ๋Š” ๋ฐฉ๋ฒ•์„ ์ฐพ์•„๋ณด์•˜๋‹ค. Elastic Search ํ•œ๊ธ€ ํ˜•ํƒœ์†Œ ๋ถ„์„๊ธฐ Elastic Search 7.0 ์ดํ›„ ๋ฒ„์ „๋ถ€ํ„ฐ๋Š” Nori(๋…ธ๋ฆฌ)๋ผ๋Š” ํ•œ๊ธ€ ํ˜•ํƒœ์†Œ ๋ถ„์„๊ธฐ๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค. (๊ณต์‹์ ์œผ๋กœ๋Š” 6.6 ๋ฒ„์ „ ์ดํ›„๋ถ€ํ„ฐ ์ œ๊ณต) Nori์˜ ์„ค์น˜๋Š” ์•„๋ž˜ ๋งํฌ๋ฅผ ์ฐธ์กฐํ•˜์—ฌ ์ง„ํ–‰ํ•œ๋‹ค. https://www.elastic.co/guide/en/elasticsearch/plugins/current/analysis-nori.html ํ˜„ ์ƒํ™ฉ ๊ธฐ์กด์—๋Š” ์•„๋ž˜์™€ ๊ฐ™์ด ์ธ๋ฑ์Šค & ๋ถ„์„๊ธฐ๋ฅผ ๊ตฌ์„ฑํ•˜์˜€๋‹ค. { "settings": { "inde..

Elastic Search 2022.02.09

[Elastic Search] Query ์Šคํ„ฐ๋””-3ํŽธ ํ•„๋“œ ๊ฐ€์ค‘์น˜, ๋…ผ๋ฆฌ ์ฟผ๋ฆฌ, ํŒจํ„ด ๊ฒ€์ƒ‰

ํ•„๋“œ์— ๊ฐ€์ค‘์น˜ ๋‘๊ธฐ ํŠน์ • ํ•„๋“œ์— ๊ฐ€์ค‘์น˜๋ฅผ ๋‘๋Š” ๋ฐฉ๋ฒ•์„ ์‚ฌ์šฉ - ๋ถ€์ŠคํŒ… ๊ธฐ๋ฒ•. ์ฆ‰ ๊ฒ€์ƒ‰ํ•˜๋Š” ์—ฌ๋Ÿฌ ํ•„๋“œ ์ค‘ ์ค‘์š”ํ•œ ํ•„๋“œ๋ฅผ ์•Œ๊ณ  ์žˆ๋‹ค๋ฉด ๊ทธ ํ•„๋“œ์— ๊ฐ€์ค‘์น˜๋ฅผ ๋‘์–ด ๋” ์ƒ์œ„๋กœ ๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ๋ฅผ ์˜ฌ๋ฆฌ๋Š” ๋ฐฉ๋ฒ• GET product/_search { "query": { "multi_match": { "query": "๋งจํˆฌ๋งจ", "fields": [ "category2", "title^2" ] } } } ํŠน์ • ํ•„๋“œ์— ๊ฐ€์ค‘์น˜๋ฅผ ์ค˜์„œ ํŠน์ • ํ•„๋“œ์˜ ์Šค์ฝ”์–ด ๊ฐ’์„ N๋ฐฐ ํ•ด์ฃผ๋Š” ํšจ๊ณผ๋ฅผ ์ค€๋‹ค. ์œ„ ์ฟผ๋ฆฌ์—์„œ๋Š” title ํ•„๋“œ์— 2๋ฐฐ์˜ ํšจ๊ณผ๋ฅผ ์ฃผ์—ˆ๋‹ค. ์ฆ‰ title ํ•„๋“œ์—์„œ ๊ฒ€์ƒ‰ํ•œ ๊ฒฐ๊ณผ ์Šค์ฝ”์–ด์— 2๋ฐฐ์˜ ํšจ๊ณผ๋ฅผ ์ฃผ์–ด ๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ๋ฅผ ์ƒ์œ„๋กœ ์˜ฌ๋ ธ๋‹ค. ๋…ผ๋ฆฌ ์ฟผ๋ฆฌ ๋…ผ๋ฆฌ ์ฟผ๋ฆฌ๋Š” ๋ณตํ•ฉ ์ฟผ๋ฆฌ๋กœ, match, multi_math, match_phrase ๋“ฑ์„..

Elastic Search 2022.02.03

[Elastic Search]Query ์Šคํ„ฐ๋””-2ํŽธ Term ์ฟผ๋ฆฌ, Multi-match ์ฟผ๋ฆฌ

์šฉ์–ด ์ฟผ๋ฆฌ ์šฉ์–ด ์ฟผ๋ฆฌ๋Š” ์™„๋ฒฝํ•˜๊ฒŒ ๋งค์นญ๋˜๋Š” ๋‹จ์–ด ํ˜น์€ ๋ฌธ๊ตฌ๋ฅผ ๊ฐ€์ ธ์˜จ๋‹ค. match ์ฟผ๋ฆฌ์™€๋Š” ๋‹ค๋ฅด๊ฒŒ ๋ฌธ์žฅ์— ๋Œ€ํ•œ full-text-match ๊ฒ€์ƒ‰์ด๊ธฐ ๋•Œ๋ฌธ์— ๋ฌธ์žฅ ์ „์ฒด๋ฅผ ์•Œ๊ณ  ์žˆ์–ด์•ผ ํ•œ๋‹ค. ๊ธฐ์กด review ์ธ๋ฑ์Šค์—์„œ review ๋ฐ์ดํ„ฐ๊ฐ€ text ํƒ€์ž…์œผ๋กœ ๋˜์–ด ์žˆ์–ด term ์ฟผ๋ฆฌ๊ฐ€ ์ž‘๋™ํ•˜์ง€ ์•Š๋Š” ๋ฌธ์ œ๊ฐ€ ์žˆ์—ˆ๋‹ค. ๊ทธ๋ž˜์„œ ์ƒˆ๋กญ๊ฒŒ ์ธ๋ฑ์Šค๋ฅผ ๊ตฌ์„ฑํ•˜์˜€๋‹ค. "mappings": { "properties": { "prd_id": { "type": "text" }, "review_id": { "type": "text" }, "review": { "type": "text", "fields": { "full": { "type": "keyword" }, // nori ํ•„ํ„ฐ๋ฅผ ์‹œ๋„ํ–ˆ์ง€๋งŒ ์‹คํŒจํ•˜์˜€๋‹ค.. ๋‹ค์Œ์— ๋‹ค์‹œ! "nori_..

Elastic Search 2022.01.29

[Elastic Search] Query ์Šคํ„ฐ๋””-1ํŽธ Match, Match Phrase

์ธ๋ฑ์Šค ์„ค๋ช… ํ˜„์žฌ review ์ธ๋ฑ์Šค๋ฅผ ์ƒ์„ฑํ•˜์˜€๊ณ , review ์ธ๋ฑ์Šค์˜ ํ•„๋“œ๋Š” ์•„๋ž˜์™€ ๊ฐ™์ด ๊ตฌ์„ฑ๋˜์–ด ์žˆ๋‹ค. "mappings": { "properties": { "prd_id": { "type": "text" }, "review_id": { "type": "text" }, "review": { "type": "text" }, "genders": { "type": "rank_features" } } } ๋งค์นญ ์ฟผ๋ฆฌ ์ „๋ฌธ(Full-text query) ์ฟผ๋ฆฌ๋กœ Match ํ‚ค์›Œ๋“œ๋ฅผ ๊ฐ€์ง€๊ณ  ๊ฒ€์ƒ‰ํ•˜๋Š” ์ฟผ๋ฆฌ์ด๋‹ค. match์—์„œ ์‚ฌ์šฉํ•˜๋Š” ๊ฒ€์ƒ‰์–ด๋„ ํ† ํฐํ™”๊ฐ€ ๋˜์–ด ๊ฒ€์ƒ‰ํ•œ๋‹ค. ์ €์žฅ๋œ ์›๋ฌธ ์—ญ์‹œ ํ† ํฐํ™” ๋˜์–ด ์ €์žฅ๋˜์–ด ์žˆ์–ด ๊ฐ€๋Šฅํ•˜๋‹ค. ํ•˜๋‚˜์˜ ์šฉ์–ด๋ฅผ ๊ฒ€์ƒ‰ํ•˜๋Š” ์ฟผ๋ฆฌ GET review/_search { "_source": ["re..

Elastic Search 2022.01.27