https://github.com/kimxwan0319/rxschoolmeal
π°π· μμ μ νκ΅ κΈμμ κ°μ Έμ¬ μ μλ λΌμ΄λΈλ¬λ¦¬ μ
λλ€!
https://github.com/kimxwan0319/rxschoolmeal
carthage cocoapods library spm swift
Last synced: 5 months ago
JSON representation
π°π· μμ μ νκ΅ κΈμμ κ°μ Έμ¬ μ μλ λΌμ΄λΈλ¬λ¦¬ μ λλ€!
- Host: GitHub
- URL: https://github.com/kimxwan0319/rxschoolmeal
- Owner: kimxwan0319
- License: mit
- Created: 2021-06-17T05:17:15.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-07-02T07:10:09.000Z (about 5 years ago)
- Last Synced: 2025-10-08T15:46:02.760Z (9 months ago)
- Topics: carthage, cocoapods, library, spm, swift
- Language: Swift
- Homepage:
- Size: 138 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RxSchoolMeal

[](https://cocoapods.org/pods/RxSchoolMeal)


[](https://cocoapods.org/pods/RxSchoolMeal)
[](https://cocoapods.org/pods/RxSchoolMeal)
[](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, kimxwan0319@naver.com
## License
RxSchoolMeal is available under the MIT license. See the LICENSE file for more info.