Skip to content

Instantly share code, notes, and snippets.

View siempay's full-sized avatar
👨‍💻
Focusing

Brahim Elmssilha siempay

👨‍💻
Focusing
View GitHub Profile
@siempay
siempay / YoutubeVideoPlayer.swift
Created June 19, 2022 11:11
SwiftUI: How to add YouTube VideoPlayer
//
// Created by Brahim Elmssilha on 16/6/2022.
// Email: Siempay@gmail.com
//
struct YoutubeVideoView: UIViewRepresentable {
var youtubeVideoID: String
func makeUIView(context: Context) -> WKWebView {
@siempay
siempay / Data+GetSize.swift
Created September 23, 2020 09:39
Swift 5: Get Binary Data size by Kb, Mb etc ...
extension Data {
var bytes: Int64 {
.init(self.count)
}
public var kilobytes: Double {
return Double(bytes) / 1_024
}
@siempay
siempay / Array+RemoveDuplicates.swift
Last active June 1, 2020 15:44
Array extension for swift language usable in iOS to filter/remove duplicated elements based on a predicate
/// Remove duplicated elements
extension Array {
/// mutate array by iterating through element and filtering duplicated ones
/// - parameter predicate: the test to check if two elements are a dulication
public mutating func removeDuplicates(_ predicate: (Element, Element) -> Bool) {
self = removeDuplicates(predicate)
}
/// iterating through element and filtering duplicated ones
- Disable warnings of the view: `OS_ACTIVITY_MODE = disable`
@siempay
siempay / UIView+BlurRadius.swift
Created April 18, 2020 21:50
Add blur effect on a UIView with blurRadius
//
// UIView+BlurRadius.swift
// PrecisionSystem
//
// Created by Siempay on 3/27/20.
// Copyright © 2020 Brahim ELMSSILHA. All rights reserved.
//
import Foundation
@siempay
siempay / UIBorderedLabel.swift
Last active April 18, 2020 21:38
UILabel subclass that makes setting padding really easy for Swift 5 users
//
// UIBorderedLabel.swift
// app3
//
// Created by ELMSSILHA Brahim on 11/07/2017.
// Copyright © 2017 Brahim ELMSSILHA. All rights reserved.
//
import UIKit