lang
stringclasses 10
values | seed
stringlengths 5
2.12k
|
---|---|
swift |
private let button = UIButton(type: .custom)
weak var delegate: TipViewDelegate?
public override var visualConstraintViews: [String: AnyObject] {
return [
"stackView": stackView,
"button": button |
swift | override func viewDidLoad() {
super.viewDidLoad()
setupView()
}
private func setupView() {
view.addSubview(scrollView)
scrollView.addSubview(imageView) |
swift | // SSVerticalSegmentsSliderExamplesApp.swift
// SSVerticalSegmentsSliderExamples
//
// Created by smartsense-kiran on 01/12/21.
//
import SwiftUI
@main
struct SSVerticalSegmentsSliderExamplesApp: App {
var body: some Scene {
WindowGroup { |
swift | provider.info(text: text, tag: tag)
}
static func debug(text: String,
tag: String? = nil) {
provider.debug(text: text, tag: tag)
}
static func warning(text: String,
tag: String? = nil) {
provider.warning(text: text, tag: tag)
}
}
|
swift | // UIFont+extensions.swift
// Base64
//
// Created by Elazar Yifrach on 16/05/2019.
//
extension UIFont {
class func loadFonts(from bundle: Bundle) { |
swift | header.isFindButtonTap = { [weak self] in
self?.searchFriendPresent()
}
header.isReceiveButtonTap = { [weak self] in
self?.invitePresent()
}
|
swift | }
public init(none: ()) {
self = .none
}
}
extension Optional { |
swift | /// Ref: https://stackoverflow.com/questions/3077109/how-to-check-if-uilabel-is-truncated
extension UILabel {
var isTruncated: Bool {
guard let labelText = text else {
return false
}
let labelTextSize = (labelText as NSString).boundingRect(
with: CGSize(width: frame.size.width, height: .greatestFiniteMagnitude),
options: .usesLineFragmentOrigin,
attributes: [.font: font ?? UIFont.systemFont(ofSize: 17)], |
swift | }
public extension ScreengrabfileProtocol {
var androidHome: String? { return nil }
var buildToolsVersion: String? { return nil } |
swift | @IBOutlet weak var totalLabel: UILabel!
@IBOutlet weak var tipLabel: UILabel!
@IBAction func buttonpressed(_ sender: Any) {
print("I was pressed") |
swift | return imagesCycleView
}()
private lazy var textCycleView: QSTextBannerView = {
let model = QSBaseBannerModel.init()
model.timeInterval = 3.0
model.isAutoRun = true
model.isNeedPageControl = false
model.itemSize = CGSize.init(width: UIScreen.main.bounds.width, height: 50.0)
model.isCardStytle = false
model.visibleCount = 3
model.collectionViewBgColor = .gray |
swift | //
// Created by Tibor Bodecs on 2021. 07. 23..
//
/// The `<progress>` tag represents the completion progress of a task.
///
/// **Tip:** Always add the `<label>` tag for best accessibility practices!
open class Progress: Tag {
public init(_ contents: String) {
super.init(Node(type: .standard, name: "progress", contents: contents))
}
}
|
swift | @objc open var touchMatrix: CGAffineTransform
{
return _touchMatrix
}
// MARK: - Boundaries Check
|
swift | private func updateCentralLabel() {
//swiftlint:disable empty_count
if let count = fetchedResultsController?.fetchedObjects?.count, count == 0 {
setBackgroundText(NSLocalizedString("Empty list", comment: "On the first screen, when no bookmarks are in the list"))
} else {
hideBackgroundText()
}
//swiftlint:enable empty_count
|
swift | // CHECK: checked_cast_addr_br take_always P in [[COPY]] : $*P to S in [[TMP]] : $*S, bb1, bb2
// Success block.
// CHECK: bb1:
// CHECK: [[T0:%.*]] = load [trivial] [[TMP]] : $*S
// CHECK: [[T1:%.*]] = enum $Optional<S>, #Optional.some!enumelt, [[T0]] : $S
// CHECK: dealloc_stack [[TMP]]
// CHECK: br bb3([[T1]] : $Optional<S>)
// Failure block.
// CHECK: bb2: |
swift |
public func nextGameIntent() -> NextGameIntent {
let intent = NextGameIntent()
intent.suggestedInvocationPhrase = "Who do we play next"
return intent |
swift | public var description: String {
return String(playgroundDescriptionMarkup().rawTextApproximation())
}
}
|
swift | import ApodiniDatabase
import XCTest
@testable import ApodiniNotifications
final class DatabaseConfigurationTests: XCTestCase {
// swiftlint:disable implicitly_unwrapped_optional
var app: Application!
override func setUp() {
super.setUp() |
swift | }
}
extension CoinAuditsService {
var stateObservable: Observable<State> {
stateRelay.asObservable()
}
}
extension CoinAuditsService { |
swift | inputKey: \ListCallAnalyticsCategoriesRequest.nextToken,
outputKey: \ListCallAnalyticsCategoriesResponse.nextToken,
logger: logger,
on: eventLoop
) |
swift | }
// MARK: Dummy API
struct MenuBadgeDummyAPI
{
typealias MenuResponse = (main: [MenuId], sub: [MenuId])
typealias BadgeResponse = [(menuId: MenuId, badgeString: String)]
/// Dummy response for layouting tabBar (main) and `Settings`'s tableView (sub). |
swift |
DataProvider.loadArchive()
}
override func reloadData() {
DataProvider.clear()
DataProvider.loadArchive()
}
override func firstSwipeAction() -> UITableViewRowAction {
return actionGenerator!.moveToInbox()
}
} |
swift | // Example: "com.apple.CoreSimulator.SimDeviceType.Apple-TV-1080p"
public let identifier: DeviceTypeIdentifier
public init(
name: String,
bundlePath: String?,
identifier: String) |
swift | withBSBNumber: STPBSBNumberValidator.sanitizedNumericString(for: bsbNumber ?? ""),
completeOnMaxLengthOnly: editing) == .complete
}
}
func isInputValid(_ input: String, for field: STPAUBECSFormViewField, editing: Bool) -> Bool {
switch field {
case .name:
return true
case .email:
return input.count == 0
|| (editing && STPEmailAddressValidator.stringIsValidPartialEmailAddress(input))
|| (!editing && STPEmailAddressValidator.stringIsValidEmailAddress(input))
case .BSBNumber:
let state = STPBSBNumberValidator.validationState(forText: input) |
swift |
self.decimalPointBtn?.setTitle((Locale.current as NSLocale).object(forKey: NSLocale.Key.decimalSeparator) as? String, for: UIControl.State.normal)
minusButton.isEnabled = type == .decimalNegativePad || type == .numberNegativePad
}
/// Notifications for textview
private func notificateTextDidChange(){ |
swift | // Show the message.
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
self.present(alert, animated: true, completion: nil)
return
}
@IBAction func onSignClick(_ sender: UIButton)
{
var alert: UIAlertController = UIAlertController(title: "Secure Key Sample", message: "Test string '\(signingString)' signed.", preferredStyle: .alert)
|
swift | }
}
return account.postbox.transaction { transaction -> Signal<Void, NoError> in
if let peer = transaction.getPeer(peerId), let memberPeer = transaction.getPeer(memberId), let inputUser = apiInputUser(memberPeer) {
if let group = peer as? TelegramGroup {
return account.network.request(Api.functions.messages.deleteChatUser(flags: 0, chatId: group.id.id, userId: inputUser))
|> mapError { error -> Void in
return Void()
}
|> `catch` { _ -> Signal<Api.Updates, NoError> in |
swift |
public class CoffeeTestModel: Mappable {
// MARK: Properties
|
swift | import LogifyCore
Logifier.main()
|
swift | for i in 0...MaxNumberedMappings+1 {
if let numberedMapping = userInfo?[MappingUserInfoKey + ".\(i)"] as? String {
_mappings.append(numberedMapping)
if i == MaxNumberedMappings+1 {
CDK.sharedLogger(.warn, "Only mappings up to \(MappingUserInfoKey).\(MaxNumberedMappings) mappings are supported all others are ignored, you defined more for \(entity.name).\(name)")
}
} |
swift | super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/* |
swift | ///用于保存弱对象
public struct FXWeaker {
public weak var obj: AnyObject?
}
///保存弱对象,并在对象销毁时自动清除对象
open class FXWeakerSet {
private var weakers: [FXWeaker] = [] |
swift | super.viewDidLoad()
}
override func viewWillAppear(_ animated: Bool) {
view.backgroundColor = UIColor.init(named:"input")
setNavbar()
setComponents()
}
func setNavbar() { |
swift | }
deinit {end()}
public func hash(into hasher: inout Hasher) {
hasher.combine(ObjectIdentifier(self))
} |
swift | innerContentView.translatesAutoresizingMaskIntoConstraints = false
leftPaddingConstraint = innerContentView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor)
rightPaddingConstraint = innerContentView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor)
bottomPaddingConstraint = innerContentView.bottomAnchor.constraint(equalTo: contentView.bottomAnchor)
topPaddingConstraint = innerContentView.topAnchor.constraint(equalTo: contentView.topAnchor)
NSLayoutConstraint.activate([
leftPaddingConstraint, rightPaddingConstraint, bottomPaddingConstraint, topPaddingConstraint |
swift | //使用方式二
let label2 = UILabel()
label2.lgl.set("这是UILabel2", color2, font)
label2.frame = CGRect(x: 0, y: 140, width: 160, height: 30)
label2.backgroundColor = color1
self.view.addSubview(label2) |
swift |
struct AnimationCompletionShape<Value: VectorArithmetic>: Shape {
var animatableData: Value {
get { tmpValue }
set { |
swift | public static var rt: Rt { .init(name: "rt") }
open class Rt: SFSymbol {
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
open var rectangleRoundedtop: SFSymbol { ext(.start.rectangle + ".roundedtop") }
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
open var rectangleRoundedtopFill: SFSymbol { ext(.start.rectangle + ".roundedtop".fill) }
|
swift | @param originalUrl The original url that triggered finicky to start
@param sourceBundleIdentifier Bundle identifier of the application that triggered the url to open
@return A dictionary keyed with "url" and "bundleIdentifier" with
the new url and bundle identifier to spawn |
swift | // Created by Jonathan Cochran on 4/4/19.
// Copyright © 2019 Jonathan Cochran. All rights reserved.
//
import Foundation
extension Date{
func formatToString() -> String {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
return dateFormatter.string(from: self) |
swift | public func dropFirst(count : Int = 1) -> Emitters.DropFirst<Self> {
Emitters.DropFirst(emitter: self, count: count)
}
} |
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
// |
swift |
var prevCardPart: UIView = contentView
var padding: CGFloat = 0
for cardPart in cardParts {
cardPart.view.translatesAutoresizingMaskIntoConstraints = false
padding += cardPart.margins.top
if let _ = cardPart.viewController {
// TODO add support for cardParts implemented as view controllers
print("Viewcontroller card parts not supported in collection view cells")
} else {
contentView.addSubview(cardPart.view)
}
|
swift | //
// ComponentDefinitionContainer.swift
// Tokenizer
//
// Created by Tadeas Kriz on 09/12/2019.
//
|
swift | let response = self.service.setVisionPositionEstimate(request)
let result = try response.response.wait().mocapResult
if (result.result == Mavsdk_Rpc_Mocap_MocapResult.Result.success) {
completable(.completed)
} else {
completable(.error(MocapError(code: MocapResult.Result.translateFromRpc(result.result), description: result.resultStr)))
}
} catch { |
swift |
/// The raw pattern string. Guaranteed to be a valid FTS3/4 pattern.
public let rawPattern: String
/// Creates a pattern from a raw pattern string; throws DatabaseError on
/// invalid syntax. |
swift | }
override var tailPosition: BubbleMaskTailPosition {
didSet {
self.bubbleTrailingConstraint.constant = 45 |
swift | }
extension Notification.Name {
static let CalibrationServiceHumidityDidChange = Notification.Name("CalibrationServiceDidChange")
} |
swift | // StackOv (FavoriteFlow module)
//
// Created by Erik Basargin
// Copyright © 2021 Erik Basargin. All rights reserved.
// |
swift | formattedCount = String(format: "%.1fk", Double(count) / 1000.0)
}
else{
formattedCount = "\(count)"
}
return formattedCount
}
|
swift | /// - Parameters:
/// - letter: The letter of the note
/// - octave: The octave of the note
/// - Throws: An error if the rest of the components cannot be calculated
public init(letter: Letter, octave: Int) throws {
self.letter = letter
self.octave = octave
index = try NoteCalculator.index(forLetter: letter, octave: octave)
frequency = try NoteCalculator.frequency(forIndex: index)
wave = try AcousticWave(frequency: frequency)
}
|
swift | open func updateItem<I>(_ item: I, forKey key: Key) where I: Item, I.Value == Value {
storage.updateValue(item.eraseToAnyItem(), forKey: key)
}
open func removeItem(forKey key: Key) {
storage.removeValue(forKey: key)
}
open func setValue(_ value: Value?) {
self.value = value
}
// MARK: - Private
}
|
swift | XCTAssertEqual(pageControl.numberOfPages, 0)
XCTAssertEqual(pageControl.pageIndicatorTintColor, UIColor.systemGray)
}
func testDefaultsWithFivePages() {
let pageControl = ScrollingPageControl()
pageControl.numberOfPages = 5
XCTAssertEqual(pageControl.accessibilityLabel, "page 1 of 5")
XCTAssertEqual(pageControl.accessibilityTraits, [.adjustable, .updatesFrequently])
XCTAssertEqual(pageControl.accessibilityValue, "1")
XCTAssertEqual(pageControl.currentPage, 0)
XCTAssertEqual(pageControl.currentPageIndicatorTintColor, UIColor.systemBlue) |
swift | return nil
}
self.bufferStartIndex = self.indexSucceeding(index: self.bufferStartIndex)
self.isEmpty = (self.bufferStartIndex == self.bufferEndIndex)
return first
}
// pushes element onto the end of the queue. If the queue is full, this
// will pop off and return the oldest element. Otherwise, it will return nil
@discardableResult
public mutating func push(element: Element) -> Element? {
let popped: Element?
if self.isFull { |
swift | //
// Track.swift
// RNTrackPlayer
//
// Created by David Chavez on 12.08.17.
// Copyright © 2017 David Chavez. All rights reserved.
//
import Foundation
import MediaPlayer |
swift | }
}
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "XHERBountyViewCell", for: indexPath) as! XHERBountyViewCell
if let bounty = self.bounties?[indexPath.row] { |
swift |
public class EKSimpleMessageView: UIView {
// MARK: Props
let thumbImageView = UIImageView()
let messageContentView = EKMessageContentView()
// MARK: Setup
init(with message: EKSimpleMessage) { |
swift |
var anchor: NSLayoutXAxisAnchor {
switch self {
case let .left(view):
return view.safeAreaLayoutGuide.leftAnchor
case let .right(view):
return view.safeAreaLayoutGuide.rightAnchor |
swift | return
}
header.title = (group.midnightUTCDate as NSDate?)?.wmf_localizedRelativeDateFromMidnightUTCDate()
header.apply(theme: theme)
}
func createNewCardVCFor(_ cell: ExploreCardCollectionViewCell) -> ExploreCardViewController {
let cardVC = ExploreCardViewController()
cardVC.delegate = self
cardVC.dataStore = dataStore
cardVC.view.autoresizingMask = []
addChild(cardVC)
cell.cardContent = cardVC
cardVC.didMove(toParent: self)
return cardVC |
swift |
import Foundation
public class Nihongo {
public typealias AnalyzerRequestCallback = ([Word]) -> ()
init(yahooJapanAppId appId: String) {
service = .yahooJapan(appId: appId)
} |
swift | // APIClient.swift
// RSDemoProject
//
// Created by Amaury Ricardo on 6/25/20.
// Copyright © 2020 TopTier labs. All rights reserved.
//
import Foundation
struct APIRequestHeaders {
static let baseHeaders: [String: String] = [
HTTPHeader.accept.rawValue: "application/json",
HTTPHeader.contentType.rawValue: "application/json"
]
|
swift | self.init(red:red, green:green, blue:blue, alpha:alpha)
}
class func tinylogNavigationBarColor() -> UIColor {
return UIColor(hue: 0.0, saturation: 0.0, brightness: 0.98, alpha: 1.00)
}
class func tinylogBackgroundColor() -> UIColor {
return UIColor(red: 250.0 / 255.0, green: 250.0 / 255.0, blue: 250.0 / 255.0, alpha: 1.0)
}
class func tinylogTableViewLineColor() -> UIColor {
return UIColor(red: 224.0 / 255.0, green: 224.0 / 255.0, blue: 224.0 / 255.0, alpha: 1.0)
}
|
swift |
func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
switch self {
case .board(let board):
try container.encode(board, forKey: .board)
case .thread(let board, let thread): |
swift |
extension LayerContext: CompatibilityTrackerProviding {
var compatibilityIssueContext: String {
layerName
}
}
// MARK: - LayerAnimationContext + CompatibilityTrackerProviding
extension LayerAnimationContext: CompatibilityTrackerProviding {
var compatibilityIssueContext: String {
currentKeypath.fullPath
} |
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
enum S<T where T. : a {
class c
var d {
if
}
|
swift | UIView.animate(withDuration: config.b_AnimationTime!, animations: {
view.transform = CGAffineTransform(scaleX: 0.4, y: 0.4);
}, completion: { (over) in
view.transform = CGAffineTransform.identity;
});
}; |
swift | /// Constructor
///
/// - Parameters:
/// - app: the ID of kintone app
/// - id: the ID of record
/// - updateKey: the unique key of the record to be updated
/// - revision: the number of revision |
swift | lazy var inPort: InPort<T> = InPort(self) { packet in
self.network.send(self.outPort, packet)
}
lazy var outPort: OutPort<T> = OutPort(self)
}
|
swift | for index in 0 ..< monsterDTOs.count {
let actual = MonsterItem(entity: MonsterEntity(dto: monsterDTOs[index]))
let expected = monsterItems[index]
XCTAssertEqual(actual, expected)
}
}
await presenter.viewDidLoad()
XCTAssertEqual(viewMock.startIndicatorCallCount, 1)
XCTAssertEqual(interactorMock.monstersCallCount, 1)
XCTAssertEqual(viewMock.showMonstersCallCount, 1)
XCTAssertEqual(viewMock.stopIndicatorCallCount, 1)
}
|
swift | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
// OperationEntityProtocol is the operation supported by Cognitive Services.
public protocol OperationEntityProtocol : Codable {
var name: String? { get set }
var display: OperationDisplayInfoProtocol? { get set }
var origin: String? { get set }
var properties: [String: String?]? { get set }
}
|
swift | guard let data = try? JSONEncoder().encode(item) else { return nil }
let string = String(data: data, encoding: .utf8)
return string
}
override public func decode<T: Any>(_ item: String) -> T? where T: Codable {
guard let data = item.data(using: .utf8) else { return nil }
let decoded: T? = try? JSONDecoder().decode(T.self, from: data)
return decoded
}
}
|
swift | import Essentials
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Branch
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
swift | override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
|
swift | let profileBackgroundUrlString = dictionary["profile_background_image_url_https"] as? String
if let profileBackgroundUrlString = profileBackgroundUrlString {
profileBackgroundUrl = NSURL(string: profileBackgroundUrlString)
}
tagline = dictionary["description"] as? String
}
// 'computed properties' - not a piece of storage associated with var
static var _currentUser: User?
static let userDidLogoutNotification = "UserDidLogout"
|
swift |
retweetLabel.text = "\(rtCount!)"
let fCount = tweet?.favoriteCount
|
swift |
let name: String
/// Create a variable term.
/// - parameter name: The variable name.
public init(_ name: String) {
self.name = name
}
}
/// Build the `NSExpression`. |
swift | 输入:
4
/ \
2 7
/ \ / \
1 3 6 9
输出:
4
/ \
7 2 |
swift | members.insert(SDAI.STRING(Self.typeName))
return members
}
|
swift | done()
}
}
}
}
} |
swift | public static let violet = UIColor(rgb: 0x6950ab, alphaVal: 1.0)
public static let almostWhite = UIColor(rgb: 0xf7f7f7, alphaVal: 1.0)
public static let white = UIColor(rgb: 0xffffff, alphaVal: 1.0)
public static let black = UIColor(rgb: 0x344148, alphaVal: 1.0) // check
public static let blueTint = UIColor(rgb: 0x0072d0, alphaVal: 1.0) // check
public static let lightGray = UIColor(rgb: 0xadb0b2, alphaVal: 1.0) // check
public static let mediumGray = UIColor(rgb: 0xa3a3a3, alphaVal: 1.0) |
swift | // Copyright © 2021 nw. All rights reserved.
//
import Cocoa
final class DebugViewController: NSViewController {
|
swift | //
// Created by wizard on 1/13/16.
// Copyright © 2016 morgenworks. All rights reserved.
//
import UIKit
class NewtownianAttachmentBehavior : UIAttachmentBehavior {
deinit {
print(" i am dealloced") |
swift | // In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// 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.
super.tearDown()
}
|
swift | }
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
|
swift |
/**
Method to add a user post to Parse (uploading image file)
- parameter image: Image that the user wants upload to parse
- parameter caption: Caption text input by the user
- parameter completion: Block to be executed after save operation is complete |
swift | // Override point for customization after application launch.
self.window = UIWindow.init(frame: UIScreen.main.bounds)//如果不用storyboard就在这里初始化window
let tabBarCtr = MyTabBarController()
self.window?.rootViewController = tabBarCtr
self.window?.backgroundColor = UIColor.white
self.window?.makeKeyAndVisible()
return true
}
|
swift | //
enum ConfigurationKey: String {
case extends
case fontName = "font-name" |
swift | public init(_ string: String) {
enum ParsingState {
case readingScheme
case readingHost
case readingPort
case readingPath
case readingQuery
case finished
}
var scheme: HBParser?
var host: HBParser?
var port: HBParser?
var path: HBParser?
var query: HBParser?
var state: ParsingState = .readingScheme |
swift | //
// Created by Dmitry Ivanenko on 12.10.2019.
// Copyright © 2019 Dmitry Ivanenko. All rights reserved.
//
import Foundation
enum TransactionsFeature { }
|
swift | Contacts.fetchContactsGroupedByAlphabets { [unowned self] result in
switch result {
case .success(let orderedContacts):
completionHandler(orderedContacts)
|
swift | @IBOutlet private weak var activityIndicatorView: UIActivityIndicatorView!
init() {
super.init(frame: .zero)
UINib(nibName: "LoadingView", bundle: nil)
.instantiate(withOwner: self, options: nil)
} |
swift | // Created by Fredrik Sjöberg on 2018-02-18.
// Copyright © 2018 emp. All rights reserved.
//
// Lightweight modification of the Alamofire framework.
|
swift | open class var slate: UIColor {
return UIColor(displayP3Red: 38/255, green: 47/255, blue: 52/255, alpha: 1)
}
open class var neonRed: UIColor {
return UIColor(displayP3Red: 243/255, green: 74/255, blue: 74/255, alpha: 1)
}
open class var crepe: UIColor {
return UIColor(displayP3Red: 241/255, green: 211/255, blue: 188/255, alpha: 1)
}
open class var brownishGray: UIColor {
return UIColor(displayP3Red: 97/255, green: 80/255, blue: 73/255, alpha: 1)
} |
swift | if !node.path.isEmpty && node.path[node.path.startIndex] == ":" {
let key = node.path.substring(from: node.path.index(after: node.path.startIndex))
let value = comps[result.0]
return (result.0 + 1, [key: value])
} else {
return (result.0 + 1, result.1)
}
}.1
*/
let params: [String: String] = [:] |
swift | import SwiftUI
struct ContentContainer: View {
let appStore: PerduxStore
var body: some View {
RootContainer()
.environmentObject(appStore.getState(NetworkState.self))
}
} |
swift | * Протокол объекта конфигурации хэдеров таблицы
*/
protocol HeaderObject {
/*
Метод получения идентификатора вьюшки, которая должна использоваться для отображения соответствующего хэдера
*/
func headerReuseIdentifier() -> String
}
extension HeaderObject {
/** |
swift | //
// Created by Claus Wolf on 30.10.19.
// Copyright © 2019 Claus Wolf. All rights reserved.
//
import SafariServices
class SafariExtensionHandler: SFSafariExtensionHandler {
var tabCount : Int = 0
var windowCount : Int = 0
let settings = SettingsHelper()
let helper = Helper()
|
swift | green: CGFloat( g ) / 255,
blue: CGFloat( b ) / 255,
alpha: a )
}
static func rgba(_ r: Int,_ g:Int,_ b:Int,_ a:CGFloat = 1 ) -> UIColor{
return UIColor.init(red: CGFloat( r ) / 255,
green: CGFloat( g ) / 255,
blue: CGFloat( b ) / 255,
alpha: a )
} |
swift | return Component.month
case NSCalendar.Unit.day:
return Component.day
case NSCalendar.Unit.hour:
return Component.hour
case NSCalendar.Unit.minute:
return Component.minute
case NSCalendar.Unit.second: |
swift |
import SwiftUI
@main
struct MemoriseApp: App {
private let game = EmojiMemoryGame()
var body: some Scene {
WindowGroup {
EmojiMemoryGameView(game: game)
}
}
} |
Subsets and Splits