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)")
}
({intensity = 1.0})() |
swift |
Button(action: {
self.viewRouter.currentPage = "orders"
}){
VStack{
Image("Order_black")
.resizable()
.frame(width: 30, height: 28.42)
.foregroundColor(.black) |
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.leadingAnchor).isActive = true
mdView.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true
mdView.bottomAnchor.constraint(equalTo: bottomLayoutGuide.topAnchor).isActive = true
let path = Bundle.main.path(forResource: "sample", ofType: "md")!
let url = URL(fileURLWithPath: path)
let markdown = try! String(contentsOf: url, encoding: String.Encoding.utf8) |
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 `rhs` is non-`nil`.
/// - Remark: effectively `lhs = (rhs ?? lhs) ?? nil` _(skipping same-value assignments)_
public func =??<Wrapped>(lhs:inout Wrapped?, rhsClosure:@autoclosure ()throws->Wrapped?) rethrows { |
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, withOtherMonth: false)
self.configureViews()
}
override init(frame: CGRect) { |
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
}
try await group.addUser(id: userId)
command.message.reply(key: "addgroup.success", fromCommand: command, map: [ |
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.heightAnchor.constraint(equalTo: logoImageView.widthAnchor),
welcomeTitle.heightAnchor.constraint(equalToConstant: 50),
welcomeTitle.bottomAnchor.constraint(equalTo: startMessaging.topAnchor, constant: -10),
startMessaging.centerXAnchor.constraint(equalTo: centerXAnchor),
welcomeTitle.centerXAnchor.constraint(equalTo: centerXAnchor) |
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 self.arfDataManager.intString(textField.text!) > self.points {
let label = "Points exceed total allowable points!"
HUD.flash(.label(label), onView: nil, delay: 3.5, completion: { (success) in
textField.becomeFirstResponder()
})
}
} |
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.encode(string)
}
public static func == (lhs: DateTime, rhs: DateTime) -> Bool {
return lhs.date == rhs.date
}
public static func < (lhs: DateTime, rhs: DateTime) -> Bool {
return lhs.date < rhs.date |
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
try AudioKit.start()
player.play() |
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)
UNUserNotificationCenter.current().delegate = self |
swift | guard assessment.isEnabled else { return }
self.viewModel.selectedAssessment =
.init(session: session.window, assessment: assessment.assessment)
self.viewModel.isPresentingAssessment = true
}
.transition(.exitStageLeft)
.animation(.easeOut(duration: 1))
}
}
@ViewBuilder |
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", value: adaptedValue)], body: nil)
case .ingredient: |
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.isUserNativeNavBar = true
webVC.showShareItem = true
self.navigationController?.pushViewController(webVC, animated: true)
}
}
|
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("ShowSomewhereScene", sender: nil) |
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()
self.type = .user
self.username = username |
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 parts = path.map { token -> String in
if token.isEther { |
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) == scaledSize)
}
func testCenterPointInLargerSize() {
let size = CGSize(width: 10, height: 20)
let largerSize = CGSize(width: 50, height: 100)
XCTAssertTrue(CGPoint(x: 20, y: 40) == size.centerPointInSize(largerSize)) |
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 once with intermediate result
rasters. The callback will be called exactly once with a stream status of .finished, and may be called additional
times beforehand (but not afterwards) with a status of .hasMore. Consecutive calls to the callback may provide an |
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)!.trim
let values = regxsub.subgroupMatchAtIndex(1)!.trim
if let aHtml = Regex("@"+className).replace(finalHtml, withTemplate: values) {
finalHtml = aHtml
}
} |
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. |
swift | // MARK: - Private Methods
fileprivate func setupAnimatedDropdownMenu() {
let dropdownMenu = AnimatedDropdownMenu(navigationController: navigationController, containerView: view, selectedIndex: selectedStageIndex, items: dropdownItems)
dropdownMenu.cellBackgroundColor = UIColor.menuGreenColor()
dropdownMenu.menuTitleColor = UIColor.menuLightTextColor()
dropdownMenu.menuArrowTintColor = UIColor.menuLightTextColor()
dropdownMenu.cellTextColor = UIColor.init(white: 1.0, alpha: 0.3)
dropdownMenu.cellTextSelectedColor = UIColor.menuLightTextColor()
dropdownMenu.cellTextAlignment = .center
dropdownMenu.cellSeparatorColor = .clear
dropdownMenu.didSelectItemAtIndexHandler = { |
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
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
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 dictionaryElements = [[String:Any]]()
for customPlateImagesElement in customPlateImages {
dictionaryElements.append(customPlateImagesElement.toDictionary())
}
dictionary["CustomPlateImages"] = dictionaryElements
} |
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<NestedKey>(
keyedBy _: NestedKey.Type,
forKey key: Key
) -> KeyedEncodingContainer<NestedKey> {
let sharedChoice = SharedBox(ChoiceBox()) |
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)
} |
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 UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
// Use a UIHostingController as window root view controller
if let windowScene = scene as? UIWindowScene {
let context = CoreData.stack.context |
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.didChangeContentHandler = { [weak self] updatedModule in
if let index = self?.tableViewModules.index(where: { $0 === updatedModule }) {
self?.tableView.reloadSections(IndexSet(integer: index), with: .none)
} else {
self?.tableView.reloadData() |
swift | //
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
// Override point for customization after application launch.
return true
}
|
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
case UIResponder.keyboardWillHideNotification:
self.contentInset = insets
self.scrollIndicatorInsets = insets |
swift | CATransaction.begin()
CATransaction.setDisableActions(true)
snakeLayer.strokeStart = 0
snakeLayer.strokeEnd = snakeLengthByCycle / CGFloat(cycleCount) * progress
CATransaction.commit()
}
fileprivate let AnimationGroupKey = "SnakePathAnimations"
func startAnimating() {
animating = true
snakeLayer.isHidden = false
snakeLayer.strokeStart = 0 |
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?.absoluteString)
return attributionInfo
}
} |
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 substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// 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.
// |
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: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
} |
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 = tripCancellation
} |
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._advanceForward(i, by: n) |
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 {
return self
}
return Image(nsImage: remoteImage) |
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 addMinute() {
minuteLayer = CALayer()
minuteLayer.backgroundColor = UIColor.black.cgColor
minuteLayer.bounds = CGRect(x: 0, y: 0, width: 2, height: 60)
minuteLayer.position = CGPoint(x: clockImageView.bounds.width * 0.5, y: clockImageView.bounds.height * 0.5)
minuteLayer.anchorPoint = CGPoint(x: 0.5, y: 1)
clockImageView.layer.addSublayer(minuteLayer)
}
|
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) -> @autoreleased NonNilTest
// OPT: [[NONOPTIONAL:%[0-9]+]] = apply [[GETTER]]([[OBJ]]) : $@convention(objc_method) (NonNilTest) -> @autoreleased NonNilTest
// OPT: [[OPTIONAL:%[0-9]+]] = unchecked_ref_cast [[NONOPTIONAL]] : $NonNilTest to $Optional<NonNilTest>
// OPT: switch_enum [[OPTIONAL]] : $Optional<NonNilTest>
func loadUnownedProperty(obj: NonNilTest) -> NonNilTest? {
let foo: NonNilTest? = obj.unownedNonNilObjectProperty |
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)
button.setTitleColor(UIColor.blue, for: .normal)
button.setTitleColor(UIColor.darkGray, for: .highlighted)
button.addTarget(self, action: #selector(onClickStopSpotlightButton), for: .touchUpInside)
return button
}()
lazy var nextButton: UIButton = { |
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 = groupId
completion(nil, nil)
}
} |
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 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 | 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: "央广 - 文艺之声", url: URL(string: "http://ngcdn010.cnr.cn/live/wyzs/index.m3u8")!, image: "文艺之声"))
radioLists.append(Channels(title: "央广 - 大湾区之声", url: URL(string: "http://ngcdn007.cnr.cn/live/hxzs/index.m3u8")!, image: "大湾区之声"))
radioLists.append(Channels(title: "央广 - 老年之声", url: URL(string: "http://ngcdn011.cnr.cn/live/lnzs/index.m3u8")!, image: "老年之声"))
radioLists.append(Channels(title: "央广 - 香港之声", url: URL(string: "http://ngcdn008.cnr.cn/live/xgzs/index.m3u8")!, image: "香港之声"))
radioLists.append(Channels(title: "央广 - 藏语之声", url: URL(string: "http://ngcdn012.cnr.cn/live/zygb/index.m3u8")!, image: "藏语之声"))
radioLists.append(Channels(title: "央广 - 哈语之声", url: URL(string: "http://ngcdn025.cnr.cn/live/hygb/index.m3u8")!, image: "哈语之声"))
radioLists.append(Channels(title: "央广 - 中国交通广播", url: URL(string: "http://ngcdn016.cnr.cn/live/gsgljtgb/index.m3u8")!, image: "中国交通广播"))
radioLists.append(Channels(title: "央广 - 乡村之声", url: URL(string: "http://ngcdn017.cnr.cn/live/xczs/index.m3u8")!, image: "乡村之声"))
radioLists.append(Channels(title: "央广 - 阅读广播", url: URL(string: "http://ngcdn014.cnr.cn/live/ylgb/index.m3u8")!, image: "阅读广播"))
radioLists.append(Channels(title: "央广 - 维语之声", url: URL(string: "http://ngcdn013.cnr.cn/live/wygb/index.m3u8")!, image: "维语之声"))
radioLists.append(Channels(title: "央广 - 南海之声", url: URL(string: "http://cnlive.cnr.cn/hls/nanhaizhisheng.m3u8")!, image: "南海之声"))
radioLists.append(Channels(title: "央广 - CRI环球资讯", url: URL(string: "http://cnlive.cnr.cn/hls/huanqiuzixunguangbo.m3u8")!, image: "CRI环球资讯"))
} |
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).base64EncodedString()
return "\(headerBase64).\(payloadBase64).\(signatureBase64)"
}
private var payloadWithoutInsightsProperties: String {
let currentDate = Date()
let expireIn = buildFutureDate(baseDate: currentDate, minute: minuteExpireIn)
return """
{ |
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 = YMGlobalRedColor()
return indicatorView
}()
func leftButtonClick(button: UIButton) {
button.selected = !button.selected
UIView.animateWithDuration(kAnimationDuration) { |
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: false
) |
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 tokenized formatted whitespace buffer.
func checkForAddLineErrors(userOffset: Int, user: [String], form: [String]) { |
swift | case comment(String)
case illegal
}
|
swift |
func italic() -> UIFont {
var symTraits = fontDescriptor.symbolicTraits
symTraits.insert(.traitItalic)
return self.buildFont(symTraits: symTraits)
}
|
Subsets and Splits