Git Product home page Git Product logo

koreajusoapidemo's Introduction

KoreaJusoAPIDemo

Search Korea Address using Ministry of the Interior and Safety's Address Open API

(행정안전부의 주소 OpenAPI를 사용한 영문주소 검색데모 입니다.)

SearchAddress Modules was made use VIPER Architecture.

(SearchAddress 모듈은 VIPER 아키텍쳐를 사용하여 만들어졌습니다.)

demo.gif

Demo 

What you need

a. Get an API Key from Ministry of the Interior and Safety's Address Open API (행정안전부)

(해당 사이트를 방문하여 API 키를 발급받으세요.)

b. Set your key at confmKey in SearchAddressService.swift

( SearchAddressService.swift에 있는 confmKey 값에 발급받은 키를 적어주세요.)

func fetchAddress(
    pageIndex: Int,
    interval: Int,
    keyword: String,
    success: @escaping (JusoResult?) -> Void,
    failure: @escaping (Error) -> Void
  ){
    let parameters = [
      "confmKey":"API-KEY",// Set your API Key
      "currentPage":"\(pageIndex)",
      "countPerPage":"\(interval)",
      "keyword":"\(keyword)",
      "resultType": "json"
    ]
    let url = "http://www.juso.go.kr/addrlink/addrEngApi.do"
    ...
}

sample code

// In ViewController

  @IBAction func touchSearchButton(_ sender: UIButton) {
    SearchAddressWireframe().openViewControllerWithNavigationWithDelegate(
      delegate: self,
      source: self
    )
  }
  
extension ViewController: SearchAddressDelegate {
  func SearchAddress(viewController: SearchAddressViewController, didSelectedJuso juso: Juso) {
    
    zipcodeLabel.text = juso.zipNo
    roadAddressLabel.text = juso.roadAddr
    jibunAddressLabel.text = juso.jibunAddr
    addressTextField.text = juso.korAddr
    
    viewController.dismiss(animated: true, completion: nil)
  }
}

Comment

This repository's purpose is just study. So there is no license. Please use as you like.

(이 리포지토리는 공부를 목적으로 생성하였습니다. 따로 저작권은 없습니다. 마음껏 사용하세요.)

Author

[email protected]

koreajusoapidemo's People

Contributors

devikkim avatar

Watchers

 avatar

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.