lang
stringclasses
10 values
seed
stringlengths
5
2.12k
swift
let path: AbsolutePath /// Dictionary whose keys are the target names and the value the Xcode targets. let targets: [String: PBXNativeTarget] /// Project name with the .xcodeproj extension. let name: String /// Initializes the GeneratedProject with its attributes. ///
swift
#elseif os(macOS) && targetEnvironment(macCatalyst) || os(iOS) || os(tvOS) import UIKit #endif // Exposed #if os(macOS) && !targetEnvironment(macCatalyst) /// public typealias NKButton = AppKit.NSButton #elseif os(macOS) && targetEnvironment(macCatalyst) || os(iOS) || os(tvOS) /// public typealias NKButton = UIKit.UIButton
swift
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // RUN: not %target-swift-frontend %s -typecheck func i<n.j: B? { class b class func f: Int = n for b {
swift
} return articleFactory?.getSpec(code: code, period: period, version: version) } func getConceptSpec(code: ConceptCode, period: IPeriod, version: VersionCode) -> ConceptSpec? { if (conceptFactory == nil) { return nil } return conceptFactory?.getSpec(code: code, period: period, version: version) } func buildArticleFactory() -> Bool { return false } func buildConceptFactory() -> Bool { return false
swift
// RUN: %target-swift-frontend -parse -verify %s -disable-objc-interop var x: Any = 1 var y = x as AnyObject // expected-error{{not convertible}}
swift
protocol ComposibleController: UIViewController { associatedtype State: Equatable associatedtype Action: Equatable typealias MainStore = Store<State, Action> typealias MainViewStore = ViewStore<State, Action> var cancellables: Set<AnyCancellable> { get set } var store: MainStore { get } var viewStore: MainViewStore { get }
swift
// // Created by nuc_mac on 2019/9/5. // Copyright © 2019 nuc_mac. All rights reserved. // import Cocoa
swift
// Pursuit-Core-iOS-Unit2Final // // Created by Aaron Cabreja on 11/30/18. // Copyright © 2018 Alex Paul. All rights reserved. // import UIKit class CrayonCell: UITableViewCell {
swift
// StepCalculator.swift // RangeUISlider // // Created by Fabrizio Duroni on 29.12.20. // 2020 Fabrizio Duroni. // import Foundation import UIKit
swift
input: input, command: listServiceTemplates, inputKey: \ListServiceTemplatesInput.nextToken, outputKey: \ListServiceTemplatesOutput.nextToken, logger: logger, on: eventLoop ) } /// List services with summaries of detail data. /// Return PaginatorSequence for operation. /// /// - Parameters:
swift
return String(format: "%d bpm", maxHeartRate) } var formattedAverageHeartRate: String { return String(format: "%d bpm", averageHeartRate) }
swift
* you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and
swift
internal static func getSystemSources(for entity: MIDIEntityRef) -> [OutputEndpoint] { let srcCount = MIDIEntityGetNumberOfSources(entity) var endpoints: [OutputEndpoint] = [] endpoints.reserveCapacity(srcCount) for i in 0..<srcCount { let endpoint = MIDIEntityGetSource(entity, i) endpoints.append(.init(endpoint))
swift
import Foundation import GameplayKit class SlingshotComponent: GKComponent { var restPos: SIMD3<Float> var currentPos: SIMD3<Float> var vel: SIMD3<Float> var physicsMode: Bool
swift
} case .Version(let version): let versionRange = VersionRange() for ver in version { try versionRange.combine(ver) } let versions = fetchVersions(pkg)
swift
category.text = HangmanBrain.chosenCategory label.text = "" print(randomWord) } @IBAction func restart(_ sender: Any) { restartGame() } } extension SinglePlayerViewController: UITextFieldDelegate { func textFieldShouldReturn(_ textField: UITextField) -> Bool { textField.resignFirstResponder()
swift
let queueSwitch = UISwitch() queueSwitch.onTintColor = .darkBlue queueSwitch.isOn = ToastManager.shared.isQueueEnabled queueSwitch.addTarget(self, action: #selector(ViewController.handleQueueToggled), for: .valueChanged) cell?.accessoryView = queueSwitch cell?.selectionStyle = .none cell?.textLabel?.font = UIFont.systemFont(ofSize: 16.0) }
swift
let name: String let imageURL: URL? let isFavorite: Bool
swift
extension CDArticle { @nonobjc public class func fetchRequest() -> NSFetchRequest<CDArticle> { return NSFetchRequest<CDArticle>(entityName: "CDArticle") } @NSManaged public var author: String @NSManaged public var id: UUID @NSManaged public var imageUrl: String @NSManaged public var subtitle: String
swift
import Foundation import azureSwiftRuntime public protocol WebAppsListHostNameBindings { var nextLink: String? { get } var hasAdditionalPages : Bool { get } var headerParameters: [String: String] { get set } var resourceGroupName : String { get set } var name : String { get set }
swift
frozenColumns: Int = 0, frozenRows: Int = 0, frozenColumnWidth: CGFloat = 0, frozenRowHeight: CGFloat = 0, columnWidth: CGFloat = 0, rowHeight: CGFloat = 0, columnWidthCache: [CGFloat] = [], rowHeightCache: [CGFloat] = [], mergedCells: [CellRange] = [], mergedCellLayouts: [Location: CellRange] = [:]) { self.numberOfColumns = numberOfColumns self.numberOfRows = numberOfRows self.frozenColumns = frozenColumns self.frozenRows = frozenRows self.frozenColumnWidth = frozenColumnWidth self.frozenRowHeight = frozenRowHeight
swift
} try self.executeMission([circle]) } public func returnHome() throws { print ("drone returning home")
swift
// // HostingController.swift // NeumorphicWallet // // Created by Roman Churkin on 25.05.2020. // Copyright © 2020 Redmadrobot. All rights reserved. //
swift
import AppKit import PlaygroundSupport let view = MyView.init() PlaygroundPage.current.liveView = view
swift
class MovieCell: UITableViewCell { @IBOutlet weak var titleLabel: UILabel! @IBOutlet weak var overviewLabel: UILabel! @IBOutlet weak var posterView: UIImageView! override func awakeFromNib() { super.awakeFromNib() // Initialization code }
swift
ENTITY: different_number_of_geometric_elements, TYPE: a3m_equivalence_assessment_by_logical_test ENTITY: missing_face, TYPE: a3m_equivalence_assessment_by_logical_test ENTITY: mismatch_of_points, TYPE: a3m_equivalence_assessment_by_numerical_test ENTITY: missing_component, TYPE: a3m_equivalence_assessment_by_logical_test ENTITY: different_placement_of_component, TYPE: a3m_equivalence_assessment_by_numerical_test
swift
// // Created by Joseph Neuman on 8/4/14. // Copyright (c) 2014 Joseph Neuman. All rights reserved. // import UIKit import XCTest class SwimgurTests: XCTestCase { }
swift
switch self { case .none: handler() case .some: break } return self } }
swift
return CVAutomobile().intrinsicContentSize.height } @IBAction func push(_ sender: Any) { } //MARK:- UI Business override var intrinsicContentSize: CGSize { return CGSize(width: 0, height: 150) }
swift
import Foundation extension Date { static func fromISOString(_ string: String) -> Date? { let dateFormatter = DateFormatter() dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssX" return dateFormatter.date(from: string) } }
swift
} } enum NowPlayingWidgetStyle: String, Codable { case `default`, playPause, onlyInfo } extension Defaults.Keys { static let hideControlStrip = Defaults.Key<Bool>("hideControlStrip", default: true) static let enableAutomaticUpdates = Defaults.Key<Bool>("enableAutomaticUpdates", default: false) /// Dock widget static let notificationBadgeRefreshInterval = Defaults.Key<NotificationBadgeRefreshRateKeys>("notificationBadgeRefreshInterval", default: .tenSeconds) static let appExposeSettings = Defaults.Key<AppExposeSettings>("appExposeSettings", default: .ifNeeded) static let itemSpacing = Defaults.Key<Int>("itemSpacing", default: 8) static let hideFinder = Defaults.Key<Bool>("hideFinder", default: false)
swift
} } else { parameters.updateValue("", forKey: key) } }
swift
} } public extension CircularScrollingConfigurationBuilder where T: CircularScrolling.Both.RowHeaderStartsFirstColumn { var rowHeaderNotRepeated: CircularScrollingConfigurationBuilder<CircularScrolling.Both.RowHeaderStartsFirstColumn.RowHeaderNotRepeated> { return CircularScrollingConfigurationBuilder<CircularScrolling.Both.RowHeaderStartsFirstColumn.RowHeaderNotRepeated>() } } public extension CircularScrollingConfigurationBuilder where T: CircularScrolling.Both.ColumnHeaderStartsFirstRow { var columnHeaderNotRepeated: CircularScrollingConfigurationBuilder<CircularScrolling.Both.ColumnHeaderStartsFirstRow.ColumnHeaderNotRepeated> {
swift
} } public func Unmap() throws { return try perform(as: WinSDK.IDXGISurface.self) { pThis in try CHECKED(pThis.pointee.lpVtbl.pointee.Unmap(pThis)) } } }
swift
return standalone_generic } // CHECK-LABEL: sil hidden @_TF9functions20return_generic_tuple{{.*}} func return_generic_tuple() -> (x: (Builtin.Int64, Builtin.Int64), y: (Builtin.Int64, Builtin.Int64)) -> (Builtin.Int64, Builtin.Int64) { // CHECK: [[GEN:%.*]] = function_ref @_TF9functions18standalone_generic{{.*}} : $@convention(thin) <τ_0_0> (@out τ_0_0, @in τ_0_0, @in τ_0_0) -> () // CHECK: [[SPEC:%.*]] = partial_apply [[GEN]]<(Builtin.Int64, Builtin.Int64)>()
swift
withClone(tree) { node in var path = Path(startOf: node) path.forEachSlot(ascending: false) { slot in XCTAssertEqual(slot, 0) } path.forEachSlot(ascending: true) { slot in XCTAssertEqual(slot, 0) } return path.finish() } }
swift
//3 when is code runs, the data task is completed. We need to remove this task from the dictionary defer {self.remove(uuid)} //4 if let data = data, let image = UIImage(data: data) { self.setLoadedImage(image, for: url)
swift
case accountDoesNotExist case invalidPath case invalidKey case invalidAddress case malformedKeystore case networkFailure case conversionFailure case notEnoughBalance case contractFailure case unexpectedResult }
swift
cell.fieldNameLabel.text = fieldName cell.infoLabel.text = info return cell
swift
import Foundation import CoreData public class Stock: NSManagedObject { }
swift
case .status404: return 404 case .status500: return 500
swift
let key = JSONCodingKeys(stringValue: key)! switch value { case let value as Bool: try encode(value, forKey: key) case let value as Int: try encode(value, forKey: key) case let value as String: try encode(value, forKey: key)
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. // Use this method to select a configuration to create the new scene with. return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) } func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
swift
detailImagesContainer.isHidden = false } private func populateTitle(with product: Product) { titleLabel.text = product.title } private func populateDescription(with product: Product) { descriptionLabel.text = product.productDescription }
swift
This function reads the output probabilities from sftImage to CPU, sorts them and gets the label of top 5 probabilities - Returns: A string with top-5 valid labels ready to be put in predictLabel */ func getResults() -> [(String, Float)] { // gather measurements of MPSImage to use to get out probabilities let width = sftImage.width let height = sftImage.height let numSlices = (sftImage.featureChannels + 3)/4; let count = sftImage.texture.width*sftImage.texture.height*sftImage.featureChannels
swift
public func save(_ object: Any) throws -> Data { guard let typedObject = object as? Set<Date> else { throw AmberError.wrongTypes(self.types, AmberBase.types(of: object)) } let encoder = JSONEncoder() return try encoder.encode(typedObject) } public func load(_ data: Data) throws -> Any { let decoder = JSONDecoder()
swift
// // CoreColumnLayoutAware.swift // CoreResolve // // Created by David Mitchell // Copyright © 2019 The App Studio LLC. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at //
swift
if let ltv = lottieView as? LOTAnimationView { return ltv } } return LOTAnimationView() } set(newVal) { for lottieView in self.subviews {
swift
} extension CommentListCell { static var reuseId: String {
swift
.frame(minWidth: 200, maxHeight: .infinity) DetailView(item: selectedItem?.representedObject) .frame(maxHeight: .infinity) } } }
swift
// Put teardown code here. This method is called after the invocation of each test method in the class. super.tearDown() } func testExample() {
swift
override public init(){ super.init() self.name = "ColorPacking" } override public func applyFilter() { addCommandWithoutFactor() }
swift
// // import SwiftUI struct BreedRow: View { @Environment(\.colorScheme) var colorScheme let breed: DisplayBreed var body: some View { VStack(alignment: .leading, spacing: 8) {
swift
* * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */
swift
// SR-13933: Fix "multiple consuming users" ownership error caused by // `VJPCloner::visitApply` related to `@differentiable`-function-typed callees. import _Differentiation protocol P: Differentiable { associatedtype Assoc: Differentiable }
swift
import FMDB // Repository + Code extension Repository { public enum SuccessCode { case `default`(Database) case rowId(Database, Int) case count(Database, Int) case object(Database, Repository.Table.Item?) case list(Database, [Repository.Table.Item]) case update(Database) case insert(Database) case delete(Database)
swift
} // MARK: - Core Data stack lazy var persistentContainer: NSPersistentContainer = { let container = NSPersistentContainer(name: "LoginDemo") container.loadPersistentStores(completionHandler: { (storeDescription, error) in if let error = error as NSError? { fatalError("Unresolved error \(error), \(error.userInfo)") } }) return container }()
swift
// String.swift // Adventurist // // Created by Touseef Sarwar on 23/09/2020. // Copyright © 2020 Touseef Sarwar. All rights reserved. // import Foundation extension String { func capitalizingFirstLetter() -> String { return prefix(1).capitalized + dropFirst()
swift
return button }() override func layoutSubviews() { super.layoutSubviews() contentView.backgroundColor = UIColor.white let bounds = contentView.bounds let divide = bounds.divided(atDistance: 100, from: .maxXEdge) label.frame = divide.slice.insetBy(dx: 15, dy: 0) button.frame = divide.remainder } func onButton(_ button: UIButton) {
swift
var body: some View { ZStack { Rectangle() .foregroundColor(isFiltered ? category.color.opacity(0.3) : category.color) Text(category.rawValue.localized).fontWeight(.bold).foregroundStyle(.white) .padding(.vertical, 5).lineLimit(1) } .onTapGesture { isFiltered.toggle() HapticUtil.generateFeedback(style: .soft) } .cornerRadius(5) } }
swift
// DerivableAccounts.swift // p2p_wallet // // Created by Chung Tran on 24/09/2021. //
swift
} XCTAssertEqual(self.documentId1, document.id , "Wrong documentId read from updated document") print(">> Successfully updated the JSON document.") self.delay(self.confirmUpdate) }) }
swift
public func go() throws { throw AXError(0) }
swift
func updatedTransactions(_ transactions: [SKPaymentTransaction]) { transactions.forEach { transaction in switch transaction.transactionState { case .restored: SKPaymentQueue.default().finishTransaction(transaction) default: break } } self.products = transactions.map { $0.payment.productIdentifier } } func restoreFinished() {
swift
import Foundation struct Revision: Codable { let items: [Int] let nextHref: String? enum CodingKeys: String, CodingKey { case items case nextHref = "_links.next.href" }
swift
return detailRootController } } // MARK: - internal func loadDetailRootController() { // Should load the first viewController that will be shown by this tab assert(false, "should be implemented by subclasses") } // MARK: - Tab Management func tabShown() { }
swift
@objc func allFundsSelected() { switch transactionType { case .nativeCryptocurrency: guard let ethCost = allFundsFormattedValues else { return } isAllFunds = true amountTextField.set(ethCost: ethCost.allFundsFullValue, shortEthCost: ethCost.allFundsShortValue, useFormatting: false) case .ERC20Token: guard let ethCost = allFundsFormattedValues else { return } isAllFunds = true
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 supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } func applicationWillEnterForeground(_ application: UIApplication) { // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. } 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. }
swift
} extension Commands.JobCollections { // ListByResourceGroup gets all job collections under specified resource group. internal class ListByResourceGroupCommand : BaseCommand, JobCollectionsListByResourceGroup { var nextLink: String? public var hasAdditionalPages : Bool { get { return nextLink != nil } }
swift
var router: SearchUserRouterProtocol? { get set } } public protocol SearchUserBuilderProtocol { func build() -> SearchUserModuleInterface } // In/Out public protocol SearchUserInputProtocol { func start(with query: String)
swift
public func hasMagicDefaultArgs(_ f: String = #file, _ fu: String = #function, _ l: Int = #line) {} // CHECK: func hasSimpleDefaultArgs(_ x: Swift.Int = 0, b: Swift.Int = 1) public func hasSimpleDefaultArgs(_ x: Int = 0, b: Int = 1) { } // rdar://83202870 (SR-15181): Make sure we can extract the textual representation here.
swift
* All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ public extension FBSnapshotTestCase { public func FBSnapshotVerifyView(view: UIView, identifier: String = "", suffixes: NSOrderedSet = FBSnapshotTestCaseDefaultSuffixes(), tolerance: CGFloat = 0, file: StaticString = #file, line: UInt = #line) { FBSnapshotVerifyViewOrLayer(view, identifier: identifier, suffixes: suffixes, tolerance: tolerance, file: file, line: line) } public func FBSnapshotVerifyLayer(layer: CALayer, identifier: String = "", suffixes: NSOrderedSet = FBSnapshotTestCaseDefaultSuffixes(), tolerance: CGFloat = 0, file: StaticString = #file, line: UInt = #line) { FBSnapshotVerifyViewOrLayer(layer, identifier: identifier, suffixes: suffixes, tolerance: tolerance, file: file, line: line)
swift
override var intrinsicContentSize: CGSize { CGSize( width: UIView.noIntrinsicMetric, height: 48.0 ) } private func setupLayout() { let baseView = UIView()
swift
} return self } ///Verifies if this Screen is presented @discardableResult public func screenExists() -> Self { XCTContext.runActivity(named: "Check if this Screen Exists") { _ in guard let trait = trait() else { XCTFail(); return } self.test.wait(element: trait, by: testTimeout) { (error) in XCTAssertNil(error, "Timeout!") } XCTAssert(trait.exists, "Not Exist trait: '\(trait)'") } return self
swift
} extension ViewController: NSTextViewDelegate { func textView(_ textView: NSTextView, doCommandBy commandSelector: Selector) -> Bool { if commandSelector == #selector(insertNewline(_:)) { runScript()
swift
// This is an example of a functional test case. // Use XCTAssert and related functions to verify your tests produce the correct results. } func testPerformanceExample() throws { // This is an example of a performance test case. self.measure { // Put the code you want to measure the time of here. } } }
swift
// import UIKit class MenuItemCell: UITableViewCell { @IBOutlet weak var menuItemName: UILabel! override func awakeFromNib() { super.awakeFromNib() // Initialization code
swift
// // Created by Erdem Özgür on 29.10.2020. // import UIKit
swift
// // Published.swift // ColourViewer // // Created by Michael Salmon on 2019-08-09. // Copyright © 2019 mesme. All rights reserved. // import Foundation import Combine /// Generic wrapper for publishing data class Published<T> { var publisher = PassthroughSubject<T, Never>()
swift
// // SwiftHSVColorPickerExampleTests.swift // SwiftHSVColorPickerExampleTests // // Created by Johan Kasperi on 2015-09-06. // Copyright (c) 2015 kspri. All rights reserved. // import UIKit import XCTest
swift
let d = (s as NSString).doubleValue self.field.newValue = NSNumber(value: d) } notifyUpdate() } override func setEditableField(editable: EditHelperProtocol) { super.setEditableField(editable: editable) self.labelName.text = editable.name self.labelValue.text = String(describing:editable.value()) }
swift
- parameter maskField : The mask field for which editing ended. */ func maskFieldDidEndEditing(_ maskField: AKMaskField) /** Tells the delegate that specified mask field change text with event. - parameter maskField : The mask field for which event changed.
swift
@testable import CalciferUpdater public class FileDownloaderStub: FileDownloader { let onDownloadFile: (URL) -> (Result<URL, Error>) public init(onDownloadFile: @escaping (URL) -> (Result<URL, Error>)) { self.onDownloadFile = onDownloadFile } public func downloadFile( url: URL, completion: @escaping (Result<URL, Error>) -> ()) {
swift
.frame(width: 70, height: 70, alignment: .center) .clipShape(Circle()) .overlay(Circle().stroke(Color.white, lineWidth: 5)) if stargazer.isLoadingImage { ActivityIndicator(isAnimating: .constant(true), color: .constant(UIColor.gray), style: .medium) .frame(alignment: .center) } } .padding(.leading, 20)
swift
if path.count == k { res.append(path) return } var path = path if max + 1 > n { return }
swift
callback(cell as! MasterFeedTableViewCell, node) } } private func accountForNode(_ node: Node) -> Account? { if let account = node.representedObject as? Account { return account } if let folder = node.representedObject as? Folder {
swift
// Keyboard Switch Notifier // // Created by Jiří Palas on 03.07.17. // Copyright © 2017 Jiří Palas. All rights reserved. // import Foundation class PreferenceManager { // Single instance static let instance = PreferenceManager() private init() { registerFactoryDefaults()
swift
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // import Foundation class LocationIncomingWithPaginationTitleBubbleCell: LocationIncomingBubbleCell { override func setupViews() { super.setupViews() roomCellContentView?.showPaginationTitle = true }
swift
// 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: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. // Saves changes in the application's managed object context before the application terminates. self.saveContext() } // MARK: - Core Data stack
swift
} var url: URL? { switch self { case .url(let url): return url default: return nil } } var imageData: Data? { switch self { case .imageData(let data): return data default: return nil } }
swift
// Created by Ben Scheirman on 8/18/21. // import XCTest @testable import Models class ModelsTests: XCTestCase { override func setUpWithError() throws { // Put setup code here. This method is called before the invocation of each test method in the class. }
swift
for the `.Debug` severity. */ public static let DebugColor = Color(r: 0x66, g: 0x66, b: 0x66) /** A blue `Color` (`#0000CC`) used as the foreground color for the `.Info` severity. */ public static let InfoColor = Color(r: 0x00, g: 0x00, b: 0xCC) /** An orange `Color` (`#DD7722`) used as the foreground color for the `.Warning` severity. */ public static let WarningColor = Color(r: 0xDD, g: 0x77, b: 0x22)
swift
super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } /* // 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 controller using segue.destinationViewController. // Pass the selected object to the new view controller. } */
swift
} } var activityIndicator:UIActivityIndicatorView! override func viewDidLoad() { BBSListProvider.loadClasses() super.viewDidLoad() self.initHeaderView() self.footView.hidden = true tableView.tableFooterView = UIView() activityIndicator = UIActivityIndicatorView(activityIndicatorStyle: .Gray) activityIndicator.center = CGPoint(x: tableView.frame.width/2, y: tableView.frame.height/2) self.tableView.addSubview(activityIndicator) BBSListProvider.loadTopicData(BBSListProvider.ClassIds[currentSelectPedia], page: currentPage) {
swift
init(_ dictionary: NSDictionary?) { self.height = dictionary?["height"] as? String if let rawMyCdps = dictionary?["result"] as? Array<NSDictionary> { self.result = Array<MyCdp>() for rawMyCdp in rawMyCdps { self.result?.append(MyCdp.init(rawMyCdp)) }
swift
import UIKit public extension Bool { func pr_toInt() -> Int { return self ? 1 : 0 } func pr_toString() -> String { return self ? "true" : "false" }
swift
} func testExample() { // This is an example of a functional test case. XCTAssert(true, "Pass") } func testPerformanceExample() { // This is an example of a performance test case. self.measure() { // Put the code you want to measure the time of here. } }
swift
self.path.addLine(to: CGPoint(x: self.bounds.width - glyphMargin, y: self.bounds.height / 2)) self.path.addLine(to: CGPoint(x: self.bounds.width - glyphHeight, y: self.bounds.height / 2 + glyphWidth / 2)) self.path.lineWidth = 2 UIColor(hex: 0xFFFFFF, alpha: 0.6).setStroke() self.path.stroke()
swift
public func mark(_ rootSet: ObjectPool<TrackedObject>) { // Increment cycle counter self.cycles += 1 // Compute next tag self.tag = self.tag &+ 1 // Mark all root objects
swift
let channel = FlutterMethodChannel(name: CHANNEL_NAME, binaryMessenger: binaryMessenger) let instance = SwiftAudioplayersPlugin(registrar: registrar, channel: channel) registrar.addMethodCallDelegate(instance, channel: channel) } @objc func needStop() { isDealloc = true destroy()