lang
stringclasses
10 values
seed
stringlengths
5
2.12k
swift
// import UIKit class CollectionViewCell: UICollectionViewCell { @IBOutlet weak var cellImage: UIImageView! }
swift
#if !os(Linux) public class AmatorkaFilter: LookupFilter { public override init() { super.init() do { try ({lookupImage = try PictureInput(imageName:"lookup_amatorka.png")})() } catch { print("ERROR: Unable to create PictureInput \(error)") } ...
swift
Button(action: { self.viewRouter.currentPage = "orders" }){ VStack{ Image("Order_black") .resizable() .frame(width: 3...
swift
override func viewDidLoad() { super.viewDidLoad() let mdView = MarkdownView() view.addSubview(mdView) mdView.translatesAutoresizingMaskIntoConstraints = false mdView.topAnchor.constraint(equalTo: topLayoutGuide.topAnchor).isActive = true mdView.leadingAnchor.constraint(equalTo: view.leadingAn...
swift
// MARK: - PopJumpIfTrue func test_appendPopJumpIfTrue() { let builder = createBuilder() let label = builder.createLabel() builder.appendPopJumpIfTrue(to: label) // 0
swift
/// Assigns only when `rhs` is non-`nil`.. /// - Remark: effectively `lhs = rhs ?? lhs` _(skipping same-value assignments)_ public func =??<Wrapped>(lhs:inout Wrapped, rhsClosure:@autoclosure ()throws->Wrapped?) rethrows { let rhs:Wrapped? = try rhsClosure() if rhs != nil { lhs = rhs! } } /// Assigns only when ...
swift
var isAnimating = false var currentPage: Int! required public init?(coder aDecoder: NSCoder) { self.configuration = MJConfiguration.getDefault() self.date = NSDate().dateAtStartOfDay() super.init(coder: aDecoder) self.visiblePeriodDate = self.startDate(self.date, wi...
swift
evaluators.forEach { $0.evaluate(blendShapes, forDelegate: delegate) } } }
swift
$0.attributes.name.value.lowercased() == command.parameters[1].lowercased() }) else { command.message.reply(key: "addgroup.nogroup", fromCommand: command, map: [ "param": command.parameters[1] ]) return } ...
swift
let package = Package( name: "Alicerce", dependencies: [ .package(url: "https://github.com/antitypical/Result.git", from: "4.0.0")
swift
addSubview(startMessaging) NSLayoutConstraint.activate([ logoImageView.topAnchor.constraint(equalTo: topAnchor), logoImageView.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 55), logoImageView.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -55), logoImageView.h...
swift
// Created by Dennis Pashkov on 4/15/16. // Copyright © 2016 Dennis Pashkov. All rights reserved. // import Foundation extension NSObject { /*! Returns the receiver as Self. - returns: Receiver as Self */ public func asSelf<T>() -> T! {
swift
let numberSet = CharacterSet.decimalDigits if (string as NSString).rangeOfCharacter(from: numberSet.inverted).location != NSNotFound { return false } return true } func textFieldDidEndEditing(_ textField: UITextField, reason: UITextFieldDidEndEditingReason) { if sel...
swift
public extension TGBot { /**
swift
/// This method designated to be called from `tableView:moveRowAtIndexPath:toIndexPath:` /// /// In default, does nothing. /// - Parameters: /// - sourceIndex: Source IndexPath for the cell row. /// - destinationIndex: Destination IndexPath for the cell row.
swift
} let config: Config init(config: Config) { self.config = config } func query(delegate: URLSessionDelegate, completion: @escaping () -> Void) {
swift
// import Foundation import RxCocoa
swift
dialog.confirmButtonTapEvents .observeOn(schedulerProvider.mainThread()) .subscribe(onNext: { [unowned self] in self.tripFinishedListener?.tripFinished() }) .disposed(by: disposeBag) }
swift
/** Инициализация цели с ее описанием - parameter title: Описание цели - returns: Инициализированный экземпляр цели с пустыми списками и методом "Выбор альтернативы" */ required public init(title: String) {
swift
throw DecodingError.dataCorruptedError(in: container, debugDescription: "Date not in correct format") } public func encode(to encoder: Encoder) throws { var container = encoder.singleValueContainer() let string = DateTime.dateEncodingFormatter.string(from: date) try container.en...
swift
let file = try AKAudioFile(readFileName: playgroundAudioFiles[0]) var player = AKPlayer(audioFile: file) player.isLooping = true let input = AKStereoOperation.input let sporth = "\(input) 15 200 7.0 8.0 10000 315 0 1500 0 1 0 zitarev" let effect = AKOperationEffect(player, sporth: sporth) AudioKit.output = effect t...
swift
@discardableResult public func .= (lhs: [View], rhs: XAxisAnchorExpression) -> [XAxisAnchor.Solution] { return lhs.map { $0 .= rhs } } // MARK: [View] == Expressions @discardableResult public func .= (lhs: [View], rhs: XAxisAnchorExpressions) -> [[XAxisAnchor.Solution]] { return lhs.map { $0 .= rhs } }
swift
self.watchSessionManager = watchSessionManager self.mmuNotificationsHandler = mmuNotificationsHandler super.init() // Listen to changes to OctoPrint Settings in case the camera orientation has changed octoprintClient.octoPrintSettingsDelegates.append(self) ...
swift
guard assessment.isEnabled else { return } self.viewModel.selectedAssessment = .init(session: session.window, assessment: assessment.assessment) self.viewModel.isPresentingAssessment = true } .transit...
swift
func getMeals(filteredBy filter: MAMealListFilter, value: String) -> Single<MAMealListResponse> { let adaptedValue = value.replacingOccurrences(of: " ", with: "_") switch filter { case .area: return service.request(path: .filter, method: .GET, queryItems: [.init(name: "a", valu...
swift
// Copyright © Fleuronic LLC. All rights reserved. public extension JSONBin.V2.API.Collection { struct Update { public let success: Bool public let collectionID: Collection.ID? public let collectionDetails: Details? public let schemaDocID: SchemaDoc.ID? public let schemaDocDetails: Details? } } // MARK: -
swift
let webVC: FYFWebViewController = FYFWebViewController.init(webViewUrl: "https://luna.gtjaqh.com/news-static/html/2021/0825/af7c33e841a0e3bc02cabf66b590e2e5.html") // let webVC: FYFWebViewController = FYFWebViewController.init(webViewUrl: "https://www.baidu.com/") webVC.isUserNativeNavBa...
swift
public var latitude: Double public var longitude: Double public var name: String public var ticketsUrl: String? public var timeStart: String? public var timeEnd: String? public var businessId: String? public var location: BusinessLocation
swift
// // Created by Oleksii on 31/10/2017. // Copyright © 2017 WeAreReasonablePeople. All rights reserved. //
swift
weak var viewController: AddToDoTaskViewController! // MARK: Navigation func navigateToSomewhere(){ // NOTE: Teach the router how to navigate to another scene. Some examples follow: // 1. Trigger a storyboard segue // viewController.performSegueWithIdentifier("Show...
swift
// // SegmentedControlFormItem.swift // SwiftForm // // Copyright © 2019 itzseven. All rights reserved. // import UIKit public protocol SegmentedControlFormItem: FormItem { var titles: [String] { get }
swift
// https://developer.apple.com/documentation/xcode_release_notes/xcode_10_2_release_notes/swift_5_release_notes_for_xcode_10_2?language=objc open override var hash: Int { return "\(username):\(password)".hashValue } public init(username: String, password: String) { super.init() ...
swift
// EntityWithEncryptedFields // // Created by Manuel on 09/08/2021. // Copyright © 2021 Manuel Entrena. All rights reserved. // import Foundation import Realm import CloudKit import PZSyncKit class EntityWithEncryptedFields: RLMObject, PrimaryKey, EncryptedObject { @objc dynamic var name: String = ""
swift
var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true }
swift
syncControls() syncAllowance() syncSwapData() } override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) { super.touchesEnded(touches, with: event) view.endEditing(true) } private func pathString(path: [SwapToken]) -> String { let part...
swift
let scaledSize = CGSize(width: 10, height: 5).sizeWithScale(2) XCTAssertTrue(CGSize(width: 20, height: 10) == scaledSize) } func testScalingWithNegativeScale() { let scaledSize = CGSize(width: 10, height: 5).sizeWithScale(-3) XCTAssertTrue(CGSize(width: -30, height: -15) == ...
swift
/** Computes an in-memory representation (Raster) of the data set. When `delivery` is .onceComplete, the `callback` will be called exactly once, with the final result raster and a stream status of .finished (also in the case of an error). When `delivery` is set to .incremental, the callback may be called more than o...
swift
/// :nodoc: @objcMembers open class PXPayerCompliance: NSObject, Codable { let offlineMethods: PXOfflineMethodsCompliance let ifpe: PXIfpe? enum CodingKeys: String, CodingKey { case offlineMethods = "offline_methods" case ifpe }
swift
keyFrameAnimation.isRemovedOnCompletion = false keyFrameAnimation.fillMode = "forwards" progressLayer.add(keyFrameAnimation, forKey: "start") } func finishAnimation() { if (progressLayer.animation(forKey: "finish") != nil) { return
swift
class Solution { func missingNumber(_ nums: [Int]) -> Int { var missing = 0 for i in 0..<nums.count { missing ^= i ^ nums[i] } return missing ^ nums.count } }
swift
if let styleString = regx.subgroupMatchAtIndex(0)?.trim, let regxsubs = Regex("\\.([\\w]*)[\\s]*\\{[\\s]?([^}]*)[\\s]?\\}").match(styleString){ for regxsub in regxsubs { let className = regxsub.subgroupMatchAtIndex(0...
swift
} } } } /* // MARK: - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepare(for segue: UIStoryboardSegue, sender: Any?) { // Get the new view ...
swift
// MARK: - Private Methods fileprivate func setupAnimatedDropdownMenu() { let dropdownMenu = AnimatedDropdownMenu(navigationController: navigationController, containerView: view, selectedIndex: selectedStageIndex, items: dropdownItems) dropdownMenu.cellBackgroundColor = UI...
swift
* Copyright (c) 2021 Aspose.Words for Cloud * </copyright> * <summary> * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights...
swift
/** Name of the pet */ public var ATT_NAME: String? public init(smallCamel: String? = nil, capitalCamel: String? = nil, smallSnake: String? = nil, capitalSnake: String? = nil, sCAETHFlowPoints: String? = nil, ATT_NAME: String? = nil) { self.smallCamel = smallCamel
swift
* Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property */ func toDictionary() -> [String:Any] { var dictionary = [String:Any]() if customPlateImages != nil{ var dictionaryElement...
swift
{ return (0..<entryCount).reduce(description + ":") { "\($0)\n\(self.entryForIndex($1)?.description ?? "")" } } // MARK: - NSCopying open func copy(with zone: NSZone? = nil) -> Any { let copy = type(of: self).init()
swift
class UAProjectValidationTest: XCTestCase { var sourceRootURL : URL? var xcodeProject : XCProjectFile? override func setUp() {
swift
setTitleColor(UIColor.grayColor(), forState: .Normal) sizeToFit() } override func setTitle(title: String?, forState state: UIControlState) {
swift
defer { self.codingPath.removeLast() } let container = XMLKeyedEncodingContainer<NestedKey>( referencing: encoder, codingPath: codingPath, wrapping: sharedKeyed ) return KeyedEncodingContainer(container) } mutating func nestedChoiceContainer<...
swift
return true } // MARK: UISceneSession Lifecycle func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { // Called when a new scene session is being created. // Us...
swift
// } } protocol SambaCastChannelDelegate: class { func didReceiveMessage(message: String) } class SambaCastRequest: NSObject /*, GCKRequestDelegate*/ { // private var callback: ((Error?) -> Void)?
swift
protocol DateFormatterService { func dateToString(_ date: Date) -> String func stringToDate(_ string: String) -> Date? } final class DateFormatterServiceImpl: DateFormatterService {
swift
import UIKit import SwiftUI class SceneDelegate: UIResponder, UIWindowSceneDelegate { var window: UIWindow? func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { // Use this method to optionally configure and attach the UIWindo...
swift
} extension PresentAlert { func presentGenericErrorAlert() {
swift
}, completion: { finished in if finished { self.newlyCreatedFace.removeFromSuperview() } }) } } }
swift
class ModulledTableViewController: UITableViewController { var tableViewModules: [TableViewModule]! { didSet { tableViewModules.forEach { module in module.prepare(forTableView: self.tableView) module.parentController = self module.didChangeContent...
swift
// import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { // Override point for customization after applicat...
swift
let bottomEdgeInWindowCoordinates = window.frame.maxY - frameInWindowCoordinates.maxY let bottomInsets = max(insets.bottom, change.frame.height - bottomEdgeInWindowCoordinates) self.contentInset.bottom = bottomInsets self.verticalScrollIndicatorInsets.bottom = bottomInsets ...
swift
CATransaction.begin() CATransaction.setDisableActions(true) snakeLayer.strokeStart = 0 snakeLayer.strokeEnd = snakeLengthByCycle / CGFloat(cycleCount) * progress CATransaction.commit() } fileprivate let AnimationGroupKey = "SnakePathAnimations" func startAnimatin...
swift
import Foundation enum CountEffect { case setCount(Int) case incrementCount }
swift
if success { fulfill(true) return } fulfill(false) } }*/ /*override func checkID() -> Promise<Bool> { return Promise<Bool> { fulfill, reject in }
swift
// deprecated - will be removed in version 6.3.x or above func getAndTrack(deepLink: URL, callbackBlock: @escaping ITEActionBlock) -> Future<IterableAttributionInfo?, Error> { return resolve(appLinkURL: deepLink).map { resolvedURL, attributionInfo in callbackBlock(resolvedURL?.absoluteS...
swift
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substan...
swift
game.answerScores = [] } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated.
swift
func applicationDidBecomeActive(_ application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } func applicationWillTerminate(_ application: ...
swift
} } } catch { Logger.d("Request failed: \(error)") }
swift
// rdar://17242486 protocol a { typealias d typealias e = d typealias f = d
swift
// Distributed under the terms of the MIT license // Test case submitted to project by https://github.com/practicalswift (practicalswift) // Test case found by fuzzing { var b = {
swift
@testable import KarhooSDK final class MockCancelTripInteractor: CancelTripInteractor, MockInteractor { var callbackSet: CallbackClosure<KarhooVoid>? var cancelCalled = false var tripCancellationSet: TripCancellation? func set(tripCancellation: TripCancellation) { tripCancellationSet = tripCa...
swift
import Foundation final public class LibraryClass { public static func crashMeIfYouCan() {
swift
"Only BidirectionalIndexType can be advanced by a negative amount") var i = i for var offset: Index.Distance = 0; offset != n && i != limit; ++offset { _nextInPlace(&i) } return i } @warn_unused_result public func advance(i: Index, by n: Index.Distance) -> Index { return self._ad...
swift
// Save cache ImageCache.save(data, for: url) return Image(nsImage: remoteImage) } func data(_ urlString: String) -> Self { guard let url = URL(string: urlString), let data = try? Data(contentsOf: url), let remoteImage = NSImage(data: data) else { ...
swift
} } extension Data { public func toString() -> String? { return String(data: self, encoding: String.Encoding.utf8) } } extension NSRegularExpression { func isMatch(text : String) -> Bool {
swift
// TreeViewController.swift // funAndroidBySwift // // Created by 馋猫 on 2020/9/15. // Copyright © 2020 馋猫. All rights reserved. // import UIKit class TreeViewController: BaseViewController { }
swift
secondLayer.bounds = CGRect(x: 0, y: 0, width: 1, height: 80) secondLayer.position = CGPoint(x: clockImageView.bounds.width * 0.5, y: clockImageView.bounds.height * 0.5) secondLayer.anchorPoint = CGPoint(x: 0.5, y: 1) clockImageView.layer.addSublayer(secondLayer) } func addM...
swift
// // Created by Jacklandrin on 2021/12/9. // import SwiftUI import AlertToast struct RadioSettingView: View {
swift
// OPT-LABEL: sil shared @_T021objc_nonnull_lie_hack19loadUnownedPropertySo10NonNilTestCSgAD3obj_tFTf4g_n // OPT: [[GETTER:%[0-9]+]] = objc_method [[OBJ:%[0-9]+]] : $NonNilTest, #NonNilTest.unownedNonNilObjectProperty!getter.1.foreign : (NonNilTest) -> () -> NonNilTest, $@convention(objc_method) (NonNilTest) -> @autor...
swift
selectionStyle = .none // 正式项目中要离屏渲染 iconIMV.layer.cornerRadius = iconIMV.width * 0.5 iconIMV.layer.masksToBounds = true }
swift
drawPath.addLine(to: lastPoint) } // We are done drawing, so reset the last draw point. lastDrawPoint = nil } else { if lastDrawPoint == nil {
swift
lazy var stopSpotlightButton: UIButton = { let button = UIButton(frame: CGRect(x: 20, y: UIScreen.main.bounds.height - 160, width: UIScreen.main.bounds.width - 40, height: 40)) button.backgroundColor = .white button.setTitle("Stop Spotlight", for: .normal) bu...
swift
// CollectionReusableView.swift // DecorationSectionCollectionView // // Created by Victor Chee on 2017/4/18. // Copyright © 2017年 VictorChee. All rights reserved. // import UIKit class CollectionReusableView: UICollectionReusableView {
swift
// // CABitOperations.swift // DopplerDog // // Created by Rohit Gurnani on 01/04/17. // Copyright © 2017 Rohit Gurnani. All rights reserved. // import Foundation func CountLeadingZeroes(_ x: UInt32) -> UInt32 { var x = x
swift
// // Created by Anton Domashnev on 01.08.17. // Copyright © 2017 Anton Domashnev. All rights reserved. // import Foundation extension String { /// Shortcut for `trimmingCharacters(in: .whitespaces)` func stripping() -> String {
swift
// import Foundation import KommunicateCore_iOS_SDK @testable import Kommunicate class ConversationDetailMock: ConversationDetail { var groupId: NSNumber! override func updatedAssigneeDetails(groupId: NSNumber?, userId _: String?, completion: @escaping (ALContact?, ALChannel?) -> Void) { self.groupId...
swift
private func incrementStep() { firstStepperValue += 1 if firstStepperValue >= colors.count { firstStepperValue = 0 } } /// Decrement 1 step private func decrementStep() { firstStepperValue -= 1 if firstStepperValue < 0 { firstStepperValue = colors.count - 1 } }
swift
func applicationDidEnterBackground(_ application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application...
swift
radioLists.append(Channels(title: "央广 - 神州之声", url: URL(string: "http://ngcdn006.cnr.cn/live/szzs/index.m3u8")!, image: "神州之声")) radioLists.append(Channels(title: "央广 - 民族之声", url: URL(string: "http://ngcdn009.cnr.cn/live/mzzs/index.m3u8")!, image: "民族之声")) radioLists.append(Channels(title: "央广 ...
swift
} public func clear() { cache.removeAllObjects() } }
swift
// Copyright © 2018 Gilt. All rights reserved. // import Foundation import MERLin
swift
import SwiftUI struct CustomText: View { var text: String var body: some View { Text(text) }
swift
} @objc class SwiftDelegateViewController: UIViewController{ public weak var delegate:SwiftDelegateViewControllerDelegate? public var numberTest:NSNumber? override func viewDidLoad() { super.viewDidLoad()
swift
/// Returns the Authentication Token var tokenWithoutInsightsProperties: String { let headerBase64 = Data(header.utf8).base64EncodedString() let payloadBase64 = Data(payloadWithoutInsightsProperties.utf8).base64EncodedString() let signatureBase64 = Data("fake Signature".utf8).base64Enco...
swift
// Created by KimYoonBong on 2015. 6. 2.. // Copyright (c) 2015년 KimYoonBong. All rights reserved. // import UIKit class LNRemotePushViewController: UIViewController {
swift
rightButton.layer.borderColor = YMColor(230, g: 230, b: 230, a: 1.0).CGColor rightButton.layer.borderWidth = klineWidth return rightButton }() /// 底部红色条 private lazy var indicatorView: UIView = { let indicatorView = UIView() indicatorView.backgroundColor = YMGlob...
swift
override func awakeFromNib() { super.awakeFromNib() controls.append(button) controls.append(textField) }
swift
finalizable_text = String( format: NSLocalizedString( "= %@ %@", comment: "" ), moneroAmount.localized_formattedString, CcyConversionRates.Currency.XMR.symbol ) } let final_text = finalizable_text __setTextOnAmountUI( title: final_text, shouldHide_tooltipButton: ...
swift
/// } /// /// User: /// /// func myFun() { return 123 } // add linesbreaks before and after the return statement /// /// - Parameters: /// - userOffset: The current character offset within the user text. /// - user: The tokenized user whitespace buffer. /// - form: The tokenize...
swift
case comment(String) case illegal }
swift
func italic() -> UIFont { var symTraits = fontDescriptor.symbolicTraits symTraits.insert(.traitItalic) return self.buildFont(symTraits: symTraits) }