Commit fd57002d authored by Javokhir's avatar Javokhir
Browse files

2.3.9

parent 545e2699
{ {
"images" : [ "images" : [
{ {
"filename" : "40.png",
"idiom" : "iphone", "idiom" : "iphone",
"scale" : "2x", "scale" : "2x",
"size" : "20x20" "size" : "20x20"
}, },
{ {
"filename" : "60.png",
"idiom" : "iphone", "idiom" : "iphone",
"scale" : "3x", "scale" : "3x",
"size" : "20x20" "size" : "20x20"
}, },
{ {
"filename" : "29.png",
"idiom" : "iphone",
"scale" : "1x",
"size" : "29x29"
},
{
"filename" : "58.png",
"idiom" : "iphone", "idiom" : "iphone",
"scale" : "2x", "scale" : "2x",
"size" : "29x29" "size" : "29x29"
}, },
{ {
"filename" : "87.png",
"idiom" : "iphone", "idiom" : "iphone",
"scale" : "3x", "scale" : "3x",
"size" : "29x29" "size" : "29x29"
}, },
{ {
"filename" : "80.png",
"idiom" : "iphone", "idiom" : "iphone",
"scale" : "2x", "scale" : "2x",
"size" : "40x40" "size" : "40x40"
}, },
{ {
"filename" : "120.png",
"idiom" : "iphone", "idiom" : "iphone",
"scale" : "3x", "scale" : "3x",
"size" : "40x40" "size" : "40x40"
}, },
{ {
"filename" : "57.png",
"idiom" : "iphone",
"scale" : "1x",
"size" : "57x57"
},
{
"filename" : "114.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "57x57"
},
{
"filename" : "120.png",
"idiom" : "iphone", "idiom" : "iphone",
"scale" : "2x", "scale" : "2x",
"size" : "60x60" "size" : "60x60"
}, },
{ {
"filename" : "180.png",
"idiom" : "iphone", "idiom" : "iphone",
"scale" : "3x", "scale" : "3x",
"size" : "60x60" "size" : "60x60"
}, },
{ {
"filename" : "20.png",
"idiom" : "ipad", "idiom" : "ipad",
"scale" : "1x", "scale" : "1x",
"size" : "20x20" "size" : "20x20"
}, },
{ {
"filename" : "40.png",
"idiom" : "ipad", "idiom" : "ipad",
"scale" : "2x", "scale" : "2x",
"size" : "20x20" "size" : "20x20"
}, },
{ {
"filename" : "29.png",
"idiom" : "ipad", "idiom" : "ipad",
"scale" : "1x", "scale" : "1x",
"size" : "29x29" "size" : "29x29"
}, },
{ {
"filename" : "58.png",
"idiom" : "ipad", "idiom" : "ipad",
"scale" : "2x", "scale" : "2x",
"size" : "29x29" "size" : "29x29"
}, },
{ {
"filename" : "40.png",
"idiom" : "ipad", "idiom" : "ipad",
"scale" : "1x", "scale" : "1x",
"size" : "40x40" "size" : "40x40"
}, },
{ {
"filename" : "80.png",
"idiom" : "ipad", "idiom" : "ipad",
"scale" : "2x", "scale" : "2x",
"size" : "40x40" "size" : "40x40"
}, },
{ {
"filename" : "50.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "50x50"
},
{
"filename" : "100.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "50x50"
},
{
"filename" : "72.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "72x72"
},
{
"filename" : "144.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "72x72"
},
{
"filename" : "76.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "76x76"
},
{
"filename" : "152.png",
"idiom" : "ipad", "idiom" : "ipad",
"scale" : "2x", "scale" : "2x",
"size" : "76x76" "size" : "76x76"
}, },
{ {
"filename" : "167.png",
"idiom" : "ipad", "idiom" : "ipad",
"scale" : "2x", "scale" : "2x",
"size" : "83.5x83.5" "size" : "83.5x83.5"
}, },
{ {
"filename" : "1024.png",
"idiom" : "ios-marketing", "idiom" : "ios-marketing",
"scale" : "1x", "scale" : "1x",
"size" : "1024x1024" "size" : "1024x1024"
......
//
// ContentView.swift
//
import SwiftUI
import MyIdSDK
struct ContentView: View {
@StateObject private var viewModel = ViewModel()
var body: some View {
ScrollView {
VStack(spacing: 16) {
FormSection(viewModel: viewModel)
Button(action: {
viewModel.startMyId()
}) {
Text("Start SDK")
.font(.headline)
.frame(maxWidth: .infinity)
.padding()
.background(Color.blue)
.foregroundColor(.white)
.cornerRadius(10)
}
.padding(.horizontal)
if let image = viewModel.image {
Image(uiImage: image)
.resizable()
.scaledToFit()
.frame(height: 100)
.cornerRadius(12)
.padding(.horizontal)
}
if !viewModel.message.isEmpty {
Text(viewModel.message)
.foregroundColor(.blue)
.padding()
.background(Color.gray.opacity(0.1))
.cornerRadius(8)
.padding(.horizontal)
.onTapGesture {
copyToClipboard(viewModel.message)
}
}
}
.padding(.vertical)
}
}
private func copyToClipboard(_ text: String) {
UIPasteboard.general.string = text
}
}
struct FormSection: View {
@ObservedObject var viewModel: ViewModel
var body: some View {
VStack(
alignment: .leading,
spacing: 16
) {
Group {
TextField("Passport Data", text: $viewModel.passportData)
TextField("Date of Birth", text: $viewModel.dateOfBirth)
TextField("External ID", text: $viewModel.externalId)
}
.textFieldStyle(RoundedBorderTextFieldStyle())
.padding(.horizontal)
Group {
Picker("Residency", selection: $viewModel.residency) {
Text("Resident").tag(MyIdResidency.resident)
Text("Non-Resident").tag(MyIdResidency.nonResident)
Text("User defined").tag(MyIdResidency.userDefined)
}
Picker("Environment", selection: $viewModel.environment) {
Text("Production").tag(MyIdEnvironment.production)
Text("Debug").tag(MyIdEnvironment.debug)
}
Picker("Entry Type", selection: $viewModel.entryType) {
Text("Identification").tag(MyIdEntryType.identification)
Text("Face detection").tag(MyIdEntryType.faceDetection)
}
Picker("Locale", selection: $viewModel.locale) {
Text("Uzbek").tag(MyIdLocale.uzbek)
Text("English").tag(MyIdLocale.english)
Text("Russian").tag(MyIdLocale.russian)
}
Picker("Camera Shape", selection: $viewModel.cameraShape) {
Text("Circle").tag(MyIdCameraShape.circle)
Text("Ellipse").tag(MyIdCameraShape.ellipse)
}
}
.pickerStyle(MenuPickerStyle())
.padding(.horizontal)
}
}
}
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
//
// ViewModel.swift
//
import SwiftUI
import Combine
import MyIdSDK
@objc public class ViewModel: NSObject, ObservableObject {
@Published var passportData: String = ""
@Published var dateOfBirth: String = ""
@Published var externalId: String = ""
@Published var residency: MyIdResidency = .resident
@Published var environment: MyIdEnvironment = .debug
@Published var entryType: MyIdEntryType = .identification
@Published var locale: MyIdLocale = .uzbek
@Published var cameraShape: MyIdCameraShape = .circle
@Published var image: UIImage?
@Published var message: String = ""
@objc public func startMyId() {
let devClientId = "your_dev_client_id"
let devClientHash = "your_dev_client_hash"
let devClientHashId = "your_dev_client_hash_id"
let prodClientId = "your_prod_client_id"
let prodClientHash = "your_prod_client_hash"
let prodClientHashId = "your_prod_client_hash_id"
let config = MyIdConfig()
config.clientId = environment == .production ? prodClientId : devClientId
config.clientHash = environment == .production ? prodClientHash : devClientHash
config.clientHashId = environment == .production ? prodClientHashId : devClientHashId
config.passportData = passportData
config.dateOfBirth = dateOfBirth
config.externalId = externalId
config.residency = residency
config.environment = environment
config.entryType = entryType
config.locale = locale
config.cameraShape = cameraShape
config.presentationStyle = .sheet
MyIdClient.start(withConfig: config, withDelegate: self)
}
}
@objc extension ViewModel: MyIdClientDelegate {
public func onSuccess(result: MyIdResult) {
message = result.code ?? ""
image = result.image
}
public func onError(exception: MyIdException) {
message = exception.message ?? ""
image = nil
}
public func onUserExited() {
message = "User exited"
image = nil
}
}
//
// myid_ios_parentApp.swift
//
import SwiftUI
@main
struct myid_ios_parentApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment