Skip to content

Instantly share code, notes, and snippets.

View alekseypotapov-dev's full-sized avatar

Aleksey Potapov alekseypotapov-dev

View GitHub Profile

Low Quality Answer

Welcome to Stack Overflow. Thanks for writing the answer! However, while answering the question please try to be more explicit and provide some more details e.g. code samples, output, documentation links, screenshots. I would recommend you to check SO's [official How to Answer article](https://stackoverflow.com/help/how-to-answer).

Low Quality Question

Welcome to Stack Overflow. Your question should have your effort to solve the task. Here you post abstract question which people will likely delete rather answer. Code is good, environment, screenshots, error codes if any. I would recommend you to check SO's [official How to Ask article](https://stackoverflow.com/help/how-to-ask).

Code as image

func drawTableHeaderTitles(titles: [String], drawContext: CGContext, pageRect: CGRect) {
// prepare title attributes
let textFont = UIFont.systemFont(ofSize: 16.0, weight: .medium)
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.alignment = .left
paragraphStyle.lineBreakMode = .byWordWrapping
let titleAttributes = [
NSAttributedString.Key.paragraphStyle: paragraphStyle,
NSAttributedString.Key.font: textFont
]
@alekseypotapov-dev
alekseypotapov-dev / lldb-commands.md
Created January 7, 2020 11:48
List of commands that are useful during development

ignore asserts

process handle -p true -s false SIGSTOP
import UIKit
// [^] Negated set - Match any character that is not in the set.
// @ Character - Matches "@" character (char code 64).
// * Quantifier - Match 0 or more of pending token.
// $ End - Matches the end of the string, or the end of a line if the multiline flag (m) is enabled. This matches a position, not a character.
func matchesRegex(_ regex: String, in text: String) -> String {
do {
let regex = try NSRegularExpression(pattern: regex)
@alekseypotapov-dev
alekseypotapov-dev / FoldersMerger.swift
Created September 2, 2020 07:05
Merging files using FileManager in swift
let merger = FoldersMerger(actionType: .copy, conflictResolution: .keepSource)
merger.merge(atPath: sourceFolder, toPath: destinationFolder)
class FoldersMerger {
enum ActionType { case move, copy }
enum ConflictResolution { case keepSource, keepDestination }
private let fileManager = FileManager()