Skip to content
main
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

RxSchoolMeal

CI Version Carthage compatible Swift Package Manager License Platform codecov

Usage

μ΄ˆκΈ°ν™”

iOS μ•±μ—μ„œ RxSchoolMealλ₯Ό μ‚¬μš©ν•˜λ €λ©΄ RxSchoolMeal νŒŒμΌμ„ μ•„λž˜μ™€ 같이 μž„ν¬νŠΈ(import)ν•΄μ•Ό ν•©λ‹ˆλ‹€. λ˜ν•œ 학ꡐ이름을 μ΄μš©ν•΄ RxSchoolMealλ₯Ό μ΄ˆκΈ°ν™” ν•˜λŠ” 과정이 ν•„μš”ν•©λ‹ˆλ‹€. λ‹€μŒ 예제λ₯Ό μ°Έκ³ ν•˜μ—¬ AppDelegate.swift에 RxSchoolMealλ₯Ό μ΄ˆκΈ°ν™”ν•˜λŠ” μ½”λ“œλ₯Ό μΆ”κ°€ν•©λ‹ˆλ‹€.

import RxSchoolMeal 

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 

γ…€... 
    SchoolCommon.initSchool(schoolName: <#학ꡐ이름#>)
γ…€... 
γ…€
}

급식 정보 κ°€μ Έμ˜€κΈ°

급식 정보λ₯Ό κ°€μ Έμ˜€λŠ” μ½”λ“œμ˜ 기본적인 ν˜•νƒœμž…λ‹ˆλ‹€.

MEAL.getMeal(<#λ‚ μ§œ#>, timePart: <#식사ꡬ뢄#>).subscribe(onSuccess: { meal in
    print(meal)
})
.disposed(by: disposeBag)
  • μœ„ <#λ‚ μ§œ#>라고 μž‘μ„± λ˜μ–΄μžˆλŠ” λΆ€λΆ„μ—λŠ” MealDateλΌλŠ” μ΄λ¦„μœΌλ‘œ μ •μ˜λœ enum을 μž…λ ₯ν•©λ‹ˆλ‹€.
    Raw Value Description
    .today μ˜€λŠ˜μ„ λ‚˜νƒ€λƒ…λ‹ˆλ‹€.
    .anotherDate(date: Date) μ›ν•˜λŠ” λ‚ μ§œλ₯Ό Date νƒ€μž…μœΌλ‘œ λ°›μŠ΅λ‹ˆλ‹€.
    .plusMinusDay(day: Int) μ˜€λŠ˜μ„ κΈ°μ€€μœΌλ‘œ μ‘°νšŒν•˜κ³  싢은 λ‚ μ§œκ°€ λͺ‡μΌ 후인지, λͺ‡μΌ 전인지λ₯Ό Intν˜•μ‹μœΌλ‘œ λ°›μŠ΅λ‹ˆλ‹€.
  • μœ„ getMeal() ν•¨μˆ˜λŠ” timePart: <#식사ꡬ뢄#> 뢀뢄을 μž‘μ„±ν•˜μ§€ μ•Šμ•„λ„ λ˜λ„λ‘ μ˜€λ²„λ‘œλ”© λ˜μ–΄μžˆμŠ΅λ‹ˆλ‹€. λ§Œμ•½ MealModelλΌλŠ” μ΄λ¦„μœΌλ‘œ μ •μ˜λœ struct둜 μ•„μΉ¨, 점심, 저녁 메뉴λ₯Ό λͺ¨λ‘ λ°›κ³ μ‹Άλ‹€λ©΄ μž‘μ„±ν•˜μ§€ μ•ŠμœΌμ‹œλ©΄ λ©λ‹ˆλ‹€. ν•˜μ§€λ§Œ μ•„μΉ¨, 점심, 저녁쀑 ν•˜λ‚˜λ₯Ό [String]ν˜•νƒœλ‘œ 받아보고 μ‹Άλ‹€λ©΄ μž‘μ„±ν•˜μ‹œλ©΄ λ©λ‹ˆλ‹€.
  • <#식사ꡬ뢄#> 라고 μž‘μ„± λ˜μ–΄μžˆλŠ” λΆ€λΆ„μ—λŠ” MealPartTimeμ΄λΌλŠ” μ΄λ¦„μœΌλ‘œ μ •μ˜λœ enum을 μž…λ ₯ν•©λ‹ˆλ‹€.
    Raw Value Description
    .breakfast μ•„μΉ¨λ°₯ μž…λ‹ˆλ‹€.
    .lunch 점심λ°₯ μž…λ‹ˆλ‹€.
    .dinner 저녁λ°₯ μž…λ‹ˆλ‹€.
Examples

μ•„λž˜ μ„Έ μ˜ˆμ œλŠ” λͺ¨λ‘ 였늘의 급식을 μ‘°νšŒν•©λ‹ˆλ‹€.

MEAL.getMeal(.today).subscribe(onSuccess: { meal in 
   print(meal)
}, onFailure: { err in
   print(err)
})
.disposed(by: disposeBag)
MEAL.getMeal(.anotherDate(date: Date())).subscribe(onSuccess: { meal in
   print(meal)
}, onFailure: { err in
   print(err)
})
.disposed(by: disposeBag)
MEAL.getMeal(.plusMinusDay(day: 0)).subscribe(onSuccess: { meal in
   print(meal)
}, onFailure: { err in
   print(err)
})
.disposed(by: disposeBag)

μ•„λž˜ μ˜ˆμ œλŠ” μ–΄μ œμ˜ 급식쀑 μ μ‹¬λ§Œ κ°€μ Έμ˜€λŠ” μ˜ˆμ œμž…λ‹ˆλ‹€.

MEAL.getMeal(.plusMinusDay(day: -1), timePart: .lunch).subscribe(onSuccess: { meal in
   print(meal)
}, onFailure: { err in
   print(err)
})
.disposed(by: disposeBag)

Installation

CocoaPods

# Podfile
use_frameworks!

target 'YOUR_TARGET_NAME' do
    pod 'RxSchoolMeal', '1.0.3'
end

Replace YOUR_TARGET_NAME and then, in the Podfile directory, type:

$ pod install

Carthage

Add this to Cartfile

github "kimxwan0319/RxSchoolMeal" "1.0.3"
$ carthage update

Swift Package Manager

// Package.swift

dependencies: [
    .package(url: "https://github.com/kimxwan0319/RxSchoolMeal", from: "1.0.3")
]

Author

semicolondsmkr, kimxwan0319@naver.com

License

RxSchoolMeal is available under the MIT license. See the LICENSE file for more info.

About

πŸ‡°πŸ‡· μžμ‹ μ˜ 학ꡐ 급식을 κ°€μ Έμ˜¬ 수 μžˆλŠ” 라이브러리 μž…λ‹ˆλ‹€!

Topics

Resources

License

Packages

No packages published