This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import Security | |
class RSA: NSObject { | |
private var publicKey : SecKey? | |
private var privateKey : SecKey? | |
func generateKeyPair(keySize: UInt, privateTag: String, publicTag: String) -> Bool { | |
let publicKeyParameters: [NSString: AnyObject] = [kSecAttrIsPermanent: true as AnyObject,kSecAttrApplicationTag: publicTag as AnyObject] | |
let privateKeyParameters: [NSString: AnyObject] =[kSecAttrIsPermanent: true as AnyObject, | |
kSecAttrApplicationTag: publicTag as AnyObject] | |
let parameters: [String: AnyObject] = [kSecAttrKeyType as String: kSecAttrKeyTypeRSA,kSecAttrKeySizeInBits as String: keySize as AnyObject,kSecPrivateKeyAttrs as String: privateKeyParameters as AnyObject,kSecPublicKeyAttrs as String: publicKeyParameters as AnyObject] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct ContentView: View { | |
@State private var rect: CGPoint = CGPoint() | |
var body: some View { | |
ZStack { | |
Text("Hello World").background(InsideView(rect: $rect)).onTapGesture { | |
print("geometry ",self.rect) | |
} | |
Circle() | |
.fill(Color.yellow) | |
.frame(width: 10, height: 10, alignment: .center) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct ContentView: View { | |
@State private var rect: CGPoint = CGPoint() | |
@State private var textText:String = "" | |
@State private var textValue:String = "Hello World" | |
var body: some View { | |
let dropDelegate = TheDropDelegate(textText: $textText) | |
return VStack { | |
Spacer() | |
Text(textValue).background(InsideView(rect: $rect)) | |
.onDrag { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct TheDropDelegate: DropDelegate { | |
@Binding var textText:String | |
func validateDrop(info: DropInfo) -> Bool { | |
return info.hasItemsConforming(to: ["public.utf8-plain-text"]) | |
} | |
func dropEntered(info: DropInfo) { | |
print("drop entered") | |
} | |
func performDrop(info: DropInfo) -> Bool { | |
if let item = info.itemProviders(for: "public.utf8-plain-text").first { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct ContentView: View { | |
@State private var rect: CGPoint = CGPoint() | |
@State private var textText = ["",""] | |
@State private var textID = 0 | |
@State private var textValue:String = "Hello World" | |
var body: some View { | |
let dropDelegate = TheDropDelegate(textID: $textID, textText: $textText, textValue: $textValue) | |
return VStack { | |
Spacer() | |
Text(textValue).background(InsideView(rect: $rect)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func dropTarget(info: DropInfo) -> Int { | |
if info.location.x > UIScreen.main.bounds.width / 2 { | |
return(1) | |
} else { | |
return(0) | |
} | |
} | |
func performDrop(info: DropInfo) -> Bool { | |
textID = dropTarget(info: info) | |
if let item = info.itemProviders(for: ["public.utf8-plain-text"]).first { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
import CoreServices | |
struct ContentView: View { | |
@State private var rect:[CGRect] = [] | |
@State private var textText = ["","","",""] | |
@State private var textID = 0 | |
@State private var textValue1:String = "Hello World 1" | |
@State private var textValue2:String = "Hello World 2" | |
var body: some View { | |
let dropDelegate = TheDropDelegate(textID: $textID, textText: $textText, rect: $rect) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func dropTarget(info: DropInfo) -> Int? { | |
for squareno in 0..<rect.count { | |
if rect[squareno].contains(info.location) { | |
return squareno | |
} | |
} | |
return nil | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let dropDelegate = TheDropDelegate(textText: $textText, textValue: $textValue) | |
struct TheDropDelegate: DropDelegate { | |
@Binding var textText:String | |
@Binding var textValue:String | |
func dropUpdated(info: DropInfo) -> DropProposal? { | |
print("drop Updated") | |
self.textValue = "" | |
return nil | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
import CoreServices | |
struct Fonts { | |
static func futuraCondensedMedium(size:CGFloat) -> Font{ | |
return Font.custom("Futura-CondensedMedium",size: size) | |
} | |
} | |
let backgrounds = [Color.red,Color.blue,Color.orange,Color.green] | |
struct ContentView: View { | |
@State private var rect:[CGRect] = [] |
OlderNewer