Skip to content

Instantly share code, notes, and snippets.

View mehmetfarhan's full-sized avatar
🚀

Mohammad Farhan mehmetfarhan

🚀
View GitHub Profile
@mehmetfarhan
mehmetfarhan / XOREncryptionAndDecryption.swift
Last active June 28, 2020 09:47
XOR encryption and decryption
final class XOREncryptionAndDecryption {
static func encript(_ text: String, cipher: String) -> String {
let text = [UInt8](text.utf8)
let cipher = [UInt8](cipher.utf8)
var encripted = [UInt8]()
for (index, item) in text.enumerated() {
encripted.append(item ^ cipher[index])
}
@mehmetfarhan
mehmetfarhan / FlayCart.swift
Created May 9, 2019 13:14
Flay Shopping Cart
private var badge = BadgeBarButtonItem()
var counterItem = 0
@objc
func didTappedAddToCart(with imageView: UIImageView?) {
guard let imageView = imageView else { return }
let bounds = imageView.bounds
let size = imageView.frame.size
//
// SocialNetwork.swift
// SocialNetwork
//
// Created by Mohammad Farhan on 4/27/19.
// Copyright © 2019 SocialNetwork. All rights reserved.
//
import UIKit
@mehmetfarhan
mehmetfarhan / PaddedLabel.swift
Last active April 26, 2019 21:37
PaddedLabel
//
// PaddedLabel.swift
// PaddedLabel
//
// Created by Mohammad Farhan on 4/27/19.
// Copyright © 2019 PaddedLabel. All rights reserved.
//
import UIKit
@mehmetfarhan
mehmetfarhan / UIFont
Created December 15, 2018 11:19
Override the system font "swift 4" "iOS"
import UIKit
struct AppFontName {
static let regular = "CourierNewPSMT"
static let bold = "CourierNewPS-BoldMT"
static let italic = "CourierNewPS-ItalicMT"
}
extension UIFontDescriptor.AttributeName {
static let nsctFontUIUsage = UIFontDescriptor.AttributeName(rawValue: "NSCTFontUIUsageAttribute")
@mehmetfarhan
mehmetfarhan / ArrayDeepCopy.swift
Created September 20, 2017 05:50 — forked from sohayb/ArrayDeepCopy.swift
Array deep copy in Swift
//Protocal that copyable class should conform
protocol Copying {
init(original: Self)
}
//Concrete class extension
extension Copying {
func copy() -> Self {
return Self.init(original: self)
}