Skip to content

Instantly share code, notes, and snippets.

View yildirimatcioglu's full-sized avatar

Yildirim Atcioglu yildirimatcioglu

  • Getir NL
  • Amsterdam, Netherlands
  • X @wixvii
View GitHub Profile
@nunogoncalves
nunogoncalves / CreditCardValidation.swift
Last active October 7, 2021 07:51
Credit card validation in Swift 3
import UIKit
import PlaygroundSupport
//http://stackoverflow.com/questions/72768/how-do-you-detect-credit-card-type-based-on-number
enum CreditCardType {
case visa
case visaElectron
case mastercard
@shaildyp
shaildyp / UIView+roundCorners.swift
Last active December 7, 2022 12:14
Backward compatible maskedCorners of iOS 11.
extension UIView {
func roundCorners(_ corners: CACornerMask, radius: CGFloat) {
if #available(iOS 11, *) {
self.layer.cornerRadius = radius
self.layer.maskedCorners = corners
} else {
var cornerMask = UIRectCorner()
if(corners.contains(.layerMinXMinYCorner)){
cornerMask.insert(.topLeft)
class Button: UIButton {
var outset: CGSize = CGSize.zero
var shouldFitContentVertically: Bool = false {
didSet {
if shouldFitContentVertically {
titleLabel?.lineBreakMode = .byWordWrapping
titleLabel?.numberOfLines = 0
}
@navsing
navsing / MessagesPart-III.swift
Last active March 28, 2024 15:41
Recreating the Messages App Part III (Chat Bubble Shape) using SwiftUI and Swift Playgrounds on iPad
import SwiftUI
import PlaygroundSupport
struct Screen: View {
var body: some View {
VStack {
HStack {
Spacer()
Text("Here’s to the crazy ones, the misfits, the rebels, the troublemakers, the round pegs in the square holes… the ones who see things differently — they’re not fond of rules…").padding().background(Color(UIColor.systemBlue)).clipShape(BubbleShape(myMessage: true)).foregroundColor(.white)