Skip to content

Commit d5832e0

Browse files
committed
Update README
1 parent a15ae6d commit d5832e0

File tree

2 files changed

+72
-89
lines changed

2 files changed

+72
-89
lines changed

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2017 Studyplus inc.
3+
Copyright (c) 2021 Studyplus inc.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+71-88
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,41 @@
1-
StudyplusSDK-V2
2-
=======
3-
4-
StudyplusSDK-V2 is [Studyplus iOS SDK](https://github.com/studyplus/Studyplus-iOS-SDK) for Swift.
1+
# StudyplusSDK-V2
52

63
## Requirements
74

8-
* iOS 9.0 or above
9-
* Swift 4.0 or above
10-
11-
## Dependency
12-
* [KeychainAccess](https://github.com/kishikawakatsumi/KeychainAccess)
5+
* iOS 11.0以上
6+
* Swift 5.1以上
137

148
## Install
159

10+
### [Swift Package Manager](https://github.com/apple/swift-package-manager/)
11+
12+
<https://github.com/studyplus/Studyplus-iOS-SDK-V2>を追加してください。
13+
1614
### [CocoaPods](https://cocoapods.org/)
17-
Add the following line to your Podfile:
18-
```ruby
19-
use_frameworks!
2015

21-
target 'YOUR_TARGET_NAME' do
22-
pod 'StudyplusSDK-V2'
23-
end
24-
```
16+
Podfileに `StudyplusSDK-V2` を追加してください。
2517

26-
### [Carthage](https://github.com/Carthage/Carthage)
27-
Add the following line to your Cartfile:
28-
```swift
29-
github "studyplus/Studyplus-iOS-SDK-V2"
18+
```ruby
19+
use_frameworks!
20+
pod 'StudyplusSDK-V2'
3021
```
3122

3223
## Usage
3324

34-
- If you don't have consumerKey and consumerSecret, please contact https://info.studyplus.co.jp/contact/studyplus-api
25+
<https://info.studyplus.co.jp/contact/studyplus-api>よりStudypluAPIの申請を最初に行ってください。
26+
審査後、`consumer key``consumer secret`の2つをメールにて送付いたします。
3527

36-
### ① Set up custom URL scheme
28+
### custom URL schemeの設定
3729

38-
- set __studyplus-*{your consumer key}*__ to URL Types. (ex. studyplus-MIoh79q7pfMbTUVA3BNsSeTaZRcOK3yg )
30+
__studyplus-*{consumer key}*__ URL Typesに追加してください。
3931

4032
![xcode](https://github.com/studyplus/Studyplus-iOS-SDK-V2/blob/master/docs/set_url_scheme.png)
4133

42-
### ② Set up consumerKey and consumerSecret
34+
### `consumer key``consumer secret`の追加
4335

44-
- set __consumerKey__ and __consumerSecret__ in your Info.plist.
36+
Info.plistに`consumer key``consumer secret`を追加してください。
4537

46-
```
38+
```txt
4739
<key>StudyplusSDK</key>
4840
<dict>
4941
<key>consumerKey</key>
@@ -53,11 +45,11 @@ github "studyplus/Studyplus-iOS-SDK-V2"
5345
</dict>
5446
```
5547

56-
### ③ Set up LSApplicationQueriesSchemes
48+
### LSApplicationQueriesSchemes
5749

58-
- Set LSApplicationQueriesSchemes in your info.plist for checking if studyplus is installed.
50+
Studyplusアプリがインストールされているかチェックできるようにするため、Info.plistの`LSApplicationQueriesSchemes``studyplus`を追加してください。
5951

60-
```
52+
```txt
6153
<key>LSApplicationQueriesSchemes</key>
6254
<array>
6355
<string>studyplus</string>
@@ -66,94 +58,63 @@ github "studyplus/Studyplus-iOS-SDK-V2"
6658

6759
### Initialize
6860

69-
```Swift
70-
71-
// when carthage is StudyplusSDK, cocoapods is StudyplusSDK_V2
72-
import StudyplusSDK_V2
61+
```swift
62+
import StudyplusSDK
7363

7464
class ViewController: UIViewController, StudyplusLoginDelegate {
75-
7665
override func viewDidLoad() {
7766
super.viewDidLoad()
7867
Studyplus.shared.delegate = self
7968
}
80-
81-
// ...
8269
}
8370
```
8471

8572
### Login
86-
```Swift
8773

88-
// when carthage is StudyplusSDK, cocoapods is StudyplusSDK_V2
89-
import StudyplusSDK_V2
74+
```swift
75+
import StudyplusSDK
9076

9177
class AppDelegate: UIResponder, UIApplicationDelegate {
92-
93-
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
94-
return Studyplus.shared.handle(appDelegateUrl: url)
78+
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
79+
return Studyplus.shared.handle(url)
9580
}
9681
}
9782
```
9883

99-
```Swift
100-
101-
// when carthage is StudyplusSDK, cocoapods is StudyplusSDK_V2
102-
import StudyplusSDK_V2
84+
```swift
85+
import StudyplusSDK
10386

10487
class ViewController: UIViewController, StudyplusLoginDelegate {
105-
106-
// ...
107-
108-
// MARK: - Login
109-
110-
@IBAction func loginButton(_ sender: UIButton) {
88+
func login() {
11189
Studyplus.shared.login()
11290
}
11391

114-
// MARK: - StudyplusLoginDelegate
115-
116-
func studyplusDidSuccessToLogin() {
117-
// do something
118-
}
119-
120-
func studyplusDidFailToLogin(error: StudyplusError) {
121-
// do something
92+
func studyplusLoginSuccess() {
93+
// on success
12294
}
12395

124-
func studyplusDidCancelToLogin() {
125-
// do something
96+
func studyplusLoginFail(error: StudyplusLoginError) {
97+
// on failed
12698
}
12799
}
128100
```
129101

130-
### Post studyRecord to Studyplus
131-
132-
```Swift
102+
### 学習記録の投稿
133103

134-
// when carthage is StudyplusSDK, cocoapods is StudyplusSDK_V2
135-
import StudyplusSDK_V2
136-
137-
class ViewController: UIViewController, StudyplusLoginDelegate {
138-
139-
// ...
140-
141-
// MARK: - Post studyRecord to Studyplus
142-
143-
@IBAction func postStudyRecordButton(_ sender: UIButton) {
144-
let recordAmount: StudyplusRecordAmount = StudyplusRecordAmount(amount: 10)
145-
let record: StudyplusRecord = StudyplusRecord(duration: duration, recordedAt: Date(), amount: recordAmount, comment: "Today, I studied like anything.")
146-
147-
Studyplus.shared.post(studyRecord: record, success: {
148-
149-
// do something
150-
151-
}, failure: { error in
152-
153-
print("Error Code: \(error.code()), Message: \(error.message())")
154-
})
104+
```swift
105+
let record = StudyplusRecord(duration: Int(duration),
106+
amount: 10,
107+
comment: "Today, I studied like anything.",
108+
recordDatetime: Date())
109+
110+
Studyplus.shared.post(record, completion: { result in
111+
switch result {
112+
case .failure(let error):
113+
// handle error
114+
case .success:
115+
// finish post
155116
}
156-
}
117+
})
157118
```
158119

159120
## Demo app
@@ -166,4 +127,26 @@ class ViewController: UIViewController, StudyplusLoginDelegate {
166127

167128
## License
168129

169-
- [MIT License.](http://opensource.org/licenses/mit-license.php)
130+
```txt
131+
The MIT License (MIT)
132+
133+
Copyright (c) 2021 Studyplus inc.
134+
135+
Permission is hereby granted, free of charge, to any person obtaining a copy
136+
of this software and associated documentation files (the "Software"), to deal
137+
in the Software without restriction, including without limitation the rights
138+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
139+
copies of the Software, and to permit persons to whom the Software is
140+
furnished to do so, subject to the following conditions:
141+
142+
The above copyright notice and this permission notice shall be included in
143+
all copies or substantial portions of the Software.
144+
145+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
146+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
147+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
148+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
149+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
150+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
151+
THE SOFTWARE.
152+
```

0 commit comments

Comments
 (0)