# 초기화하기

Wepin iOS PIN Pad 라이브러리를 초기화하는 방법은 다음과 같습니다.&#x20;

`WepinPin` 인스턴스를 생성하기 전에, App ID와 App Key를 `WepinPinParams` 객체에 다음과 같이 전달해 주세요.

```swift
let initPinParam = WepinPinParams(appId: appId, appKey: appKey)
```

앞서 생성한 `WepinPinParams` 를 전달하면서 `WepinPin` 인스턴스를 생성해 주세요.

```swift
var wepinPin = WepinPin(initPinParam);
```

`WepinPin` 인스턴스생성 후 `initialize` 메서드를 호출하여 초기화를 합니다.

```swift
await wepinPin?.initialize(attributes: attributes)
```

#### parameters

&#x20;`attributes` \<WepinPinAttributes>

* `language` \<String>\
  핀 패드 화면의 기본 언어 설정, 기본 값은 `'en'` 입니다. 현재 지원하는 언어는 `'ko'`, `'en'` ,`'ja'`입니다.

#### Return value

`<Boolean>`\
정상적으로 잘 된 경우 **true** , 실패한 경우 **false** 를 반환합니다.

### Example

```swift
let appKey: String = "Wepin-App-Key"
let appId: String = "Wepin-App-ID"
var wepinPin: WepinPin? = nil
let initPinParam = WepinPinParams(appId: appId, appKey: appKey)
wepinPin = WepinPin(initPinParam)
// Call initialize function
let attributes = WepinPinAttributes(language: "en")
if let res = try await wepinPin?.initialize(attributes: attributes) {
    self.tvResult.text = "Successed: \(res)"
} else {
    self.tvResult.text = "Failed: No result returned from initialization"
}
```

## isInitialized

`isInitialized` 메서드를 사용하여 `WepinPin` 인스턴스가 올바르게 초기화되었는지 확인할 수 있습니다. 반환 값은 다음과 같습니다:

* \<Bool>\
  초기화가 정상적으로 잘 된 경우 **true** , 실패한 경우 **false** 를 반환합니다.

```swift
let result = wepinPin!.isInitialized()
```

## changeLanguage

```swift
wepinPin!.changeLanguage(language: "ko")
```

핀 패드 화면에 표시되는 언어를 변경합니다. 현재 `'ko'`, `'en'`, `'ja'`만 지원됩니다. <br>

**Parameters**

* &#x20;`language` \<String>

### **Return value**

* \<Void>

### Example

```swift
wepinPin!.changeLanguage(language: "ko")
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wepin.io/widget-integration/ios-swift-sdk/pin-pad-library/init.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
