Commit8928ee2e by developer39

v1.0 - Project files added

parents
<?xmlversion="1.0"encoding="UTF-8"?>
<!DOCTYPEplistPUBLIC"-//Apple//DTDPLIST1.0//EN""http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plistversion="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
LastUpgradeVersion ="1310"
version ="1.3">
parallelizeBuildables ="YES"
buildImplicitDependencies ="YES">
buildForTesting ="YES"
buildForRunning ="YES"
buildForProfiling ="YES"
buildForArchiving ="YES"
buildForAnalyzing ="YES">
BuildableIdentifier ="primary"
BlueprintIdentifier ="34FEEC01275A4A83005C3D99"
BuildableName ="uFR GIDS Demo.app"
BlueprintName ="uFR GIDS Demo"
ReferencedContainer ="container:uFR GIDS Demo.xcodeproj">
buildConfiguration ="Debug"
selectedDebuggerIdentifier ="Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier ="Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv ="YES">
buildConfiguration ="Release"
selectedDebuggerIdentifier ="Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier ="Xcode.DebuggerFoundation.Launcher.LLDB"
enableASanStackUseAfterReturn ="YES"
launchStyle ="0"
useCustomWorkingDirectory ="NO"
ignoresPersistentStateOnLaunch ="NO"
debugDocumentVersioning ="YES"
debugServiceExtension ="internal"
allowLocationSimulation ="YES">
runnableDebuggingMode ="0">
BuildableIdentifier ="primary"
BlueprintIdentifier ="34FEEC01275A4A83005C3D99"
BuildableName ="uFR GIDS Demo.app"
BlueprintName ="uFR GIDS Demo"
ReferencedContainer ="container:uFR GIDS Demo.xcodeproj">
buildConfiguration ="Release"
shouldUseLaunchSchemeArgsEnv ="YES"
savedToolIdentifier =""
useCustomWorkingDirectory ="NO"
debugDocumentVersioning ="YES">
runnableDebuggingMode ="0">
BuildableIdentifier ="primary"
BlueprintIdentifier ="34FEEC01275A4A83005C3D99"
BuildableName ="uFR GIDS Demo.app"
BlueprintName ="uFR GIDS Demo"
ReferencedContainer ="container:uFR GIDS Demo.xcodeproj">
buildConfiguration ="Debug">
buildConfiguration ="Release"
revealArchiveInOrganizer ="YES">
<?xmlversion="1.0"encoding="UTF-8"?>
<!DOCTYPEplistPUBLIC"-//Apple//DTDPLIST1.0//EN""http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plistversion="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>在这里GIDSDemo.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>34FEEC01275A4A83005C3D99</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
//
// AppDelegate.swift
// uFR GIDS Demo
//
// Created by bojan on 3.12.21..
//
importUIKit
@main
classAppDelegate:UIResponder,UIApplicationDelegate{
funcapplication(_application:UIApplication,didFinishLaunchingWithOptionslaunchOptions:[UIApplication.LaunchOptionsKey:Any]?)->Bool{
// Override point for customization after application launch.
returntrue
}
// MARK: UISceneSession Lifecycle
funcapplication(_application:UIApplication,configurationForConnectingconnectingSceneSession:UISceneSession,options:UIScene.ConnectionOptions)->UISceneConfiguration{
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
returnUISceneConfiguration(name:"Default Configuration",sessionRole:connectingSceneSession.role)
}
funcapplication(_application:UIApplication,didDiscardSceneSessionssceneSessions:Set<UISceneSession>){
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
funcapplication(_application:UIApplication,supportedInterfaceOrientationsForwindow:UIWindow?)->UIInterfaceOrientationMask{
//Only allow portrait (standard behaviour)
return.portrait;
}
}
{
"colors":[
{
"idiom":"universal"
}
],
"info":{
"author":"xcode",
"version":1
}
}
{"images":[{"size":"60x60","expected-size":"180","filename":"180.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"40x40","expected-size":"80","filename":"80.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"40x40","expected-size":"120","filename":"120.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"60x60","expected-size":"120","filename":"120.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"57x57","expected-size":"57","filename":"57.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"1x"},{"size":"29x29","expected-size":"58","filename":"58.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"29x29","expected-size":"29","filename":"29.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"1x"},{"size":"29x29","expected-size":"87","filename":"87.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"57x57","expected-size":"114","filename":"114.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"20x20","expected-size":"40","filename":"40.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"20x20","expected-size":"60","filename":"60.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"1024x1024","filename":"1024.png","expected-size":"1024","idiom":"ios-marketing","folder":"Assets.xcassets/AppIcon.appiconset/","scale":"1x"},{"size":"40x40","expected-size":"80","filename":"80.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"72x72","expected-size":"72","filename":"72.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"76x76","expected-size":"152","filename":"152.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"50x50","expected-size":"100","filename":"100.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"29x29","expected-size":"58","filename":"58.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"76x76","expected-size":"76","filename":"76.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"29x29","expected-size":"29","filename":"29.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"50x50","expected-size":"50","filename":"50.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"72x72","expected-size":"144","filename":"144.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"40x40","expected-size":"40","filename":"40.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"83.5x83.5","expected-size":"167","filename":"167.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"20x20","expected-size":"20","filename":"20.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"20x20","expected-size":"40","filename":"40.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"}]}
\ No newline at end of file
{
"info":{
"author":"xcode",
"version":1
}
}
{
"images":[
{
"filename":"header_gids.jpg",
"idiom":"universal",
"scale":"1x"
},
{
"idiom":"universal",
"scale":"2x"
},
{
"idiom":"universal",
"scale":"3x"
}
],
"info":{
"author":"xcode",
"version":1
}
}
{
"images":[
{
"filename":"kartica_telefon.png",
"idiom":"universal",
"scale":"1x"
},
{
"idiom":"universal",
"scale":"2x"
},
{
"idiom":"universal",
"scale":"3x"
}
],
"info":{
"author":"xcode",
"version":1
}
}
{
"images":[
{
"filename":"kartica_ufr.png",
"idiom":"universal",
"scale":"1x"
},
{
"idiom":"universal",
"scale":"2x"
},
{
"idiom":"universal",
"scale":"3x"
}
],
"info":{
"author":"xcode",
"version":1
}
}
{
"images":[
{
"filename":"map_logo.png",
"idiom":"universal",
"scale":"1x"
},
{
"idiom":"universal",
"scale":"2x"
},
{
"idiom":"universal",
"scale":"3x"
}
],
"info":{
"author":"xcode",
"version":1
}
}
type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB"version="3.0"toolsVersion="13122.16"targetRuntime="iOS.CocoaTouch"propertyAccessControl="none"useAutolayout="YES"launchScreen="YES"useTraitCollections="YES"useSafeAreas="YES"colorMatched="YES"initialViewController="01J-lp-oVM">
identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin"version="13104.12"/>
name="Safe area layout guides"minToolsVersion="9.0"/>
name="documents saved in the Xcode 8 format"minToolsVersion="8.0"/>
sceneID="EHf-IW-A2E">
id="01J-lp-oVM"sceneMemberID="viewController">
key="view"contentMode="scaleToFill"id="Ze5-6b-2t3">
key="frame"x="0.0"y="0.0"width="375"height="667"/>
key="autoresizingMask"widthSizable="YES"heightSizable="YES"/>
key="backgroundColor"xcode11CocoaTouchSystemColor="systemBackgroundColor"cocoaTouchSystemColor="whiteColor"/>
key="safeArea"id="6Tk-OE-BBY"/>
placeholderIdentifier="IBFirstResponder"id="iYj-Kq-Ea1"userLabel="First Responder"sceneMemberID="firstResponder"/>
key=“canvasLocation”x="53"y="375"/>
#import
/**
* A hightly customizable Radio Button for iOS.
*/
IB_DESIGNABLE
NS_ASSUME_NONNULL_BEGIN
@interfaceDLRadioButton:UIButton
#pragma mark - Access buttons
/**
* @brief Finds out selected button in same group.
* @return Selected button.
*/
-(nullableDLRadioButton*)selectedButton;
/**
* @brief Finds out selected buttons in same group, use it only if multiple selection is enabled.
* @return Selected buttons.
*/
-(NSArray<DLRadioButton*>*)selectedButtons;
/**
* @brief Container for holding other buttons in same group.
*/
@property(nonatomic)IBOutletCollection(DLRadioButton)NSArray<DLRadioButton*>*otherButtons;
/**
* @brief Clears selection for other buttons in in same group.
*/
-(void)deselectOtherButtons;
#pragma mark - Customization
/**
* @brief Size of icon, default is kDefaulIconSize.
*/
@property(nonatomic)IBInspectableCGFloaticonSize;
/**
* @brief Color of icon, default is title color for current UIControlState.
*/
@property(nonatomic)IBInspectableUIColor*iconColor;
/**
* @brief Stroke width of icon, default is iconSize / 9.
*/
@property(nonatomic)IBInspectableCGFloaticonStrokeWidth;
/**
* @brief Size of selection indicator, default is iconSize * 0.5.
*/
@property(nonatomic)IBInspectableCGFloatindicatorSize;
/**
* @brief Color of selection indicator, default is title color for current UIControlState.
*/
@property(nonatomic)IBInspectableUIColor*indicatorColor;
/**
* @brief Margin width between icon and title, default is kDefaultMarginWidth.
*/
@property(nonatomic)IBInspectableCGFloatmarginWidth;
/**
* @brief是否图标在右边,我默认s NO.
* @warning Please also set contentHorizontalAlignment to UIControlContentHorizontalAlignmentRight.
*/
@property(nonatomic,getter=isIconOnRight)IBInspectableBOOLiconOnRight;
/**
* @brief Whether use square icon, default is NO.
*/
@property(nonatomic,getter=isIconSquare)IBInspectableBOOLiconSquare;
/**
* @brief Image for radio button icon (optional).
*/
@property(nonatomic)IBInspectableUIImage*icon;
/**
* @brief Image for radio button icon when selected (optional).
*/
@property(nonatomic)IBInspectableUIImage*iconSelected;
/**
* @brief Whether enable multiple selection, default is NO.
*/
@property(nonatomic,getter=isMultipleSelectionEnabled)BOOLmultipleSelectionEnabled;
/**
* @brief Duration of radio button icon animation in seconds. Set it to 0.0 to turn off animation, default is 0.3.
*/
@property(nonatomic)CFTimeIntervalanimationDuration;
@end
NS_ASSUME_NONNULL_END
<?xmlversion="1.0"encoding="UTF-8"?>
<!DOCTYPEplistPUBLIC"-//Apple//DTDPLIST1.0//EN""http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plistversion="1.0">
<dict>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>DefaultConfiguration</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
</dict>
</array>
</dict>
</dict>
<key>com.apple.developer.nfc.readersession.formats</key>
<array>
<string>TAG</string>
</array>
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
<string>A0000002471001</string>
<string>A00000039742544659</string>
<string>00000000000000</string>
</array>
</dict>
</plist>
//
// SceneDelegate.swift
// uFR GIDS Demo
//
// Created by bojan on 3.12.21..
//
importUIKit
classSceneDelegate:UIResponder,UIWindowSceneDelegate{
varwindow:UIWindow?
funcscene(_scene:UIScene,willConnectTosession:UISceneSession,optionsconnectionOptions:UIScene.ConnectionOptions){
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guardlet_=(sceneas?UIWindowScene)else{return}
}
funcsceneDidDisconnect(_scene:UIScene){
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
}
funcsceneDidBecomeActive(_scene:UIScene){
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
funcsceneWillResignActive(_scene:UIScene){
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
funcsceneWillEnterForeground(_scene:UIScene){
/ /称为现场transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
funcsceneDidEnterBackground(_scene:UIScene){
/ /称为现场transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}
}
//
// uFCoder-bridging-header.h
// ndef-ios-nfc-ufr
//
// Created by bojan on 23/08/2021.
//
#ifndef uFCoder_bridging_header_h
#define uFCoder_bridging_header_h
#import "uFCoder.h"
#import "../DLRadioButton/DLRadioButton.h"
#endif/* uFCoder_bridging_header_h */
This source diff could not be displayed because it is too large. You canview the blobinstead.
//
// HelperFunc.swift
// uFRPassportReader
//
// Created by dlogic on 07/02/2020.
// Copyright © 2020 dlogic. All rights reserved.
//
importFoundation
importUIKit
extensionUIView{
funcpin(tosuperView:UIView)
{
translatesAutoresizingMaskIntoConstraints=false
topAnchor.constraint(equalTo:superView.topAnchor).isActive=true
leadingAnchor.constraint(equalTo:superView.leadingAnchor).isActive=true
trailingAnchor.constraint(equalTo:superView.trailingAnchor).isActive=true
bottomAnchor.constraint(equalTo:superView.bottomAnchor).isActive=true
}
}
extensionUIViewController{
funcclearTmpDir(){
do{
letfileManager=FileManager()
lettmpDirURL=FileManager.default.temporaryDirectory
lettmpDirectory=tryfileManager.contentsOfDirectory(atPath:tmpDirURL.path)
trytmpDirectory.forEach{filein
letfileURL=tmpDirURL.appendingPathComponent(file)
tryfileManager.removeItem(at:fileURL)
}
}catch{
print(error)
}
}
}
//MARK: VARIOUS EXTENSIONS
funcresizeImage(image:UIImage,targetSize:CGSize)->UIImage{
letsize=image.size
letwidthRatio=targetSize.width/size.width
letheightRatio=targetSize.height/size.height
// Figure out what our orientation is, and use that to form the rectangle
varnewSize:CGSize
if(widthRatio>heightRatio){
newSize=CGSize(width:size.width*heightRatio,height:size.height*heightRatio)
}else{
newSize=CGSize(width:size.width*widthRatio,height:size.height*widthRatio)
}
// This is the rect that we've calculated out and this is what is actually used below
letrect=CGRect(x:0,y:0,width:newSize.width,height:newSize.height)
// Actually do the resizing to the rect using the ImageContext stuff
UIGraphicsBeginImageContextWithOptions(newSize,false,1.0)
image.draw(in:rect)
letnewImage=UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
returnnewImage!
}
extensionString{
funcattributedStringWithColor(_strings:[String],color:UIColor,characterSpacing:UInt?=nil)->NSAttributedString{
letattributedString=NSMutableAttributedString(string:self)
forstringinstrings{
letrange=(selfasNSString).range(of:string)
attributedString.addAttribute(NSAttributedString.Key.backgroundColor,value:color,range:range)
}
guardletcharacterSpacing=characterSpacingelse{returnattributedString}
attributedString.addAttribute(NSAttributedString.Key.kern,value:characterSpacing,range:NSRange(location:0,length:attributedString.length))
returnattributedString
}
varUTF8CString:UnsafeMutablePointer<Int8>{
returnUnsafeMutablePointer<Int8>(mutating:(selfasNSString).utf8String!)
}
varToUtf8:UnsafeMutablePointer<CChar>{
returnUnsafeMutablePointer<CChar>(mutating:(selfasNSString).utf8String!)
}
}
extensionUIView{
funcaddBottomBorderWithColor(color:UIColor,width:CGFloat){
letborder=CALayer()
border.backgroundColor=color.cgColor
border.frame=CGRect(x:0,y:self.frame.size.height-width,
width:self.frame.size.width,height:width)
self.layer.addSublayer(border)
}
}
extensionStringProtocol{
varhexa:[UInt8]{
varstartIndex=self.startIndex
returnstride(from:0,to:count,by:2).compactMap{_in
letendIndex=index(startIndex,offsetBy:2,limitedBy:self.endIndex)??self.endIndex
defer{startIndex=endIndex}
returnUInt8(self[startIndex..<endIndex],radix:16)
}
}
}
extensionSequencewhereElement==UInt8{
vardata:Data{.init(self)}
varhexa:String{map{.init(format:"%02X",$0)}.joined().uppercased()}
}
//MARK: SUBCLASSING
classButtonWithImage:UIButton{
overridefunclayoutSubviews(){
super.layoutSubviews()
ifimageView!=nil{
//imageEdgeInsets = UIEdgeInsets(top: 0, left: spacing, bottom: 0, right: 5)
titleEdgeInsets=UIEdgeInsets(top:((imageView?.frame.height)!*0.5)-((titleLabel?.frame.height)!*0.5),
left:(imageView?.frame.width)!,
bottom:0,
right:0)
}
}
}
funcserverTimeReturn(completionHandler:@escaping(_getResDate:Date?)->Void){
leturl=NSURL(string:"https://www.d-logic.net")
lettask=URLSession.shared.dataTask(with:url!asURL){(data,response,error)in
lethttpResponse=responseas?HTTPURLResponse
ifletcontentType=httpResponse!.allHeaderFields["Date"]as?String{
letdateFormatter=DateFormatter()
dateFormatter.locale=Locale(identifier:"en_US_POSIX")
dateFormatter.dateFormat="EEE, dd MMM yyyy HH:mm:ss z"
dateFormatter.timeZone=TimeZone(identifier:"UTC")
ifletserverTime=dateFormatter.date(from:contentType){
completionHandler(serverTime)
}else{
completionHandler(nil)
}
}
}
task.resume()
}
extensionUITextField{
funcaddDoneCancelToolbar(onDone:(target:Any,action:Selector)?=nil,onCancel:(target:Any,action:Selector)?=nil){
letonCancel=onCancel??(target:self,action:#selector(cancelButtonTapped))
letonDone=onDone??(target:self,action:#selector(doneButtonTapped))
lettoolbar:UIToolbar=UIToolbar()
toolbar.barStyle=.default
toolbar.items=[
UIBarButtonItem(title:"Cancel",style:.plain,target:onCancel.target,action:onCancel.action),
UIBarButtonItem(barButtonSystemItem:.flexibleSpace,target:self,action:nil),
UIBarButtonItem(title:"Done",style:.done,target:onDone.target,action:onDone.action)
]
toolbar.sizeToFit()
self.inputAccessoryView=toolbar
}
// Default actions:
@objcfuncdoneButtonTapped(){self.resignFirstResponder()}
@objcfunccancelButtonTapped(){self.resignFirstResponder()}
}
extensionUITextView{
funcaddDoneButton(title:String,target:Any,selector:Selector){
lettoolBar=UIToolbar(frame:CGRect(x:0.0,
y:0.0,
width:UIScreen.main.bounds.size.width,
height:44.0))//1
letflexible=UIBarButtonItem(barButtonSystemItem:.flexibleSpace,target:nil,action:nil)//2
letbarButton=UIBarButtonItem(title:title,style:.plain,target:target,action:selector)//3
toolBar.setItems([flexible,barButton],animated:false)//4
self.inputAccessoryView=toolBar//5
}
}
version="1.0">
com.apple.developer.nfc.readersession.formats
TAG
    Markdownis supported
    0%or
    You are about to add0people的讨论。谨慎行事。
    Finish editing this message first!
    Pleaseregisterorto comment
    Baidu
    map