URL 호출  


//
//  ContentView.swift
//  URLcaller
//
//  Created by Junho HA on 2019/11/15.
//

import SwiftUI

struct ContentView: View {
    
    var body: some View {
        Button(action: {
            btnClick()
        }) {
             Text("Open anotherApp")
             }
    }
}

func btnClick() {
    print("onClickBTN")
    guard let s = URL(string : "yourappurl://") else {
        return }
    
    if UIApplication.shared.canOpenURL(s) {
        UIApplication.shared.open(s, options: [:]) { (b ) in
            print(b)
        }
    }
    
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

'Blog History' 카테고리의 다른 글

개 발 일 지 038  (0) 2019.12.09
개 발 일 지 037  (0) 2019.12.06
개 발 일 지 035  (0) 2019.12.04
개 발 일 지 034  (1) 2019.12.04
개 발 일 지 033  (0) 2019.11.26

+ Recent posts