Author: Chris Lattner
This file contains hidden or 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
| // Разное интересное по многопоточности: | |
| // Featured-секция, для любителей архивной документации от Apple: | |
| 1. https://developer.apple.com/library/archive/technotes/tn/tn2028.html#//apple_ref/doc/uid/DTS10003065 - про внутренности потоков в MAC OS X в сравнении с MAC OS 9 | |
| 2. https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/KernelProgramming/About/About.html - Kernel Programming guide, вы же понимаете, что там будет, да :D | |
| // Для любителей WWDC: | |
| 1. https://developer.apple.com/videos/play/wwdc2015/718/ - GCD раз. |
This file contains hidden or 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
| // | |
| // View+Geometry.swift | |
| // SwiftUIKit | |
| // | |
| // Created by Daniel Saidi on 2020-03-26. | |
| // Copyright © 2020 Daniel Saidi. All rights reserved. | |
| // | |
| import SwiftUI |
This file contains hidden or 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
| // Created by Vasily Ulianov on 09.02.17, updated in 2019. | |
| // License: MIT | |
| import Foundation | |
| /// Subclass of `Operation` that adds support of asynchronous operations. | |
| /// 1. Call `super.main()` when override `main` method. | |
| /// 2. When operation is finished or cancelled set `state = .finished` or `finish()` | |
| open class AsynchronousOperation: Operation { | |
| public override var isAsynchronous: Bool { |
Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.
- Follow standard conventions.
- Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
- Boy scout rule. Leave the campground cleaner than you found it.
- Always find root cause. Always look for the root cause of a problem.
This file contains hidden or 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
| // | |
| // ReusableView.swift | |
| // Pods | |
| // | |
| // Created by Shahpour Benkau on 27/02/2017. | |
| // | |
| // | |
| import UIKit |
This file contains hidden or 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
| // | |
| // DON'T do this, or else you risk a deadlock (e.g., by accidentally performing it in a different order somewhere) | |
| // | |
| dispatch_async(firstQueue, ^{ | |
| dispatch_sync(secondQueue, ^{ | |
| // code requiring both queues | |
| }); | |
| }); |
This file contains hidden or 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
| 1. You mast have a public key from your mashine stored on github as SSH key here: | |
| https://github.com/settings/ssh | |
| How to create ssh key on unix/mac os x: | |
| - Open terminal, go to the root typing: $ cd ~ (recommended) | |
| - Type: ssh-keygen -t rsa -C "your@email.address" | |
| - To secure your ssh key ststem will ask you for passphrase (recommended) but you can skip it also | |
| - That's you have the ssh key | |
| - Check it with: $ ls -al ~/.ssh |
This file contains hidden or 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 | |
| class AsyncOperation : NSOperation{ | |
| enum State{ | |
| case Waiting, Executing, Finished | |
| } | |
This file contains hidden or 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
| //Safe bounds check for Array | |
| //http://stackoverflow.com/questions/25329186/safe-bounds-checked-array-lookup-in-swift-through-optional-bindings | |
| extension Collection { | |
| /// Returns the element at the specified index iff it is within bounds, otherwise nil. | |
| subscript (safe index: Index) -> Iterator.Element? { | |
| return index >= startIndex && index < endIndex ? self[index] : nil | |
| } | |
| } | |
| //Helper function to exchange position in one array |
NewerOlder