lang
stringclasses 10
values | seed
stringlengths 5
2.12k
|
---|---|
swift |
assertTransform(
statement: statement,
into: .compound([
.variableDeclaration(identifier: "a",
type: "A",
initialization: Expression.identifier("_a").typed("A"))
])
); assertNotifiedChange()
}
func testDontPromoteUninitializedConstants() {
let statement = Statement
.compound([
.variableDeclaration(identifier: "a", |
swift | import UIKit
final class LoginDataSource: FieldsDataSource {
// Model
var user: User?
private var fields: [FieldModel] = []
// Init |
swift | alertFetcher.alerts = [alert]
performNonMatchingTest(alertFetcher: alertFetcher, cleanUpUserDefaults: false)
}
|
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
let a=""
struct B{
struct B{
struct B<T where B:T{
class B<T where B:d |
swift |
import UIKit
import SnapKit
class DeviceTableViewCell: UITableViewCell { |
swift | import CoreGraphics
/// Methods for configuring trade, search and UI related behaviors in a context.
public protocol TweakContextDelegate: AnyObject {
// MARK: - Trade
/// Asks the delegate for the trade sources of the context during import.
///
/// If this method is not implemented, then the return value is assumed to be no sources.
///
/// - Parameters: |
swift | // ViewControllerExtension.swift
// Flicks
//
// Created by randy_zhao on 5/17/16.
// Copyright © 2016 randy_zhao. All rights reserved.
//
import Foundation
import UIKit
extension UIViewController {
public func hideKeyboardWhenTappedAround() {
let tap: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: "dismissKeyboard") |
swift |
import Foundation
struct UserLinkHeader {
let url: URL
let query: String
var page: Int
let lastPage: Int?
} |
swift | //
// SDRandomBinaryParametersModuleSDPRandomBinaryParametersModuleRouter.swift
// Swift-data-processor
//
// Created by Dmytro Platov on 10/10/2018.
// Copyright © 2018 Dmytro Platov. All rights reserved.
//
class SDPRandomBinaryParametersModuleRouter: SDPRandomBinaryParametersModuleRouterInput {
}
|
swift | case base64 = "base64"
case uri = "uri"
case DATA_URL = "dataUrl"
}
struct CameraSettings { |
swift | //
import Foundation
import CoreLocation
class LocationFetcher: NSObject, CLLocationManagerDelegate {
let manager = CLLocationManager()
var lastKnownLocation: CLLocationCoordinate2D? |
swift | import Foundation
public struct BytePushMediaRetrieve: WordPressRetrieve {
/// The blog URL with complete path to the appropriate endpoint.
public let wpEndpointURL: URL |
swift | //
import Foundation
public class JVViewControllerRef {
public var name:String
public var storyboard:String
public init(name:String, storyboard:String){
self.name = name
self.storyboard = storyboard
}
}
|
swift | let binary = message.elements[1] as! BertBinary
let datastring = NSString(data: binary.value as Data, encoding: String.Encoding.utf8.rawValue)
if datastring! as String == "channel_created" {
self.can_send = true
} else if datastring! as String == "typing" {
//
}
} |
swift | waitForTransition(of: .morningGoals, toIsVisible: false)
}
let goalsBar = group("goal right on border") {() -> XCUIElement in
setTimeUtc(h: 08, m: 00)
let ptn = wait(for: .ptn)
let goalsBar = findGoalsBar(within: ptn)
goalsBar.buttons["Add new goal"].click()
goalsBar.children(matching: .textField).element.typeText("goal 2\r")
return goalsBar
}
group("goal right after grace period") {
setTimeUtc(h: 08, m: 00, s: 01) |
swift | }
//照片修改情况
if let changedIndexes = collectionChanges.changedIndexes,
changedIndexes.count > 0{
weakSelf.photoType = .update
weakSelf.clouse?(weakSelf.photoType,nil,nil)
}
//照片新增情况 |
swift |
func makeUIView(context: Context) -> LPLinkView {
let view = LPLinkView(url: previewURL)
return view
}
func updateUIView(_ view: LPLinkView, context: Context) {
let provider = LPMetadataProvider() |
swift |
// MARK: - Public methods
func start() {
self.secretsSetupRecoveryKeyViewModel.coordinatorDelegate = self
}
|
swift | required convenience init?(data: Data?) {
guard let data = data else {return nil}
guard let json = (try? JSONSerialization.jsonObject(with: data, options: [])) as? [String: Any] else {return nil}
self.init(json: json)
}
init(links: Links, name: String, id: String, price_per_unit: Float) { |
swift |
struct Calc {
/// Flip rotation
static var flipRotation: CGFloat {
return .pi
}
/// to rad.
/// - Parameter f: degree
/// - Returns: postion
static func torad(_ f: CGFloat) -> CGFloat {
return f * .pi / 180.0
}
|
swift |
private final class MockScrollMetricsProvider: ScrollMetricsProvider {
// MARK: Internal
func size(for scrollAxis: ScrollAxis) -> CGFloat {
switch scrollAxis {
case .vertical: return contentSize.height
case .horizontal: return contentSize.width
}
}
func setSize(to size: CGFloat, for scrollAxis: ScrollAxis) { |
swift | import Foundation
public extension CIFilter {
@available(macOS 10.4, iOS 6, *)
@inlinable @objc static func SharpenLuminance() -> CIFilterFactory.CISharpenLuminance? {
return CIFilterFactory.CISharpenLuminance()
} |
swift | }
class LocationsViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, UISearchBarDelegate {
// TODO: Fill in actual CLIENT_ID and CLIENT_SECRET
let CLIENT_ID = "QA1L0Z0ZNA2QVEEDHFPQWK0I5F1DE3GPLSNW4BZEBGJXUCFL"
let CLIENT_SECRET = "W2AOE1TYC4MHK5SZYOUGX0J3LVRALMPB4CXT3ZH21ZCPUMCU"
@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var searchBar: UISearchBar!
weak var delegate: LocationsViewControllerDelegate!
|
swift | hud.hide(afterDelay: 0.333) { _ in completion?() }
}
static func failed(onView view: UIView, _ completion: (() -> ())? = nil) {
let hud = setup(view)
hud.contentView = PKHUDErrorView() |
swift | }
func update(taskID: String, title: String, memo: String?) -> Observable<Task> {
return self.fetchTasks()
.flatMap { [weak self] tasks -> Observable<Task> in
guard let `self` = self else { return .empty() }
guard let index = tasks.firstIndex(where: { $0.id == taskID }) else { return .empty() }
var tasks = tasks
let newTask = tasks[index].with {
$0.title = title
$0.memo = memo
} |
swift |
override func viewDidLoad() {
super.viewDidLoad()
API.provider.request(.Subscribe(.hotrank), completion: {result in
})
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning() |
swift | @objc optional func didTapInfoViewFor(actionID: String)
/**
Called when map is tapped
*/
@objc optional func didTapMapView()
/** |
swift |
private func getEventHandlers(forType type: TLAnalogJoystickEventType) -> TLAnalogJoystickEventHandlers {
return hadnlers[type] ?? TLAnalogJoystickEventHandlers()
}
private func runEvent(_ type: TLAnalogJoystickEventType) {
let handlers = getEventHandlers(forType: type)
handlers.forEach { _, handler in |
swift | model = changeset?.collection.sections[indexPath.section].metadata.header
}
guard let headerModel = model else {
return UICollectionReusableView()
} |
swift | import XCTest
#if !os(macOS)
public func allTests() -> [XCTestCaseEntry] {
return [
testCase(GumboTests.allTests),
]
}
#endif |
swift | for value in values {
ret.append(T(rawValue: value)!)
}
return ret as! A
}
var wrappedValue: A {
get { EnumArraySetting<A, T>.fromRawArray(getArchiveData(defaultValue, key: key)) }
set(newValue) { setArchiveData(EnumArraySetting<A, T>.toRawArray(newValue), key: key) }
}
}
|
swift | enum Segue: Hashable {
case home
case detail(PokemonModel)
}
private func create(_ segue: Segue) -> UIViewController {
switch segue {
case .home:
return PokedexViewController.create(with: self)
case .detail(let model):
return PokemonDetailViewController.create(with: self, model: model) |
swift | imgV3.image = tintcolr3
imgV3.tintColor = UIColor(netHex: COLORS.IGCOLOR.rawValue)
let image4 = UIImage(named: "ic_keyboard_arrow_right")
let tintcolor4 = image4?.withRenderingMode(.alwaysTemplate)
imgV4.image = tintcolor4
imgV4.tintColor = UIColor(netHex: COLORS.IGCOLOR.rawValue)
|
swift |
guard let item = result as? [String : Any],
let data = item[kSecValueData as String] as? Data,
let idString = item[kSecAttrAccount as String] as? String,
let id = UUID(uuidString: idString) else {
logger.error("No registration data in keychain")
return nil |
swift | // Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
|
swift | var window: UIWindow?
let vc = BaseVC()
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
window = UIWindow(frame: UIScreen.main.bounds)
window?.rootViewController = vc
window?.backgroundColor = .white
window?.makeKeyAndVisible()
return true
}
|
swift | // Copyright © 2018 CocoaPods. All rights reserved.
//
import UIKit
extension ViewController {
struct ViewModel: ViewControllerViewModel {
var title: String |
swift | static let xmlns = "xmlns"
static let show = "show"
static let status = "status"
static let utc = "utc"
static let value = "value"
static let field = "field"
static let start = "start"
static let varXMPP = "var"
static let query = "query"
static let queryId = "queryid" |
swift | return 110
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
{
var result: QuestionPreviewTableViewCell
if let cell = tableView.dequeueReusableCellWithIdentifier(CELL_IDENTIFIER_Question_Preview) as? QuestionPreviewTableViewCell {
result = cell
}
else {
result = QuestionPreviewTableViewCell()
} |
swift | failure.
*/
public enum Status: String {
case analyzed = "analyzed"
case beingProcessed = "being_processed"
case undetermined = "undetermined"
}
/**
The name of the corpus.
*/
public var name: String
/** |
swift | if let navController = navigationController as? NavigationController {
navController.setBackground(color: .clear)
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
|
swift | public static var image: UIImage? = Bundle.image("gallery_empty_view_image")
public static var textColor: UIColor = UIColor(red: 102/255, green: 118/255, blue: 138/255, alpha: 1)
}
public struct Permission {
public static var shouldCheckPermission = true
public static var image: UIImage? = Bundle.image("gallery_permission_view_camera")
public static var textColor: UIColor = UIColor(red: 102/255, green: 118/255, blue: 138/255, alpha: 1)
public struct Button {
public static var textColor: UIColor = UIColor.white
public static var highlightedTextColor: UIColor = UIColor.lightGray
public static var backgroundColor = UIColor(red: 40/255, green: 170/255, blue: 236/255, alpha: 1)
} |
swift | // Copyright (c) 2016 Damien (http://delba.io)
//
// 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
// 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 substantial portions of the Software. |
swift | targets: [
.target(
name: "CHIPageControl",
path: "CHIPageControl"
)
] |
swift | // license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import PackageDescription |
swift | // ListManager
//
// Created by Nikita Nikitsky on 03/27/2020.
// Copyright (c) 2020 Nikita Nikitsky. All rights reserved.
//
import UIKit
protocol TableManagerFactory {
func makeSingleSectionDataSource() -> UITableViewDataSource?
func makeMultipleSectionDataSource() -> UITableViewDataSource?
func makeMultipleSectionDelegate() -> UITableViewDelegate?
}
|
swift | // MARK: - PREVIEW
struct DetailView_BasicListWithNavigationView_Previews: PreviewProvider {
static var previews: some View {
DetailView_BasicListWithNavigationView(discipline: "")
}
} |
swift | // iAPICaller
//
// Created by Mantas Paškevičius on 2020-08-08.
// Copyright © 2020 Mantas Paškevičius. All rights reserved.
// |
swift |
import Foundation
import UIKit
public struct BaulettoSettings {
/// Icon that goes at the left of the text.
public var icon: UIImage?
/// Text that goes at the right of the image.
public var title: String?
/// Tint color for icon and title.
public var tintColor: UIColor!
|
swift | humidity: unitHumidity,
pressure: unitPressure,
acceleration: acceleration,
voltage: unitVoltage,
movementCounter: nil,
measurementSequenceNumber: nil,
txPower: nil)
} |
swift | }
}
static func getCities(completion: @escaping (([City]?) -> Void)) {
DispatchQueue.global(qos: .default).async {
let url = Bundle.main.url(forResource: "city.list", withExtension: ".json")
if let url = url { |
swift | self.path = path
}
// MARK: - Builder functions
@discardableResult
public func addHeader(name: String, value: String) -> RequestBuilder {
self.headers[name, default: []].append(value)
return self
}
@discardableResult
public func removeHeaders(name: String) -> RequestBuilder { |
swift | /*** timer for billfield ***/
// let settings = UserDefaults.standard
// stopTime = settings.object(forKey: stopTimeKey) as? Date
// if let time = stopTime {
// if time > Date() {
// billAmount = settings.integer(forKey: billAmountKey)
// } else {
// billAmount = 0
// }
// }
// stopTimer() |
swift | tokenViewHeight = height
self.view.setNeedsLayout()
}
public func tokenInputView(view: CLTokenInputView, didRemoveToken token: CLToken) {
for i in 0..<selected.count {
let n = selected[i]
if (n.token == token) {
selected.removeAtIndex(i) |
swift | }
func testThreeElementSequence() {
let pairs = (0...).prefix(3).adjacentPairs()
XCTAssertEqualSequences(pairs, [(0, 1), (1, 2)], by: ==)
}
func testManySequences() {
for n in 4...100 {
let pairs = (0...).prefix(n).adjacentPairs()
XCTAssertEqualSequences(pairs, zip(0..., 1...).prefix(n - 1), by: ==)
}
}
|
swift | @IBInspectable dynamic public var highlightedColor: UIColor? {
willSet { setImageColor(newValue, forState: .Highlighted) }
}
/// Color applied to the button's background image for highlighted control state. By default normalBackgroundColor is used.
@IBInspectable dynamic public var highlightedBackgroundColor: UIColor? {
willSet { setBackgroundImageColor(newValue, forState: .Highlighted) }
}
/// Color applied to the button's image for selected control state. If not set then normalColor is used.
@IBInspectable dynamic public var selectedColor: UIColor? {
willSet { setImageColor(newValue, forState: .Selected) }
}
/// Color applied to the button's background image for selected control state. By default normalBackgroundColor is used.
@IBInspectable dynamic public var selectedBackroundColor: UIColor? {
willSet { setBackgroundImageColor(newValue, forState: .Selected) }
} |
swift | /// The URL resource cache, or nil to indicate that no caching is to be performed
let urlCache: URLCache?
/// Enable extended background idle mode for any tcp sockets created.
let shouldUseExtendedBackgroundIdleMode: Bool
let protocolClasses: [AnyClass]?
}
}
internal extension URLSession._Configuration { |
swift | //: ## Episode 07: Optionals
|
swift |
public struct EmbossedText {
public static func emboss(_ text: String, font: UIFont, color: UIColor, texture: UIImage, useHeightMap: Bool) -> UIImage? {
let styled = StyledString().pushFont(font).pushColor(color).pushString(text)
return emboss(styled.attributedString, texture: texture, useHeightMap: useHeightMap)
}
public static func emboss(_ text: NSAttributedString, texture: UIImage, useHeightMap: Bool) -> UIImage? {
let image = UIImage
.image(from: text)?
.applyEmboss(shadingImage: texture, useHeightMap: useHeightMap) |
swift | let bodyView = UIView()
let scrollView = UIScrollView()
let imageView: UIImageView = {
let imageView = UIImageView()
imageView.image = Images.titleLogo.image
return imageView
}()
let titleLabel: UILabel = {
let label = UILabel() |
swift |
extension feature_cpacket { //60
var size: Int {
get {
return 88 |
swift | Copyright (c) 2021 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 Swift project authors |
swift | return .init(repeat: `repeat`, sections: sections)
}
}
class RepeatManualViewModelStub: RepeatManualViewModelMock {
override var sections: [RepeatManualSectionViewModel] {
get {
return [
.init(cells: [.repetition(RepeatModelData(cases: RepeatModelData.Model.allCases, selected: RepeatModelData.Model.allCases.first!))]),
.init(cells: [.daysOfWeek(RepeatDaysOfWeekData(days: Calendar.current.shortWeekdaySymbols, selected: []))]),
.init(cells: [.endDate(RepeatEndDateData(dateTitle: "", dateSubtitle: "", date: Date.now))]),
]
} |
swift | }
struct Keys {
static let ObjectId = UdacityParseClient.ResultsKeys.ObjectId
static let UniqueKey = UdacityParseClient.ResultsKeys.UniqueKey
static let FirstName = UdacityParseClient.ResultsKeys.FirstName
static let LastName = UdacityParseClient.ResultsKeys.LastName |
swift | required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
// MARK: - User interactions
@objc func dismissDialog(_ sender: UITapGestureRecognizer) {
guard sender.state == .ended else { return }
let tappedAtPoint = sender.location(in: view)
if !containerView.frame.contains(tappedAtPoint) { |
swift | //
// TranslateUseCase.swift
// TranslateBar
//
// Created by Artem Bobrov on 28/10/2018.
// Copyright © 2018 Artem Bobrov. All rights reserved.
// |
swift |
self.hideKeyboardWhenTappedOutside()
let recoveryView = RecoveryView(recoveryURL: recoveryURL, for: self)
view.addSubview(recoveryView)
recoveryView.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
recoveryView.centerXAnchor.constraint(equalTo: view.centerXAnchor),
recoveryView.centerYAnchor.constraint(equalTo: view.centerYAnchor),
]) |
swift | /**
The main object for registering for events from the SDK, starting and stopping their delivery.
It also provides some useful functions for performance configuration and data conversion.
Lifecycle of VisionManager :
1. `create` |
swift | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
XCUIApplication().launch()
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() {
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results. |
swift | static let left: CGFloat = 10
static let right: CGFloat = 10
}
}
let profile: UIImageView = {
let imageView = UIImageView()
imageView.image = UIImage(named: "contactPlaceholder", in: Bundle.applozic, compatibleWith: nil)
imageView.layer.cornerRadius = 20
imageView.clipsToBounds = true
return imageView
}()
let nameLabel: UILabel = {
let label = UILabel() |
swift | import XCTest
@testable import WebSocketServerTests
XCTMain([
testCase(WebSocketServerTests.allTests),
])
|
swift | struct iconfiles {
static public var policyDict = [String:[String:String]]()
static var pendingDict = [String:String]()
}
struct wipeData {
static var on = false
}
struct History {
static var logPath: String? = (NSHomeDirectory() + "/Library/Logs/jamf-migrator/")
static var logFile = "" |
swift | if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) {
// This measures how long it takes to launch your application.
measure(metrics: [XCTApplicationLaunchMetric()]) {
XCUIApplication().launch()
}
}
}
}
|
swift | // self.navigator.toUsers()
case .login:
self.navigator.toLogin()
}
})
.sink()
.store(in: cancelBag) |
swift |
let x = CGFloat(i) * (self.size.width / CGFloat(self.springs.count))
let y = self.size.height + spring.height
path.addLineToPoint(CGPoint(x: x, y: y))
}
path.addLineToPoint(CGPoint(x: self.size.width, y: 0))
}
path.closePath()
return path.CGPath
}
} |
swift | import UIKit
class DashViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
} |
swift | //
// ParametersEncoding.swift
// MovieApp
//
// Created by Igor Gomes Arantes on 17/04/19.
// Copyright © 2019 Igor Gomes Arantes. All rights reserved.
//
import Foundation
class ParameterEncoding {
static func encode(_ parameters: HTTPParameters, request: inout URLRequest) throws { |
swift | /**
* Copyright Soramitsu Co., Ltd. All Rights Reserved.
* SPDX-License-Identifier: Apache 2.0
*/
import XCTest
@testable import SoraPassport
import RobinHood
class BearerTokenRequestModifierTests: XCTestCase {
func testHeaderSuccessfullySet() {
do {
// given
let token = UUID().uuidString |
swift | //
// Albums.swift
// PostFeed
//
// Created by Ridoan Wibisono on 30/07/21.
//
import Foundation
struct Albums : Codable, Hashable {
var userId : Int
var id : Int
var title : String |
swift | .map { n in
return n as? Element
}
}
}
#endif
|
swift | /// Errors that can occur when unsubscribing from a topic on the broker.
public enum MQTTUnsubscribeError: Error {
/// One or more of the topic filters to unsubscribe from are invalid.
case invalidTopic
}
|
swift | // Created by Alexander Cyon on 2018-10-07.
// Copyright © 2018 Open Zesame. All rights reserved.
//
import CryptoSwift |
swift | //
import WatchKit
import Foundation
class InterfaceController: WKInterfaceController {
@IBOutlet var skInterface: WKInterfaceSKScene!
override func awake(withContext context: Any?) {
super.awake(withContext: context)
let scene = GameScene.newGameScene()
|
swift | self.id = id
self.label = label
self.pageCount = pageCount
self.offerCount = offerCount
self.runDateRange = runDateRange
self.aspectRatio = aspectRatio
self.branding = branding
self.frontPageImages = frontPageImages
self.isAvailableInAllStores = isAvailableInAllStores
self.dealerId = dealerId
self.storeId = storeId
self.incitoId = incitoId
self.types = types |
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
|
swift | self,
selector: #selector(self.playerItemDidReachEnd),
name: NSNotification.Name.AVPlayerItemDidPlayToEndTime,
object: videoPlayer.currentItem)
let videoLayer = AVPlayerLayer(player: videoPlayer)
videoLayer.frame = self.view.bounds
videoLayer.videoGravity = AVLayerVideoGravity.resizeAspect
self.imageView.layer.addSublayer(videoLayer) |
swift | // several lines of glyphs
var effectiveRange = NSMakeRange(0, 0)
// Range of current "line of glyphs". If a line is wrapped,
// then it will have more than one "line of glyphs"
let lineRect = layoutManager.lineFragmentRect(forGlyphAt: glyphIndexForGlyphLine, effectiveRange: &effectiveRange, withoutAdditionalLayout: true) |
swift | Text(move?.name?.capitalized ?? "")
.font(.title3)
.fontWeight(.light)
Spacer()
Image(move?.type?.name?.capitalized ?? "")
.resizable()
.scaledToFit()
.frame(width: 40, height: 40)
.cornerRadius(40/2)
}
.padding(.horizontal, 20)
} |
swift | //
import Foundation
import CoreML
class Classifier {
let model = SpamMessageClassifier()
var idf = [Double]()
var vocabulary = [String:Int]() |
swift | //
// Created by Ashish Awasthi on 06/02/20.
// Copyright © 2020 Ashish Awasthi. All rights reserved.
//
import XCTest
class ViperUITests: XCTestCase {
|
swift | // EmptyBuilder.swift
// RTFView
//
// Created by Marco Seidel on 21.04.20.
// Copyright © 2020 Hanako. All rights reserved.
//
import Foundation
import UIKit
public struct EmptyComponent: Component { |
swift | }
func testExtractingUserTrackingMode() throws {
guard #available(iOS 14.0, tvOS 14.0, macOS 11.0, watchOS 7.0, *) else { return }
let region = MKCoordinateRegion() |
swift | self._class = _class
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case _self = "self"
case _class
}
// Encodable protocol methods
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(_self, forKey: ._self)
try container.encodeIfPresent(_class, forKey: ._class) |
swift |
guard let query = jsonDictionary["query"] as? JSONDictionary else {
DispatchQueue.main.async {
// There is no query but also no error message if nothing is found.
completion (nil, .notFound)
}
return
}
guard let pages = query["pages"] as? [JSONDictionary] else { |
swift | guard current.hashValue == raw else { return nil }
raw += 1
return current
}
} |
swift | //
// Created by Huai-Che Lu on 3/5/16.
// Copyright © 2016 Huai-Che Lu. All rights reserved.
//
import Foundation
extension CGPoint {
func distanceToPoint(point: CGPoint) -> CGFloat {
let dx = self.x - point.x
let dy = self.y - point.y |
swift | // Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
public struct ServerConfigCustomServicesTwitter: Codable {
public var username: String?
public var whitelisted: Bool?
public init(username: String? = nil, whitelisted: Bool? = nil) { |
swift |
class UChapterCHead: UBaseCollectionReusableView {
var buttonAction: sortButtonAction!
private lazy var chapterLabel: UILabel = {
let label = UILabel()
label.textColor = .gray
label.font = .systemFont(ofSize: 13)
return label
}()
private lazy var sortButton: UIButton = {
let btn = UIButton() |
swift | }
struct B<T : a : b( )
b D ( x array c
"
func a {
var = c: Int = x( c
:
var
protocol b < >
e: : a {
protocol A {
" |
swift | case textGroup = "t"
}
private enum TextCodingKeys : String, CodingKey {
case text = "d"
case animators = "a"
}
required init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: TextLayerModel.CodingKeys.self)
let textContainer = try container.nestedContainer(keyedBy: TextCodingKeys.self, forKey: .textGroup)
self.text = try textContainer.decode(KeyframeGroup<TextDocument>.self, forKey: .text)
self.animators = try textContainer.decode([TextAnimator].self, forKey: .animators) |
Subsets and Splits