Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kimxwan0319/rxschoolmeal

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

carthage cocoapods library spm swift

Last synced: 21 days ago
JSON representation

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

Awesome Lists containing this project

README

        

# RxSchoolMeal

![CI](https://github.com/kimxwan0319/RxSchoolMeal/actions/workflows/main.yml/badge.svg?event=release)
[![Version](https://img.shields.io/cocoapods/v/RxSchoolMeal.svg?style=flat)](https://cocoapods.org/pods/RxSchoolMeal)
![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)
![Swift Package Manager](https://img.shields.io/badge/Swift_Package_Manager-compatible-4BC51D.svg?style=flat)
[![License](https://img.shields.io/cocoapods/l/RxSchoolMeal.svg?style=flat)](https://cocoapods.org/pods/RxSchoolMeal)
[![Platform](https://img.shields.io/cocoapods/p/RxSchoolMeal.svg?style=flat)](https://cocoapods.org/pods/RxSchoolMeal)
[![codecov](https://codecov.io/gh/kimxwan0319/RxSchoolMeal/branch/main/graph/badge.svg?token=KAWST1E1TU)](https://codecov.io/gh/kimxwan0319/RxSchoolMeal)

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

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

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

### 급식 정보 κ°€μ Έμ˜€κΈ°
급식 정보λ₯Ό κ°€μ Έμ˜€λŠ” μ½”λ“œμ˜ 기본적인 ν˜•νƒœμž…λ‹ˆλ‹€.
```swift
MEAL.getMeal(<#λ‚ μ§œ#>, timePart: <#식사ꡬ뢄#>).subscribe(onSuccess: { meal in
print(meal)
})
.disposed(by: disposeBag)
```

* μœ„ `<#λ‚ μ§œ#>`라고 μž‘μ„± λ˜μ–΄μžˆλŠ” λΆ€λΆ„μ—λŠ” [`MealDate`](https://github.com/kimxwan0319/RxSchoolMeal/blob/main/Sources/RxSchoolMeal/MealDate.swift)λΌλŠ” μ΄λ¦„μœΌλ‘œ μ •μ˜λœ enum을 μž…λ ₯ν•©λ‹ˆλ‹€.
| Raw Value | Description |
| -------------------------- | ------------------------------------------------------------ |
| `.today` | μ˜€λŠ˜μ„ λ‚˜νƒ€λƒ…λ‹ˆλ‹€. |
| `.anotherDate(date: Date)` | μ›ν•˜λŠ” λ‚ μ§œλ₯Ό Date νƒ€μž…μœΌλ‘œ λ°›μŠ΅λ‹ˆλ‹€. |
| `.plusMinusDay(day: Int)` | μ˜€λŠ˜μ„ κΈ°μ€€μœΌλ‘œ μ‘°νšŒν•˜κ³  싢은 λ‚ μ§œκ°€ λͺ‡μΌ 후인지, λͺ‡μΌ 전인지λ₯Ό Intν˜•μ‹μœΌλ‘œ λ°›μŠ΅λ‹ˆλ‹€. |
* μœ„ `getMeal()` ν•¨μˆ˜λŠ” `timePart: <#식사ꡬ뢄#>` 뢀뢄을 μž‘μ„±ν•˜μ§€ μ•Šμ•„λ„ λ˜λ„λ‘ μ˜€λ²„λ‘œλ”© λ˜μ–΄μžˆμŠ΅λ‹ˆλ‹€.
λ§Œμ•½ [`MealModel`](https://github.com/kimxwan0319/RxSchoolMeal/blob/main/Sources/RxSchoolMeal/Model/MealModel.swift)λΌλŠ” μ΄λ¦„μœΌλ‘œ μ •μ˜λœ struct둜 μ•„μΉ¨, 점심, 저녁 메뉴λ₯Ό λͺ¨λ‘ λ°›κ³ μ‹Άλ‹€λ©΄ μž‘μ„±ν•˜μ§€ μ•ŠμœΌμ‹œλ©΄ λ©λ‹ˆλ‹€.
ν•˜μ§€λ§Œ μ•„μΉ¨, 점심, 저녁쀑 ν•˜λ‚˜λ₯Ό `[String]`ν˜•νƒœλ‘œ 받아보고 μ‹Άλ‹€λ©΄ μž‘μ„±ν•˜μ‹œλ©΄ λ©λ‹ˆλ‹€.
* `<#식사ꡬ뢄#>` 라고 μž‘μ„± λ˜μ–΄μžˆλŠ” λΆ€λΆ„μ—λŠ” [`MealPartTime`]()μ΄λΌλŠ” μ΄λ¦„μœΌλ‘œ μ •μ˜λœ enum을 μž…λ ₯ν•©λ‹ˆλ‹€.
| Raw Value | Description |
| ------------ | -------------- |
| `.breakfast` | μ•„μΉ¨λ°₯ μž…λ‹ˆλ‹€. |
| `.lunch` | 점심λ°₯ μž…λ‹ˆλ‹€. |
| `.dinner` | 저녁λ°₯ μž…λ‹ˆλ‹€. |
Examples

μ•„λž˜ μ„Έ μ˜ˆμ œλŠ” λͺ¨λ‘ 였늘의 급식을 μ‘°νšŒν•©λ‹ˆλ‹€.
```swift
MEAL.getMeal(.today).subscribe(onSuccess: { meal in
print(meal)
}, onFailure: { err in
print(err)
})
.disposed(by: disposeBag)
```
```swift
MEAL.getMeal(.anotherDate(date: Date())).subscribe(onSuccess: { meal in
print(meal)
}, onFailure: { err in
print(err)
})
.disposed(by: disposeBag)
```
```swift
MEAL.getMeal(.plusMinusDay(day: 0)).subscribe(onSuccess: { meal in
print(meal)
}, onFailure: { err in
print(err)
})
.disposed(by: disposeBag)
```
μ•„λž˜ μ˜ˆμ œλŠ” μ–΄μ œμ˜ 급식쀑 μ μ‹¬λ§Œ κ°€μ Έμ˜€λŠ” μ˜ˆμ œμž…λ‹ˆλ‹€.
```swift
MEAL.getMeal(.plusMinusDay(day: -1), timePart: .lunch).subscribe(onSuccess: { meal in
print(meal)
}, onFailure: { err in
print(err)
})
.disposed(by: disposeBag)
```

## Installation

### [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html)
```ruby
# 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](https://github.com/Carthage/Carthage)
Add this to `Cartfile`

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

### [Swift Package Manager](https://github.com/apple/swift-package-manager)
```swift
// Package.swift

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

## Author

semicolondsmkr, [email protected]

## License

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