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
| struct ContentView: View { | |
| var body: some View { | |
| ScrollView(.horizontal, showsIndicators: false) { | |
| LazyHStack(spacing: 10) { | |
| ForEach(Array(1...10), id: \.self) { id in | |
| RoundedRectangle(cornerRadius: 50) | |
| .fill(.yellow) | |
| .overlay { | |
| Text("\(id)") |
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
| # Основы Cocoapods 04: Как создать библиотеку без исходного кода? | |
| # https://youtu.be/LjPBxPywGoI | |
| # zip -r PMComplitedUserPrinter.zip LICENSE PMUserPrinter.xcframework | |
| xcodebuild archive \ | |
| -workspace PMUserPrinter.xcworkspace \ | |
| -scheme PMUserPrinter \ | |
| -sdk iphoneos \ | |
| -archivePath "xcframework_archives/ios_devices.xcarchive" \ |
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
| # Основы Cocoapods 02: Как создать публичную библиотеку | |
| # https://youtu.be/wUjGImmGsVc | |
| Pod::Spec.new do |s| | |
| s.name = 'PMUserPrinter' | |
| s.version = '1.0.0' | |
| s.license = 'MIT' | |
| s.summary = 'Test framework' | |
| s.homepage = 'https://github.com/denandreychuk/PMUserPrinter' | |
| s.authors = { 'Den Andreychuk' => 'business@denandreychuk.com' } |
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
| func someAsyncFunc(result: @escaping (Result<Void, Error>) -> Void) { | |
| DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(3)) { | |
| result(.success(())) | |
| } | |
| } | |
| let runner = SwiftScriptRunner() | |
| runner.lock() | |
| someAsyncFunc { result in |
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
| // СВИФТЕР | Блог про Swift | t.me/BlogSwift | |
| extension UITableView { | |
| func setTableHeaderView(headerView: UIView) { | |
| tableHeaderView = headerView | |
| headerView.translatesAutoresizingMaskIntoConstraints = false | |
| headerView.widthAnchor.constraint(equalTo: self.widthAnchor).isActive = true | |
| headerView.centerXAnchor.constraint(equalTo: self.centerXAnchor).isActive = true |
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
| // СВИФТЕР | Блог про Swift | t.me/BlogSwift | |
| struct FailableDecodable<Base : Decodable> : Decodable { | |
| let base: Base? | |
| init(from decoder: Decoder) throws { | |
| let container = try decoder.singleValueContainer() | |
| self.base = try? container.decode(Base.self) | |
| } |
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
| // СВИФТЕР | Блог про Swift | t.me/BlogSwift | |
| extension Int { | |
| var abbreviated: String { | |
| "KMBTQ".enumerated().reversed().reduce(nil as String?) { result, abbreviation in | |
| let factor = Double(self) / pow(10, Double(abbreviation.offset + 1) * 3) | |
| let format = (factor.truncatingRemainder(dividingBy: 1) == 0 ? "%.0f%@" : "%.1f%@") | |
| return result ?? (factor > 1 ? String(format: format, factor, String(abbreviation.element)) : nil) | |
| } ?? String(self) | |
| } |
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
| // СВИФТЕР | Блог про Swift | t.me/BlogSwift | |
| @main | |
| class AppDelegate: PluggableApplicationDelegate { | |
| // MARK: Services | |
| override var services: [ApplicationService] { | |
| [ | |
| FirebaseService(), |
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
| // СВИФТЕР | Блог про Swift | t.me/BlogSwift | |
| extension UIImage { | |
| convenience init(color: UIColor, size: CGSize) { | |
| UIGraphicsBeginImageContextWithOptions(size, false, 1) | |
| defer { | |
| UIGraphicsEndImageContext() | |
| } |
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
| // СВИФТЕР | Блог про Swift | t.me/BlogSwift | |
| // Константа | |
| let maxPasswordLenght = 64 | |
| // Переменная | |
| var currentPasswordLenght = 12 |
NewerOlder