Skip to content

Instantly share code, notes, and snippets.

View ergunkocak's full-sized avatar

Ergün KOÇAK ergunkocak

  • Cologne, Germany
View GitHub Profile
@ergunkocak
ergunkocak / instructions.md
Created January 30, 2023 10:05 — forked from svpino/instructions.md
Installing TensorFlow on Apple Silicon
@ergunkocak
ergunkocak / iOS11CompatibleLabel.swift
Created March 12, 2021 21:32 — forked from samskiter/iOS11CompatibleLabel.swift
A UILabel subclass that detects and attempts to fix intrinsicContentSize bugs in UILabel on iOS 11
import UIKit
/// A UILabel subclass that detects and attempts to fix intrinsicContentSize bugs in UILabel
class iOS11CompatibleLabel: UILabel {
override var intrinsicContentSize: CGSize {
// First attempt at a fix...
// All UILabels that misbehave have numberOfLines==0 and preferredMaxLayoutWidth=0
// but all UILabels that have these two properties as 0 do not necessarily misbehave
@ergunkocak
ergunkocak / Keyboard View Resize
Last active February 20, 2020 18:45
Update button constraint by keyboard open and close
override func viewDidLoad() {
super.viewDidLoad()
NotificationCenter.default.addObserver(self, selector: #selector(keyboardNotification(notification:)), name: UIResponder.keyboardWillChangeFrameNotification, object: nil)
}
@objc func keyboardNotification(notification: NSNotification) {
if let userInfo = notification.userInfo {
let endFrame = (userInfo[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue
let endFrameY = endFrame?.origin.y ?? 0
@ergunkocak
ergunkocak / NibLoadingView.swift
Created October 29, 2019 20:56
Basic UIView From xib file
//
// name the xib file as: "ViewExtendingNibLoadingView.xib"
//
// let newView = ViewExtendingNibLoadingView()
//
import UIKit
@IBDesignable
class NibLoadingView: UIView {
@ergunkocak
ergunkocak / Swift-Codable.swift
Created September 20, 2017 07:16 — forked from ahcode0919/Swift-Codable.swift
Swift 4 Codable example (Type -> JSON)
//Simple Type - Person
struct Person: Codable {
let name: String
let age: Int
func getString() -> String {
return "Name: \(name), Age: \(age)"
}
}