This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// UIViewControllerExtension.swift | |
// Rocket.Chat | |
// | |
// Created by Rafael K. Streit on 14/11/16. | |
// Copyright © 2016 Rocket.Chat. All rights reserved. | |
// | |
import UIKit | |
import Photos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mport Foundation | |
public typealias TaskClosure = (_ completion: @escaping () -> Void) -> Void | |
public protocol SerialTaskQueueProtocol { | |
func addTask(_ task: @escaping TaskClosure) | |
func start() | |
func stop() | |
func flushQueue() | |
var isEmpty: Bool { get } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func isSingaporeNRIC(fin :String) -> Bool { | |
guard fin.count == 9 else { return false } | |
let str = fin.uppercased() | |
let characters = [Character](str) | |
var weight = 0 | |
weight += Int(String(characters[1]))! * 2 | |
weight += Int(String(characters[2]))! * 7 | |
weight += Int(String(characters[3]))! * 6 | |
weight += Int(String(characters[4]))! * 5 | |
weight += Int(String(characters[5]))! * 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
protocol MyanmarNumber {} | |
extension MyanmarNumber { | |
func toMyanmarNumber() -> String? { | |
guard let this = self as? NSNumber else { | |
return nil | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
public class TextReader { | |
let encoding: String.Encoding | |
let chunkSize: Int | |
let fileHandle: FileHandle | |
var buffer: Data | |
let delimPattern : Data | |
var isAtEOF: Bool = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// MyanmarPhoneValidator.swift | |
// mMsgr | |
// | |
// Created by Aung Ko Min on 17/10/19. | |
// Copyright © 2019 Aung Ko Min. All rights reserved. | |
// | |
import Foundation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// AutocompleteTextView.swift | |
// mMsgr | |
// | |
// Created by Aung Ko Min on 6/9/19. | |
// Copyright © 2019 Aung Ko Min. All rights reserved. | |
// | |
import UIKit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct RegexParser { | |
static let hashtagPattern = "(?:^|\\s|$)#[\\p{L}0-9_]*" | |
static let mentionPattern = "(?:^|\\s|$|[.])@[\\p{L}0-9_]*" | |
static let urlPattern = "(^|[\\s.:;?\\-\\]<\\(])" + | |
"((https?://|www\\.|pic\\.)[-\\w;/?:@&=+$\\|\\_.!~*\\|'()\\[\\]%#,☺]+[\\w/#](\\(\\))?)" + | |
"(?=$|[\\s',\\|\\(\\).:;?\\-\\[\\]>\\)])" | |
static let phonePattern = "(?:(\\+\\d\\d\\s+)?((?:\\(\\d\\d\\)|\\d\\d)\\s+)?)(\\d{4,5}\\-?\\d{4})" | |
static let myanmarWordsBreakerPattern = "(?:(?<!\\u1039)([\\u1000-\\u102A\\u103F\\u104A-\\u104F]|[\\u1040-\\u1049]+|[^\\u1000-\\u104F]+)(?![\\u103E\\u103B]?[\\u1039\\u103A\\u1037]))" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
func highlightMatches(for pattern: String, inString string: String) -> NSAttributedString { | |
guard let regex = try? NSRegularExpression(pattern: pattern, options: []) else { | |
return NSMutableAttributedString(string: string) | |
} | |
let range = NSRange(string.startIndex..., in: string) | |
let matches = regex.matches(in: string, options: [], range: range) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// StringTracker.swift | |
// Myanmar Lens | |
// | |
// Created by Aung Ko Min on 24/11/19. | |
// Copyright © 2019 Aung Ko Min. All rights reserved. | |
// | |
import Foundation |
OlderNewer