Giter Club home page Giter Club logo

dimigoinkit's Introduction

DimigoinKit

DimigoinKit License Release

디미고인의 iOS/macOS개발을 위한 디미고인 API

MVVM아키텍쳐 중 Model과 ViewModel이 구현되어 있습니다.

✅ 요구사항

  • iOS 14+
  • macOS 11+
  • Xcode 12
  • Swift 5.1+

🛠 설치

Swift Package Manager

.package(url: "https://github.com/dimigoin/DimigoinKit", from: "2.1.1"),

Info.plist 수정

<plist version="1.0">
<dict>
  <key>NSAllowsArbitraryLoads</key>
    <true/>
    <key>NSExceptionDomains</key>
    <dict>
        <key>edison.dimigo.hs.kr</key>
        <dict>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <key>NSIncludesSubdomains</key>
            <true/>
        </dict>
    </dict>
</dict>
</plist>

App Transport Security policy 오류를 해결하기 위해 필요합니다. 참고(링크)-StackOverFlow

사용예시

더욱 자세한 내용은 DimigoinKit 문서(링크)를 확인하세요.

선언

import DimigoinKit

@ObservedObject var api = DimigoinAPI()

로그인/로그아웃

import DimigoinKit

@ObservedObject var api = DimigoinAPI()

// 로그인 요청
api.login("USERNAME", "PASSWORD") { result in
    if result == true {
        // 로그인 성공
    } else {
        // 로그인 실패
    }
}

// 로그아웃, 기기에 저장된 토큰을 삭제합니다.
api.logout()

로그인 성공시 모든 데이터가 자동으로 패치 됩니다. 또는 api.fetchAll{ } 을 사용할 수도 있습니다.

사용 가능한 데이터

/// 데이터 패치중이면 true, 아니면 false
@Published public var isFetching = true

/// 디미고인 API 전반에 걸쳐 활용되는 JWT토큰
@Published public var accessToken = ""

/// 토큰 새로고침에 사용되는 `refreshToken`
@Published public var refreshToken = ""

/// 로그인 이력이 있으면 `true` 없으면 `false`
@Published public var isLoggedIn = false

/// 이름, 학년, 반 등 사용자에 대한 데이터
@Published public var user = User()

/// 주간 급식 - `meals[0]`부터 월요일 급식
@Published public var meals = [Meal](repeating: Meal(), count: 7)

/// 인원 체크
@Published public var attendanceList: [Attendance] = []

/// 모바일용 사용자 맞춤 `Place`
@Published public var primaryPlaces: [Place] = []

/// 디미고내 모든 장소 `Place`
@Published public var allPlaces: [Place] = []

/// 사용자의 최근 `Place`
@Published public var currentPlace: Place = Place()

/// 시간표
@Published public var timetable = Timetable()

/// 인강 데이터
@Published public var ingangs: [Ingang] = []

/// 공지사항
@Published public var notices: [Notice] = []

/// 주간 최대 인강실 신청
@Published public var weeklyTicketCount: Int = 0

/// 주간 사용한 인강실 신청 티켓
@Published public var weeklyUsedTicket: Int = 0

/// 주간 남은 인강실 신청 티켓
@Published public var weeklyRemainTicket: Int = 0

Author

@Chagnemin

dimigoinkit's People

Contributors

changemin avatar

Stargazers

Byun Jong Hyeon avatar  avatar Seunghyun Min avatar hanukoon avatar Euiseo Cha avatar Ji Sungbin avatar 정한 Rycont avatar 엄서훈 avatar

Watchers

James Cloos avatar  avatar

dimigoinkit's Issues

토큰 중복

각기 다른 api class들이 토큰 api를 포함하면서 토큰 새로고침 등이 중복 호출됨

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.