Skip to content

Instantly share code, notes, and snippets.

View kutan74's full-sized avatar
🏠
Working from home

Kutan Çıngısız kutan74

🏠
Working from home
  • iOS Developer
  • Ankara / Turkey
View GitHub Profile
@kutan74
kutan74 / UIView++.swift
Created September 11, 2020 08:35
UIView++
import UIKit
public struct AnchoredConstraints {
var top, leading, bottom, trailing, width, height: NSLayoutConstraint?
}
extension UIView {
@available(iOS 9.0, *)
@discardableResult
extension UIImageButton {
static func make(withImageIdentifier imageIdentifier: String) -> UIImageButton {
let button = UIImageButton(UIImage(named: imageIdentifier))
return button
}
}
// So that we create an instance like that
let searchButton = UIImageButton.make(withImageIdentifier: "Simple Search Icon")
import UIKit
extension UITapGestureRecognizer {
func didTapAttributedTextInLabel(label: UILabel, inRange targetRange: NSRange) -> Bool {
// Create instances of NSLayoutManager, NSTextContainer and NSTextStorage
let layoutManager = NSLayoutManager()
let textContainer = NSTextContainer(size: CGSize.zero)
let textStorage = NSTextStorage(attributedString: label.attributedText!)
// Configure layoutManager and textStorage
import UIKit
class TWReusableCollectionViewCell: UICollectionViewCell {
var slot: UIView! {
didSet {
layoutViews()
}
}
override init(frame: CGRect) {
//
// MoyaServices.swift
// Sensgreen-ios
//
// Created by KUTAN ÇINGISIZ on 9.11.2018.
// Copyright © 2018 KUTAN ÇINGISIZ. All rights reserved.
//
import Foundation
import Moya
//
// TextFieldViewWithDivider.swift
// sensme-ios
//
// Created by KUTAN ÇINGISIZ on 8.04.2019.
// Copyright © 2019 KUTAN ÇINGISIZ. All rights reserved.
//
import UIKit
struct CustomToggleView : View {
@State var isToggled = false
var toggleBody = Circle()
.frame(width: 30, height: 30)
.foregroundColor(.white)
var body: some View {
HStack {
if isToggled {
@kutan74
kutan74 / SegmentControl.swift
Created June 8, 2019 08:38
SwiftUI Segment Control Example
//
// ContentView.swift
// Pop
//
// Created by KUTAN ÇINGISIZ on 6.06.2019.
// Copyright © 2019 KUTAN ÇINGISIZ. All rights reserved.
//
import SwiftUI
@kutan74
kutan74 / RowView.swift
Last active August 6, 2020 21:12
SwiftUI Expandable Rows
//
// RowView.swift
// Pop
//
// Created by KUTAN ÇINGISIZ on 7.06.2019.
// Copyright © 2019 KUTAN ÇINGISIZ. All rights reserved.
//
import SwiftUI