lang
stringclasses 10
values | seed
stringlengths 5
2.12k
|
---|---|
swift | // UIImage+OEXHelpers.swift
// edX
//
// Created by Michael Katz on 10/14/15.
// Copyright © 2015 edX. All rights reserved.
//
import Foundation
|
swift | // Created by LWindy on 08/30/2019.
// Copyright (c) 2019 LWindy. All rights reserved.
//
import UIKit
import BOTestTools
class ViewController: UIViewController {
@IBOutlet weak var btn: UIButton!
|
swift | if let tweetDict = tweetDict as? NSDictionary {
let tweet: Tweet = Tweet(dictionary: tweetDict)
success(tweet)
}
else {
let errDict = ["localizedDescription": "Can not convert Any? to NSDictionary"]
let error = NSError(domain: "com.bluoma.TwitterClient", code: -605, userInfo: errDict)
failure(error)
}
}, failure: { (task: URLSessionDataTask?, error: Error) -> Void in
//dlog("err faving tweet originalRequest: \(task?.originalRequest?.allHTTPHeaderFields)")
//if let postBody = task?.originalRequest?.httpBody {
// let bodyStr = String(data: postBody, encoding: .utf8) |
swift | // Hint
//
// Created by Christopher Smith on 1/8/17.
// Copyright © 2017 Chris Smith. All rights reserved.
//
import Cocoa
class LinkButton: NSButton {
|
swift | //
// Copyright 2018-2020 Amazon.com,
// Inc. or its affiliates. All Rights Reserved.
//
// SPDX-License-Identifier: Apache-2.0 |
swift | guard exists else {
throw FileError.fileNotReadable(file: name)
}
guard size > 0 else {
if expectedTotalBytes > 0 {
throw FileError.fileNotReadable(file: name)
} |
swift | // This source file is part of the Swift.org open source project
// Copyright (c) 2014 - 2017 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 |
swift | }
internal func createLinePath() -> UIBezierPath {
// Can't really do anything without the delegate.
guard let owner = owner,
let delegate = owner.graphViewDrawingDelegate
else { return currentLinePath }
currentLinePath.removeAllPoints()
|
swift | @inline(never)
public func testObjCGenericParamChange(_ a: GenericClass<NSMutableString>) -> GenericClass<NSString> {
return a as! GenericClass<NSString>
}
// CHECK-LABEL: sil [noinline] @$s26cast_folding_objc_generics34testObjCGenericParamChangeSubclassySo07GenericJ0CySo8NSStringCGSo0K5ClassCySo15NSMutableStringCGF : $@convention(thin) (@guaranteed GenericClass<NSMutableString>) -> @owned GenericSubclass<NSString> {
// CHECK: unconditional_checked_cast
// CHECK-NOT: int_trap
// CHECK: } // end sil function '$s26cast_folding_objc_generics34testObjCGenericParamChangeSubclassySo07GenericJ0CySo8NSStringCGSo0K5ClassCySo15NSMutableStringCGF'
@inline(never) |
swift |
let invalid = Validator.validate(input: "p@ssword", rule: rule)
XCTAssertFalse(invalid.isValid)
}
func test_validate_staticNumber_valid() {
let rule = ValidationRuleEquality<Double>(target: 1.0, error: "💣")
let valid = Validator.validate(input: 1.0, rule: rule)
XCTAssertTrue(valid.isValid)
} |
swift | //
import Foundation
import UIKit
class SelectTableViewCell: UITableViewCell {
@IBOutlet weak var itemNameLabel: UILabel!
@IBOutlet weak var itemDateLabel: UILabel!
@IBOutlet weak var itemSelectSwitch: UISwitch!
} |
swift | // 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
// limitations under the License.
//
import WebKit
private let kVMDefaultResizeCmd = "stty cols $COLS rows $ROWS\\n"
|
swift | }
override func prepareForReuse() {
super.prepareForReuse()
imageView.image = nil
}
}
|
swift | .tag(1)
SupportView()
.tabItem {
NavLabel(item: NavItem.support)
}
.tag(2)
InfoView()
.tabItem {
NavLabel(item: NavItem.info) |
swift |
self.profileResult = ""
// Delay execution of my block for 1 seconds.
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + Double(Int64(1) * Int64(NSEC_PER_SEC)) / Double(NSEC_PER_SEC), execute: {
self.profileResult.append("AAC:")
self.doLoadAAC()
})
// Delay execution of my block for 5 seconds.
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + Double(Int64(5) * Int64(NSEC_PER_SEC)) / Double(NSEC_PER_SEC), execute: {
self.profileResult.append(" MP3:")
self.doLoadMP3()
}) |
swift | /// - Parameters:
/// - dataSource: Data source for data loading.
/// - customErrorHandler: Custom error handler for state update. Pass nil for default error handling.
/// - emptyResultChecker: Empty result checker closure.
public init(dataSource: DataSourceType,
customErrorHandler: ErrorHandler? = nil,
emptyResultChecker: @escaping EmptyResultChecker) {
self.emptyResultChecker = emptyResultChecker
super.init(dataSource: dataSource, customErrorHandler: customErrorHandler)
}
|
swift |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
Parse.initialize(with: ParseClientConfiguration(block: { (configuration: ParseMutableClientConfiguration) in
configuration.applicationId = "CodePath-Parse"
configuration.server = "http://45.79.67.127:1337/parse"
}))
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. |
swift |
Circle()
.trim(from: 1 - progress, to: 1)
.stroke(
LinearGradient(
gradient: Gradient(colors: gradient),
startPoint: .leading, endPoint: .trailing),
style: StrokeStyle(lineWidth: lineWidth, lineCap: .round)
)
.rotationEffect(Angle(degrees: 90))
.rotation3DEffect(Angle(degrees: 180),
axis: (x: 1, y: 0, z: 0))
.frame(width: size, height: size) |
swift | /// Customer’s state. String up to 32 characters.
public var state: String?
/// Create the optional payer options data holder.
/// - Parameters:
/// - middleName: Customer’s middle name. String up to 32 characters.
/// - birthdate: Customer’s birthday. Format: yyyy-MM-dd, e.g. 1970-02-17.
/// - address2: The adjoining road or locality of the сustomer’s address. String up to 255 characters.
/// - state: Customer’s state. String up to 32 characters.
public init(middleName: String? = nil, birthdate: Date? = nil, address2: String? = nil, state: String? = nil) { |
swift | case let .structLiteral(s):
return s.freeTypeVariables
case let .switch(s):
return s.freeTypeVariables
}
}
}
extension Expr: TypeSubstitutable where A == TypeAnnotation {
func apply(_ sub: TypeSubstitution) -> Expr<TypeAnnotation> {
.init(payload: payload.apply(sub), annotation: annotation.apply(sub))
}
|
swift | }
end(nil,false)
}
if method == .GET{
get(url, parameters: paragram, progress: nil, success: successd, failure: failure)
}else{
post(url, parameters: paragram, progress: nil, success: successd, failure: failure)
}
} |
swift | // ContentView.swift
// HotProspects
//
// Created by Matej Novotný on 15/11/2020.
//
import SamplePackage
import UserNotifications |
swift | {
buttonLike.setImage(
#imageLiteral(resourceName: "assetGenericLikeOn").withRenderingMode(UIImageRenderingMode.alwaysOriginal),
for:UIControlState.normal)
buttonLike.setImage(
#imageLiteral(resourceName: "assetGenericLikeOn").withRenderingMode(UIImageRenderingMode.alwaysTemplate),
for:UIControlState.highlighted)
} |
swift | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
public struct CDYelpSearchResponse: Decodable {
public let total: Int? |
swift | // Created by 田风有 on 2021/5/10.
//
import UIKit
public extension TFY where Base: UIPickerView {
@discardableResult
func dataSource(_ dataSource: UIPickerViewDataSource?) -> TFY {
base.dataSource = dataSource
return self
}
@discardableResult |
swift | static let cellId = "SearcHotCell"
var titleLab: UILabel = {
let lan = UILabel()
lan.font = UIFont.systemFont(ofSize: 12)
lan.textAlignment = .center
lan.textColor = UIColor.darkGray
//
// lan.layer.cornerRadius = 15
// lan.layer.borderColor = UIColor.lightGray.cgColor
// lan.layer.masksToBounds = true |
swift | if (code == 1000) {
let data = response["data"] as! [[String: Any]]
self.pathFront = data[0]["path"] as? String ?? ""
self.pathBack = data[1]["path"] as? String ?? ""
self.uploadAvatar()
} else {
PayME.currentVC?.dismiss(animated: false)
self.toastMess(title: "error".localize(), message: response["data"]!["message"] as? String ?? "Something went wrong")
}
}, onError: { error in
PayME.currentVC?.dismiss(animated: false)
self.toastMess(title: "error".localize(), message: (error["message"] as? String) ?? "Something went wrong")
})
} |
swift | // Created by Kevin Pham on 12/27/18.
// Copyright © 2018 Kevin Pham. All rights reserved.
//
import XCTest
@testable import tippy_kp
class tippy_kpTests: XCTestCase {
override func setUp() {
// Put setup code here. This method is called before the invocation of each test method in the class. |
swift | expect(emptyArray.arrayByAppending()).to(equal(emptyArray))
expect(emptyArray.arrayByAppending([])).to(equal(emptyArray))
expect(nonEmptyArray.arrayByAppending()).to(equal(nonEmptyArray))
expect(nonEmptyArray.arrayByAppending([])).to(equal(nonEmptyArray))
}
describe("arrayByAppending can append one element") {
expect(emptyArray.arrayByAppending("testko")).to(equal(["testko"]))
expect(emptyArray.arrayByAppending(["testko"])).to(equal(["testko"]))
expect(nonEmptyArray.arrayByAppending(5)).to(equal([1, 2, 3, 4, 5]))
expect(nonEmptyArray.arrayByAppending([5])).to(equal([1, 2, 3, 4, 5]))
} |
swift |
self.btnPlaceCall.isEnabled = true
self.btnPickCall.isEnabled = true
self.btnEndCall.isEnabled = true
// let handle = "9314291678"
// let incoming = true
// let videoEnabled = false
//
// if incoming {
// let backgroundTaskIdentifier = UIApplication.shared.beginBackgroundTask(expirationHandler: nil)
// DispatchQueue.main.asyncAfter(wallDeadline: DispatchWallTime.now() + 1.5) {
// AppDelegate.shared.displayIncomingCall(uuid: UUID(), handle: handle, hasVideo: videoEnabled) { _ in |
swift | return .init(
maxResults: self.maxResults,
nextToken: token
)
}
}
extension ACMPCA.ListPermissionsRequest: AWSPaginateStringToken { |
swift | ///
/// - Complexity: O(1)
@warn_unused_result
public func distanceTo(end: BTreeIndex) -> Int {
state.expectRoot(end.state.root)
return end.state.offset - state.offset
}
}
/// Return true iff `a` is equal to `b`.
@warn_unused_result |
swift | // PropertyTableViewCell.swift
// PropertyFinder
//
// Created by Apokrupto on 25/10/2017.
// Copyright © 2017 Apokrupto. All rights reserved.
//
import UIKit
class PropertyTableViewCell: UITableViewCell {
@IBOutlet var title: UILabel!
@IBOutlet var subtitle: UILabel!
@IBOutlet var amenities: UILabel!
@IBOutlet var price: UILabel! |
swift | let task = networkService.search(query: "h") { (data, error) in
// Make sure we downloaded some data.
XCTAssertNotNil(data, "No data was downloaded. \(error!)")
// Fulfill the expectation to indicate that the background task has finished successfully.
expectation.fulfill()
}
XCTAssertNotNil(task, "task should not be nil")
wait(for: [expectation], timeout: 4.0) |
swift | self.presenter.presentLoadingState()
}
if (searchTerm.trimmingCharacters(in: .whitespacesAndNewlines) != "") {
updateSearchHistory(searchTerm: searchTerm)
}
imageLoader!.loadImages(searchTerm: searchTerm,
pageNumber: lastFetchedPageNumber+1,
successCallback: { imageDataArray in
if (self.lastFetchedPageNumber == 0) {
self.currentImageDataArray = imageDataArray
} else {
self.currentImageDataArray.append(contentsOf: imageDataArray)
} |
swift | initialSpringVelocity: 0.5,
options: UIView.AnimationOptions.allowUserInteraction,
animations: {
self.imageTutorialHand.alpha = alpha
}, completion: handler)
}
private func animateHandMove(offset: CGFloat, delay: TimeInterval, duration: TimeInterval, handler: ((Bool)->Void)?) {
let transform = imageTutorialHand.transform.translatedBy(x: 0.0, y: -offset)
UIView.animate(withDuration: duration,
delay: delay, |
swift | extension Check {
// MARK: - Methods
/// Checks that the parameter value is greater than the minimum value.
///
/// - Parameters:
/// - value: The parameter value.
/// - min: The minimum.
/// - message: The identifying message for the `CheckError` (`nil` okay). The default is an empty string. |
swift | }
}
func findStaticTextByString(_ staticText: String) -> XCUIElement {
let foundElement = XCUIApplication().staticTexts[staticText]
return foundElement
}
|
swift |
override class var runsForEachTargetApplicationUIConfiguration: Bool {
true
}
override func setUpWithError() throws {
continueAfterFailure = false
}
func testLaunch() throws {
let app = XCUIApplication()
app.launch()
|
swift |
import UIKit
@testable import AIADemo
class IntradayViewModelMock: IntradayViewModel {
var is_routeToDashboard_Called = false
var is_sortIDChange_Called = false
var getValueText:String?
override func routeToDashboard() {
is_routeToDashboard_Called = true
}
override func sortIDChange(index: Int) { |
swift | // AccountHeaderView.swift
// ravenwallet
//
// Created by Adrian Corscadden on 2016-11-16.
// Copyright © 2018 Ravenwallet Team. All rights reserved.
//
import UIKit
class AddressBookHeaderView : NormalHeaderView { |
swift | //
// Created by Aditya Dhingra on 2/27/17.
// Copyright © 2017 Aditya Dhingra. All rights reserved.
//
import UIKit
class TweetCell: UITableViewCell { |
swift | ExpandableCell2.ID,//
ExpandableSelectableCell2.ID,//
NormalCell.ID//
],
[ExpandableCell2.ID,//
NormalCell.ID,//
ExpandableCell2.ID,//
ExpandableInitiallyExpanded.ID// |
swift | /// Adds `plugin` to the list of Plugins that implement functionality for this category.
///
/// - Parameter plugin: The Plugin to add
public func add(plugin: DataStoreCategoryPlugin) throws {
let key = plugin.key
guard !key.isEmpty else {
let pluginDescription = String(describing: plugin)
let error = DataStoreError.configuration("Plugin \(pluginDescription) has an empty `key`.",
"Set the `key` property for \(String(describing: plugin))")
throw error
}
guard !isConfigured else {
let pluginDescription = String(describing: plugin) |
swift | // PRODUCTNAME
//
// Created by LEADDEVELOPER on 3/27/17.
// Copyright © 2017 ORGANIZATION. All rights reserved.
//
import Foundation
extension UserDefaults {
private enum Keys: String {
case hasOnboarded
}
static var hasOnboarded: Bool { |
swift | // Copyright © 2016年 kyo__hei. All rights reserved.
//
import Foundation
public extension QiitaAPI.Tag {
/// タグを取得します
///
/// https://qiita.com/api/v2/docs#get-apiv2tagstag_id
public struct GetTagRequest: QiitaRequest {
|
swift | }
}
}
struct CalendarWrapperView_Previews: PreviewProvider { |
swift | }
dictionary["name"] = currentString
if let candidateStreetLineOne = self.candidateStreetLineOne {
currentString = candidateStreetLineOne
} else {
currentString = ""
}
dictionary["streetLineOne"] = currentString |
swift | /*
This source file is part of the Swift.org open source project
Copyright (c) 2021 Apple Inc. and the Swift project authors
Licensed under Apache License v2.0 with Runtime Library Exception
See http://swift.org/LICENSE.txt for license information
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
*/
/// Provides information about the target being built, as well as contextual
/// information such as the paths of the directories to which commands should
/// be configured to write their outputs. This information should be used as
/// part of generating the commands to be run during the build.
public final class TargetBuildContext: Decodable { |
swift |
// 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 tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() throws {
// UI tests must launch the application that they test.
let app = XCUIApplication()
app.launch() |
swift |
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) |
swift | // BrowserKit
//
// Created by tramp on 2021/1/27.
//
import Foundation
import UIKit
extension CGSize: CompatibleValue {}
extension CompatibleWrapper where Base == CGSize {
/// inset by
/// - Parameter insets: UIEdgeInsets
/// - Returns: CGSize
internal func inset(by insets: UIEdgeInsets) -> CGSize { |
swift | assertionFailure("J'ai pas trouvé de cell qui allait")
return UITableViewCell()
}
let thisDermatologist = collectionOfDermatologists[indexPath.row]
cell.nameLabel?.text = thisDermatologist.name |
swift | //
// Created by Adonis_HongYang on 2019/12/23.
// Copyright © 2019 Adam. All rights reserved.
//
import SwiftUI
struct SettingRootView: View { |
swift | @testable import TuistGraph
public extension Workspace {
static func test(
path: AbsolutePath = AbsolutePath("/"),
xcWorkspacePath: AbsolutePath = AbsolutePath("/"),
name: String = "test",
projects: [AbsolutePath] = [],
schemes: [Scheme] = [],
additionalFiles: [FileElement] = []
) -> Workspace {
Workspace( |
swift | with: ParseClientConfiguration(block: { (configuration: ParseMutableClientConfiguration) -> Void in
configuration.applicationId = "account-sharer"
configuration.clientKey = "myMasterKey" // set to nil assuming you have not set clientKey
configuration.server = "https://account-sharer.herokuapp.com/parse"
})
)
if PFUser.current() != nil {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
// view controller currently being set in Storyboard as default will be overridden
let homeTimelineViewController = storyboard.instantiateViewController(withIdentifier: "tabController")
window?.rootViewController = homeTimelineViewController |
swift | //
// Created by Red Davis on 02/08/2018.
// Copyright © 2018 Red Davis. All rights reserved.
//
import XCTest
@testable import Changelly |
swift | private let userDefaults = UserDefaults.standard
func addArrayData(data: Data, key: String) {
guard var persisted = self.arrayDataByKey(key: key) else {
return userDefaults.set([data], forKey: key)
}
persisted.append(data)
userDefaults.set(persisted, forKey: key) |
swift | makeTransaction()
}
@IBAction func retryButton(_ sender: UIButton) {
// Hide Failed View and show Step 1 View
transit(from: failedView, to: step1View)
}
@IBAction func goBack(_ sender: UIButton) { |
swift | return Data()
}
// MARK: - Private properties
private var parameters: [String: Any]? {
switch self {
case .search(let query):
return ["count": "10", "q": query, "t": "images", "offset": "1", "uiv": "4"]
}
}
}
|
swift | // CleanArchitecture
//
// Created by Alberto on 23/12/2018.
// Copyright © 2018 Alberto. All rights reserved.
//
import Foundation
struct CurrentWeatherViewModel {
let city: String
let description: String
let temperature: String |
swift |
class NLNetworkTests: XCTestCase {
let expectation = XCTestExpectation(description: "should not hit any assert.")
func testAppleStoreApi() {
let request: AppleStoreAppInfo = AppleStoreAppInfo(identifier: "", country: "")
let url: URL = request.url
let data: Data = DataResource.getDataFromBundleFile(name: "mockResult", type: "json")
let response: HTTPURLResponse = .init(url: url,
mimeType: nil,
expectedContentLength: 1024,
textEncodingName: nil)
|
swift |
func execute(in store: Store) {
_ = LoadPokemonRequest.all
.sink(
receiveCompletion: { complete in
if case .failure(let error) = complete {
store.dispatch(
.loadPokemonsDone(result: .failure(error))
) |
swift | import Foundation
import CoreLocation
let summaryEndpoint = "https://api.openweathermap.org/data/2.5/weather"
let forecastEndpoint = "https://api.openweathermap.org/data/2.5/forecast"
func composeUrlRequest(endpoint: String, from location: CLLocation) -> URLRequest {
let urlStr = "\(endpoint)?lat=\(location.coordinate.latitude)&lon=\(location.coordinate.longitude)&appid=\(apiKey)&lang=kr&units=metric"
let url = URL(string: urlStr)! |
swift | // EZSwiftExtensions
//
// Created by Lucas Farah on 23/02/16.
// Copyright (c) 2016 Lucas Farah. All rights reserved.
//
import UIKit
extension UIAlertController {
/// EZSE: Easy way to present UIAlertController
func show() {
UIApplication.shared.keyWindow?.rootViewController?.present(self, animated: true, completion: nil)
} |
swift | calendarKitEvent.text = title
if let cgColor = cgColor {
calendarKitEvent.backgroundColor = UIColor(cgColor: cgColor)
}
|
swift | //
import UIKit
class TokenDetailHeaderCosmosCell: UITableViewCell {
@IBOutlet weak var totalAmount: UILabel!
@IBOutlet weak var totalValue: UILabel!
@IBOutlet weak var availableAmount: UILabel!
@IBOutlet weak var delegatedAmount: UILabel!
@IBOutlet weak var unbondingAmount: UILabel!
@IBOutlet weak var rewardAmount: UILabel!
override func awakeFromNib() {
super.awakeFromNib() |
swift | id = venue!["id"] as? String ?? "No Id"
description = categories![0]["name"] as? String ?? "No description"
IconURLprefix = icon!["prefix"] as? String ?? "No IconURLprefix"
IconURL = IconURLprefix + IconURLsuffix
// for address
let location = venue!["location"] as? [String: Any]
let address = location!["address"] as? String ?? "No address"
let city = location!["city"] as? String ?? "No city"
let state = location!["state"] as? String ?? "No state"
let country = location!["country"] as? String ?? "No country"
let postalCode = location!["postalCode"] as? String ?? "No postalCode" |
swift | if let height = self.intrinsicContentHeight {
return CGSize(width: UIView.noIntrinsicMetric, height: height)
} else {
return CGSize.zero
}
}
open var visualMode: VisualMode = .light
@objc public func load(markdown: String?, enableImage: Bool = true) {
guard let markdown = markdown else { return }
|
swift | let defaultGroupIndex = groupControl.selectedSegmentIndex
let defaults = NSUserDefaults.standardUserDefaults()
defaults.setInteger(defaultGroupIndex, forKey: "defaultGroupIndex")
defaults.synchronize()
|
swift |
print(#function)
}
//-------------------------------------------------------------------------------------------------------------------------------------------
@IBAction func actionDone(_ sender: Any) {
print(#function)
}
// MARK: - Refresh methods
//-------------------------------------------------------------------------------------------------------------------------------------------
func refreshTableView() {
tableView.reloadData() |
swift | return (chunk as? DataChunk)?.pushedData
}
public func execute(with context: ScriptExecutionContext) throws {
for chunk in chunks {
if let opChunk = chunk as? OpcodeChunk {
try opChunk.opCode.execute(context)
} else if let dataChunk = chunk as? DataChunk {
if context.shouldExecute {
try context.pushToStack(dataChunk.pushedData)
}
} else {
throw ScriptMachineError.error("Unknown chunk")
}
} |
swift | //
//
import Foundation
class MovieDetailsPresenter {
// MARK: - VIPER Stack
weak var view: MovieDetailsPresenterToViewProtocol!
var interactor: MovieDetailsPresenterToInteractorProtocol!
var wireframe: MovieDetailsPresenterToWireframeProtocol!
// MARK: - Instance Variables
weak var delegate: MovieDetailsDelegate?
var movie: MovieModel! |
swift | }()
lazy var currentTimeLabel: UILabel = {
return LabelBuilder()
.setText("--:--:--")
.setFont(.systemFont(ofSize: 17, weight: .regular))
.setTextColor(.darkGray)
.setTextAlignment(.left)
.build()
}()
lazy var durationTimeLabel: UILabel = {
return LabelBuilder()
.setText("--:--:--")
.setFont(.systemFont(ofSize: 17, weight: .regular)) |
swift | @available(iOS 10.0, *)
public class SwiftLocalNotificationCategory {
/// Holds the actions you want available for this category type
private var actions = [UNNotificationAction]()
/// Hold the actual cateogry
internal var categoryInstance: UNNotificationCategory?
/// Holds the identifier of the category type
var identifier: String
public init (categoryIdentifier: String, actions: [UNNotificationAction]) {
identifier = categoryIdentifier
self.actions = actions
} |
swift | // ZKSwift
//
// Created by lizhikai on 16/7/9.
// Copyright © 2016年 ZK. All rights reserved.
//
import UIKit
import XLProgressHUD |
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
deinit {
init( ) {
var f = {
class
case ,
|
swift | addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(tap(gesture:))))
}
override func layoutSubviews() {
super.layoutSubviews()
updateView()
}
|
swift |
y += 30.0
bm = bm.getParent()!
title = Title(f1, "Let's see ...", x, y).setOffset(offset)
bm.addBookmark(page, title).autoNumber(title.prefix!)
title.drawOn(page)
y += 30.0 |
swift | pickerView?.delegate = self
dataSource?.pickerDelegate = self
}
}
|
swift | */
/**
* ## 线程
* 一个独立的代码执行路径,是代码执行路径的最小分支
*/
/**
* ## 任务
* 一个代码块
*/
/** |
swift | import ADNavigationBarExtension
class Tests: XCTestCase {
override func setUp() {
super.setUp() |
swift |
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
|
swift | // Use XCTAssert and related functions to verify your tests produce the correct
// results.
// Some of the APIs that we use below are available in macOS 10.13 and above.
guard #available(macOS 10.13, *) else {
return
}
let fooBinary = productsDirectory.appendingPathComponent("framekit-gen")
let process = Process()
process.executableURL = fooBinary
let pipe = Pipe()
process.standardOutput = pipe |
swift | // Stripe
//
// Created by Andrew Edwards on 7/11/17.
//
//
// https://stripe.com/docs/api#dispute_object-reason
public enum DisputeReason: String, Codable {
case duplicate
case fraudulent
case subscriptionCanceled = "subscription_canceled"
case productUnacceptable = "product_unacceptable"
case productNotReceived = "product_not_received"
case unrecognized |
swift | acls.contains(acl) else {
return substructureOffsets
}
if dictionary.docLength != nil {
return substructureOffsets
}
return substructureOffsets + [(offset, acl)]
}
} |
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 controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
}
|
swift | let locality = placemark.locality,
let subLocality = placemark.subLocality else {
return print("oops it looks like your placemark could not be computed")
}
print("name: \(name)")
print("isoCountryCode: \(isoCountryCode)")
print("country: \(country)") |
swift | //
// 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 | var orderedContacts: [String: [CNContact]] = [String: [CNContact]]()
CNContact.localizedString(forKey: CNLabelPhoneNumberiPhone)
fetchRequest.mutableObjects = false
fetchRequest.unifyResults = true
fetchRequest.sortOrder = .givenName
do {
try contactStore.enumerateContacts(with: fetchRequest, usingBlock: { (contact, _) -> Void in
// Ordering contacts based on alphabets in firstname
var key: String = "#"
// If ordering has to be happening via family name change it here.
let firstLetter = contact.givenName.count > 0 ? contact.givenName[0] : " "//contact.givenName[0..<1]
if firstLetter.containsAlphabets {
key = firstLetter.uppercased()
}
var contacts = [CNContact]() |
swift | import Foundation
public struct DebugOptions: OptionSet {
public let rawValue: Int
|
swift | // WebView Example
//
// Created by Domenico Solazzo on 06/05/15.
// License MIT
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
}
|
swift |
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad() |
swift | //
// AppDelegate.swift
// gratti
//
// Created by Singh, Jagdeep on 9/25/16.
// Copyright © 2016 Singh, Jagdeep. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate { |
swift | open func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
guard let fromVC = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.from),
let toVC = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to)
else { return }
let containerView = transitionContext.containerView
if forwardTransition {
containerView.addSubview(toVC.view) |
swift | //
import Foundation
import RxSwift
extension HTTPService { |
swift | class SampleComposerObj: NSObject, DeepARDelegate {
private let deepAR: DeepAR = DeepAR.init()
// private let openGLContext: NSOpenGLContext = NSOpenGLContext()
private let CVPixelBufferCreateOptions: [String: Any] = [
kCVPixelBufferCGImageCompatibilityKey as String: true, |
swift | //
// CheckButtonTableViewCell.swift
// Yelp
//
// Created by Dylan Miller on 10/23/16.
// Copyright © 2016 Dylan Miller. All rights reserved.
//
import UIKit
|
swift | // Created by B_Litwin on 9/28/18.
// Copyright © 2018 Ryan Nystrom. All rights reserved.
//
import UIKit |
swift | /// - `[HeroAndFriendsNames.Data.Hero.Friend]`
/// - `FriendsAppearsIn`
/// - `[FriendsAppearsIn.Friend]`
///
/// These values then get passed into a generated `GraphQLMappable` initializer, and this is how type safe results get built up.
///
final class GraphQLExecutor { |