Skip to content

Instantly share code, notes, and snippets.

View hsleedevelop's full-sized avatar
🔥

HS Lee hsleedevelop

🔥
View GitHub Profile
@danielmartin
danielmartin / BetterXcodeJumpToCounterpartSwift.org
Last active March 9, 2024 02:00
Add support for a better Xcode's Jump to Next Counterpart in Swift

If you work on a Swift project that follows the Model-View-ViewModel (MVVM) architecture or similar, you may want to jump to counterpart in Xcode from your view to your model, and then to your view model. (ie. by using Ctrl+Cmd+Up and Ctrl+Cmd+Down).

You can do this in recent versions of Xcode by setting a configuration default.

From a terminal, just type this command and press Enter:

defaults write com.apple.dt.Xcode IDEAdditionalCounterpartSuffixes -array-add "ViewModel" "View"
// The SwiftUI Lab
// Website: https://swiftui-lab.com
// Article: https://swiftui-lab.com/alignment-guides
import SwiftUI
class Model: ObservableObject {
@Published var minimumContainer = true
@Published var extendedTouchBar = false
@Published var twoPhases = true
@ohgyun
ohgyun / oh.py
Last active June 18, 2019 06:21
꿀벌개발일지 검색 알프레드
#!/usr/bin/python
# encoding: utf-8
import sys
import os
from workflow import Workflow3, web
reload(sys)
sys.setdefaultencoding("utf-8")
{
"create": {
"create": "const styles = StyleSheet.create({})"
},
"Platform_Select": {
"pselect": "...Platform.select({ ios: {}, android: {}})"
},
"Shadow_Properties": {
"sdw": "...Platform.select({ ios: { ...shadowProperties }, android: { elevation }}),"
},
@byeounghoon
byeounghoon / Regex+StringExtension.swift
Last active April 25, 2018 04:19
Regex(with String Extension) Swift4.0
import AVFoundation
extension String {
//한글 검증
func isHangul() -> Bool {
let regEx = "^[가-힣0-9]+$"
let emailTest = NSPredicate(format:"SELF MATCHES[c] %@", regEx)
import UIKit
// MARK: - UIColor
extension UIColor {
static func rbg(r: CGFloat, g: CGFloat, b: CGFloat) -> UIColor {
return UIColor(red: r/255, green: g/255, blue: b/288, alpha: 1)
}
convenience init?(hex: String, alpha: CGFloat = 1.0) {
@Jegge
Jegge / Localizable.strings
Last active February 5, 2023 19:16
Localized enums in Swift
"Test_a" = "AAAAA";
"Test_b" = "BBBBB";
"Test_c" = "CCCCC";
"Test_d" = "DDDDD";
@jdmcd
jdmcd / API.swift
Last active June 19, 2020 07:37
Alamofire + Codable
class API {
static let apiKey = "test"
static let baseUrl = ""
enum Endpoint {
case login
case register
var endpoint: String {
switch self {
import Foundation
// Inspired by https://gist.github.com/mbuchetics/c9bc6c22033014aa0c550d3b4324411a
struct JSONCodingKeys: CodingKey {
var stringValue: String
init?(stringValue: String) {
self.stringValue = stringValue
}
@JulianAlonso
JulianAlonso / Regex&Matcher-Playground.swift
Last active March 7, 2023 06:22
Mapping URL (Deep linking) on iOS.
import Foundation
extension String {
//Know if self is only composed by numbers
var isNumber: Bool {
return !self.isEmpty && CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: self))
}
}
//Struct to check Regular Expresions