Skip to content

Instantly share code, notes, and snippets.

View trilliwon's full-sized avatar
🎯
Focusing

WonJo trilliwon

🎯
Focusing
View GitHub Profile
extension Date {
var startOfDay: Date {
return Calendar.current.startOfDay(for: self)
}
var endOfDay: Date {
var components = DateComponents()
components.day = 1
components.second = -1
return Calendar.current.date(byAdding: components, to: startOfDay)!
let min = CGFloat(-30)
let max = CGFloat(30)
let xMotion = UIInterpolatingMotionEffect(keyPath: "layer.transform.translation.x", type: .TiltAlongHorizontalAxis)
xMotion.minimumRelativeValue = min
xMotion.maximumRelativeValue = max
let yMotion = UIInterpolatingMotionEffect(keyPath: "layer.transform.translation.y", type: .TiltAlongVerticalAxis)
yMotion.minimumRelativeValue = min
yMotion.maximumRelativeValue = max
@trilliwon
trilliwon / CIFilter+Extension.swift
Created February 15, 2019 09:41 — forked from ha1f/CIFilter+Extension.swift
CIFilter+Extension.swift
//
// Created by はるふ on 2017/12/11.
// Copyright © 2017年 ha1f. All rights reserved.
//
import Foundation
import CoreImage
import AVFoundation
extension CIFilter {
//
// RxAVSpeechSynthesizerDelegate.swift
// Pomodoro
//
// Created by Won on 17/12/2018.
// Copyright © 2018 won. All rights reserved.
//
#if os(iOS)
import UIKit
class TailTagView: UIView {
var rawText: String? {
didSet {
label.attributedText = parseText(rawText: rawText)
}
}
// HDR
@IBOutlet weak var hdrButton: HDRButton!
var currentHDRMode: HDRMode = .auto
@IBAction func HDRButtonTouched(_ sender: HDRButton) {
toggleHDR()
sender.mode = currentHDRMode
}
@trilliwon
trilliwon / AnimatedMaskLabel.swift
Created January 13, 2019 09:56
AnimatedMaskLabel
# AnimatedMaskLabel
```swift
//
// AnimatedMaskLabel.swift
// AnimatedMaskLabel
//
// Created by JOGENDRA on 06/04/18.
//
@trilliwon
trilliwon / tintedUIImage.swift
Created January 3, 2019 00:26
tinted UIImage
let origImage = UIImage(named: "icon")
let tintedImage = origImage?.withRenderingMode(.alwaysTemplate)
button.setImage(tintedImage, for: .normal)
button.tintColor = .red
override var isSelected: Bool{
didSet{
if self.isSelected
{
self.transform = CGAffineTransform(scaleX: 1.1, y: 1.1)
self.contentView.backgroundColor = UIColor.red
self.tickImageView.isHidden = false
}
else
{
@trilliwon
trilliwon / codable.swift
Created December 23, 2018 13:18
Codable Swift
struct Coordinate: Codable {
var latitude: Double
var longitude: Double
}
struct Landmark: Codable {
var name: String
var foundingYear: Int
var location: Coordinate