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 urlSession( | |
_ session: URLSession, | |
task: URLSessionTask, | |
didReceive challenge: URLAuthenticationChallenge, | |
completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void | |
) { | |
// SERVER TRUST | |
if challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodClientCertificate { | |
guard |
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 Foundation | |
import OpenSSL | |
static func pkcs12(fromPem pemCertificate: String, | |
withPrivateKey pemPrivateKey: String, | |
p12Password: String = "", | |
certificateAuthorityFileURL: URL? = nil) throws -> NSData { | |
// Create sec certificates from PEM string | |
let modifiedCert = pemCertificate | |
.replacingOccurrences(of: "-----BEGIN CERTIFICATE-----", with: "") |
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 DayMonthView: View { | |
@State var monthString = Date().getMonthString() | |
@State var dayString = Date().getDayString() | |
var body: some View { | |
VStack { | |
Text(monthString) | |
.foregroundColor(Color.red) |
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
// | |
// Connectivity.swift | |
// Test App | |
// | |
// Created by Onur Işık on 14.05.2020. | |
// Copyright © 2020 Onur Işık. All rights reserved. | |
// | |
// NOTE: This struct needs to Alomafire pod to work (Alomafire includes NetworkReachabilityManager) |
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 android.content.Context | |
import android.net.ConnectivityManager | |
import android.net.NetworkCapabilities | |
import android.os.Build | |
val Context.isConnected: Boolean | |
get() { | |
val connectivityManager = this.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager | |
return when { | |
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M -> { |
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 { BrowserModule } from "@angular/platform-browser"; | |
import { NgModule } from "@angular/core"; | |
import { HttpClientModule } from "@angular/common/http"; | |
import { AppRoutingModule } from "./app-routing.module"; | |
import { AppComponent } from "./app.component"; | |
import { NavComponent } from "./nav/nav.component"; | |
import { HomeComponent } from "./home/home.component"; | |
import { RegisterComponent } from "./register/register.component"; | |
import { JobsComponent } from "./jobs/jobs.component"; |
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 AVFoundation | |
class ViewController: UIViewController { | |
override func viewDidAppear(_ animated: Bool) { | |
super.viewDidAppear(animated) | |
switch AVCaptureDevice.authorizationStatus(for: .video) { | |
case .notDetermined: |
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
extension UILabel { | |
func textWidth() -> CGFloat { | |
return UILabel.textWidth(label: self) | |
} | |
class func textWidth(label: UILabel) -> CGFloat { | |
return textWidth(label: label, text: label.text!) | |
} | |
class func textWidth(label: UILabel, text: String) -> CGFloat { |
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
enum X509Error: Error { | |
case certificateError(message: String) | |
case publicKeyError(message: String) | |
} | |
class X509 { | |
// A DER (Distinguished Encoding Rules) representation of an X.509 certificate. | |
let publicKey: SecKey |
NewerOlder