blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 2
625
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
47
| license_type
stringclasses 2
values | repo_name
stringlengths 5
116
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 643
values | visit_date
timestamp[ns] | revision_date
timestamp[ns] | committer_date
timestamp[ns] | github_id
int64 80.4k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 16
values | gha_event_created_at
timestamp[ns] | gha_created_at
timestamp[ns] | gha_language
stringclasses 85
values | src_encoding
stringclasses 7
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 1
class | length_bytes
int64 4
6.44M
| extension
stringclasses 17
values | content
stringlengths 4
6.44M
| duplicates
listlengths 1
9.02k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e33b317882bce0adb6300845964baaaa52cd7c1b
|
36d75599c17ed057d63711dfbc39610851c96803
|
/ShuTu/Network/Model/Callback.swift
|
c170f30560993ce6320b213604c9f1cd65e9fc11
|
[] |
no_license
|
YvanMasterAll/yvan.ios.JianKe
|
57226b136e92da05b2e27d65de9a749b33443269
|
a80884a1928d0c14e7438645c08e00f087c779bc
|
refs/heads/master
| 2021-09-10T11:15:00.196836 | 2018-03-25T10:56:14 | 2018-03-25T10:56:14 | 113,850,104 | 0 | 0 | null | 2018-01-22T11:32:14 | 2017-12-11T11:20:07 |
Swift
|
UTF-8
|
Swift
| false | false | 886 |
swift
|
//
// Result.swift
// ShuTu
//
// Created by yiqiang on 2018/1/22.
// Copyright © 2018年 yiqiang. All rights reserved.
//
import Foundation
import ObjectMapper
public struct Callback: Mappable {
var code: Int!
var msg: String?
var data: [[String: Any]]?
var token: String?
public init(){}
public init?(map: Map) {}
public mutating func mapping(map: Map) {
code <- map["code"]
msg <- map["msg"]
data <- map["data"]
token <- map["token"]
}
}
public struct Callback2: Mappable {
var code: Int!
var msg: String?
var data: [String: Any]?
var token: String?
public init(){}
public init?(map: Map) {}
public mutating func mapping(map: Map) {
code <- map["code"]
msg <- map["msg"]
data <- map["data"]
token <- map["token"]
}
}
|
[
-1
] |
3525114ce07dbfdf949936b227756f636b59928a
|
124730fe62a2983c90c901219e5c6c6740864e23
|
/bankingApp/SettingsViewController.swift
|
0e9f600269c924e20f95b4ebb014e64097b3be67
|
[] |
no_license
|
arjun-lalwani/iOS-bankingApp
|
bd80addf6efbc7c2051e0d2bb774c7aa6a2efbad
|
744ff7314b88769db65e4363e7950632ee9c9fbe
|
refs/heads/master
| 2021-07-11T10:33:22.269495 | 2017-10-11T19:14:39 | 2017-10-11T19:14:39 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 2,017 |
swift
|
//
// SettingsViewController.swift
// bankingApp
//
// Created by Arjun Lalwani on 10/11/16.
// Copyright © 2016 Arjun Lalwani. All rights reserved.
//
import UIKit
class SettingsViewController: 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.
}
@IBAction func agentLocation(_ sender: Any) {
let alertController = UIAlertController(title: "Agent Location", message: "Google Maps with Agent Location", preferredStyle: UIAlertControllerStyle.alert)
alertController.addAction(UIAlertAction(title: "Dismsiss", style: UIAlertActionStyle.default, handler:nil))
self.present(alertController, animated: true, completion: nil)
}
@IBAction func reportFraud(_ sender: Any) {
let alertController = UIAlertController(title: "Report Fraud", message: "Agent Number - (404)-456-4123. Call or send a message", preferredStyle: UIAlertControllerStyle.alert)
alertController.addAction(UIAlertAction(title: "Dismiss", style: UIAlertActionStyle.default, handler: nil))
self.present(alertController, animated: true, completion: nil)
}
@IBAction func signOutButton(_ sender: Any) {
let mainView = self.storyboard?.instantiateViewController(withIdentifier:"MainVC") as! ViewController
self.present(mainView, animated: true, completion: nil)
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
|
[
-1
] |
b186438abbb0b3d0bcbaf6c65a5ed26661e52650
|
1f173ea8d5e23ad82076bd5d0ef604757737efc1
|
/Sources/PictionSDK/Network/Model/DefaultModel.swift
|
b8aecdca80e556eb40aaca7ff46b428e947c3645
|
[
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] |
permissive
|
piction-protocol/piction-sdk-ios
|
f48fcdfb4becb78850ff73ce45184d1a9368332f
|
ef19d7f82fa76ebea2bc1a8c55bff078157b1c7b
|
refs/heads/master
| 2020-05-26T09:42:34.178710 | 2020-04-08T08:01:33 | 2020-04-08T08:01:33 | 188,190,784 | 1 | 2 |
MIT
| 2019-05-28T07:29:20 | 2019-05-23T08:13:46 |
Swift
|
UTF-8
|
Swift
| false | false | 569 |
swift
|
//
// DefaultModel.swift
// PictionSDK
//
// Created by jhseo on 14/06/2019.
// Copyright © 2019 Piction Network. All rights reserved.
//
import Mapper
public typealias DefaultViewResponse = DefaultModel
public struct DefaultModel: Response {
public init(map: Mapper) throws {}
public func toJSONString() throws -> String {
return try! toJSON(dict: self.toDict())
}
public func toDict() -> [String: Any?] {
return [:]
}
}
extension DefaultModel {
static func sampleData() -> [String: Any] {
return [:]
}
}
|
[
-1
] |
a3ff04440ad5c7aa790dde37cd4f39c8737effa6
|
3b7554cdf3de24ba5c05b7a6d63758910c3e6f33
|
/ConsentViewController/Classes/LocalStorage/SPUserDefaults.swift
|
0b4860947e45fbf2e9772ffc63a73941ff8ae4e5
|
[
"MIT"
] |
permissive
|
mumer92/ios-cmp-app
|
a3a2814bdab37f4a14880426009c2d51434fcae2
|
b802bda61e689afc1607f21941ead5bad1d8ec48
|
refs/heads/master
| 2023-05-31T12:57:27.395183 | 2021-06-04T13:54:47 | 2021-06-04T13:54:47 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 2,224 |
swift
|
//
// SPUserDefaults.swift
// ConsentViewController
//
// Created by Andre Herculano on 07.05.20.
//
import Foundation
/// TODO: handle data transition from v5 -> v6
class SPUserDefaults: SPLocalStorage {
static public let SP_KEY_PREFIX = "sp_"
static public let IAB_KEY_PREFIX = "IABTCF_"
static public let US_PRIVACY_STRING_KEY = "IABUSPrivacy_String"
static let LOCAL_STATE_KEY = "\(SP_KEY_PREFIX)localState"
static let USER_DATA_KEY = "\(SP_KEY_PREFIX)userData"
static let IAB_CMP_SDK_ID_KEY = "\(IAB_KEY_PREFIX)CmpSdkID"
static let IAB_CMP_SDK_ID = 6
var storage: Storage
var tcfData: [String: Any]? {
get {
storage.dictionaryRepresentation().filter {
$0.key.starts(with: SPUserDefaults.IAB_KEY_PREFIX)
}
}
set {
storage.removeObjects(forKeys: Array((tcfData ?? [:]).keys))
storage.setValuesForKeys(newValue ?? [:])
}
}
var usPrivacyString: String? {
get { storage.string(forKey: SPUserDefaults.US_PRIVACY_STRING_KEY) }
set { storage.set(newValue, forKey: SPUserDefaults.US_PRIVACY_STRING_KEY) }
}
var userData: SPUserData {
get {
storage.object(
ofType: SPUserData.self,
forKey: SPUserDefaults.USER_DATA_KEY
) ?? SPUserData()
}
set {
storage.setObject(newValue, forKey: SPUserDefaults.USER_DATA_KEY)
}
}
var localState: SPJson {
get { storage.object(ofType: SPJson.self, forKey: SPUserDefaults.LOCAL_STATE_KEY) ?? SPJson() }
set { storage.setObject(newValue, forKey: SPUserDefaults.LOCAL_STATE_KEY) }
}
required init(storage: Storage = UserDefaults.standard) {
self.storage = storage
}
func dictionaryRepresentation() -> [String: Any?] {[
SPUserDefaults.USER_DATA_KEY: userData,
SPUserDefaults.US_PRIVACY_STRING_KEY: usPrivacyString,
SPUserDefaults.LOCAL_STATE_KEY: localState
].merging(tcfData ?? [:]) { item, _ in item }}
func clear() {
localState = SPJson()
tcfData = [:]
usPrivacyString = ""
userData = SPUserData()
}
}
|
[
-1
] |
8cead0caec948c2c1868570fc6f93c1fa06254d0
|
24a5b8ecdea34b37e5750dc1da6be163ad485804
|
/dict/View/Dictionary/FlashCardFormView.swift
|
92cb9e2e2a998fd8db236ef5d40194eb5a8c179c
|
[
"MIT"
] |
permissive
|
bzbislawski/FlashHero
|
ec6d65ed7fc9284a2e29862236850a640dd22993
|
16ffe6eb4eee9e1b99330e2d5d731fc595d2d56d
|
refs/heads/master
| 2022-11-23T12:38:25.096193 | 2020-07-30T17:05:08 | 2020-07-30T17:05:08 | 224,945,590 | 1 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 5,376 |
swift
|
//
// FlashCardFormView.swift
// dict
//
// Created by Bartosz Zbislawski on 20/11/2019.
// Copyright © 2019 Bartosz Zbislawski. All rights reserved.
//
import SwiftUI
struct FlashCardFormView: View {
@EnvironmentObject var activeSheetHandler: ActiveSheetHandler
@EnvironmentObject var gameStatus: GameStatus
@Binding var showSheet: Bool
@State private var word: String = ""
@State private var translation: String = ""
@State private var missingFrontTextAlert = false
var body: some View {
VStack{
ZStack {
Rectangle()
.fill(Color.secondaryBackgroundColor)
.frame(width: UIScreen.main.bounds.width / 6, height: 4)
.cornerRadius(2)
.padding(.top, 10)
}
ZStack {
if self.activeSheetHandler.activeFlashCard != nil {
HStack {
Button(action:
{
self.gameStatus.delete(flashCard: self.activeSheetHandler.activeFlashCard!)
self.showSheet.toggle()
self.activeSheetHandler.delayHideView()
})
{
Image(systemName:"trash").foregroundColor(Color.backgroundColor)
}
.frame(width: 44, height: 44)
.background(Color.red)
.cornerRadius(12)
Spacer()
}.padding(.leading, 20)
}
Text("Flashcard")
.font(.system(size: 18, weight: .semibold))
.foregroundColor(Color.rgb(r: 53, g: 54, b: 67))
}
Divider()
ZStack {
TextField("Front text", text: $word)
.padding(.leading, 10)
.padding(.trailing, 30)
.frame(height: 47)
.background(Color.secondaryBackgroundColor)
.cornerRadius(12)
HStack {
Spacer()
Button(action: { self.word = "" })
{
Image(systemName: "xmark.circle.fill")
.foregroundColor(.tertiaryBackgroundColor)
}
.padding(.trailing, 8)
}
}
.padding(.leading, 20)
.padding(.trailing, 20)
.padding(.bottom, 15)
.padding(.top, 15)
Divider()
ZStack {
TextField("Reverse", text: $translation)
.padding(.leading, 10)
.padding(.trailing, 30)
.frame(height: 47)
.background(Color.secondaryBackgroundColor)
.cornerRadius(12)
HStack {
Spacer()
Button(action: { self.translation = "" })
{
Image(systemName: "xmark.circle.fill")
.foregroundColor(.tertiaryBackgroundColor)
}
.padding(.trailing, 8)
}
}
.padding(.leading, 20)
.padding(.trailing, 20)
.padding(.bottom, 15)
.padding(.top, 15)
Button(action: {
if self.word == "" {
self.missingFrontTextAlert.toggle()
return
}
if (self.activeSheetHandler.activeFlashCard != nil) {
self.activeSheetHandler.activeFlashCard!.word = self.word
self.activeSheetHandler.activeFlashCard!.translation = self.translation
self.gameStatus.save(deck: self.activeSheetHandler.activeDeck!, flashCard: self.activeSheetHandler.activeFlashCard!)
} else {
self.gameStatus.save(deck: self.activeSheetHandler.activeDeck!, word: self.word, translation: self.translation)
}
self.showSheet.toggle()
self.activeSheetHandler.delayHideView()
}) {
ButtonView(text: "Save", backgroundColor: Color.darkBlue, horizontalPadding: 20)
}
.alert(isPresented: $missingFrontTextAlert) {
Alert(
title: Text("Error"),
message: Text("Front text can not be empty")
)
}
.onAppear {
self.word = self.activeSheetHandler.activeFlashCard?.wrappedWord ?? self.word
self.translation = self.activeSheetHandler.activeFlashCard?.translation ?? self.translation
}
}
}
}
struct FlashCardFormView_Previews: PreviewProvider {
struct Wrapper: View {
@State var show: Bool = true
var body: some View {
let env = ActiveSheetHandler()
return FlashCardFormView(showSheet: self.$show).environmentObject(env)
}
}
static var previews: some View {
Wrapper()
}
}
|
[
-1
] |
9c012f1bfe7f7cca798a5100d47603a9af5f8cc6
|
be2914b71b34727987d90d5f52ebe0b655ccdaf9
|
/SpriteKit Watch Face.playgroundbook/Contents/Sources/FaceScene.swift
|
3e3970d7f78e7497ee029311c0f689d971411301
|
[] |
no_license
|
adbateson/SpriteKitWatchFacePlaygroundBook
|
eed7d80fb5da9c9c3f84470960cdc12515034673
|
60c882ddcb0c487c85537a0f6c23d2d08e6147df
|
refs/heads/master
| 2023-03-16T11:57:11.515921 | 2018-10-16T12:42:17 | 2018-10-16T12:42:17 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 24,993 |
swift
|
//
// FaceScene.swift
// SpriteKitWatchFace WatchKit Extension
//
// Created by Guillermo Cique Fernández on 14/10/2018.
// Copyright © 2018 Guillermo Cique Fernández. All rights reserved.
//
import SpriteKit
import CoreText
import PlaygroundSupport
#if os(iOS) || os(watchOS)
/* Sigh. */
typealias NSFont = UIFont
typealias NSFontDescriptor = UIFontDescriptor
#endif
extension NSFont {
var smallCaps: NSFont {
let settings: [NSFontDescriptor.FeatureKey: Int] = [
NSFontDescriptor.FeatureKey.featureIdentifier: kUpperCaseType,
NSFontDescriptor.FeatureKey.typeIdentifier: kUpperCaseSmallCapsSelector
]
let attributes: [NSFontDescriptor.AttributeName : Any] = [
NSFontDescriptor.AttributeName.featureSettings: settings,
NSFontDescriptor.AttributeName.name: fontName
]
return NSFont(descriptor: NSFontDescriptor(fontAttributes: attributes), size: pointSize)
}
}
public class FaceScene: SKScene, SKSceneDelegate {
public static let shared = FaceScene(fileNamed: "FaceScene")
static let minus2piOver12: CGFloat = -(2 * .pi)/12.0
static let minus2piOver60: CGFloat = -(2 * .pi)/60.0
let faceSize: CGSize = CGSize(width: 184, height: 224)
let dateFormatter: DateFormatter = {
let dateFormatter = DateFormatter()
dateFormatter.locale = NSLocale.current
dateFormatter.dateFormat = "ccc d"
return dateFormatter
}()
public var colorTheme: ColorTheme = .marques {
didSet { }
}
public var faceStyle: FaceStyle = .round {
didSet { }
}
public var numeralStyle: NumeralStyle = .all {
didSet { }
}
public var tickmarkStyle: TickmarkStyle = .all {
didSet { }
}
public var majorTickmarkShape: TickmarkShape = .rectangular {
didSet { }
}
public var minorTickmarkShape: TickmarkShape = .rectangular {
didSet { }
}
public var colorRegionStyle: ColorRegionStyle = .dynamicDuo {
didSet { }
}
public var useProgrammaticLayout: Bool = true {
didSet { refreshTheme() }
}
public var showDate: Bool = true {
didSet { }
}
public var showCenterDisc: Bool = false {
didSet { }
}
public override func sceneDidLoad() {
self.delegate = self
refreshTheme()
}
public func refreshTheme() {
if let markings = childNode(withName: "Markings") {
markings.removeAllChildren()
markings.removeFromParent()
}
if let markings = childNode(withName: "Markings Alternate") {
markings.removeAllChildren()
markings.removeFromParent()
}
setupScene()
if useProgrammaticLayout && colorTheme.shouldUseMasking && (colorRegionStyle == .dynamicDuo || colorRegionStyle == .half) {
setupMasking()
}
// var dict : [String:PlaygroundValue] = [:]
// dict["colorTheme"] = PlaygroundValue.integer(ColorTheme.allThemes.index(of:self.colorTheme))
}
func setupScene() {
guard let face = childNode(withName: "Face"),
let hourHand = face.childNode(withName: "Hours") as? SKSpriteNode,
let minuteHand = face.childNode(withName: "Minutes") as? SKSpriteNode,
let hourHandInlay = hourHand.childNode(withName: "Hours Inlay") as? SKSpriteNode,
let minuteHandInlay = minuteHand.childNode(withName: "Minutes Inlay") as? SKSpriteNode,
let secondHand = face.childNode(withName: "Seconds") as? SKSpriteNode,
let colorRegion = face.childNode(withName: "Color Region") as? SKSpriteNode,
let colorRegionReflection = face.childNode(withName: "Color Region Reflection") as? SKSpriteNode,
let numbers = face.childNode(withName: "Numbers") as? SKSpriteNode,
let centerDisc = face.childNode(withName: "Center Disc") as? SKSpriteNode else {
fatalError("Nodes missing from scene")
}
hourHand.color = colorTheme.handColor
hourHand.colorBlendFactor = 1
minuteHand.color = colorTheme.handColor
minuteHand.colorBlendFactor = 1
secondHand.color = colorTheme.secondHandColor
secondHand.colorBlendFactor = 1
backgroundColor = colorTheme.faceBackgroundColor
colorRegion.color = colorTheme.colorRegionColor
colorRegion.colorBlendFactor = 1
numbers.color = colorTheme.textColor
numbers.colorBlendFactor = 1
hourHandInlay.color = colorTheme.inlayColor
hourHandInlay.colorBlendFactor = 1
minuteHandInlay.color = colorTheme.inlayColor
minuteHandInlay.colorBlendFactor = 1
let colorRegionScale: CGFloat = 0.9
switch colorRegionStyle {
case .none:
colorRegion.alpha = 0
case .dynamicDuo:
colorRegion.alpha = 1
colorRegion.texture = nil
colorRegion.anchorPoint = CGPoint(x: 0.5, y: 0)
colorRegion.size = CGSize(width: 768, height: 768)
colorRegionReflection.texture = nil
case .half:
colorRegion.alpha = 1
colorRegion.texture = nil
colorRegion.anchorPoint = CGPoint(x: 0.5, y: 0)
colorRegion.size = CGSize(width: 768, height: 768)
colorRegionReflection.texture = nil
case .circle:
colorRegion.texture = SKTexture(imageNamed: "ColorRegionCircle")
colorRegion.anchorPoint = CGPoint(x: 0.5, y: 0.5)
colorRegion.position = .zero
colorRegion.size = CGSize(width: 179*colorRegionScale, height: 179*colorRegionScale)
colorRegionReflection.texture = SKTexture(imageNamed: "ColorRegionCircleReflection")
colorRegionReflection.anchorPoint = CGPoint(x: 0.5, y: 0.5)
colorRegionReflection.position = .zero
colorRegionReflection.size = CGSize(width: 368*colorRegionScale, height: 448*colorRegionScale)
case .ring:
colorRegion.texture = SKTexture(imageNamed: "ColorRegionRing")
colorRegion.anchorPoint = CGPoint(x: 0.5, y: 0.5)
colorRegion.position = .zero
colorRegion.size = CGSize(width: 179*colorRegionScale, height: 179*colorRegionScale)
colorRegionReflection.texture = SKTexture(imageNamed: "ColorRegionRingReflection")
colorRegionReflection.anchorPoint = CGPoint(x: 0.5, y: 0.5)
colorRegionReflection.position = .zero
colorRegionReflection.size = CGSize(width: 368*colorRegionScale, height: 448*colorRegionScale)
}
if useProgrammaticLayout {
numbers.alpha = 0
if faceStyle == .round {
if #available(iOSApplicationExtension 11, *)
{
setupTickmarksForRoundFace()
}
} else {
if #available(iOSApplicationExtension 11, *)
{
setupTickmarksForRectangularFace()
}
}
} else {
numbers.alpha = 1
}
if showCenterDisc {
centerDisc.alpha = 1
} else {
centerDisc.alpha = 0
}
colorRegionReflection.alpha = 0
}
func setupMasking() {
guard let face = childNode(withName: "Face"),
let faceMarkings = childNode(withName: "Markings") as? SKCropNode,
let colorRegion = face.childNode(withName: "Color Region") as? SKSpriteNode,
let colorRegionReflection = face.childNode(withName: "Color Region Reflection") as? SKSpriteNode else {
fatalError("Nodes missing from scene")
}
faceMarkings.maskNode = colorRegion
if faceStyle == .round {
if #available(iOSApplicationExtension 11, *)
{
setupTickmarksForRoundFace(isAlternateLayer: true)
}
} else {
if #available(iOSApplicationExtension 11, *)
{
setupTickmarksForRectangularFace(isAlternateLayer: true)
}
}
colorRegionReflection.alpha = 1
if let markings = childNode(withName: "Markings Alternate") as? SKCropNode {
markings.maskNode = colorRegionReflection
}
}
@available(iOSApplicationExtension 11, *)
func setupTickmarksForRoundFace(isAlternateLayer: Bool = false) {
let faceMarkings = SKCropNode()
let textColor: SKColor
let majorMarkColor: SKColor
let minorMarkColor: SKColor
if isAlternateLayer {
faceMarkings.name = "Markings Alternate"
textColor = colorTheme.alternateTextColor!
majorMarkColor = colorTheme.alternateMajorMarkColor!
minorMarkColor = colorTheme.alternateMinorMarkColor!
} else {
faceMarkings.name = "Markings"
textColor = colorTheme.textColor
majorMarkColor = colorTheme.majorMarkColor
minorMarkColor = colorTheme.minorMarkColor
}
/* Hardcoded for 44mm Apple Watch */
let margin: CGFloat = 4
let labelMargin: CGFloat = 26
for i in 0..<12 {
let angle: CGFloat = FaceScene.minus2piOver12 * CGFloat(i)
let workingRadius: CGFloat = faceSize.width / 2
let longTickHeight: CGFloat = workingRadius / 15
if tickmarkStyle == .all || tickmarkStyle == .major {
let tick = SKSpriteNode(color: majorMarkColor, size: CGSize(width: 2, height: longTickHeight))
tick.position = .zero
tick.anchorPoint = CGPoint(x: 0.5, y: (workingRadius - margin) / longTickHeight)
tick.zRotation = angle
faceMarkings.addChild(tick)
switch majorTickmarkShape {
case .rectangular:
break
case .circular:
tick.color = .clear
let shape = SKShapeNode(ellipseOf: CGSize(width: longTickHeight, height: longTickHeight))
shape.fillColor = majorMarkColor
shape.strokeColor = .clear
shape.position = CGPoint(x: 0, y: (workingRadius - margin) - longTickHeight/2)
tick.addChild(shape)
case .triangular:
tick.color = .clear
let triangleHeight: CGFloat = numeralStyle == .none ? 8 : 3
let triangleWidth: CGFloat = 4
var points = [CGPoint(x: -(0.5 * triangleWidth), y: triangleHeight),
CGPoint(x: 0, y: -triangleHeight),
CGPoint(x: (0.5 * triangleWidth), y: triangleHeight)
]
let shape = SKShapeNode(points: &points, count: points.count)
shape.fillColor = majorMarkColor
shape.strokeColor = .clear
shape.position = CGPoint(x: 0, y: (workingRadius - margin) - triangleHeight)
tick.addChild(shape)
}
}
if numeralStyle == .all || numeralStyle == .cardinal && i%3 == 0 {
let fontSize: CGFloat = 25
let attributes: [NSAttributedStringKey: Any] = [.font: NSFont.systemFont(ofSize: fontSize, weight: .medium).smallCaps,
.foregroundColor: textColor]
let labelText = NSAttributedString(string: (i == 0 ? 12 : i).description, attributes: attributes)
let numberLabel = SKLabelNode(attributedText: labelText)
numberLabel.position = CGPoint(x: (workingRadius-labelMargin) * -sin(angle), y: (workingRadius-labelMargin) * cos(angle) - 9)
faceMarkings.addChild(numberLabel)
}
}
if tickmarkStyle == .all || tickmarkStyle == .minor {
for i in 0..<60 {
guard i % 5 != 0 else {
continue
}
let angle: CGFloat = FaceScene.minus2piOver60 * CGFloat(i)
let workingRadius: CGFloat = faceSize.width / 2
let shortTickHeight: CGFloat = workingRadius / 20
let tick = SKSpriteNode(color: minorMarkColor, size: CGSize(width: 1, height: shortTickHeight))
tick.position = .zero
tick.anchorPoint = CGPoint(x: 0.5, y: (workingRadius - margin) / shortTickHeight)
tick.zRotation = angle
faceMarkings.addChild(tick)
switch minorTickmarkShape {
case .rectangular:
break
case .circular:
tick.color = .clear
let shape = SKShapeNode(ellipseOf: CGSize(width: 3, height: 3))
shape.fillColor = minorMarkColor
shape.strokeColor = .clear
shape.position = CGPoint(x: 0, y: (workingRadius - margin) - shortTickHeight/2)
tick.addChild(shape)
case .triangular:
tick.color = .clear
let triangleHeight: CGFloat = numeralStyle == .none ? 4 : 2
let triangleWidth: CGFloat = 2
var points = [CGPoint(x: -(0.5 * triangleWidth), y: triangleHeight),
CGPoint(x: 0, y: -triangleHeight),
CGPoint(x: (0.5 * triangleWidth), y: triangleHeight)
]
let shape = SKShapeNode(points: &points, count: points.count)
shape.fillColor = minorMarkColor
shape.strokeColor = .clear
shape.position = CGPoint(x: 0, y: (workingRadius - margin) - triangleHeight)
tick.addChild(shape)
}
}
}
if showDate {
let dateLabel = SKLabelNode(text: nil)
dateLabel.name = "Date"
if numeralStyle == .none {
dateLabel.position = CGPoint(x: 42, y: -4)
} else {
dateLabel.position = CGPoint(x: 32, y: -4)
}
faceMarkings.addChild(dateLabel)
}
addChild(faceMarkings)
}
func workingRadiusForAngle(_ angle: CGFloat) -> CGFloat {
let vx: CGFloat = cos(angle)
let vy: CGFloat = sin(angle)
let x1: CGFloat = 0
let y1: CGFloat = 0
let x2: CGFloat = faceSize.height
let y2: CGFloat = faceSize.width
let px: CGFloat = faceSize.height / 2
let py: CGFloat = faceSize.width / 2
let t = [
(x1-px)/vx,
(x2-px)/vx,
(y1-py)/vy,
(y2-py)/vy
]
let smallestT: CGFloat = t.reduce(1000) { (result, currentT) -> CGFloat in
if currentT > 0 && currentT < result {
return currentT
}
return result
}
return smallestT
}
@available(iOSApplicationExtension 11, *)
func setupTickmarksForRectangularFace(isAlternateLayer: Bool = false) {
let faceMarkings = SKCropNode()
let textColor: SKColor
let majorMarkColor: SKColor
let minorMarkColor: SKColor
if isAlternateLayer {
faceMarkings.name = "Markings Alternate"
textColor = colorTheme.alternateTextColor!
majorMarkColor = colorTheme.alternateMajorMarkColor!
minorMarkColor = colorTheme.alternateMinorMarkColor!
} else {
faceMarkings.name = "Markings"
textColor = colorTheme.textColor
majorMarkColor = colorTheme.majorMarkColor
minorMarkColor = colorTheme.minorMarkColor
}
/* Hardcoded for 44mm Apple Watch */
let margin: CGFloat = 5
let labelXMargin: CGFloat = 24
let labelYMargin: CGFloat = 30
if tickmarkStyle == .all || tickmarkStyle == .major {
for i in 0..<12 {
let angle: CGFloat = FaceScene.minus2piOver12 * CGFloat(i)
let workingRadius: CGFloat = workingRadiusForAngle(angle)
let longTickHeight: CGFloat = workingRadius / 10
let tick = SKSpriteNode(color: majorMarkColor, size: CGSize(width: 2, height: longTickHeight))
tick.position = .zero
tick.anchorPoint = CGPoint(x: 0.5, y: (workingRadius - margin) / longTickHeight)
tick.zRotation = angle
tick.zPosition = 0
faceMarkings.addChild(tick)
switch majorTickmarkShape {
case .rectangular:
break
case .circular:
tick.color = .clear
let circleDiameter: CGFloat = 6
let shape = SKShapeNode(ellipseOf: CGSize(width: circleDiameter, height: circleDiameter))
shape.fillColor = majorMarkColor
shape.strokeColor = .clear
shape.position = CGPoint(x: 0, y: (workingRadius - margin) - circleDiameter/2)
tick.addChild(shape)
case .triangular:
tick.color = .clear
let triangleHeight: CGFloat = numeralStyle == .none ? 8 : 3
let triangleWidth: CGFloat = 4
var points = [CGPoint(x: -(0.5 * triangleWidth), y: triangleHeight),
CGPoint(x: 0, y: -triangleHeight),
CGPoint(x: (0.5 * triangleWidth), y: triangleHeight)
]
let shape = SKShapeNode(points: &points, count: points.count)
shape.fillColor = majorMarkColor
shape.strokeColor = .clear
shape.position = CGPoint(x: 0, y: (workingRadius - margin) - triangleHeight)
tick.addChild(shape)
}
}
}
if tickmarkStyle == .all || tickmarkStyle == .minor {
for i in 0..<60 {
guard i % 5 != 0 else {
continue
}
let angle: CGFloat = FaceScene.minus2piOver60 * CGFloat(i)
var workingRadius: CGFloat = workingRadiusForAngle(angle)
let shortTickHeight: CGFloat = workingRadius / 20
/* Super hacky hack to inset the tickmarks at the four corners of a curved display instead of doing math */
if (i == 6 || i == 7 || i == 23 || i == 24 || i == 36 || i == 37 || i == 53 || i == 54) {
workingRadius -= 8
}
let tick = SKSpriteNode(color: minorMarkColor, size: CGSize(width: 1, height: shortTickHeight))
tick.position = .zero
tick.anchorPoint = CGPoint(x: 0.5, y: (workingRadius - margin) / shortTickHeight)
tick.zRotation = angle
tick.zPosition = 0
faceMarkings.addChild(tick)
switch minorTickmarkShape {
case .rectangular:
break
case .circular:
tick.color = .clear
let shape = SKShapeNode(ellipseOf: CGSize(width: 3, height: 3))
shape.fillColor = minorMarkColor
shape.strokeColor = .clear
shape.position = CGPoint(x: 0, y: (workingRadius - margin) - shortTickHeight/2)
tick.addChild(shape)
case .triangular:
tick.color = .clear
let triangleHeight: CGFloat = numeralStyle == .none ? 4 : 2
let triangleWidth: CGFloat = 2
var points = [CGPoint(x: -(0.5 * triangleWidth), y: triangleHeight),
CGPoint(x: 0, y: -triangleHeight),
CGPoint(x: (0.5 * triangleWidth), y: triangleHeight)
]
let shape = SKShapeNode(points: &points, count: points.count)
shape.fillColor = minorMarkColor
shape.strokeColor = .clear
shape.position = CGPoint(x: 0, y: (workingRadius - margin) - triangleHeight)
tick.addChild(shape)
}
}
}
for i in 1...12 {
guard numeralStyle == .all || numeralStyle == .cardinal && i%3 == 0 else {
continue
}
let fontSize: CGFloat = 25
let labelNode = SKSpriteNode(color: .clear, size: CGSize(width: fontSize, height: fontSize))
labelNode.anchorPoint = CGPoint(x: 0.5, y: 0.5)
let faceWidthWithXMarginOver3: CGFloat = (faceSize.width-labelXMargin*2)/3.0
switch i {
case 1, 11, 12:
labelNode.position = CGPoint(x: labelXMargin-faceSize.width/2 + CGFloat((i+1)%3) * faceWidthWithXMarginOver3 + (faceSize.width-labelXMargin*2)/6.0,
y: faceSize.height/2-labelYMargin)
case 5, 6, 7:
labelNode.position = CGPoint(x: labelXMargin-faceSize.width/2 + CGFloat(2-((i+1)%3)) * faceWidthWithXMarginOver3 + (faceSize.width-labelXMargin*2)/6.0,
y: -faceSize.height/2+labelYMargin)
case 2, 3, 4:
labelNode.position = CGPoint(x: faceSize.height/2-fontSize-labelXMargin,
y: -(faceSize.width-labelXMargin*2)/2 + CGFloat(2-((i+1)%3)) * faceWidthWithXMarginOver3 + (faceSize.width-labelYMargin*2)/6.0)
case 8, 9, 10:
labelNode.position = CGPoint(x: -faceSize.height/2+fontSize+labelXMargin,
y: -(faceSize.width-labelXMargin*2)/2 + CGFloat((i+1)%3) * faceWidthWithXMarginOver3 + (faceSize.width-labelYMargin*2)/6.0)
default:
break
}
let attributes: [NSAttributedStringKey: Any] = [.font: NSFont.systemFont(ofSize: fontSize, weight: .medium).smallCaps,
.foregroundColor: textColor]
let labelText = NSAttributedString(string: i.description, attributes: attributes)
let numberLabel = SKLabelNode(attributedText: labelText)
numberLabel.position = CGPoint(x: 0, y: -9)
faceMarkings.addChild(labelNode)
labelNode.addChild(numberLabel)
}
if showDate {
let dateLabel = SKLabelNode(text: nil)
dateLabel.name = "Date"
if numeralStyle == .none {
dateLabel.position = CGPoint(x: 42, y: -4)
} else {
dateLabel.position = CGPoint(x: 32, y: -4)
}
faceMarkings.addChild(dateLabel)
}
addChild(faceMarkings)
}
public func update(_ currentTime: TimeInterval, for scene: SKScene) {
updateHands()
}
func updateHands() {
guard let face = childNode(withName: "Face"),
let hourHand = face.childNode(withName: "Hours") as? SKSpriteNode,
let minuteHand = face.childNode(withName: "Minutes") as? SKSpriteNode,
let secondHand = face.childNode(withName: "Seconds") as? SKSpriteNode,
let colorRegion = face.childNode(withName: "Color Region") as? SKSpriteNode,
let colorRegionReflection = face.childNode(withName: "Color Region Reflection") as? SKSpriteNode else {
fatalError("Nodes missing from scene")
}
let now = Date()
let calendar = Calendar.current
let components = calendar.dateComponents([.hour, .minute, .second, .nanosecond], from: now)
let hour: CGFloat = CGFloat(components.hour!).truncatingRemainder(dividingBy: 12)
let minute: CGFloat = CGFloat(components.minute!)
let second: CGFloat = CGFloat(components.second!)
let nanosecond: CGFloat = CGFloat(components.nanosecond!)
hourHand.zRotation = FaceScene.minus2piOver12 * (hour + 1.0/60.0*minute)
minuteHand.zRotation = FaceScene.minus2piOver60 * (minute + 1.0/60.0*second)
secondHand.zRotation = FaceScene.minus2piOver60 * (second + 1.0/CGFloat(NSEC_PER_SEC)*nanosecond)
switch colorRegionStyle {
case .none:
break
case .dynamicDuo:
colorRegion.alpha = 1.0;
colorRegion.zRotation = .pi/2 + minuteHand.zRotation
colorRegionReflection.zRotation = colorRegion.zRotation
case .half:
colorRegion.alpha = 1.0
colorRegion.zRotation = 0
colorRegionReflection.zRotation = 0
case .circle, .ring:
colorRegion.zRotation = 0
colorRegionReflection.zRotation = 0
}
if #available(iOSApplicationExtension 11, *)
{
updateDateLabel()
}
}
@available(iOSApplicationExtension 11, *)
func updateDateLabel() {
let now = Date()
let fontSize: CGFloat = 12
let dateString = dateFormatter.string(from: now).uppercased()
if let markings = childNode(withName: "Markings"),
let dateLabel = markings.childNode(withName: "Date") as? SKLabelNode {
let attributes: [NSAttributedStringKey: Any] = [.font: NSFont.systemFont(ofSize: fontSize, weight: .medium).smallCaps,
.foregroundColor: colorTheme.textColor]
let labelText = NSAttributedString(string: dateString, attributes: attributes)
dateLabel.attributedText = labelText
}
if let markings = childNode(withName: "Markings Alternate"),
let dateLabel = markings.childNode(withName: "Date") as? SKLabelNode,
let alternateTextColor = colorTheme.alternateTextColor {
let attributes: [NSAttributedStringKey: Any] = [.font: NSFont.systemFont(ofSize: fontSize, weight: .medium).smallCaps,
.foregroundColor: alternateTextColor]
let labelText = NSAttributedString(string: dateString, attributes: attributes)
dateLabel.attributedText = labelText
}
}
// MARK: -
public func writeToSharedSettings()
{
let defaults = UserDefaults.standard
defaults.set(self.colorTheme.name, forKey: "colorTheme")
defaults.set(self.faceStyle.rawValue, forKey: "faceStyle")
defaults.set(self.numeralStyle.rawValue, forKey: "numeralStyle")
defaults.set(self.tickmarkStyle.rawValue, forKey: "tickmarkStyle")
defaults.set(self.majorTickmarkShape.rawValue, forKey: "majorTickmarkShape")
defaults.set(self.minorTickmarkShape.rawValue, forKey: "minorTickmarkShape")
defaults.set(self.colorRegionStyle.rawValue, forKey: "colorRegionStyle")
defaults.set(self.useProgrammaticLayout, forKey: "useProgrammaticLayout")
defaults.set(self.showDate, forKey: "showDate")
defaults.set(self.showCenterDisc, forKey: "showCenterDisc")
if let proxy = PlaygroundPage.current.liveView as? PlaygroundRemoteLiveViewProxy {
let message = PlaygroundValue.integer(1)
proxy.send(message)
}
}
public func readFromSharedSettings()
{
let defaults = UserDefaults.standard
for theme in ColorTheme.allThemes {
if theme.name == defaults.string(forKey:"colorTheme")
{
self.colorTheme = theme
break
}
}
self.faceStyle = FaceStyle(rawValue:UInt(defaults.integer(forKey:"faceStyle")))!;
self.numeralStyle = NumeralStyle(rawValue:UInt(defaults.integer(forKey:"numeralStyle")))!;
self.tickmarkStyle = TickmarkStyle(rawValue:UInt(defaults.integer(forKey:"tickmarkStyle")))!;
self.majorTickmarkShape = TickmarkShape(rawValue:UInt(defaults.integer(forKey:"majorTickmarkShape")))!;
self.minorTickmarkShape = TickmarkShape(rawValue:UInt(defaults.integer(forKey:"minorTickmarkShape")))!;
self.colorRegionStyle = ColorRegionStyle(rawValue:UInt(defaults.integer(forKey:"colorRegionStyle")))!;
self.useProgrammaticLayout = defaults.bool(forKey:"useProgrammaticLayout");
self.showDate = defaults.bool(forKey:"showDate");
self.showCenterDisc = defaults.bool(forKey:"showCenterDisc");
}
}
public class FaceViewController : UIViewController, PlaygroundLiveViewSafeAreaContainer, PlaygroundRemoteLiveViewProxyDelegate, PlaygroundLiveViewMessageHandler
{
public override func viewDidLayoutSubviews()
{
let face = FaceScene.shared!
let maxSceneWidth = min(self.view.bounds.size.width, self.view.bounds.size.height)
face.camera?.xScale = (184.0/maxSceneWidth)
face.camera?.yScale = (184.0/maxSceneWidth)
}
// MARK: - Playgrounds
public func remoteLiveViewProxyConnectionClosed(_ remoteLiveViewProxy: PlaygroundRemoteLiveViewProxy) {
}
//Receive message from live view
public func remoteLiveViewProxy(_ remoteLiveViewProxy: PlaygroundRemoteLiveViewProxy, received message: PlaygroundValue) {
}
public func receive(_ message: PlaygroundValue) {
if case let .string(command) = message {
}
else if case let .integer(command) = message {
let face = FaceScene.shared!
face.readFromSharedSettings()
}
else if case let .dictionary(dict) = message {
//face.colorTheme = ColorTheme.allThemes[.integer(dict["colorTheme"])]
//(rawValue:dict["colorTheme"])
}
else if case let .boolean(result) = message {
//send(.string(Constants.PROGRAM_FINISHED))
}
}
}
|
[
-1
] |
34891593df3748d92de549e3398e1e2a1af3e76b
|
7e1e6661de0ceb361294487c406440847e728468
|
/RxSwift-Practise/D_ViewController.swift
|
6484a93fac2845af63bbe7f25ccd04fd47975027
|
[
"MIT"
] |
permissive
|
yehot/RxSwift-Practise
|
531eddb4b2cfc80449f7953bcf33f6189d4230de
|
790dc9391f5a3305b6dd8835f40d74d95ce44ee8
|
refs/heads/master
| 2020-03-18T12:14:20.792990 | 2018-06-07T07:24:48 | 2018-06-07T07:24:48 | 134,716,468 | 2 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 4,009 |
swift
|
//
// D_ViewController.swift
// RxSwift-Practise
//
// Created by yehot on 2018/5/28.
// Copyright © 2018年 Xin Hua Zhi Yun. All rights reserved.
//
import UIKit
import RxCocoa
import RxSwift
// https://medium.com/@DianQK/%E5%9C%A8%E5%AE%9E%E8%B7%B5%E4%B8%AD%E5%BA%94%E7%94%A8-rxswift-%E5%B9%B6%E5%8F%91-f947f2c316a5
class D_ViewController: UIViewController {
lazy var bag = DisposeBag()
override func viewDidLoad() {
super.viewDidLoad()
// objectToRxObservable()
rxSerialConcurrentDemo()
}
// MARK: 2. 有序请求 demo
func rxSerialConcurrentDemo() {
let array1 = [1, 2, 3, 4, 5, 6, 7, 8]
Observable.from(array1)
.map { (num) -> URLRequest in
let urlStr = "https://httpbin.org/get?foo=" + String(num)
return URLRequest.init(url: URL.init(string: urlStr)!)
}
.map { (request) -> Observable<Data> in // flat map 改为 map
URLSession.shared.rx.data(request: request)
}
.concat() // 串行
// .merge(maxConcurrent: 3) // 控制并发
.map({ (data) -> [String : Any]? in
let dict = try JSONSerialization.jsonObject(with: data, options: .allowFragments)
return dict as? [String : Any]
})
.observeOn(MainScheduler.instance)
.subscribe(onNext: { (dict) in
if let jsonDict = dict {
print(jsonDict)
}
})
.disposed(by: bag)
}
// MARK: 1. 并发请求 demo (无序)
func rxConcurrentDemo() {
let array1 = [1, 2, 3, 4]
Observable.from(array1)
.map { (num) -> URLRequest in
let urlStr = "https://httpbin.org/get?foo=" + String(num)
return URLRequest.init(url: URL.init(string: urlStr)!)
}
.flatMap { (request) -> Observable<Data> in
URLSession.shared.rx.data(request: request)
}
.map({ (data) -> [String : Any]? in
let dict = try JSONSerialization.jsonObject(with: data, options: .allowFragments)
return dict as? [String : Any]
})
.observeOn(MainScheduler.instance)
.subscribe(onNext: { (dict) in
if let jsonDict = dict {
print(jsonDict)
}
})
.disposed(by: bag)
}
// MARK: 将 Native obj 转为 rx Observable
func objectToRxObservable() {
// 1.将数组包装为 Variable,转为 Observable
let array1 = [1, 2, 3, 4]
let observableArray = Variable(array1)
// 2.订阅 数组
observableArray.asObservable()
.subscribe(onNext: { (array) in
print(array)
})
.disposed(by: bag)
// 3.修改数组
observableArray.value.append(5)
// Variable 不再推荐使用,可换用 BehaviorRelay
let array2 = BehaviorRelay(value: array1)
array2.asObservable()
.subscribe { (arr) in
}
.disposed(by: bag)
}
// MARK: 将 array 转换为 流
// 从一个序列创建一个可被观察的序列
func arrayToFlow() {
let array1 = [1, 2, 3, 4]
Observable.from(array1)
.subscribe(onNext: { (num) in
print(num)
})
.disposed(by: bag)
}
// flat map 使用
func testFlatMap() {
let first = BehaviorSubject(value: "👦🏻")
let variable = Variable(first)
// rxswift 中,flat map 和 map 的区别:
// flatMap 处理的闭包,必须是 ObservableType -> ObservableConvertibleType
variable.asObservable()
.flatMap { $0 }
.subscribe(onNext: { print($0) })
.disposed(by: bag)
}
}
|
[
-1
] |
ff79d8a727fb13ab302604b8b99918534d72bb1c
|
2ec2496ee4f32c92cfe1491fad492e9e7ec33070
|
/Video3DrawTriangle/testMetal/renderer.swift
|
ec899041bb1f145cc9d5338832ea705a3a2923ae
|
[] |
no_license
|
ddvergsten/MetalRW
|
c29c2b0ea775cbfd0497e0d6a922ef38c0ea851e
|
95225555c8bf7875f8f72ac77af9a5d3b9cd3566
|
refs/heads/master
| 2022-01-18T16:33:49.065683 | 2022-01-08T16:18:00 | 2022-01-08T16:18:00 | 202,537,729 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 3,014 |
swift
|
//
// renderer.swift
// testMetal
//
// Created by David Dvergsten on 8/15/19.
// Copyright © 2019 Rapid Imaging Tech. All rights reserved.
//
import Foundation
import MetalKit
class Renderer:NSObject {
enum Colors{
static let green = MTLClearColor(red: 0.0, green: 1.0, blue: 0.0, alpha: 1.0)
}
var device:MTLDevice!
var vertices:[Float] = [
-1,1,0, //v0
-1,-1,0, //v1
1,-1,0, //v2
1,-1,0,
1,1,0, //v3
-1,1,0
]
//var indices:[UInt16] = [0,1,2,2,3,0]
var pipelineState: MTLRenderPipelineState?
var vertexBuffer:MTLBuffer?
var commandQueue:MTLCommandQueue!
var metalView: MTKView!
private func BuildModel(){
vertexBuffer = device.makeBuffer(bytes: vertices, length: vertices.count * MemoryLayout<Float>.size, options: [])
}
func setMTKView(to mtkView:MTKView) {
//func setMTKView(){
metalView = mtkView
metalView.device = MTLCreateSystemDefaultDevice()
device = metalView.device
metalView.clearColor = Colors.green
commandQueue = device.makeCommandQueue()
metalView.delegate = self
BuildModel()
BuildPipelineState()
}
private func BuildPipelineState(){
let library = device.makeDefaultLibrary()
let vertexFunction = library?.makeFunction(name: "vertex_shader")
let fragmentFunction = library?.makeFunction(name: "fragment_shader")
let pipelineDescriptor = MTLRenderPipelineDescriptor()
pipelineDescriptor.vertexFunction = vertexFunction
pipelineDescriptor.fragmentFunction = fragmentFunction
pipelineDescriptor.colorAttachments[0].pixelFormat = .bgra8Unorm
do{
pipelineState = try device.makeRenderPipelineState(descriptor: pipelineDescriptor)
}
catch let error as NSError{
print("error: \(error.localizedDescription)")
}
}
override init() {
print("initializing")
//metalView = mtkView
//metalView.device = MTLCreateSystemDefaultDevice()
}
}
extension Renderer:MTKViewDelegate{
func mtkView(_ view: MTKView, drawableSizeWillChange size: CGSize) {
}
func draw(in view: MTKView) {
guard let drawable = view.currentDrawable,
let pipelineState = pipelineState,
let descriptor = view.currentRenderPassDescriptor else{
return
}
let commandBuffer = commandQueue.makeCommandBuffer()
let commandEncoder = commandBuffer?.makeRenderCommandEncoder(descriptor: descriptor)
commandEncoder?.setRenderPipelineState(pipelineState)
commandEncoder?.setVertexBuffer(vertexBuffer, offset: 0, index: 0)
commandEncoder?.drawPrimitives(type: .triangle, vertexStart: 0, vertexCount: vertices.count)
commandEncoder?.endEncoding()
commandBuffer?.present(drawable)
commandBuffer?.commit()//draw at the gpu
}
}
|
[
-1
] |
0a0ca317e4f0298e6807302e09a5c5c68598e766
|
454d519e0100f64b4b4f0a4a00f659ba7da90289
|
/viper/viperTests/viperTests.swift
|
74227231035d760390a334db9049d56ad6b12795
|
[] |
no_license
|
swami701/mvc-mvp-viper-ios
|
385f20ce1b0e0d89361c63daec751d8796242384
|
d484d2b1f52ec699168293350e96ad9d5bedbaaf
|
refs/heads/master
| 2021-06-27T21:40:24.372105 | 2017-09-14T14:52:07 | 2017-09-14T14:52:07 | 103,469,835 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 982 |
swift
|
//
// viperTests.swift
// viperTests
//
// Created by Swaminathan Nagarajan on 14/09/17.
// Copyright © 2017 Swaminathan Nagarajan. All rights reserved.
//
import XCTest
@testable import viper
class viperTests: XCTestCase {
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()
}
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}
|
[
98333,
278558,
16419,
229413,
204840,
278570,
344107,
155694,
253999,
229424,
229430,
319542,
180280,
213052,
286788,
352326,
311372,
196691,
278615,
237663,
278634,
319598,
352368,
131191,
237689,
131198,
278655,
311438,
278677,
278685,
311458,
278691,
49316,
278699,
32941,
278704,
278708,
131256,
278714,
295098,
254170,
229597,
286958,
327929,
278797,
180493,
254226,
319763,
278816,
98610,
278842,
287041,
287043,
139589,
319813,
319821,
254286,
344401,
278869,
155990,
106847,
246127,
246136,
139640,
246137,
311681,
246178,
311727,
377264,
278970,
319930,
336317,
278978,
188871,
278989,
278993,
278999,
328152,
369116,
188894,
287198,
279008,
279013,
279018,
311786,
319981,
319987,
279029,
279032,
279039,
287241,
279050,
279062,
279065,
180771,
377386,
279094,
352829,
115270,
295519,
66150,
344680,
279146,
295536,
287346,
287352,
279164,
189057,
311941,
279177,
369289,
344715,
311949,
287374,
352917,
230040,
271000,
303771,
205471,
279206,
295590,
287404,
295599,
205487,
303793,
164533,
230072,
287417,
287422,
66242,
287433,
287439,
279252,
295652,
279269,
246503,
230125,
312047,
279280,
312052,
230134,
205568,
295682,
295697,
336671,
344865,
279336,
262954,
295724,
312108,
353069,
164656,
303920,
262962,
328499,
353078,
230199,
353079,
336702,
295744,
279362,
353094,
353095,
353109,
230234,
295776,
279392,
303972,
279397,
230248,
246641,
246648,
279417,
361337,
254850,
287622,
58253,
295824,
189348,
279464,
353195,
140204,
353197,
304051,
189374,
353216,
213960,
279498,
304087,
50143,
123881,
320493,
304110,
320494,
287731,
295927,
304122,
320507,
328700,
328706,
320516,
230410,
320527,
418837,
140310,
197657,
336929,
189474,
345132,
238639,
312373,
238651,
238664,
296019,
353367,
156764,
156765,
304222,
230499,
279660,
353397,
279672,
337017,
279685,
222343,
296086,
238743,
296092,
238765,
279728,
238769,
230588,
279747,
353479,
353481,
353482,
279760,
189652,
279765,
189653,
148696,
296153,
279774,
304351,
304356,
279785,
279792,
353523,
279814,
312587,
328971,
173334,
320796,
304421,
279854,
345396,
116026,
222524,
279875,
304456,
230729,
296270,
238927,
296273,
222559,
230756,
230765,
296303,
279920,
312689,
296307,
116084,
378244,
296329,
296335,
279974,
279984,
173491,
279989,
361927,
296392,
280010,
370123,
148940,
280013,
312782,
222675,
353750,
239068,
280032,
280041,
361963,
329197,
329200,
321009,
280055,
288249,
296448,
230921,
296461,
304656,
329232,
230959,
312880,
288309,
288318,
280130,
124485,
288326,
288327,
239198,
157281,
312940,
222832,
247416,
288378,
337535,
239237,
288392,
239250,
345752,
255649,
206504,
321199,
337591,
321207,
296632,
280251,
280257,
321219,
280267,
9936,
313041,
9937,
280278,
280280,
18138,
67292,
321247,
288491,
280300,
239341,
313081,
124669,
288512,
288516,
280327,
280329,
321302,
116505,
321310,
247590,
280366,
280372,
321337,
280380,
280390,
280392,
345929,
304977,
18262,
280410,
370522,
345951,
362337,
345955,
296806,
288619,
288620,
280430,
362352,
313203,
124798,
182144,
305026,
67463,
329622,
337815,
124824,
214937,
214938,
354212,
124852,
288697,
214977,
280514,
280519,
214984,
247757,
231375,
280541,
337895,
247785,
296941,
329712,
362480,
313339,
313357,
182296,
239650,
354343,
354345,
223274,
124975,
346162,
124984,
288833,
288834,
313416,
354385,
223316,
280661,
329814,
338007,
354393,
280675,
280677,
313447,
288879,
223350,
280694,
288889,
215164,
313469,
215166,
280712,
215178,
346271,
239793,
125109,
182456,
280762,
223419,
379071,
280768,
338119,
280778,
321745,
280795,
280802,
338150,
125169,
338164,
125183,
125188,
313608,
125193,
125198,
125203,
125208,
305440,
125217,
125235,
280887,
125240,
321860,
280902,
182598,
289110,
272729,
379225,
354655,
321894,
280939,
313713,
354676,
199029,
362881,
248194,
395659,
395661,
240016,
190871,
141728,
289189,
281040,
281072,
289304,
182817,
338490,
322120,
281166,
281171,
354911,
436832,
191082,
313966,
281199,
330379,
330387,
330388,
289434,
338613,
166582,
314040,
158394,
363211,
289502,
363230,
338662,
346858,
289518,
125684,
199414,
35583,
363263,
191235,
322313,
322316,
322319,
166676,
207640,
281377,
289576,
281408,
420677,
281427,
281433,
322395,
330609,
207732,
240518,
289698,
289703,
289727,
363458,
19399,
338899,
248797,
207838,
314342,
289774,
183279,
314355,
240630,
314362,
134150,
322570,
322582,
281626,
248872,
322612,
314448,
281697,
314467,
281700,
322663,
207979,
363644,
150657,
248961,
339102,
306338,
249002,
208058,
339130,
290000,
298208,
298212,
290022,
330984,
298228,
216315,
208124,
388349,
363771,
322824,
126237,
339234,
306494,
216386,
224586,
372043,
314710,
314720,
281957,
306542,
314739,
290173,
306559,
224640,
298374,
314758,
314760,
142729,
388487,
314766,
306579,
224661,
282007,
290207,
314783,
314789,
282022,
314791,
282024,
241066,
314798,
380357,
339398,
306631,
306639,
191981,
282096,
306673,
306677,
191990,
290300,
290301,
282114,
306692,
306693,
323080,
323087,
282129,
282136,
282141,
282146,
306723,
290358,
282183,
290390,
306776,
282213,
323178,
314998,
175741,
282245,
224901,
282246,
290443,
323217,
282259,
282271,
282273,
323236,
282276,
298661,
290471,
282280,
298667,
282303,
323263,
282312,
306890,
282318,
241361,
282327,
298712,
298720,
12010,
282348,
282355,
282358,
282369,
175873,
323331,
323332,
216839,
282378,
282391,
249626,
282400,
241441,
339745,
257830,
282409,
282417,
200498,
282427,
315202,
282434,
307011,
282438,
307025,
413521,
216918,
307031,
282480,
241528,
315264,
339841,
282504,
315273,
315274,
110480,
184208,
282518,
282519,
298909,
118685,
298920,
200627,
290745,
290746,
151497,
298980,
282612,
290811,
282633,
241692,
102437,
233517,
315476,
307289,
200794,
315487,
307299,
315497,
315498,
299121,
233589,
233590,
241808,
323729,
233636,
184484,
299174,
233642,
184505,
299198,
299203,
282831,
356576,
176362,
184570,
184575,
299293,
233762,
217380,
282919,
151847,
332085,
332089,
315706,
282939,
307517,
241986,
332101,
323916,
348492,
250192,
323920,
348500,
323935,
242029,
291192,
225670,
291224,
242078,
283038,
61857,
315810,
61859,
315811,
381347,
340398,
299441,
61873,
283064,
61880,
127427,
127428,
283075,
324039,
176601,
242139,
160225,
242148,
291311,
233978,
291333,
340490,
283153,
291358,
283182,
283184,
234036,
315960,
70209,
348742,
70215,
348749,
332378,
111208,
291454,
348806,
152203,
184973,
111253,
316053,
111259,
299699,
299700,
225995,
299746,
234217,
299759,
299770,
234234,
299776,
242433,
291592,
291604,
283419,
234277,
283430,
152365,
242485,
234294,
160575,
299849,
283467,
201551,
349026,
275303,
177001,
201577,
308076,
242541,
209783,
209785,
177019,
291712,
308107,
308112,
234386,
209817,
324506,
324507,
324517,
283558,
349121,
316364,
340955,
340961,
324586,
340974,
316405,
201720,
234500,
324625,
234514,
316437,
201755,
300068,
357414,
300084,
324666,
308287,
21569,
300111,
234577,
341073,
234587,
250981,
300135,
300136,
316520,
316526,
357486,
300146,
300151,
291959,
160891,
341115,
300158,
349316,
349318,
234638,
169104,
177296,
308372,
185493,
119962,
300187,
300188,
234663,
300201,
300202,
283840,
259268,
283847,
62665,
283852,
283853,
357595,
234733,
292085,
234742,
292091,
316669,
234755,
242954,
292107,
251153,
177428,
300343,
193859,
300359,
234827,
177484,
251213,
234831,
120148,
283991,
357719,
234850,
292195,
333160,
284014,
243056,
111993,
112017,
112018,
234898,
357786,
333220,
316842,
210358,
284089,
292283,
415171,
292292,
300487,
300489,
284107,
366037,
210390,
210391,
210393,
144867,
54765,
251378,
300535,
300536,
300542,
210433,
366083,
316946,
308756,
398869,
308764,
349726,
349741,
169518,
235070,
194110,
349763,
218696,
292425,
243274,
128587,
333388,
333393,
300630,
128599,
235095,
374372,
300644,
317032,
54893,
366203,
235135,
333470,
300714,
218819,
333517,
333520,
333521,
333523,
153319,
284401,
325371,
194303,
194304,
300811,
284429,
161554,
366360,
284442,
325404,
325410,
341796,
300848,
317232,
325439,
153415,
341836,
325457,
284507,
300894,
284512,
284514,
276327,
292712,
325484,
292720,
325492,
300918,
194429,
325503,
333701,
243591,
243597,
325518,
300963,
292771,
333735,
284587,
292782,
243637,
284619,
301008,
153554,
194515,
219101,
292836,
292837,
325619,
333817,
292858,
145435,
292902,
227370,
309295,
358456,
309345,
227428,
194666,
284788,
333940,
292988,
292992,
194691,
227460,
333955,
235662,
325776,
317587,
284826,
333991,
333992,
284842,
227513,
301251,
309444,
227548,
301279,
243962,
309503,
194820,
375051,
325905,
325912,
309529,
227616,
211235,
260418,
227654,
325968,
6481,
366929,
366930,
6489,
391520,
416104,
285040,
317820,
211326,
227725,
227726,
293274,
317852,
285090,
375207,
293310,
317901,
326100,
285150,
358882,
342498,
195045,
301571,
342536,
342553,
375333,
244269,
236081,
23092,
309830,
301638,
293448,
55881,
309846,
244310,
244327,
301689,
244347,
227990,
342682,
285361,
342706,
318130,
293556,
342713,
285373,
154316,
334547,
96984,
318173,
285415,
342762,
129773,
154359,
228088,
162561,
285444,
285458,
285466,
326429,
326433,
318250,
318252,
301871,
285497,
293693,
318278,
293711,
301918,
293730,
351077,
342887,
400239,
228215,
269178,
359298,
113542,
228233,
228234,
56208,
293781,
318364,
310176,
310178,
310182,
293800,
236461,
293806,
130016,
64485,
318461,
146448,
252980,
359478,
302139,
359495,
277597,
113760,
285798,
228458,
15471,
187506,
285814,
285820,
187521,
285828,
302213,
302216,
228491,
228493,
285838,
162961,
326804,
187544,
302240,
343203,
253099,
367799,
64700,
343234,
367810,
244940,
228563,
310497,
228588,
253167,
302325,
228600,
228609,
245019,
130338,
130343,
351537,
286018,
113987,
294218,
318805,
294243,
163175,
327025,
327031,
179587,
368011,
318864,
318875,
310692,
286129,
286132,
228795,
302529,
302531,
163268,
310732,
302540,
64975,
327121,
228827,
286172,
310757,
187878,
343542,
343543,
286202,
286205,
302590,
228861,
294400,
228867,
253452,
146964,
286244,
245287,
245292,
286254,
196164,
56902,
228943,
286288,
196187,
343647,
286306,
310889,
204397,
138863,
294529,
286343,
229001,
310923,
188048,
229020,
302754,
245412,
40613,
40614,
40615,
229029,
286388,
286391,
319162,
286399,
212685,
212688,
245457,
302802,
286423,
278233,
278234,
294622,
278240,
229088,
212716,
212717,
229113,
286459,
278272,
319233,
311042,
278291,
294678,
286494,
294700,
360252,
188251,
245599,
237408,
302946,
253829,
294807,
294809,
294814,
319392,
294823,
294843,
98239,
294850,
163781,
344013,
212946,
294886,
253929,
327661,
278512,
311281,
311282
] |
84197168dac1f5f8f3427e3078a4cb5c14532f8b
|
7c07d4e0c808d49a1bc18726dc7e3995217aa728
|
/Utility.swift
|
c9fc8039674c970f1b7c2c002f6af37c75ff25a3
|
[] |
no_license
|
Ashishjha007/Weather-App
|
ea51268b8eb1c77a9f9010c38a379a9fec3b7ab4
|
9f3dea1be6eb5f041d243a8c98ccd67af1f4efdb
|
refs/heads/master
| 2021-01-21T23:16:57.442822 | 2017-10-06T13:36:02 | 2017-10-06T13:36:02 | 95,222,634 | 0 | 0 | null | 2017-10-06T13:36:22 | 2017-06-23T13:28:16 |
Swift
|
UTF-8
|
Swift
| false | false | 1,305 |
swift
|
//
// Utility.swift
// Weather
//
// Created by Ashish jha on 6/16/17.
// Copyright © 2017 xyz. All rights reserved.
//
import Foundation
import UIKit
// Date formatter to get week date
func weekDateStringFromUnixtime(_ time: Int) -> String {
let timeInSeconds = TimeInterval(time)
let weatherDate = Date(timeIntervalSince1970: timeInSeconds)
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "EEE"
return dateFormatter.string(from: weatherDate)
}
// Date formatter to get days
func dateStringFromUnixtime(_ time: Int) -> String {
let timeInSeconds = TimeInterval(time)
let weatherDate = Date(timeIntervalSince1970: timeInSeconds)
let dateFormatter = DateFormatter()
dateFormatter.timeStyle = .medium
return dateFormatter.string(from: weatherDate)
}
//Convert fahrenheit To Celsius
func fahrenheitToCelsius(_ f: Int) -> Int {
return Int((Double(f)-32.0) / 1.8)
}
// Spring animation to animate views
func springWithDelay(_ duration: TimeInterval, delay: TimeInterval, animations: (() -> Void)!) {
UIView.animate(withDuration: duration, delay: delay, usingSpringWithDamping: 0.7, initialSpringVelocity: 0.8, options: [], animations: {
animations()
}, completion: { finished in
})
}
|
[
-1
] |
a5e6dacbf39527afd514d493a8442d8d58911253
|
cccfa594210d1d99e1dfaa44d3a035d22ee42cbf
|
/CityAirportSearch/CityAirportSearch/Airports Feature/Model/Geoloc.swift
|
c475c43ccc91b5a2fe1593f2b14d736014d22150
|
[] |
no_license
|
rombiddle/FRP---City-Airport-Search
|
e8c36f2882ca6145681c7f07a9959db3bf2c83c9
|
749c0550fc41c2fa43a05242a5e64aa324f318b3
|
refs/heads/master
| 2023-06-04T07:53:44.470742 | 2021-06-23T07:18:24 | 2021-06-23T07:18:24 | 373,568,832 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 170 |
swift
|
//
// Geoloc.swift
// CityAirportSearch
//
// Created by Romain Brunie on 08/06/2021.
//
import Foundation
struct Geoloc {
let lat: Double
let lng: Double
}
|
[
-1
] |
df27a2d489001d109784670e30dd38554c76ff67
|
765591fb4228c03f1bcea1f5c6b7bca40884dbf1
|
/lithelp/lithelp/ViewController.swift
|
7e87ec8d0233b031fec95ae122736ff414dd63cd
|
[] |
no_license
|
harshpreet93/SwiftPracticeApps
|
0ef60fc4943383dfe45045123d3dbe7fdc1d056d
|
0bef45c904cb88c20b4154e43c2002730278eacc
|
refs/heads/master
| 2020-05-19T14:16:59.789959 | 2014-09-26T06:53:59 | 2014-09-26T06:53:59 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 935 |
swift
|
import UIKit
class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
override func viewDidLoad() {
super.viewDidLoad()
// 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.
}
func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -> Int {
return 10
}
func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! {
let cell: UITableViewCell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: "MyTestCell")
cell.text = "Row #\(indexPath.row)"
cell.detailTextLabel.text = "Subtitle #\(indexPath.row)"
return cell
}
}
|
[
-1
] |
563ef304f60716353a4b3db039da01dbd90b988e
|
222013c9e7994552662cacb8a1914f389aea1031
|
/gravityTests/gravityTests.swift
|
c2fc280be09689b67a55027d22a5b396f8aee341
|
[] |
no_license
|
GaryonGit/Gravity
|
51f82f09f0781599fb1287ecb303ede611357cc2
|
ad6a3915f1aa5f238a8cb2a439612e274f0042ac
|
refs/heads/master
| 2016-08-12T22:39:24.611269 | 2016-02-11T06:42:24 | 2016-02-11T06:42:24 | 51,498,646 | 0 | 1 | null | null | null | null |
UTF-8
|
Swift
| false | false | 970 |
swift
|
//
// gravityTests.swift
// gravityTests
//
// Created by Gary on 27/01/2016.
// Copyright © 2016 fromTheLoft. All rights reserved.
//
import XCTest
@testable import gravity
class gravityTests: XCTestCase {
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()
}
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measureBlock {
// Put the code you want to measure the time of here.
}
}
}
|
[
333828,
282633,
305179,
317467,
241692,
278558,
307231,
313375,
239650,
102437,
229413,
354343,
354345,
227370,
278570,
360491,
233517,
309295,
229424,
282672,
237620,
276534,
229430,
288828,
159807,
288833,
288834,
286788,
280649,
254027,
311372,
315476,
223316,
223318,
278615,
280661,
288857,
227417,
354393,
180311,
180312,
315487,
194656,
45153,
309345,
237663,
227428,
280675,
276582,
313447,
280677,
307299,
131178,
194666,
278634,
276589,
278638,
227439,
319598,
288879,
284788,
131189,
280694,
223350,
131191,
288889,
292988,
215164,
278655,
292992,
280712,
141450,
215178,
311435,
278670,
311438,
276627,
317587,
278677,
276632,
284825,
284826,
278685,
311458,
196773,
284841,
233642,
284842,
278704,
239793,
323762,
129203,
299187,
131256,
227513,
278714,
280762,
223419,
299198,
280768,
227524,
309444,
276682,
280778,
282831,
280795,
227548,
311519,
317664,
356576,
280802,
176362,
321772,
286958,
233715,
157944,
211193,
168188,
278797,
319763,
309529,
278810,
299293,
282909,
278816,
237857,
233762,
211235,
217380,
227616,
211238,
282919,
262450,
98610,
280887,
278842,
282939,
315706,
287041,
260418,
311621,
227654,
280902,
227658,
276813,
6481,
6482,
278869,
289110,
6489,
379225,
323935,
106847,
391520,
276835,
321894,
416104,
280939,
276847,
285040,
242033,
280961,
311681,
227725,
178578,
178582,
190871,
293274,
285084,
61857,
285090,
61859,
246178,
289194,
108972,
377264,
278961,
278965,
293303,
61880,
283064,
276920,
33211,
319930,
276925,
278978,
283075,
127427,
291267,
127428,
324039,
278989,
317901,
373197,
281040,
278993,
326100,
278999,
328152,
176601,
369116,
285150,
287198,
279008,
227809,
358882,
227813,
279013,
279018,
279022,
291311,
281072,
309744,
279029,
279032,
279039,
276998,
287241,
279050,
186893,
303631,
279057,
283153,
303636,
279062,
223767,
279065,
223769,
291358,
182817,
293419,
283182,
283184,
23092,
234036,
279094,
277048,
338490,
329829,
70209,
309830,
55881,
281166,
281171,
287318,
309846,
295519,
66150,
277094,
111208,
279144,
279146,
277101,
313966,
281199,
287346,
277111,
287352,
301689,
279164,
291454,
184962,
303746,
279177,
152203,
277133,
133774,
287374,
330387,
330388,
117397,
227990,
295576,
230040,
314009,
303771,
221852,
285353,
279210,
287404,
205487,
295599,
279217,
285361,
342706,
299700,
303793,
299699,
293556,
314040,
287417,
158394,
285371,
303803,
285373,
287422,
199366,
287433,
225995,
333521,
225997,
287439,
242386,
279252,
226004,
203477,
226007,
287452,
289502,
226019,
279269,
285415,
342762,
277227,
293612,
330474,
289518,
312047,
279280,
209783,
199414,
230134,
154359,
234234,
299770,
221948,
279294,
299776,
234241,
295682,
205568,
285444,
242433,
209670,
291585,
322313,
226058,
234250,
234253,
295697,
285458,
234263,
285466,
283419,
234268,
293664,
326433,
234277,
283430,
279336,
289576,
234283,
295724,
312108,
234286,
285487,
234289,
234294,
230199,
285497,
162621,
234301,
289598,
281408,
293693,
162626,
160575,
277316,
318278,
234311,
234312,
299849,
283467,
234317,
277325,
293711,
201551,
234323,
281427,
234326,
281433,
234331,
301918,
279392,
295776,
349026,
293730,
234340,
303972,
242529,
234343,
230248,
201577,
234346,
246641,
234355,
207732,
174963,
277366,
228215,
234360,
209785,
279417,
177019,
234361,
277370,
234366,
234367,
308092,
158593,
269178,
291712,
234372,
226181,
113542,
213894,
226184,
277381,
228234,
308107,
287622,
295824,
56208,
234386,
234387,
293781,
234392,
324506,
277403,
324507,
234400,
279456,
289698,
234404,
283558,
289703,
279464,
234409,
275371,
236461,
234419,
234425,
234427,
287677,
189374,
234430,
353216,
234436,
234438,
213960,
279498,
316364,
52172,
234444,
234445,
183248,
234451,
234454,
234457,
50143,
234463,
340961,
234466,
314342,
277479,
234472,
234473,
52200,
324586,
203757,
234477,
234482,
287731,
277492,
314355,
316405,
293886,
234498,
234500,
277509,
277510,
230410,
234506,
330763,
324625,
234514,
277523,
277524,
140310,
230423,
320536,
197657,
281625,
281626,
175132,
189474,
234531,
300068,
234534,
310317,
234542,
234548,
234555,
238651,
277563,
230463,
234560,
308287,
207938,
234565,
238664,
234569,
300111,
234577,
296019,
234583,
234584,
353367,
234587,
277597,
304222,
302177,
281697,
230499,
281700,
285798,
322663,
300135,
228458,
207979,
281706,
275565,
279660,
15471,
144496,
156785,
312434,
275571,
234609,
285814,
300151,
234616,
398457,
279672,
160891,
285820,
291959,
234622,
300158,
187521,
150657,
234625,
285828,
279685,
285830,
302213,
253063,
234632,
275591,
228491,
302216,
330888,
234638,
162961,
234642,
308372,
185493,
296086,
238743,
283802,
119963,
285851,
300187,
339102,
234656,
330913,
306338,
234659,
234663,
275625,
300201,
281771,
249002,
238765,
279728,
238769,
226481,
208058,
277690,
230588,
64700,
228540,
228542,
283840,
322749,
302274,
279747,
283847,
353479,
283852,
279760,
290000,
228563,
189652,
279765,
316627,
279774,
304351,
298208,
363744,
195811,
298212,
304356,
290022,
298221,
279792,
298228,
302325,
204022,
234742,
228600,
292091,
208124,
216315,
228609,
234755,
322824,
292107,
312587,
328971,
277792,
339234,
199971,
304421,
277800,
279854,
113966,
226608,
298291,
300343,
286013,
333117,
226624,
286018,
279875,
193859,
15686,
226632,
294218,
224586,
177484,
222541,
372043,
238927,
296273,
120148,
314709,
318805,
283991,
357719,
218462,
222559,
224606,
142689,
234850,
230756,
281957,
163175,
281962,
134506,
284014,
296303,
279920,
243056,
327024,
181625,
224640,
179587,
281992,
142729,
368011,
230799,
296335,
112017,
306579,
9619,
282007,
357786,
318875,
290207,
310692,
333220,
279974,
282022,
282024,
316842,
173491,
304564,
279989,
296375,
284089,
292283,
228795,
296387,
415171,
163269,
296391,
296392,
300487,
302540,
280013,
312782,
64975,
306639,
310736,
284116,
329173,
212442,
228827,
239068,
226781,
286172,
280032,
310757,
187878,
316902,
280041,
296425,
308723,
333300,
306677,
191990,
280055,
333303,
286202,
286205,
300542,
282114,
306692,
306693,
329225,
192010,
149007,
65041,
282129,
308756,
282136,
204313,
302623,
333343,
230943,
286244,
278060,
286254,
230959,
288309,
194110,
280130,
349763,
282183,
276040,
218696,
366154,
288327,
292425,
276045,
243274,
228943,
286288,
333388,
280147,
300630,
290390,
306776,
147036,
243292,
333408,
157281,
286306,
282213,
317032,
222832,
276085,
288378,
325245,
188031,
294529,
192131,
282245,
282246,
286343,
288392,
229001,
310923,
290443,
323217,
282259,
276120,
229020,
276126,
282271,
282273,
302754,
282276,
229029,
298661,
40613,
40614,
40615,
300714,
298667,
323236,
278191,
198324,
286388,
296628,
286391,
296632,
282303,
280257,
218819,
282312,
306890,
280267,
302797,
276173,
333517,
9936,
212688,
302802,
282318,
245457,
241361,
280278,
286423,
280280,
282327,
18138,
216795,
298712,
278233,
278234,
276195,
282339,
153319,
313065,
12010,
280300,
282348,
419569,
276210,
282355,
284401,
282358,
229113,
300794,
286459,
276219,
194303,
278272,
282369,
288512,
311042,
288516,
323331,
323332,
216839,
280327,
280329,
300811,
276238,
284431,
278291,
278293,
294678,
282391,
116505,
284442,
278299,
310131,
276253,
282400,
313120,
315171,
282409,
333610,
284459,
159533,
280366,
282417,
200498,
296755,
280372,
321337,
276282,
276283,
280380,
282427,
276287,
345919,
282434,
307011,
276294,
282438,
280392,
280390,
276298,
323406,
18262,
216918,
307031,
280410,
284507,
188251,
284512,
237408,
284514,
276327,
292712,
282474,
288619,
280430,
296814,
292720,
282480,
246648,
300918,
276344,
317304,
194429,
305026,
241540,
67463,
282504,
325515,
243597,
110480,
184208,
40853,
282518,
282519,
44952,
214937,
214938,
294809,
239514,
294807,
294814,
247712,
241365,
292771,
294823,
284587,
282549,
276408,
288697,
290746,
294843,
294850,
276421,
280519,
284619,
276430,
231375,
153554,
24532,
276444,
280541,
329695,
298980,
292837,
276454,
317415,
294886,
247785,
276459,
296941,
278512,
282612
] |
80d50c1ff1d66b36976ebad944eba788ce018662
|
64d256d30b78c50323b99a71ceebdba8e6dea493
|
/StoreApp/ContentView.swift
|
4d9b8eb4e1357f6f12bcd07cc45023d1308a24bc
|
[] |
no_license
|
ram4ik/StoreApp
|
3d987a7b27940eabc0a48e1cc2d59e071fd9943a
|
0f3f04fc8a3091848d0b0b2ee3b738842180924d
|
refs/heads/main
| 2023-02-07T20:25:13.372444 | 2020-12-25T18:35:53 | 2020-12-25T18:35:53 | 303,661,828 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 606 |
swift
|
//
// ContentView.swift
// StoreApp
//
// Created by ramil on 13.10.2020.
//
import SwiftUI
struct ContentView: View {
@EnvironmentObject var data: AppData
var body: some View {
VStack {
Button(action: {
self.data.counter += 1
}, label: {
Text("Update")
})
Text("First Screen Counter")
Text("\(data.counter)")
.font(.largeTitle)
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
|
[
-1
] |
e49008dd349a919bd170c865fb1163f8d54671ba
|
7b366907de496438cde2d3be76fae4709090288e
|
/ToDoDemo/Scenes/Listing/ListingViewController.swift
|
e6b00cfe5aba70b9de4028f268b6fd31273e6484
|
[] |
no_license
|
etnclp/ToDoDemo
|
48fbe4f15ce7d40d4f4e8c88fd4de8cf72b049f7
|
a4324619dedad7ede49defb7bb313ebbb06404b6
|
refs/heads/master
| 2022-01-11T09:06:38.744702 | 2019-05-09T09:01:11 | 2019-05-09T09:01:11 | 185,437,219 | 0 | 0 | null | 2019-05-09T07:28:35 | 2019-05-07T16:10:33 |
Swift
|
UTF-8
|
Swift
| false | false | 3,675 |
swift
|
//
// ListingViewController.swift
// ToDoDemo
//
// Created by Erdi Tunçalp on 7.05.2019.
// Copyright © 2019 Erdi Tunçalp. All rights reserved.
//
import UIKit
import ActionKit
class ListingViewController: UIViewController, BindableType {
// MARK: - Properties
var viewModel: ListingViewModel!
// MARK: - IBOutlets
@IBOutlet weak private var tableView: UITableView!
// MARK: - View lifecycle
override func viewDidLoad() {
super.viewDidLoad()
title = "To-Do List"
navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(addBarButtonTapped))
tableView.contentInset = UIEdgeInsets(top: 20, left: 0, bottom: 0, right: 0)
tableView.dataSource = self
tableView.delegate = self
TodoCell.register(to: tableView)
}
// MARK: - Binding
func bindViewModel() {
viewModel.delegate = self
}
// MARK: - Actions
@objc private func addBarButtonTapped(_ sender: UIBarButtonItem) {
viewModel.addButtonAction()
}
private func showDeleteAlert(todoTitle: String, completion: @escaping (() -> Void)) {
let alert = UIAlertController(title: "\"\(todoTitle)\" will be deleted forever.", message: nil, preferredStyle: .actionSheet)
alert.addAction(UIAlertAction(title: "Delete to-do", style: .destructive, handler: { (_) in
completion()
}))
alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
self.present(alert, animated: true)
}
}
// MARK: - UITableViewDataSource
extension ListingViewController: UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return viewModel.elements.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell: TodoCell = tableView.dequeueReusableCell(forIndexPath: indexPath)
let element = viewModel.elements[indexPath.row]
cell.titleTextView.text = element.title
cell.checkButton.isSelected = element.isCheck
cell.checkButton.addControlEvent(.touchUpInside) { [weak self] (button) in
cell.checkButton.isSelected.toggle()
let isSelected = cell.checkButton.isSelected
self?.viewModel.updateCheck(todo: element, selected: isSelected)
}
return cell
}
func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
return true
}
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
let element = viewModel.elements[indexPath.row]
self.showDeleteAlert(todoTitle: String(element.title.prefix(10))) { [weak self] in
self?.viewModel.remove(todo: element)
}
}
}
}
// MARK: - UITableViewDelegate
extension ListingViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return TodoCell.Height
}
func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
return TodoCell.EstimatedHeight
}
}
// MARK: - ListingViewModelDelegate
extension ListingViewController: ListingViewModelDelegate {
func listingViewModelRefresh() {
self.tableView.reloadData()
}
}
|
[
-1
] |
ef63bccfc3426f58e19a6d8c3903d64acbe4d7ec
|
61c4c839e714f1b8e7b60115bbb0bf542219ff73
|
/BuildNetflixApp/StandardHomeMovie.swift
|
ff9f421d3c610f52a8e4955ac42f85aca38e8581
|
[] |
no_license
|
baeliman/BuildNetflixApp
|
9c6dc450655a68a7d05593a374697e4268d1cbd9
|
b54a087cd7a5b82c65549feabf1f328462d54b95
|
refs/heads/main
| 2022-12-28T11:23:14.422394 | 2020-09-29T11:01:27 | 2020-09-29T11:01:27 | 294,128,734 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 470 |
swift
|
//
// StandardHomeMovie.swift
// BuildNetflixApp
//
// Created by Doug Belli on 9/9/20.
//
import SwiftUI
import KingfisherSwiftUI
struct StandardHomeMovie: View {
var movie: Movie
var body: some View {
KFImage(movie.thumbnailURL)
.resizable()
.scaledToFill()
}
}
struct StandardHomeMovie_Previews: PreviewProvider {
static var previews: some View {
StandardHomeMovie(movie: exampleMoview5)
}
}
|
[
355048,
345325
] |
a6a198c788ec555bef6c126bcab71f0f9b1bf941
|
91e27ee2a86032c61951f49678af9baaf04edc4b
|
/Sources/Soto/Services/PersonalizeRuntime/PersonalizeRuntime_api.swift
|
6a60ae643441eea4b7f084c1eabf15acf3e30ce9
|
[
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
ADGrant/aws-sdk-swift
|
6cec9cffe8d1784abd873c8b4bd593e650ee3738
|
2a0f0d51cbb4a4ffd74dbf49c559e6263d43681c
|
refs/heads/master
| 2023-01-24T03:38:55.258413 | 2023-01-04T17:04:03 | 2023-01-04T17:04:03 | 133,521,608 | 0 | 0 | null | 2018-05-15T13:38:09 | 2018-05-15T13:38:09 | null |
UTF-8
|
Swift
| false | false | 4,591 |
swift
|
//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2022 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto-codegenerator.
// DO NOT EDIT.
@_exported import SotoCore
/// Service object for interacting with AWS PersonalizeRuntime service.
public struct PersonalizeRuntime: AWSService {
// MARK: Member variables
/// Client used for communication with AWS
public let client: AWSClient
/// Service configuration
public let config: AWSServiceConfig
// MARK: Initialization
/// Initialize the PersonalizeRuntime client
/// - parameters:
/// - client: AWSClient used to process requests
/// - region: Region of server you want to communicate with. This will override the partition parameter.
/// - partition: AWS partition where service resides, standard (.aws), china (.awscn), government (.awsusgov).
/// - endpoint: Custom endpoint URL to use instead of standard AWS servers
/// - timeout: Timeout value for HTTP requests
public init(
client: AWSClient,
region: SotoCore.Region? = nil,
partition: AWSPartition = .aws,
endpoint: String? = nil,
timeout: TimeAmount? = nil,
byteBufferAllocator: ByteBufferAllocator = ByteBufferAllocator(),
options: AWSServiceConfig.Options = []
) {
self.client = client
self.config = AWSServiceConfig(
region: region,
partition: region?.partition ?? partition,
service: "personalize-runtime",
signingName: "personalize",
serviceProtocol: .restjson,
apiVersion: "2018-05-22",
endpoint: endpoint,
errorType: PersonalizeRuntimeErrorType.self,
timeout: timeout,
byteBufferAllocator: byteBufferAllocator,
options: options
)
}
// MARK: API Calls
/// Re-ranks a list of recommended items for the given user. The first item in the list is deemed the most likely item to be of interest to the user. The solution backing the campaign must have been created using a recipe of type PERSONALIZED_RANKING.
public func getPersonalizedRanking(_ input: GetPersonalizedRankingRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) -> EventLoopFuture<GetPersonalizedRankingResponse> {
return self.client.execute(operation: "GetPersonalizedRanking", path: "/personalize-ranking", httpMethod: .POST, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
}
/// Returns a list of recommended items. For campaigns, the campaign's Amazon Resource Name (ARN) is required and the required user and item input depends on the recipe type used to create the solution backing the campaign as follows: USER_PERSONALIZATION - userId required, itemId not used RELATED_ITEMS - itemId required, userId not used Campaigns that are backed by a solution created using a recipe of type PERSONALIZED_RANKING use the API. For recommenders, the recommender's ARN is required and the required item and user input depends on the use case (domain-based recipe) backing the recommender. For information on use case requirements see Choosing recommender use cases.
public func getRecommendations(_ input: GetRecommendationsRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) -> EventLoopFuture<GetRecommendationsResponse> {
return self.client.execute(operation: "GetRecommendations", path: "/recommendations", httpMethod: .POST, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
}
}
extension PersonalizeRuntime {
/// Initializer required by `AWSService.with(middlewares:timeout:byteBufferAllocator:options)`. You are not able to use this initializer directly as there are no public
/// initializers for `AWSServiceConfig.Patch`. Please use `AWSService.with(middlewares:timeout:byteBufferAllocator:options)` instead.
public init(from: PersonalizeRuntime, patch: AWSServiceConfig.Patch) {
self.client = from.client
self.config = from.config.with(patch: patch)
}
}
|
[
-1
] |
5d8f208d63ad7061fbb0d911f7d4c951d524b68e
|
a1de34d0220f2c2575822a85fc574a407d7e880d
|
/OSXGame/GameViewController.swift
|
a29d225d2ef1a0277569d838b374afa0fcb778b1
|
[] |
no_license
|
michsoftster/Game
|
6fd995aaab433a10bfcbbc1bbeeba6cee1a59a08
|
54bfa13b308e615ec8b4c514c0ae856fa59ce9e5
|
refs/heads/master
| 2021-01-17T02:00:13.740112 | 2015-11-25T23:36:58 | 2015-11-25T23:36:58 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,477 |
swift
|
//
// GameViewController.swift
// OSXGame
//
// Created by Julio César Guzman on 11/21/15.
// Copyright (c) 2015 Julio. All rights reserved.
//
import SceneKit
import QuartzCore
extension NSColor {
static func randomColor () -> (NSColor) {
let red = CGFloat(arc4random_uniform(UInt32(256)))/256.0 as CGFloat
let green = CGFloat(arc4random_uniform(UInt32(256)))/256.0 as CGFloat
let blue = CGFloat(arc4random_uniform(UInt32(256)))/256.0 as CGFloat
return NSColor(red: red , green: green , blue: blue , alpha: 1.0)
}
}
class GameViewController: NSViewController {
@IBOutlet weak var gameView: GameView!
var renderer : SceneRenderer?
override func awakeFromNib(){
// create a new scene
let scene = SCNScene(named: "art.scnassets/scene.scn")!
// set the scene to the view
self.gameView!.scene = scene
//Set renderer
self.renderer = PracticaSceneRenderer(scene: scene)
gameView.delegate = self.renderer
// allows the user to manipulate the camera
self.gameView!.allowsCameraControl = true
// show statistics such as fps and timing information
self.gameView!.showsStatistics = true
// configure the view
self.gameView!.backgroundColor = NSColor.blackColor()
self.gameView!.playing = true
self.gameView!.loops = true
}
}
|
[
-1
] |
adf52c337544b8bdba4bb83151a2261904411d1f
|
3c442c7d6a663c8c30c5a9bdd46898f04016d3db
|
/EALayoutLite/ELayoutFrameworks/DemoViewController/UIView+binddata.swift
|
008dd4ca41628f75c50cf4db1dd55a5738e4331a
|
[] |
no_license
|
QiuZhiFei/EALayout
|
9e87c7d589c728393eb7b0cc768a6d3218f2fe8f
|
daaf9ab860294ddddf85f3af49c83d73204fd6f9
|
refs/heads/master
| 2021-01-20T23:36:26.096298 | 2015-08-15T12:01:06 | 2015-08-15T12:01:06 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 2,618 |
swift
|
import Foundation
/********************** 绑定基本数据到对象 *********************************/
//MARK: 绑定view最常用数据 UIView(bindData)
struct BD_Url
{
init(_ url:String?)
{
value = url
}
var value : String?
}
extension UIView
{
func bindData(data:Any?)
{
switch (self)
{
case is UILabel:
self.bindForUILabel(data)
case is UIImageView:
self.bindForUIImageView(data)
case is UIButton:
bindForUIButton(data)
/*
case is EAButton:
bindForEAButton(data)
case is TQRichTextView:
bindForTQRichTextView(data)
*/
default:
break;
}
}
func bindForUILabel(var data:Any?)
{
data = data ?? ""
if let str = data as? NSString
{
(self as! UILabel).text = str as String
}
}
func bindForUIImageView(var data:Any?)
{
if nil == data || data is UIImage
{
(self as! UIImageView).image = data as? UIImage
}
// else if let url = data as? NSString
// {
// (self as! UIImageView).setUrl(url)
// }
}
func bindForUIButton(var data:Any?)
{
if let str = data as? String
{
(self as! UIButton).setTitle(str, forState: UIControlState.Normal)
}
else if nil == data || data is UIImage
{
(self as! UIButton).setImage(data as? UIImage, forState: UIControlState.Normal)
}
}
// func bindForEAButton(var data:Any?)
// {
// if let str = data as? NSString
// {
// (self as! EAButton).text = str.stringValue
// }
// else if let url = data as? BD_Url
// {
// (self as! EAButton).setUrl(url.value)
// }
// else if data is UIImage
// {
// (self as! EAButton).image = data as? UIImage
// }
// }
//
// func bindForTQRichTextView(var data:Any?)
// {
// data = data ?? ""
// if let str = data as? NSString
// {
// (self as! TQRichTextView).text = str.stringValue
// }
// }
func bindByTag(tag:NSInteger, data:Any?)->UIView?
{
var subView = viewWithTag(tag)
subView?.bindData(data)
return subView;
}
func bindByTag(tag:String, data:Any?)->UIView?
{
var subView = viewWithStrTag(tag)
subView?.bindData(data)
return subView;
}
}
|
[
-1
] |
4ac04cfe7f58d59bcd7c0926aee42c0a5d5e8876
|
e2f399c74e1943d503127e0ad51270d89cc9beb4
|
/HomeWork2/Core/ServiceLocator/ServiceLocator.swift
|
35c965ea34a99b61247554898e31f77b4b559c8b
|
[] |
no_license
|
AnnyVoolk/CoreDataHW
|
39e7ab081dd5173a255cfaab1465d29baf78d11f
|
718051febfce340a9c1d7b425abf2da942052115
|
refs/heads/master
| 2023-02-03T19:39:08.286657 | 2020-12-19T13:50:30 | 2020-12-19T13:50:30 | 322,843,533 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 781 |
swift
|
//
// ServiceLocator.swift
// HomeWork2
//
// Created by Anna Volkova on 15.12.2020.
// Copyright © 2020 mac. All rights reserved.
//
import Foundation
public protocol IServiceLocator {
func getService<T>(type: T.Type) -> T?
func addService<T>(service: T)
}
public class ServiceLocator: IServiceLocator {
public static let shared = ServiceLocator()
private init() {}
private var services: [String: Any] = [:]
public func getService<T>(type: T.Type) -> T? {
return self.services[String(describing: type)] as? T
}
public func addService<T>(service: T) {
let type = String(describing: T.self)
if self.services[type] == nil {
self.services[type] = service
}
}
}
|
[
-1
] |
37efddc994735aadeceef58a80c00213dc44fa20
|
63ef0d5b5128f3889000868904166d191c42c3b0
|
/MJSina/MJSina/Classes/ViewModel/OAuth/MJOAuthViewModel.swift
|
cae874a090317a2995156275ca966574c4cfa12d
|
[] |
no_license
|
Zakerberg/MJsina
|
702c3f5bd8c82e890c902f072a20d6c747a2fc49
|
a2b303773dffae1da3016389b60d4b1c20f7c5f8
|
refs/heads/master
| 2021-01-13T01:17:55.076300 | 2017-08-08T13:27:24 | 2017-08-08T13:27:24 | 81,444,630 | 2 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 4,938 |
swift
|
//
// MJOAuthViewModel.swift
// MJSina
//
// Created by Michael 柏 on 2017/1/23.
// Copyright © 2017年 Michael Bai. All rights reserved.
//
import UIKit
/*
1. - 帮助OAuthVc请求数据
2. - 帮助OAuth保存用户模型和提供数据给其他控制器
*/
class MJOAuthViewModel: NSObject {
//全局访问点
static let shared : MJOAuthViewModel = MJOAuthViewModel()
//1.路径
let file = (NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.documentDirectory, FileManager.SearchPathDomainMask.userDomainMask, true).last! as NSString).appendingPathComponent("userAccount.archiver")
//个人信息数据(解决频繁访问沙盒的问题)
var userAccountModel: MJUserAccountModel?
///访问令牌()
var accessToken: String? {
// //第一次登陆
// if userAccountModel == nil {
//
// return nil
// }else{
// ///不是第一次登陆,已经保存过数据
// ///但是需要判断是否过期'
// /// 代表没有过期
// if userAccountModel?.expires_Data?.compare(Date()) == ComparisonResult.orderedAscending{
// return userAccountModel?.access_token
//
// }else{
// ///已经过期了
// return nil
// }
// }
//
if userAccountModel?.expires_Date?.compare(Date()) == ComparisonResult.orderedDescending {
return userAccountModel?.access_token
}else{
///已经过期了
return nil
}
}
///判断用户是否登陆
/*
acessToken 有值 代表登陆,fa反之,没有登陆
*/
var isLogin: Bool {
return accessToken != nil
}
//重写init方法
override init (){
super.init()
//给userAccountModel赋值
userAccountModel = getUserAccountModel()
}
}
//保存和获取用户信息数据模型
extension MJOAuthViewModel{
//保存模型
func saveUserAccountModel(userAccountModel:MJUserAccountModel){
// 解决第一次获取数据为nil的问题
self.userAccountModel = userAccountModel
//2.保存
NSKeyedArchiver.archiveRootObject(userAccountModel, toFile: file)
}
//获取模型
func getUserAccountModel() -> MJUserAccountModel?{
//2.获取
// 为什么使用as? 如果用户首次登陆 没有保存数据 获取出来的就是应该为nil
let userAccountModel = NSKeyedUnarchiver.unarchiveObject(withFile: file) as?MJUserAccountModel
return userAccountModel
}
}
//OAuth界面请求数据
extension MJOAuthViewModel {
//请求获取accessToken
func getUserAccount(code :String,isFinish:@escaping (Bool )->()){
MJNetworkTool.shared.loadUserAccount(code: code, success: { (response) in
// 判断response 是否为nil 而且是否是一个字典
// if-let 或者guard-let 做类型转换的时候 使用as?
guard let res = response as? [String :Any?] else{
//执行闭包
isFinish(false)
return
}
//字典转模型
// 字典转模型
let userAccountModel = MJUserAccountModel.yy_model(withJSON: res)
// 判断是否为nil
guard let u = userAccountModel else {
//执行闭包
isFinish(false)
return
}
//请求个人信息数据
self.getUserInfo(userAccountModel: u, isFinish: isFinish)
}, failure: {(error)->() in
print("失败",error)
//执行闭包
isFinish(false)
})
}
//获取用户信息
func getUserInfo(userAccountModel: MJUserAccountModel,isFinish:@escaping (Bool )->()){
MJNetworkTool.shared.loadUserInfo(userAccountModel: userAccountModel, success: { (response)->() in
//判断response 是否为nil ,且是否可以转换成字典
guard let res = response as?[String :Any?] else{
//执行闭包
isFinish(false)
return
}
//赋值
userAccountModel.screen_name = res["screen_name"] as? String
userAccountModel.avatar_large = res["avatar_large"]as? String
//保存用户数据
self.saveUserAccountModel(userAccountModel: userAccountModel)
//最后终于成功了
isFinish(true)
}, failure: {(error)->()in
print("失败",error)
//执行闭包
isFinish(false)
})
}
}
|
[
-1
] |
73ab44ee4226429b2e21080ec2deb1b04d1bb2c5
|
e4af5c0b0e2b0d3eb44f5b56d7705a4120b8a779
|
/ios/Classes/SwiftWebVuwPlugin.swift
|
deabbb94fd6f740e6d27a628b87a2254c0740424
|
[
"MIT"
] |
permissive
|
hahafather007/Web_Vuw
|
723cb0ecc3f5c034fd9c843bd64f22466d467182
|
d64a8e60a04a1fd6f84ff34f884cf8407259eb74
|
refs/heads/master
| 2020-06-21T03:09:34.978071 | 2019-07-17T07:29:55 | 2019-07-17T07:29:55 | 197,329,550 | 1 | 0 |
MIT
| 2019-07-17T06:33:58 | 2019-07-17T06:33:58 | null |
UTF-8
|
Swift
| false | false | 10,576 |
swift
|
import Flutter
import UIKit
import WebKit
enum FlutterMethodName: String {
case loadUrl
case canGoBack
case canGoForward
case goBack
case goForward
case stopLoading
case evaluateJavascript
case reload
case loadHtml
}
public class WebVuwFactory : NSObject, FlutterPlatformViewFactory {
var messenger: FlutterBinaryMessenger!
public func create(withFrame frame: CGRect, viewIdentifier viewId: Int64, arguments args: Any?) -> FlutterPlatformView {
return WebVuwController(withFrame: frame, viewIdentifier: viewId, arguments: args, binaryMessenger: messenger)
}
@objc public init(messenger: (NSObject & FlutterBinaryMessenger)?) {
super.init()
self.messenger = messenger
}
public func createArgsCodec() -> FlutterMessageCodec & NSObjectProtocol {
return FlutterStandardMessageCodec.sharedInstance()
}
}
public class WebVuwController: NSObject, FlutterPlatformView, FlutterStreamHandler {
//PRAMS NAME
let INITIAL_URL = "initialUrl"
let HEADER = "header"
let USER_AGENT = "userAgent"
let SETTINGS = "settings"
let CHANNEL_NAME = "plugins.devfatani.com/web_vuw_%d"
let WEB_VUW_EVENT = "web_vuw_events_%d"
let EVENT = "event"
let URL_ = "url"
let HTML = "html"
let ENABLE_JAVA_SCRIPT = "enableJavascript"
let ENABLE_LOCAL_STORAGE = "enableLocalStorage"
fileprivate var viewId:Int64!;
fileprivate var wkWebVuw: WKWebView!
fileprivate var channel: FlutterMethodChannel!
fileprivate var refController: UIRefreshControl?
fileprivate var eventSinkNavigation: FlutterEventSink?;
public init(withFrame frame: CGRect, viewIdentifier viewId: Int64, arguments args: Any?, binaryMessenger: FlutterBinaryMessenger) {
super.init()
if let initWebVuw = self.initWebVuw(frame: frame, args) {
FlutterEventChannel.init(name: String(format: WEB_VUW_EVENT, viewId),
binaryMessenger: binaryMessenger).setStreamHandler(self)
//TODO: need to refactor
self.refController = setPullToRefresh(args, wkWebVuw: initWebVuw)
self.wkWebVuw = initWebVuw
let channelName = String(format: CHANNEL_NAME, viewId)
self.channel = FlutterMethodChannel(name: channelName, binaryMessenger: binaryMessenger)
self.channel.setMethodCallHandler({
[weak self]
(call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in
if let this = self {
this.onMethodCall(call: call, result: result)
}
})
}
}
private func jsSettings(params: NSDictionary) -> WKWebViewConfiguration{
let enableJavascript = params[ENABLE_JAVA_SCRIPT] as? Int ?? 0
let enableLocalStorage = params[ENABLE_LOCAL_STORAGE] as? Int ?? 0
let preferences = WKPreferences()
let configuration = WKWebViewConfiguration()
preferences.javaScriptEnabled = enableJavascript == 1
if #available(iOS 9.0, *), enableLocalStorage == 1{
configuration.websiteDataStore = WKWebsiteDataStore.default()
}
configuration.preferences = preferences
return configuration
}
private func setPullToRefresh(_ args: Any?, wkWebVuw: WKWebView) -> UIRefreshControl?{
if let params = args as? NSDictionary {
let isPullToRefreshAllowed = params["pullToRefresh"] as? Int ?? 0
if isPullToRefreshAllowed == 1 {
let refController = UIRefreshControl()
refController.addTarget(self, action: #selector(reloadWebView), for: .valueChanged)
wkWebVuw.scrollView.addSubview(refController)
return refController
}
}
return nil
}
private func initWebVuw (frame: CGRect, _ args: Any?) -> WKWebView? {
if let params = args as? NSDictionary {
let wkWebVuw = WKWebView(frame: frame, configuration: jsSettings(params: params))
wkWebVuw.navigationDelegate = self
wkWebVuw.scrollView.bounces = true
if #available(iOS 9.0, *),
let userAgent = params[USER_AGENT] as? String {
wkWebVuw.customUserAgent = userAgent
}
if let initialURLString = params[INITIAL_URL] as? String ,
let initialURL = URL(string: initialURLString) {
var customRequest = URLRequest(url: initialURL)
if let header = params[HEADER] as? NSDictionary {
for (key, value) in header {
if let val = value as? String,
let field = key as? String {
customRequest.addValue(val, forHTTPHeaderField: field)
}
}
}
wkWebVuw.load(customRequest)
}else if let html = params[HTML] as? String {
wkWebVuw.loadHTMLString(html, baseURL: nil)
}
return wkWebVuw
}
return nil
}
public func view() -> UIView {
return wkWebVuw
}
@objc func reloadWebView(){
refController?.endRefreshing()
wkWebVuw.reload()
}
func onMethodCall(call: FlutterMethodCall, result: @escaping FlutterResult) {
if let method = FlutterMethodName(rawValue: call.method) {
switch method {
case .loadUrl:
onLoadURL(call, result)
case .canGoBack:
onCanGoBack(call, result)
case .canGoForward:
onCanGoForward(call, result)
case .goBack:
onGoBack(call, result)
case .goForward:
onGoForward(call, result)
case .stopLoading:
onStopLoading(call, result)
case .evaluateJavascript:
onEvaluateJavascript(call, result)
case .reload:
reload(call, result)
case .loadHtml:
onLoadHTML(call, result)
}
}
}
func onLoadHTML (_ call: FlutterMethodCall, _ result: @escaping FlutterResult) {
if let html = call.arguments as? String {
wkWebVuw.loadHTMLString(html, baseURL: nil)
}
}
func onEvaluateJavascript(_ call: FlutterMethodCall, _ result: @escaping FlutterResult) {
if let jsString = call.arguments as? String {
wkWebVuw.evaluateJavaScript(jsString) { (evaluateResult, error) in
if error != nil {
result(FlutterError(code: "javascribt_faild", message: "Failed evaluating JavaScript Code.", details: "Your [js code] was: \(jsString)"))
}else if let res = evaluateResult as? String {
result(res)
}
}
}
}
func onLoadURL(_ call: FlutterMethodCall, _ result: @escaping FlutterResult) {
if let url = call.arguments as? String {
if !load(url: url) {
result(FlutterError(code: "loadURL_faild", message: "faild parsing url", details: "Your [URL] was: \(url)"))
}else {
result(FlutterMethodNotImplemented)
}
}
}
func load(url:String)-> Bool {
if let urlRequest = URL(string: url) {
wkWebVuw.load(URLRequest(url: urlRequest))
return true
}
return false
}
func onCanGoBack(_ call: FlutterMethodCall, _ result: @escaping FlutterResult) {
let canGoBack = wkWebVuw.canGoBack
result([NSNumber(booleanLiteral: canGoBack)])
}
func reload(_ call: FlutterMethodCall, _ result: @escaping FlutterResult) {
wkWebVuw.reload()
}
func onCanGoForward(_ call: FlutterMethodCall, _ result: @escaping FlutterResult) {
let canGoForward = wkWebVuw.canGoForward
result([NSNumber(booleanLiteral: canGoForward)])
}
func onGoBack(_ call: FlutterMethodCall, _ result: @escaping FlutterResult) {
wkWebVuw.goBack()
result(nil)
}
func onGoForward(_ call: FlutterMethodCall, _ result: @escaping FlutterResult) {
wkWebVuw.goForward()
result(nil)
}
func onStopLoading(_ call: FlutterMethodCall, _ result: @escaping FlutterResult) {
self.wkWebVuw.stopLoading()
result(nil)
}
public func onListen(withArguments arguments: Any?, eventSink events: @escaping FlutterEventSink) -> FlutterError? {
self.eventSinkNavigation = events
return nil
}
public func onCancel(withArguments arguments: Any?) -> FlutterError? {
return FlutterError(code: "stream_fail", message: "could not streaming", details: nil)
}
public func fireEvent(event:String, webView: WKWebView) {
if let sink = self.eventSinkNavigation,
let url = webView.url?.absoluteString{
sink([
EVENT: event,
URL_: url
])
}
}
}
extension WebVuwController : WKNavigationDelegate {
public func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
fireEvent(event: "didStartProvisionalNavigation", webView: webView)
}
public func webView(_ webView: WKWebView, didCommit navigation: WKNavigation!) {
fireEvent(event: "didStart", webView: webView)
}
public func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
fireEvent(event: "didFinish", webView: webView)
}
public func webView(_ webView: WKWebView, decidePolicyFor navigationResponse: WKNavigationResponse, decisionHandler: @escaping (WKNavigationResponsePolicy) -> Void) {
if navigationResponse.response is HTTPURLResponse {
let response = navigationResponse.response as! HTTPURLResponse
if response.statusCode != 200 {
fireEvent(event: "navigationResponse", webView: webView)
}
decisionHandler(.allow)
} else {
decisionHandler(.allow)
}
}
}
|
[
-1
] |
8d5a6ddeb747474c5ffc47622a815fe79e55b94c
|
5da959d2947c7e5cd7f999043c3964cc9369c81c
|
/Sources/Controllers/Profile/ProfileHeaderLayoutView.swift
|
00708b76adadb80423c5a4c17973ed2eec23ab08
|
[
"MIT"
] |
permissive
|
zdw19840929/ello-ios
|
598efe1919b90510e42022043d5f6d614c3ccdf7
|
a6e9ddc6d2c08356153a5406bb9421e06d64471a
|
refs/heads/master
| 2021-01-20T02:38:22.763149 | 2017-04-24T19:27:38 | 2017-04-24T19:27:38 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 2,241 |
swift
|
////
/// ProfileHeaderLayoutView.swift
//
import SnapKit
class ProfileHeaderLayoutView: ProfileBaseView {
var calculatedCellHeights: CalculatedCellHeights? {
didSet {
guard let calculatedCellHeights = calculatedCellHeights else { return }
if let avatarHeight = calculatedCellHeights.profileAvatar { avatarHeightConstraint.update(offset: avatarHeight) }
if let namesHeight = calculatedCellHeights.profileNames { namesHeightConstraint.update(offset: namesHeight) }
if let totalCountHeight = calculatedCellHeights.profileTotalCount { totalCountHeightConstraint.update(offset: totalCountHeight) }
if let bioHeight = calculatedCellHeights.profileBio { bioHeightConstraint.update(offset: bioHeight) }
if let locationHeight = calculatedCellHeights.profileLocation { locationHeightConstraint.update(offset: locationHeight) }
if let linksHeight = calculatedCellHeights.profileLinks { linksHeightConstraint.update(offset: linksHeight) }
let bioLinksOrLocationHaveContent = (calculatedCellHeights.profileBio ?? 0) > 0 || (calculatedCellHeights.profileLinks ?? 0) > 0 || (calculatedCellHeights.profileLocation ?? 0) > 0
statsView.grayLineVisible = bioLinksOrLocationHaveContent
let locationOrLinksHasContent = (calculatedCellHeights.profileLocation ?? 0) > 0 || (calculatedCellHeights.profileLinks ?? 0) > 0
bioView.grayLineVisible = locationOrLinksHasContent
let linksHasContent = (calculatedCellHeights.profileLinks ?? 0) > 0
locationView.grayLineVisible = linksHasContent
setNeedsLayout()
}
}
let avatarView = ProfileAvatarView()
let namesView = ProfileNamesView()
let totalCountView = ProfileTotalCountView()
let statsView = ProfileStatsView()
let bioView = ProfileBioView()
let locationView = ProfileLocationView()
let linksView = ProfileLinksView()
var avatarHeightConstraint: Constraint!
var namesHeightConstraint: Constraint!
var totalCountHeightConstraint: Constraint!
var bioHeightConstraint: Constraint!
var locationHeightConstraint: Constraint!
var linksHeightConstraint: Constraint!
}
|
[
-1
] |
897a868add71a5e8c9600a2f09e56db146d4e7b3
|
660c1316a9cfca452c78d133d436c60ff96a4600
|
/drawingExampleTests/drawingExampleTests.swift
|
15b879437aedfd2534f2d85a1267df7717dff55a
|
[] |
no_license
|
dugnad/drawingExample
|
d8710251cb5398ee6c385e6ab205da8257d2dd9d
|
3351a2ec23a7be4cb40f9fbe436fdb02656e7b9e
|
refs/heads/master
| 2021-01-19T18:56:21.625722 | 2015-03-02T10:59:00 | 2015-03-02T10:59:00 | 31,531,865 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 939 |
swift
|
//
// drawingExampleTests.swift
// drawingExampleTests
//
// Created by Erling Austvoll on 2015/03/02.
// Copyright (c) 2015年 Kingston University. All rights reserved.
//
import UIKit
import XCTest
class drawingExampleTests: XCTestCase {
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()
}
func testExample() {
// This is an example of a functional test case.
XCTAssert(true, "Pass")
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measureBlock() {
// Put the code you want to measure the time of here.
}
}
}
|
[
276484,
276489,
277513,
275469,
277518,
295953,
223767,
289304,
277017,
281625,
279065,
275495,
278570,
278060,
275505,
275506,
203830,
226875,
276543,
277574,
282183,
288326,
277066,
276050,
278615,
227417,
239198,
370271,
276581,
276582,
275565,
276592,
275571,
284788,
227446,
285814,
276088,
276606,
188031,
276100,
276101,
312972,
278160,
239250,
278162,
226452,
164512,
225956,
227492,
276146,
303803,
277694,
280267,
282831,
203478,
18138,
201442,
276195,
276709,
276710,
285929,
12010,
276210,
276211,
120055,
209660,
171776,
227585,
277254,
227592,
204041,
226058,
276748,
278285,
276753,
129301,
369432,
276764,
105246,
228129,
281377,
259363,
278307,
293672,
277803,
159533,
152365,
226608,
200498,
276787,
277815,
276792,
277821,
226624,
277312,
277824,
164162,
307011,
295744,
276298,
277834,
296779,
278863,
6482,
276821,
277845,
276311,
188246,
276822,
280410,
276831,
276835,
276325,
276839,
292712,
277354,
277866,
276332,
276847,
277871,
173936,
400239,
313203,
278908,
277890,
277891,
148867,
226694,
277896,
277897,
226189,
40850,
282518,
277919,
277920,
277410,
370091,
277936,
276400,
173491,
277939,
278965,
278969,
277949,
237504,
226241,
277952,
127427,
127428,
277957,
278985,
284619,
277965,
306639,
275410,
228823,
228824,
276443,
276958,
276450,
276451,
277988,
276962,
276454,
276963,
317415,
277993,
277994,
279018,
183279,
306673,
276468,
276469,
278005,
278008
] |
7a195f534682498dc0d8decd0f3a639ce8e38bd0
|
0dee380e9ac0ac8774ce796c92ba6207e2496ceb
|
/NetworkCallWithAlamofire/SceneDelegate.swift
|
abaf19f1350cee68d95b72336f8c40c0c267e19f
|
[] |
no_license
|
mariamtppa/NetworkCallWithAlamofire
|
c8c283ca9603e20ee872a187d4386d86e7a856bb
|
0bde305f73166e2e0394b28e08bd8c5cb826e446
|
refs/heads/main
| 2023-01-24T11:16:18.644852 | 2020-11-30T19:34:26 | 2020-11-30T19:34:26 | 317,326,129 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 2,361 |
swift
|
//
// SceneDelegate.swift
// NetworkCallWithAlamofire
//
// Created by Decagon on 30/11/2020.
//
import UIKit
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = scene as? UIWindowScene else { return }
window = UIWindow(frame: windowScene.coordinateSpace.bounds)
window?.windowScene = windowScene
let viewController = ViewController()
window?.rootViewController = viewController
window?.makeKeyAndVisible()
}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
// Save changes in the application's managed object context when the application transitions to the background.
(UIApplication.shared.delegate as? AppDelegate)?.saveContext()
}
}
|
[
343168,
372481,
415362,
389507,
375297,
266757,
210696,
264585,
330890,
379915,
391691,
393613,
380433,
351382,
206489,
206490,
386074,
381212,
344736,
397089,
357793,
262702,
340910,
345906,
370611,
264502,
333499,
355132,
345916,
333374,
266815,
260925,
386366,
418367,
104636,
334276,
372166,
244552,
396874,
346317,
370254,
386259,
358100,
437588,
332118,
329816,
211161,
383323,
248799,
423393,
108386,
340452,
346340,
369254,
325359,
368753,
387314,
372977,
173170,
341114,
257021,
194942
] |
e8ea4f28ea4b3885c165777f33589c758e7aba73
|
62741a12ef6d119ac6744b823b6c63fff9c212d4
|
/Traveler/AppDelegate.swift
|
e8e8df19503f0de0e852f65cbc70b451b442d1b9
|
[] |
no_license
|
rozeridilar/traveler-ios
|
c2c9bde159a87b2738bc0db73e930c4011772a01
|
cff89e2182358ecdf330a3fbc212cdc177648b8c
|
refs/heads/master
| 2021-05-18T05:30:53.483596 | 2020-03-26T08:04:58 | 2020-03-27T14:41:39 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,858 |
swift
|
//
// AppDelegate.swift
// Traveler
//
// Created by Ata Namvari on 2018-09-07.
// Copyright © 2018 Guestlogix Inc. All rights reserved.
//
import UIKit
import TravelerKit
import TravelerStripePaymentProvider
import TravelerKitUI
import GoogleSignIn
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// GoogleSignInSDK
GIDSignIn.sharedInstance()?.clientID = Environment.gIDClientId
GIDSignIn.sharedInstance()?.serverClientID = Environment.gIDServerClientID
// TravelerSDK
#if TRAVELER
Traveler.initialize(apiKey: Environment.travelerKitKey, device: UIDevice.current, sandboxMode: true)
#endif
#if GCREW
Traveler.initialize(apiKey: Environment.travelerKitKey, device: UIDevice.current)
#endif
TravelerUI.initialize(paymentHandler: PaymentCollectionViewController.self,
paymentAuthenticator: StripePaymentAuthenticator(),
paymentManager: StripePaymentProvider.self)
// Temp Styles
UINavigationBar.appearance().tintColor = UIColor.white
UINavigationBar.appearance().barTintColor = UIColor(red: 45.0 / 255.0, green: 91.0 / 255.0, blue: 166.0 / 255.0, alpha: 1.0)
UINavigationBar.appearance().titleTextAttributes = [
NSAttributedString.Key.foregroundColor : UIColor.white
]
UISearchBar.appearance().tintColor = UIColor.white
UITextField.appearance(whenContainedInInstancesOf: [UISearchBar.self]).defaultTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white]
// End Temp Styles
return true
}
}
|
[
-1
] |
7a882073bc9d6e19132f7b3d1c2882c4d31a82e5
|
be720d45a02af9872105c2006a83e4ead0f25092
|
/XCUIDeviceIssues/MasterViewController.swift
|
e75163b1daf75684f7828146fafa5dbfe289e4d6
|
[
"MIT"
] |
permissive
|
muncman/XCUIDeviceIssues
|
ba05d3ccd7aa6e6eaaeb3a582d8d31748566799b
|
37d6e695304853796da8beb20f391cdd4a85df70
|
refs/heads/main
| 2023-03-04T17:34:46.572772 | 2018-02-02T13:09:33 | 2018-02-02T13:09:33 | 114,566,377 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 3,101 |
swift
|
//
// MasterViewController.swift
// XCUIDeviceIssues
//
// Created by Kevin Munc on 12/13/17.
// Copyright © 2017 Method Up. All rights reserved.
//
import UIKit
class MasterViewController: UITableViewController {
var detailViewController: DetailViewController? = nil
var objects = [Any]()
override func viewDidLoad() {
super.viewDidLoad()
navigationItem.leftBarButtonItem = editButtonItem
let addButton = UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(insertNewObject(_:)))
navigationItem.rightBarButtonItem = addButton
if let split = splitViewController {
let controllers = split.viewControllers
detailViewController = (controllers[controllers.count-1] as! UINavigationController).topViewController as? DetailViewController
}
}
override func viewWillAppear(_ animated: Bool) {
clearsSelectionOnViewWillAppear = splitViewController!.isCollapsed
super.viewWillAppear(animated)
}
@objc
func insertNewObject(_ sender: Any) {
objects.insert(NSDate(), at: 0)
let indexPath = IndexPath(row: 0, section: 0)
tableView.insertRows(at: [indexPath], with: .automatic)
}
// MARK: - Segues
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "showDetail" {
if let indexPath = tableView.indexPathForSelectedRow {
let object = objects[indexPath.row] as! NSDate
let controller = (segue.destination as! UINavigationController).topViewController as! DetailViewController
controller.detailItem = object
controller.navigationItem.leftBarButtonItem = splitViewController?.displayModeButtonItem
controller.navigationItem.leftItemsSupplementBackButton = true
}
}
}
// MARK: - Table View
override func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return objects.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
let object = objects[indexPath.row] as! NSDate
cell.textLabel!.text = object.description
return cell
}
override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
return true
}
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
objects.remove(at: indexPath.row)
tableView.deleteRows(at: [indexPath], with: .fade)
} else if editingStyle == .insert {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view.
}
}
}
|
[
281546,
289168,
228211,
283415,
339096,
287449
] |
9fea3e716446e079ec479d562b154e3595a986e7
|
9f62310b91bd1e6edca0093eedfb2cba3915c755
|
/leapYear/SceneDelegate.swift
|
a86bbaf88ed55cab979e475c1cc4500e3c2a8b5e
|
[] |
no_license
|
bryan0011/leapYear
|
1aed23364c0479259d494651a4ac648335416ba4
|
c77733ca7bd0a9a34a58d137f176b1fe16a8eca8
|
refs/heads/main
| 2023-08-03T13:49:07.172918 | 2021-10-07T12:33:36 | 2021-10-07T12:33:36 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 2,289 |
swift
|
//
// SceneDelegate.swift
// leapYear
//
// Created by Bryan Kuo on 2021/10/6.
//
import UIKit
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).
guard let _ = (scene as? UIWindowScene) else { return }
}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}
}
|
[
393221,
163849,
393228,
393231,
393251,
352294,
344103,
393260,
393269,
213049,
376890,
385082,
393277,
376906,
327757,
254032,
368728,
180314,
254045,
180322,
376932,
286833,
286845,
286851,
417925,
262284,
360598,
286880,
377003,
377013,
164029,
327872,
180418,
377030,
377037,
377047,
418008,
418012,
377063,
327915,
205037,
393457,
393461,
393466,
418044,
385281,
336129,
262405,
180491,
336140,
164107,
262417,
368913,
262423,
377118,
377121,
262437,
254253,
336181,
262455,
393539,
262473,
344404,
213333,
418135,
270687,
262497,
418145,
262501,
213354,
246124,
262508,
262512,
213374,
385420,
262551,
262553,
385441,
385444,
262567,
385452,
262574,
393649,
385460,
262587,
344512,
262593,
360917,
369119,
328178,
328180,
328183,
328190,
254463,
328193,
164362,
328207,
410129,
393748,
377372,
188959,
385571,
377384,
197160,
33322,
352822,
270905,
197178,
418364,
188990,
369224,
385610,
270922,
352844,
385617,
352865,
262761,
352875,
344694,
352888,
336513,
377473,
385671,
148106,
377485,
352919,
98969,
344745,
361130,
336556,
385714,
434868,
164535,
336568,
164539,
328379,
328387,
352969,
418508,
385743,
385749,
139998,
189154,
369382,
361196,
418555,
344832,
336644,
344837,
344843,
328462,
361231,
394002,
336660,
418581,
418586,
434971,
369436,
262943,
369439,
418591,
418594,
336676,
418600,
418606,
369464,
361274,
328516,
336709,
328520,
336712,
361289,
328523,
336715,
361300,
213848,
426842,
361307,
197469,
361310,
254813,
361318,
344936,
361323,
361335,
328574,
369544,
361361,
222129,
345036,
115661,
386004,
345046,
386012,
386019,
386023,
328690,
435188,
328703,
328710,
418822,
377867,
328715,
386070,
271382,
336922,
345119,
377888,
214060,
345134,
345139,
361525,
386102,
361537,
377931,
189525,
156762,
402523,
361568,
148580,
345200,
361591,
386168,
361594,
410746,
214150,
345224,
386187,
345247,
361645,
345268,
402615,
361657,
337093,
402636,
328925,
165086,
165092,
328933,
222438,
328942,
386286,
386292,
206084,
328967,
345377,
345380,
353572,
345383,
263464,
337207,
345400,
378170,
369979,
386366,
337224,
337230,
337235,
263509,
353634,
337252,
402792,
271731,
378232,
337278,
271746,
181639,
353674,
181644,
361869,
181650,
181655,
230810,
181671,
181674,
181679,
181682,
337330,
181687,
370105,
181691,
181697,
361922,
337350,
181704,
337366,
271841,
329192,
361961,
329195,
116211,
337399,
402943,
337416,
329227,
419341,
419345,
329234,
419351,
345626,
419357,
345631,
419360,
370208,
394787,
419363,
370214,
419369,
394796,
419377,
419386,
206397,
214594,
419401,
353868,
419404,
173648,
419408,
214611,
419412,
403040,
345702,
222831,
370298,
353920,
403076,
345737,
198282,
403085,
403092,
345750,
419484,
345758,
345763,
419492,
345766,
419498,
419502,
370351,
419507,
337588,
419510,
419513,
419518,
337601,
403139,
337607,
419528,
419531,
419536,
272083,
394967,
419543,
419545,
345819,
419548,
419551,
345829,
419560,
337643,
419564,
337647,
370416,
337671,
362249,
362252,
395022,
362256,
321300,
345888,
362274,
378664,
354107,
345916,
354112,
370504,
329545,
345932,
370510,
354132,
247639,
337751,
370520,
313181,
182110,
354143,
354157,
345965,
345968,
345971,
345975,
403321,
1914,
354173,
395148,
247692,
337809,
247701,
329625,
436127,
436133,
247720,
337834,
362414,
337845,
190393,
346059,
247760,
346064,
346069,
419810,
329699,
354275,
190440,
354314,
346140,
436290,
395340,
378956,
436307,
338005,
100454,
329833,
329853,
329857,
329868,
411806,
329886,
346273,
362661,
100525,
387250,
379067,
387261,
256193,
395467,
346317,
411862,
256214,
411865,
411869,
411874,
379108,
411877,
387303,
346344,
395496,
338154,
387307,
346350,
338161,
436474,
321787,
379135,
411905,
411917,
379154,
395539,
387350,
387353,
338201,
182559,
338212,
395567,
248112,
362823,
436556,
321880,
362844,
379234,
354674,
321911,
420237,
379279,
272787,
354728,
338353,
338382,
272849,
248279,
256474,
182755,
338404,
330225,
248309,
248332,
330254,
199189,
420377,
330268,
191012,
330320,
199250,
191069,
346722,
248427,
191085,
338544,
191093,
346743,
346769,
150184,
174775,
248505,
174778,
363198,
223936,
355025,
273109,
355029,
264919,
256735,
338661,
264942,
363252,
338680,
264965,
338701,
256787,
363294,
199455,
396067,
346917,
396070,
215854,
355123,
355141,
355144,
338764,
355151,
330581,
330585,
387929,
355167,
265056,
265059,
355176,
355180,
355185,
412600,
207809,
379849,
347082,
396246,
330711,
248794,
248799,
347106,
437219,
257009,
265208,
265215,
199681,
338951,
330761,
330769,
330775,
248863,
158759,
396329,
347178,
404526,
396337,
330803,
396340,
339002,
388155,
339010,
347208,
248905,
330827,
248915,
183384,
339037,
412765,
257121,
322660,
265321,
248952,
420985,
330886,
330890,
347288,
248986,
44199,
380071,
339118,
249018,
339133,
126148,
322763,
330959,
330966,
265433,
265438,
388320,
363757,
388348,
339199,
396552,
175376,
175397,
273709,
372016,
437553,
347442,
199989,
175416,
396601,
208189,
437567,
175425,
437571,
126279,
437576,
437584,
331089,
437588,
331094,
396634,
175451,
437596,
429408,
175458,
175461,
175464,
265581,
331124,
175478,
249210,
175484,
175487,
249215,
175491,
249219,
249225,
249228,
249235,
175514,
175517,
396703,
396706,
175523,
355749,
396723,
388543,
380353,
216518,
380364,
339406,
372177,
339414,
249303,
413143,
339418,
339421,
249310,
339425,
249313,
339429,
339435,
249329,
69114,
372229,
208399,
380433,
175637,
405017,
134689,
339504,
265779,
421442,
413251,
265796,
265806,
224854,
224858,
339553,
257636,
224871,
372328,
257647,
372338,
224885,
224888,
224891,
224895,
126597,
421509,
224905,
11919,
224911,
224914,
126611,
224917,
224920,
126618,
208539,
224923,
224927,
224930,
224933,
257705,
224939,
224943,
257713,
224949,
257717,
257721,
224954,
257725,
224960,
257733,
224966,
224970,
257740,
224976,
257745,
339664,
257748,
224982,
257752,
224987,
257762,
224996,
225000,
225013,
257788,
225021,
339711,
257791,
225027,
257796,
339722,
257802,
257805,
225039,
257808,
249617,
225044,
167701,
372500,
257815,
225049,
257820,
225054,
184096,
397089,
257825,
225059,
339748,
225068,
257837,
413485,
225071,
225074,
257843,
225077,
257846,
225080,
397113,
225083,
397116,
257853,
225088,
225094,
225097,
257869,
257872,
225105,
397140,
225109,
225113,
257881,
257884,
257887,
225120,
257891,
413539,
225128,
257897,
339818,
225138,
339827,
257909,
225142,
372598,
257914,
257917,
225150,
257922,
380803,
225156,
339845,
257927,
225166,
397201,
225171,
380823,
225176,
225183,
372698,
372704,
372707,
356336,
380919,
393215,
372739,
405534,
266295,
266298,
217158,
421961,
200786,
356440,
217180,
430181,
266351,
356467,
266365,
192640,
266375,
381069,
225425,
250003,
225430,
250008,
356507,
250012,
225439,
135328,
192674,
225442,
438434,
225445,
225448,
438441,
225451,
258223,
225456,
430257,
225459,
225462,
225468,
389309,
225472,
372931,
225476,
389322,
225485,
225488,
225491,
266454,
225494,
225497,
225500,
225503,
225506,
356580,
225511,
217319,
225515,
225519,
381177,
397572,
389381,
356638,
356641,
356644,
356647,
266537,
389417,
356650,
356656,
332081,
307507,
340276,
356662,
397623,
332091,
225599,
201030,
348489,
332107,
151884,
430422,
348503,
332118,
250203,
250211,
340328,
250217,
348523,
348528,
332153,
356734,
389503,
332158,
438657,
332162,
389507,
348548,
356741,
250239,
332175,
160152,
373146,
340380,
373149,
70048,
356783,
373169,
266688,
324032,
201158,
340452,
127473,
217590,
340473,
324095,
324100,
324103,
324112,
340501,
324118,
324122,
340512,
332325,
324134,
381483,
356908,
324141,
324143,
356917,
324150,
324156,
168509,
348734,
324161,
324165,
356935,
348745,
381513,
324171,
324174,
324177,
389724,
332381,
373344,
340580,
348777,
381546,
119432,
340628,
184983,
373399,
258723,
332455,
332460,
332464,
332473,
381626,
332484,
332487,
332494,
357070,
357074,
332512,
332521,
340724,
332534,
373499,
348926,
389927,
348979,
152371,
340792,
398141,
357202,
389971,
357208,
389979,
430940,
357212,
357215,
439138,
201580,
201583,
349041,
340850,
381815,
430967,
324473,
398202,
119675,
340859,
324476,
430973,
324479,
340863,
324482,
324485,
324488,
185226,
381834,
324493,
324496,
324499,
430996,
324502,
324511,
422817,
324514,
201638,
398246,
373672,
324525,
111539,
324534,
324539,
324542,
398280,
349129,
340940,
340942,
209874,
340958,
431073,
398307,
340964,
209896,
201712,
209904,
349173,
381947,
201724,
349181,
431100,
431107,
349203,
209944,
209948,
250915,
250917,
169002,
357419,
209966,
209969,
209973,
209976,
209980,
209988,
209991,
431180,
209996,
341072,
349268,
177238,
250968,
210011,
373853,
341094,
210026,
210028,
210032,
349296,
210037,
210042,
210045,
349309,
152704,
349313,
160896,
210053,
210056,
349320,
259217,
373905,
210068,
210072,
210078,
210081,
210085,
210089,
210096,
210100,
324792,
210108,
357571,
210116,
210128,
210132,
333016,
210139,
210144,
218355,
218361,
275709,
128254,
275713,
242947,
275717,
275723,
333075,
349460,
333079,
251161,
349486,
349492,
415034,
210261,
365912,
259423,
374113,
251236,
374118,
333164,
234867,
390518,
357756,
374161,
112021,
349591,
357793,
333222,
259516,
415168,
366035,
415187,
366039,
415192,
415194,
415197,
415200,
333285,
415208,
366057,
366064,
415217,
415225,
423424,
415258,
415264,
366118,
415271,
382503,
349739,
144940,
415279,
415282,
415286,
210488,
415291,
415295,
333396,
333400,
366173,
423529,
423533,
210547,
415354,
333440,
267910,
267929,
333512,
259789,
366301,
333535,
153311,
366308,
366312,
431852,
399086,
366319,
210673,
366322,
399092,
366326,
333566,
268042,
210700,
366349,
210707,
399129,
333595,
210720,
366384,
358192,
210740,
366388,
358201,
325441,
366403,
325447,
341831,
341835,
341839,
341844,
415574,
358235,
341852,
350046,
399200,
399208,
268144,
358256,
358260,
341877,
399222,
325494,
333690,
325505,
333699,
399244,
333709,
333725,
333737,
382891,
382898,
350153,
358348,
333777,
219094,
399318,
358372,
350190,
350194,
333819,
350204,
350207,
325633,
325637,
350214,
268299,
333838,
350225,
350232,
333851,
350238,
350241,
374819,
350245,
350249,
350252,
178221,
350257,
350260,
350272,
243782,
350281,
350286,
374865,
342113,
252021,
342134,
374904,
268435,
333998,
334012,
260299,
350411,
350417,
350423,
211161,
350426,
350449,
375027,
358645,
350459,
350462,
350465,
350469,
268553,
350477,
268560,
350481,
432406,
350487,
325915,
350491,
325918,
350494,
325920,
350500,
350505,
358701,
391469,
350510,
358705,
358714,
358717,
383307,
358738,
334162,
383331,
383334,
391531,
383342,
334204,
268669,
194942,
391564,
366991,
334224,
268702,
342431,
375209,
375220,
334263,
326087,
358857,
195041,
334312,
104940,
375279,
350724,
186898,
342546,
350740,
342551,
334359,
342555,
334364,
416294,
350762,
252463,
358962,
334386,
334397,
358973,
252483,
219719,
399957,
334425,
326240,
375401,
334466,
334469,
391813,
162446,
326291,
342680,
342685,
260767,
342711,
244410,
260798,
334530,
260802,
350918,
154318,
342737,
391895,
154329,
416476,
64231,
113389,
342769,
203508,
375541,
342777,
391938,
391949,
375569,
326417,
375572,
375575,
375580,
162592,
334633,
326444,
383794,
326452,
326455,
375613,
244542,
260925,
375616,
326463,
326468,
342857,
326474,
326479,
326486,
416599,
342875,
244572,
326494,
433001,
400238,
326511,
211826,
211832,
392061,
351102,
359296,
252801,
260993,
351105,
400260,
211846,
342921,
342931,
252823,
400279,
392092,
400286,
252838,
359335,
211885,
400307,
351169,
359362,
351172,
170950,
187335,
326599,
359367,
359383,
359389,
383968,
343018,
359411,
261109,
261112,
244728,
383999,
261130,
261148,
359452,
211999,
261155,
261160,
261166,
359471,
375868,
343132,
384099,
384102,
384108,
367724,
187503,
343155,
384115,
212095,
384136,
384140,
384144,
351382,
384152,
384158,
384161,
351399,
384169,
367795,
244917,
384182,
367801,
384189,
384192,
351424,
343232,
367817,
244938,
384202,
253132,
326858,
384209,
146644,
351450,
384225,
359650,
343272,
351467,
359660,
384247,
351480,
384250,
351483,
351492,
343307,
384270,
359695,
261391,
253202,
261395,
384276,
384284,
245021,
384290,
253218,
245032,
171304,
384299,
351535,
376111,
245042,
326970,
384324,
343366,
212296,
212304,
367966,
343394,
367981,
343410,
155000,
327035,
245121,
245128,
253321,
155021,
384398,
245137,
245143,
245146,
245149,
343453,
245152,
245155,
155045,
245158,
40358,
245163,
114093,
327090,
343478,
359867,
384444,
146878,
327108,
327112,
384457,
359887,
359891,
368093,
155103,
343535,
343540,
368120,
343545,
409092,
359948,
359951,
245295,
359984,
400977,
400982,
179803,
155241,
245358,
155255,
155274,
368289,
245410,
425639,
425652,
425663,
155328,
245463,
155352,
155356,
212700,
155364,
245477,
155372,
245487,
212723,
409336,
155394,
155404,
245528,
155423,
360224,
155439,
204592,
155444,
155448,
417596,
384829,
384831,
360262,
155463,
155477,
376665,
155484,
261982,
425823,
155488,
376672,
155492,
327532,
261997,
376686,
262000,
262003,
425846,
262006,
147319,
262009,
327542,
262012,
155517,
155523,
155526,
360327,
376715,
155532,
262028,
262031,
262034,
262037,
262040,
262043,
155550,
253854,
262046,
262049,
262052,
327590,
155560,
155563,
155566,
327613,
393152,
311244,
393170,
155604,
155620,
253924,
155622,
253927,
327655,
360432,
393204,
360439,
253944,
393209,
155647
] |
524140cf5e51c93d9c6a3ab1b544218f54c873be
|
e5860ed81af16dfb39a93240bd4c236a581c3b19
|
/Tests/ParseSwiftTests/ParseFacebookAsyncTests.swift
|
192afff1585ce3a2195c7bb788a33cec4b3b5af7
|
[
"MIT"
] |
permissive
|
jackyin5918/Parse-Swift
|
e76f0ea8d007ba9bd89d3822e7e006b53471cd80
|
0e646a25c29384b04fd928b1e7076eef3c7edd61
|
refs/heads/main
| 2023-08-20T22:17:40.941160 | 2021-10-19T01:13:31 | 2021-10-19T01:13:31 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 14,492 |
swift
|
//
// ParseFacebookAsyncTests.swift
// ParseSwift
//
// Created by Corey Baker on 9/28/21.
// Copyright © 2021 Parse Community. All rights reserved.
//
#if swift(>=5.5) && canImport(_Concurrency) && !os(Linux) && !os(Android)
import Foundation
import XCTest
@testable import ParseSwift
@available(macOS 12.0, iOS 15.0, macCatalyst 15.0, watchOS 9.0, tvOS 15.0, *)
class ParseFacebookAsyncTests: XCTestCase { // swiftlint:disable:this type_body_length
struct User: ParseUser {
//: Those are required for Object
var objectId: String?
var createdAt: Date?
var updatedAt: Date?
var ACL: ParseACL?
// provided by User
var username: String?
var email: String?
var emailVerified: Bool?
var password: String?
var authData: [String: [String: String]?]?
}
struct LoginSignupResponse: ParseUser {
var objectId: String?
var createdAt: Date?
var sessionToken: String
var updatedAt: Date?
var ACL: ParseACL?
// provided by User
var username: String?
var email: String?
var emailVerified: Bool?
var password: String?
var authData: [String: [String: String]?]?
// Your custom keys
var customKey: String?
init() {
let date = Date()
self.createdAt = date
self.updatedAt = date
self.objectId = "yarr"
self.ACL = nil
self.customKey = "blah"
self.sessionToken = "myToken"
self.username = "hello10"
self.email = "[email protected]"
}
}
override func setUpWithError() throws {
try super.setUpWithError()
guard let url = URL(string: "http://localhost:1337/1") else {
XCTFail("Should create valid URL")
return
}
ParseSwift.initialize(applicationId: "applicationId",
clientKey: "clientKey",
masterKey: "masterKey",
serverURL: url,
testing: true)
}
override func tearDownWithError() throws {
try super.tearDownWithError()
MockURLProtocol.removeAll()
#if !os(Linux) && !os(Android)
try KeychainStore.shared.deleteAll()
#endif
try ParseStorage.shared.deleteAll()
}
@MainActor
func testLimitedLogin() async throws {
var serverResponse = LoginSignupResponse()
let authData = ParseAnonymous<User>.AuthenticationKeys.id.makeDictionary()
serverResponse.username = "hello"
serverResponse.password = "world"
serverResponse.objectId = "yarr"
serverResponse.sessionToken = "myToken"
serverResponse.authData = [serverResponse.facebook.__type: authData]
serverResponse.createdAt = Date()
serverResponse.updatedAt = serverResponse.createdAt?.addingTimeInterval(+300)
var userOnServer: User!
let encoded: Data!
do {
encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none)
//Get dates in correct format from ParseDecoding strategy
userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded)
} catch {
XCTFail("Should encode/decode. Error \(error)")
return
}
MockURLProtocol.mockRequests { _ in
return MockURLResponse(data: encoded, statusCode: 200, delay: 0.0)
}
let user = try await User.facebook.login(userId: "testing",
authenticationToken: "authenticationToken")
XCTAssertEqual(user, User.current)
XCTAssertEqual(user, userOnServer)
XCTAssertEqual(user.username, "hello")
XCTAssertEqual(user.password, "world")
XCTAssertTrue(user.facebook.isLinked)
}
@MainActor
func testGraphAPILogin() async throws {
var serverResponse = LoginSignupResponse()
let authData = ParseAnonymous<User>.AuthenticationKeys.id.makeDictionary()
serverResponse.username = "hello"
serverResponse.password = "world"
serverResponse.objectId = "yarr"
serverResponse.sessionToken = "myToken"
serverResponse.authData = [serverResponse.facebook.__type: authData]
serverResponse.createdAt = Date()
serverResponse.updatedAt = serverResponse.createdAt?.addingTimeInterval(+300)
var userOnServer: User!
let encoded: Data!
do {
encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none)
//Get dates in correct format from ParseDecoding strategy
userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded)
} catch {
XCTFail("Should encode/decode. Error \(error)")
return
}
MockURLProtocol.mockRequests { _ in
return MockURLResponse(data: encoded, statusCode: 200, delay: 0.0)
}
let user = try await User.facebook.login(userId: "testing", accessToken: "accessToken")
XCTAssertEqual(user, User.current)
XCTAssertEqual(user, userOnServer)
XCTAssertEqual(user.username, "hello")
XCTAssertEqual(user.password, "world")
XCTAssertTrue(user.facebook.isLinked)
}
@MainActor
func testLoginAuthData() async throws {
var serverResponse = LoginSignupResponse()
let authData = ParseAnonymous<User>.AuthenticationKeys.id.makeDictionary()
serverResponse.username = "hello"
serverResponse.password = "world"
serverResponse.objectId = "yarr"
serverResponse.sessionToken = "myToken"
serverResponse.authData = [serverResponse.facebook.__type: authData]
serverResponse.createdAt = Date()
serverResponse.updatedAt = serverResponse.createdAt?.addingTimeInterval(+300)
var userOnServer: User!
let encoded: Data!
do {
encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none)
//Get dates in correct format from ParseDecoding strategy
userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded)
} catch {
XCTFail("Should encode/decode. Error \(error)")
return
}
MockURLProtocol.mockRequests { _ in
return MockURLResponse(data: encoded, statusCode: 200, delay: 0.0)
}
let faceookAuthData = ParseFacebook<User>
.AuthenticationKeys.id.makeDictionary(userId: "testing",
accessToken: "accessToken",
authenticationToken: nil)
let user = try await User.facebook.login(authData: faceookAuthData)
XCTAssertEqual(user, User.current)
XCTAssertEqual(user, userOnServer)
XCTAssertEqual(user.username, "hello")
XCTAssertEqual(user.password, "world")
XCTAssertTrue(user.facebook.isLinked)
}
func loginNormally() throws -> User {
let loginResponse = LoginSignupResponse()
MockURLProtocol.mockRequests { _ in
do {
let encoded = try loginResponse.getEncoder().encode(loginResponse, skipKeys: .none)
return MockURLResponse(data: encoded, statusCode: 200, delay: 0.0)
} catch {
return nil
}
}
return try User.login(username: "parse", password: "user")
}
@MainActor
func testLinkLimitedLogin() async throws {
_ = try loginNormally()
MockURLProtocol.removeAll()
var serverResponse = LoginSignupResponse()
serverResponse.updatedAt = Date()
var userOnServer: User!
let encoded: Data!
do {
encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none)
//Get dates in correct format from ParseDecoding strategy
userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded)
} catch {
XCTFail("Should encode/decode. Error \(error)")
return
}
MockURLProtocol.mockRequests { _ in
return MockURLResponse(data: encoded, statusCode: 200, delay: 0.0)
}
let user = try await User.facebook.link(userId: "testing",
authenticationToken: "authenticationToken")
XCTAssertEqual(user, User.current)
XCTAssertEqual(user.updatedAt, userOnServer.updatedAt)
XCTAssertEqual(user.username, "parse")
XCTAssertNil(user.password)
XCTAssertTrue(user.facebook.isLinked)
XCTAssertFalse(user.anonymous.isLinked)
}
@MainActor
func testLinkGraphAPILogin() async throws {
_ = try loginNormally()
MockURLProtocol.removeAll()
var serverResponse = LoginSignupResponse()
serverResponse.updatedAt = Date()
var userOnServer: User!
let encoded: Data!
do {
encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none)
//Get dates in correct format from ParseDecoding strategy
userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded)
} catch {
XCTFail("Should encode/decode. Error \(error)")
return
}
MockURLProtocol.mockRequests { _ in
return MockURLResponse(data: encoded, statusCode: 200, delay: 0.0)
}
let user = try await User.facebook.link(userId: "testing",
accessToken: "accessToken")
XCTAssertEqual(user, User.current)
XCTAssertEqual(user.updatedAt, userOnServer.updatedAt)
XCTAssertEqual(user.username, "parse")
XCTAssertNil(user.password)
XCTAssertTrue(user.facebook.isLinked)
XCTAssertFalse(user.anonymous.isLinked)
}
@MainActor
func testLinkAuthData() async throws {
_ = try loginNormally()
MockURLProtocol.removeAll()
var serverResponse = LoginSignupResponse()
serverResponse.updatedAt = Date()
var userOnServer: User!
let encoded: Data!
do {
encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none)
//Get dates in correct format from ParseDecoding strategy
userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded)
} catch {
XCTFail("Should encode/decode. Error \(error)")
return
}
MockURLProtocol.mockRequests { _ in
return MockURLResponse(data: encoded, statusCode: 200, delay: 0.0)
}
let authData = ParseFacebook<User>
.AuthenticationKeys.id.makeDictionary(userId: "testing",
accessToken: "accessToken",
authenticationToken: nil)
let user = try await User.facebook.link(authData: authData)
XCTAssertEqual(user, User.current)
XCTAssertEqual(user.updatedAt, userOnServer.updatedAt)
XCTAssertEqual(user.username, "parse")
XCTAssertNil(user.password)
XCTAssertTrue(user.facebook.isLinked)
XCTAssertFalse(user.anonymous.isLinked)
}
@MainActor
func testUnlinkLimitedLogin() async throws {
_ = try loginNormally()
MockURLProtocol.removeAll()
let authData = ParseFacebook<User>
.AuthenticationKeys.id.makeDictionary(userId: "testing",
accessToken: nil,
authenticationToken: "authenticationToken")
User.current?.authData = [User.facebook.__type: authData]
XCTAssertTrue(User.facebook.isLinked)
var serverResponse = LoginSignupResponse()
serverResponse.updatedAt = Date()
var userOnServer: User!
let encoded: Data!
do {
encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none)
//Get dates in correct format from ParseDecoding strategy
userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded)
} catch {
XCTFail("Should encode/decode. Error \(error)")
return
}
MockURLProtocol.mockRequests { _ in
return MockURLResponse(data: encoded, statusCode: 200, delay: 0.0)
}
let user = try await User.facebook.unlink()
XCTAssertEqual(user, User.current)
XCTAssertEqual(user.updatedAt, userOnServer.updatedAt)
XCTAssertEqual(user.username, "parse")
XCTAssertNil(user.password)
XCTAssertFalse(user.facebook.isLinked)
}
@MainActor
func testUnlinkGraphAPILogin() async throws {
_ = try loginNormally()
MockURLProtocol.removeAll()
let authData = ParseFacebook<User>
.AuthenticationKeys.id.makeDictionary(userId: "testing",
accessToken: "accessToken",
authenticationToken: nil)
User.current?.authData = [User.facebook.__type: authData]
XCTAssertTrue(User.facebook.isLinked)
var serverResponse = LoginSignupResponse()
serverResponse.updatedAt = Date()
var userOnServer: User!
let encoded: Data!
do {
encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none)
//Get dates in correct format from ParseDecoding strategy
userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded)
} catch {
XCTFail("Should encode/decode. Error \(error)")
return
}
MockURLProtocol.mockRequests { _ in
return MockURLResponse(data: encoded, statusCode: 200, delay: 0.0)
}
let user = try await User.facebook.unlink()
XCTAssertEqual(user, User.current)
XCTAssertEqual(user.updatedAt, userOnServer.updatedAt)
XCTAssertEqual(user.username, "parse")
XCTAssertNil(user.password)
XCTAssertFalse(user.facebook.isLinked)
}
}
#endif
|
[
-1
] |
077aaea90307b4cafd310501c65103f4cd7a820e
|
65d29107626f756be31a65026721b9854cdf9cba
|
/12-QuartzCore框架/12-QuartzCore框架/CGContextView.swift
|
4587af924fad03df5c2c25b7f73b09d7e71aa0bc
|
[] |
no_license
|
jiu0929/Swift3.0
|
f10cd750e1373416e65c72b666ee59b4cf93fbc6
|
00d95977adc35fe603108a3f13e8d19e11d793b1
|
refs/heads/master
| 2021-01-01T20:02:59.507132 | 2016-12-14T01:36:10 | 2016-12-14T01:36:10 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 570 |
swift
|
//
// CGContextView.swift
// 12-QuartzCore框架
//
// Created by 蒋鹏 on 16/10/24.
// Copyright © 2016年 蒋鹏. All rights reserved.
//
import UIKit
class CGContextView: UIView {
override func draw(_ rect: CGRect) {
// 获取上下文
let context = UIGraphicsGetCurrentContext()
context?.move(to: CGPoint.init(x: 0, y: 0))
context?.addLine(to: CGPoint.init(x: 100, y: 100))
// 显示绘制的内容(空心)
context?.strokePath()
// 实心
//context?.fillPath()
}
}
|
[
-1
] |
15b0aefa6d61958d7c1ba1b2dce322d1f858c4ac
|
5c081edb2794a17e4334931b89a5a26262bfaff4
|
/DemoApp/DemoApp/DemoChainsViewController.swift
|
b3c9681b6f02145e8bf5080a18d745fd40b35409
|
[
"MIT"
] |
permissive
|
coolboy-ccp/EasyAnimation
|
0ad489851389262a377c63ff86f79c0ec9063b04
|
bf4348a3c104536daeba3c8d0e245221a82f68b6
|
refs/heads/master
| 2020-03-20T04:39:19.322332 | 2017-10-07T15:34:31 | 2017-10-07T15:34:31 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 3,004 |
swift
|
//
// DemoChainsViewController.swift
// DemoApp
//
// Created by Marin Todorov on 5/29/15.
// Copyright (c) 2015 Underplot ltd. All rights reserved.
//
import UIKit
class DemoChainsViewController: UIViewController {
@IBOutlet weak var redSquare: UIView!
@IBOutlet weak var blueSquare: UIView!
@IBOutlet weak var redTopConstraint: NSLayoutConstraint!
@IBOutlet weak var redLeftConstraint: NSLayoutConstraint!
@IBOutlet weak var blueTopConstraint: NSLayoutConstraint!
weak var chain: EAAnimationFuture?
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
// chain calls to animateWithDuration... to easily make animation sequences
chain = UIView.animateAndChain(withDuration: 1.0, delay: 0.0, options: [], animations: {
self.redTopConstraint.constant += 150.0
self.view.layoutIfNeeded()
}, completion: nil).animate(withDuration: 1.0, animations: {
self.redLeftConstraint.constant += 150.0
self.view.layoutIfNeeded()
}).animate(withDuration: 1.0, delay: 0.0, usingSpringWithDamping: 0.2, initialSpringVelocity: 0.0, options: [], animations: {
self.redSquare.transform = CGAffineTransform(rotationAngle: CGFloat(-Double.pi/4))
self.blueSquare.layer.transform = CATransform3DMakeRotation(CGFloat(Double.pi/4), 0.0, 0.0, 1.0)
}, completion: nil).animate(withDuration: 0.5, animations: {
self.redTopConstraint.constant -= 150.0
self.blueTopConstraint.constant -= 150.0
self.view.layoutIfNeeded()
}).animate(withDuration: 2.0, delay: 0.0, usingSpringWithDamping: 0.2, initialSpringVelocity: 0.0, options: .repeat, animations: {
self.redLeftConstraint.constant -= 150.0
self.blueTopConstraint.constant += 150.0
self.view.layoutIfNeeded()
self.redSquare.transform = CGAffineTransform.identity
self.blueSquare.layer.transform = CATransform3DIdentity
}, completion: {_ in
print("sequence finished - will loop from start")
})
}
@IBAction func actionCancelSequence(_ sender: AnyObject) {
if let sender = sender as? UIButton {
sender.setTitle("Cancelled", for: UIControlState())
sender.isEnabled = false
}
chain!.cancelAnimationChain({
self.redLeftConstraint.constant = 0
self.redTopConstraint.constant = 0
self.redSquare.transform = CGAffineTransform.identity
self.blueTopConstraint.constant = 0
self.blueSquare.layer.transform = CATransform3DIdentity
UIView.animate(withDuration: 0.5, animations: {
self.view.layoutIfNeeded()
})
})
}
}
|
[
-1
] |
3360beddcb0ddeb9a73a98e241e4b1cd63ad516e
|
44e0a0d6335a6bd2c06862aa5bec46b30e8ae4a1
|
/ViperSample/Modules/Repositories/User Interface/Presenter/RepositoriesPresenter.swift
|
6598ccff86fa931ddf36ba94ee3b0c0de5407259
|
[] |
no_license
|
devikkim/ViperSample
|
bb6567d8082b9337b53daa0ddd1b580c0a7bb0db
|
543b772591e30f79e9c85b212f1b04b3e07cc602
|
refs/heads/master
| 2020-04-30T13:45:32.525008 | 2019-03-21T05:25:52 | 2019-03-21T05:25:52 | 176,868,022 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,520 |
swift
|
//
// RepositoriesPresenter.swift
// ViperSample
//
// Created by InKwon Devik Kim on 20/03/2019.
//Copyright © 2019 InKwon Devik Kim. All rights reserved.
//
import Foundation
class RepositoriesPresenter {
// MARK: Properties
weak var view: RepositoriesViewInterface?
var interactor: RepositoriesInteractorInput?
var wireframe: RepositoriesWireframeInput?
// MARK: Converting entities
}
// MARK: Repositories module interface
extension RepositoriesPresenter: RepositoriesModuleInterface {
func viewIsReady(userName: String) {
// TODO: Repository를 받을때 indicator
view?.showLoading()
interactor?.fetchRepositories(userName: userName)
}
func refreshData(userName: String) {
interactor?.fetchRepositories(userName: userName)
}
func openSelectedRepository(repository: Repository) {
// TODO: View로 부터 사용자 입력을 받으면 해당 url로 이동
wireframe?.showRepositoryFromWebView(repository: repository)
}
}
// MARK: Repositories interactor output interface
extension RepositoriesPresenter: RepositoriesInteractorOutput {
func result(model: [Repository]) {
view?.hideLoading()
view?.show(model: model)
}
func result(error: Error) {
view?.show(error: error.localizedDescription)
}
func result(panicError: Error) {
view?.hideLoading()
view?.show(panicError: panicError.localizedDescription)
}
}
|
[
-1
] |
5ca5a5c1d9a7d85093f1fe9a276af6da93534b9e
|
af60c78f65440c2ef15c2d65f76be82e9c8710ca
|
/ios/PeerToPeer/PeerToPeer/Transcript.swift
|
7dc607ec06451d9cc5e8c0af569dad7dedfca22a
|
[] |
no_license
|
murakami/workbook
|
52eee27487452f10ab587a970e50c09d1ca1fa64
|
f393d4d6d851300154c6fad72f4f5a8bb3d03ff4
|
refs/heads/master
| 2022-12-15T17:47:52.031629 | 2022-12-03T05:00:30 | 2022-12-03T05:00:30 | 3,233,955 | 12 | 15 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,549 |
swift
|
//
// Transcript.swift
// PeerToPeer
//
// Created by 村上幸雄 on 2015/01/31.
// Copyright (c) 2015年 村上幸雄. All rights reserved.
//
import Foundation
import MultipeerConnectivity
enum TranscriptDirection {
case Send
case Receive
case Local
}
class Transcript {
var direction: TranscriptDirection
var peerID: MCPeerID
var message: String?
var imageName: String?
var imageUrl: NSURL?
var progress: NSProgress?
init(peerID: MCPeerID, message: String?, imageName: String?, imageUrl: NSURL?, progress: NSProgress?, direction: TranscriptDirection) {
self.peerID = peerID
self.message = message
self.direction = direction
self.imageUrl = imageUrl
self.progress = progress
self.imageName = imageName
}
convenience init(peerID: MCPeerID, message: String, direction: TranscriptDirection) {
self.init(peerID: peerID, message: message, imageName: nil, imageUrl: nil, progress: nil, direction: direction)
}
convenience init(peerID: MCPeerID, imageUrl: NSURL, direction: TranscriptDirection) {
self.init(peerID: peerID, message: nil, imageName: imageUrl.lastPathComponent, imageUrl: imageUrl, progress: nil, direction: direction)
}
convenience init(peerID: MCPeerID, imageName: String, progress: NSProgress, direction: TranscriptDirection) {
self.init(peerID: peerID, message: nil, imageName: imageName, imageUrl: nil, progress: progress, direction: direction)
}
}
/* End Of File */
|
[
-1
] |
7f8ab5c86709ffd9ce55ad1c4b32f5a668e5060b
|
c99e73a351aa986cc7912f64f8982e0155bea47c
|
/RemoteDebugger/UI Components/ContentView.swift
|
f46b09f357aa7dd70d4f470bd218a8eb250c1596
|
[
"MIT"
] |
permissive
|
yogevbar/RemoteDebugger
|
51f618b61fcb1227b84fa1d325f30041c82bc360
|
a873a832b981d9e73a72d14d0c94f239cca065fd
|
refs/heads/master
| 2022-12-25T17:04:15.822426 | 2020-10-08T11:02:22 | 2020-10-08T11:02:22 | 301,143,313 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,932 |
swift
|
//
// ContentView.swift
// RemoteDebugger
//
// Created by Yogev Barber on 10/04/2020.
// Copyright © 2020 Yogev Barber. All rights reserved.
//
import SwiftUI
import Combine
struct ContentView: View {
@EnvironmentObject private var session: SessionViewModel
@EnvironmentObject private var toolBarManager: ToolBarManager
@State private var selection: String?
var openSession: (_ sessionId: String) -> Void
var body: some View {
HSplitView {
if toolBarManager.showMenu {
List(selection: $selection) {
LeftMenu(openSession: { sessionId in
self.openSession(sessionId)
})
.padding(.top, 15)
Spacer()
}
.background(Color("background"))
.listStyle(SidebarListStyle())
.frame(minWidth: 190, idealWidth: 190, maxWidth: 220)
}
HSplitView {
VStack(alignment: .leading) {
SearchBar(text: $session.searchKey)
.padding([.leading, .trailing])
.layoutPriority(2)
LogList(logs: session.filteredLogs)
Spacer()
}
.padding(.top, 15)
.frame(minWidth: 400)
if toolBarManager.showDetails && session.selectedLog != nil {
LogDetails(log: session.selectedLog!)
.frame(minWidth: 200)
}
}//.animation(.easeInOut)
}
.frame(minWidth: 1200, maxWidth: .infinity, minHeight: 800, maxHeight: .infinity)
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView(openSession: { _ in })
}
}
|
[
-1
] |
66df8e68404620fbd15996fdd42f8f5aeb4ed107
|
9a864a8b48ea090a7905342e7925742f1640b204
|
/ContactCard/RandomUserStore.swift
|
2c7a8598deb4ba536056b4492b9d4b1427653944
|
[] |
no_license
|
blurrah/ContactCard
|
2e67ac186ae744493b90e8497f037fa144ac3bfd
|
425756c7fe69011bc9063156963ce91a00a46dd8
|
refs/heads/master
| 2021-01-20T01:03:12.323773 | 2015-10-05T10:21:12 | 2015-10-05T10:21:12 | 42,000,505 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,556 |
swift
|
//
// RandomUserModel.swift
// ContactCard
//
// Created by Boris Besemer on 03-09-15.
// Copyright (c) 2015 Boris Besemer. All rights reserved.
//
import Foundation
import SwiftyJSON
import Alamofire
import CoreData
// New Class based on Core Data
class RandomUserStore {
var users: [NSManagedObject] = []
class var sharedInstance: RandomUserStore {
struct Singleton {
static let instance = RandomUserStore()
}
return Singleton.instance
}
func getStoredUsers() {
CoreDataManager.sharedInstance.getUsers()
}
func getRandomUser(onCompletion: Void -> ()) {
Alamofire.request(.GET, "https://randomuser.me/api/")
.validate(statusCode: 200..<300)
.responseJSON { (req, res, result) in
switch result {
case .Success(let data):
let jsonData = JSON(data)
let results = jsonData["results"]
for (_, subJson) : (String, JSON) in results {
let user: AnyObject = subJson["user"].object
CoreDataManager.sharedInstance.addUser(Person(person: user))
//self.users.append(Person(person: user))
}
onCompletion()
case .Failure(_, let error):
print("Request failed with error: \(error)")
}
}
}
}
|
[
-1
] |
ed3862dfa4bf1e1df45aafb4db4d60e117d933d9
|
55ba063fb397f9dcdc132d010aca3896fc62002d
|
/AmazonChimeSDK/AmazonChimeSDKTests/internal/ingestion/AnyCodableTests.swift
|
a53d20c536a44cad3d602cd91b80520f9eafcec1
|
[
"Apache-2.0"
] |
permissive
|
aws/amazon-chime-sdk-ios
|
e3539abe48a4b433d92ae8a4097921cca427418e
|
5d067ec2acbb65c4b15017c77b22cd74c94d93d6
|
refs/heads/master
| 2023-08-22T09:57:50.997803 | 2023-06-27T23:05:20 | 2023-06-27T23:05:20 | 249,575,172 | 129 | 74 |
Apache-2.0
| 2023-09-07T20:47:16 | 2020-03-24T00:30:08 |
Swift
|
UTF-8
|
Swift
| false | false | 8,011 |
swift
|
//
// AnyCodableTests.swift
// AmazonChimeSDK
//
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
//
@testable import AmazonChimeSDK
import XCTest
class AnyCodableTests: XCTestCase {
private let encoder = JSONEncoder()
private let decoder = JSONDecoder()
}
// MARK: Decoder tests
extension AnyCodableTests{
func testAnyCodableCanInitBoolFromDecoder() {
let data = true
let codableData = AnyCodable(data)
guard let decodedData = encodeAndDecode(data: codableData) else {
XCTFail("Failed to encode/decode data")
return
}
XCTAssertEqual(data, decodedData.value as? Bool)
}
func testAnyCodableCanInitIntFromDecoder() {
let data = Int(123)
let codableData = AnyCodable(data)
guard let decodedData = encodeAndDecode(data: codableData) else {
XCTFail("Failed to encode/decode data")
return
}
XCTAssertEqual(data, decodedData.value as? Int)
}
func testAnyCodableCanInitDoubleFromDecoder() {
let data = Double(123.456)
let codableData = AnyCodable(data)
guard let decodedData = encodeAndDecode(data: codableData) else {
XCTFail("Failed to encode/decode data")
return
}
XCTAssertEqual(data, decodedData.value as? Double)
}
func testAnyCodableCanInitStringFromDecoder() {
let data = String("test string")
let codableData = AnyCodable(data)
guard let decodedData = encodeAndDecode(data: codableData) else {
XCTFail("Failed to encode/decode data")
return
}
XCTAssertEqual(data, decodedData.value as? String)
}
func testAnyCodableCanInitArrayFromDecoder() {
let data:[AnyCodable] = [1,2,3]
guard let decodedData = encodeAndDecode(data: data) else {
XCTFail("Failed to encode/decode data")
return
}
XCTAssertEqual(data[0].value as? Int, decodedData[0].value as? Int)
}
func testAnyCodableCanInitDictFromDecoder() {
let data:[String: AnyCodable] = ["a":1, "b":2, "c":3]
guard let decodedData = encodeAndDecode(data: data) else {
XCTFail("Failed to encode/decode data")
return
}
XCTAssertEqual(data["a"]?.value as? Int, decodedData["a"]?.value as? Int)
}
private func encodeAndDecode(data: AnyCodable) -> AnyCodable? {
guard let encodedData = try? encoder.encode(data) else {
return nil
}
guard let decodedData = try? decoder.decode(AnyCodable.self, from: encodedData) else {
return nil
}
return decodedData
}
private func encodeAndDecode(data: [AnyCodable]) -> [AnyCodable]? {
guard let encodedData = try? encoder.encode(data) else {
return nil
}
guard let decodedData = try? decoder.decode([AnyCodable].self, from: encodedData) else {
return nil
}
return decodedData
}
private func encodeAndDecode(data: [String: AnyCodable]) -> [String: AnyCodable]? {
guard let encodedData = try? encoder.encode(data) else {
return nil
}
guard let decodedData = try? decoder.decode([String: AnyCodable].self, from: encodedData) else {
return nil
}
return decodedData
}
}
// MARK: Init tests
extension AnyCodableTests {
func testInitBoolLiteral() {
let data = true
let codableData = AnyCodable(booleanLiteral: data)
XCTAssertEqual(codableData.value as? Bool, data)
}
func testInitFloatLiteral() {
let data = Double(123.456)
let codableData = AnyCodable(floatLiteral: data)
XCTAssertEqual(codableData.value as? Double, data)
}
func testInitIntLiteral() {
let data = Int(123)
let codableData = AnyCodable(integerLiteral: data)
XCTAssertEqual(codableData.value as? Int, data)
}
func testInitStringLiteral() {
let data = String("abc")
let codableData = AnyCodable(stringLiteral: data)
XCTAssertEqual(codableData.value as? String, data)
}
func testInitArrayLiteral() {
let codableData = AnyCodable(arrayLiteral: "a", "b", "c")
let value = codableData.value as? [AnyCodable]
XCTAssertEqual(value?[0].value as? String, "a")
XCTAssertEqual(value?[1].value as? String, "b")
XCTAssertEqual(value?[2].value as? String, "c")
}
func testInitDictLiteral() {
let codableData = AnyCodable(dictionaryLiteral:
("a", AnyCodable(1)),
("b", AnyCodable(2)),
("c", AnyCodable(3))
)
let value = codableData.value as? [String: AnyCodable]
XCTAssertEqual(value?["a"]?.value as? Int, 1)
XCTAssertEqual(value?["b"]?.value as? Int, 2)
XCTAssertEqual(value?["c"]?.value as? Int, 3)
}
func testBoolAnyInitShouldInitialize() {
let data: Any? = true
XCTAssertNotNil(AnyCodable(data))
}
func testDoubleAnyInitShouldInitialize() {
let data: Any? = Float(123.456)
XCTAssertNotNil(AnyCodable(data))
}
func testFloatAnyInitShouldInitialize() {
let data: Any? = Float(123.456)
XCTAssertNotNil(AnyCodable(data))
}
func testIntAnyInitShouldInitialize() {
let data: Any? = Int(123)
XCTAssertNotNil(AnyCodable(data))
}
func testInt8AnyInitShouldInitialize() {
let data: Any? = Int8(123)
XCTAssertNotNil(AnyCodable(data))
}
func testInt16AnyInitShouldInitialize() {
let data: Any? = Int16(123)
XCTAssertNotNil(AnyCodable(data))
}
func testInt32AnyInitShouldInitialize() {
let data: Any? = Int32(123)
XCTAssertNotNil(AnyCodable(data))
}
func testInt64AnyInitShouldInitialize() {
let data: Any? = Int64(123)
XCTAssertNotNil(AnyCodable(data))
}
func testUIntAnyInitShouldInitialize() {
let data: Any? = UInt(123)
XCTAssertNotNil(AnyCodable(data))
}
func testUInt8AnyInitShouldInitialize() {
let data: Any? = UInt8(123)
XCTAssertNotNil(AnyCodable(data))
}
func testUInt16AnyInitShouldInitialize() {
let data: Any? = UInt16(123)
XCTAssertNotNil(AnyCodable(data))
}
func testUInt32AnyInitShouldInitialize() {
let data: Any? = UInt32(123)
XCTAssertNotNil(AnyCodable(data))
}
func testUInt64AnyInitShouldInitialize() {
let data: Any? = UInt64(123)
XCTAssertNotNil(AnyCodable(data))
}
func testStringAnyInitShouldInitialize() {
let data: Any? = String("abc")
XCTAssertNotNil(AnyCodable(data))
}
func testArrayAnyInitShouldInitialize() {
let data: Any? = [AnyCodable("a"), AnyCodable("b"), AnyCodable("c")]
XCTAssertNotNil(AnyCodable(data))
}
func testDictAnyInitShouldInitialize() {
let data: Any? = ["a": AnyCodable(1), "b": AnyCodable(2), "c": AnyCodable(3)]
XCTAssertNotNil(AnyCodable(data))
}
}
// MARK: Int cast helper method tests
extension AnyCodableTests {
func testInt64ValueShouldReturnValueIfAnyCodableIsInt64() {
let data = Int64(123)
let codableData = AnyCodable(data)
XCTAssertEqual(data, codableData.int64Value)
}
func testInt64ValueShouldReturnValueIfAnyCodableIsInt() {
let data = Int(123)
let codableData = AnyCodable(data)
XCTAssertEqual(Int64(data), codableData.int64Value)
}
func testInt64ValueShouldReturnNilIfAnyCodableIsNotInt64OrInt() {
let data = String("123")
let codableData = AnyCodable(data)
XCTAssertNil(codableData.int64Value)
}
}
|
[
-1
] |
20ca73e0bf48c13f2264ca467ef6ccab07b84809
|
5c103410b603fd301be5bcd53fe6ad33f8b21a5b
|
/CoreImage-HDR/Convenience/textureLoaderExtensions.swift
|
7512dc6f4432a6c32700a9a5ef2de4546809ad79
|
[] |
no_license
|
rm335/CoreImage-HDR
|
b0c278ed7146bb1b75267b6c79d2971c26773ca2
|
c7f5264929338beebfcfbf2e420594aa2952ef6c
|
refs/heads/master
| 2021-09-14T22:02:15.408540 | 2018-05-20T21:47:33 | 2018-05-20T21:47:33 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,510 |
swift
|
//
// textureLoaderExtensions.swift
// HDR-Module
//
// Created by Philipp Waxweiler on 30.11.16.
// Copyright © 2016 Philipp Waxweiler. All rights reserved.
//
import MetalKit
import CoreImage
extension MTKTextureLoader {
func newTexture(CIImage: CIImage, context: CIContext, mips: Int = 1) -> MTLTexture {
let colorspace = CIImage.colorSpace ?? CGColorSpace(name: CGColorSpace.sRGB)!
let textureDescriptor = MTLTextureDescriptor()
textureDescriptor.arrayLength = 1
textureDescriptor.height = Int(CIImage.extent.height)
textureDescriptor.width = Int(CIImage.extent.width)
textureDescriptor.pixelFormat = .rgba16Unorm
textureDescriptor.storageMode = .managed
textureDescriptor.textureType = .type2D
textureDescriptor.mipmapLevelCount = mips
textureDescriptor.usage = .unknown
let metalTexture = self.device.makeTexture(descriptor: textureDescriptor)
let cmdQueue = device.makeCommandQueue()
let cmdBuffer = cmdQueue?.makeCommandBuffer()
context.render(CIImage, to: metalTexture!, commandBuffer: cmdBuffer, bounds: CIImage.extent, colorSpace: colorspace)
if metalTexture!.mipmapLevelCount > 1 {
let encoder = cmdBuffer?.makeBlitCommandEncoder()
encoder?.generateMipmaps(for: metalTexture!)
encoder?.endEncoding()
}
cmdBuffer?.commit()
return metalTexture!
}
}
|
[
-1
] |
e46c951424d3f448331491487675d9bfe12f6ff1
|
e291f7651346b2cfc2a322084733c997b739213a
|
/SwiftDemo/ZoomiOSSDKDemo/AppDelegate.swift
|
272283ae98f6a98fc7049c8235af30b0a319ed34
|
[] |
no_license
|
tingstam/client-sdk-iOS-getting-started
|
1777b408c9aac2daad9e16ab510775536995b6c3
|
0689bc5b0f5398ffbd62ec917f63f7b66db4e75e
|
refs/heads/master
| 2023-01-01T23:50:21.013152 | 2020-10-12T17:25:02 | 2020-10-12T17:25:02 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 5,670 |
swift
|
//
// AppDelegate.swift
// ZoomiOSSDKDemo
//
// Created by Zoom Video Communications on 8/14/20.
// Copyright © 2020 Zoom Video Communications. All rights reserved.
//
import UIKit
import MobileRTC
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
// Obtain your SDK Key and SDK Secret and paste it here.
// Your SDK Secret should NEVER be publically accessible, only use the sdk key and secret for testing this demo app.
// For your own application, you must obtain a JWT instead of using the SDK Key and SDK Secret.
let sdkKey = ""
let sdkSecret = ""
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
setupSDK(sdkKey: sdkKey, sdkSecret: sdkSecret)
return true
}
// Logs the user out of the app upon application termination.
// This is not a neccesary action. In real use cases, the SDK should be alerted of app events. For example, in applicationWillTerminate(_ application: UIApplication), MobileRTC.shared().appWillTerminate should be called.
func applicationWillTerminate(_ application: UIApplication) {
// Obtain the MobileRTCAuthService from the Zoom SDK, this service can log in a Zoom user, log out a Zoom user, authorize the Zoom SDK etc.
if let authorizationService = MobileRTC.shared().getAuthService() {
// Call logoutRTC() to log the user out.
authorizationService.logoutRTC()
}
}
/// Creates, Intializes, and Authorizes an instance of the Zoom SDK. This must be called before any other SDK functions.
///
/// Assign a MobileRTCAuthDelegate to listen to SDK authorization events.
///
/// In real applications, SDK Key's and SDK Secret's should not be used as they are highly sensitive data. A JWT should be used instead.
/// Do not leave a JWT, SDK Key, or SDK Secret anywhere that is not secured.
///
/// - Parameters:
/// - sdkKey: A valid SDK Client Key provided by the Zoom Marketplace.
/// - sdkSecret: A valid SDK Client Secret provided by the Zoom Marketplace.
func setupSDK(sdkKey: String, sdkSecret: String) {
// Create a MobileRTCSDKInitContext. This class contains attributes for modifying how the SDK will be created. You must supply the context with a domain.
let context = MobileRTCSDKInitContext()
// The domain we will use is zoom.us
context.domain = "zoom.us"
// Turns on SDK logging. This is optional.
context.enableLog = true
// Call initialize(_ context: MobileRTCSDKInitContext) to create an instance of the Zoom SDK. Without initializing first, the SDK will not do anything. This call will return true if the SDK was initialized successfully.
let sdkInitializedSuccessfully = MobileRTC.shared().initialize(context)
// Check if initializaiton was successful. Obtain a MobileRTCAuthService, this is for supplying credentials to the SDK for authorization.
if sdkInitializedSuccessfully == true, let authorizationService = MobileRTC.shared().getAuthService() {
// Supply the SDK with SDK Key and SDK Secret. This is required if a JWT is not supplied.
// To use a JWT, replace these lines with authorizationService.jwtToken = yourJWTToken.
authorizationService.clientKey = sdkKey
authorizationService.clientSecret = sdkSecret
// Assign AppDelegate to be a MobileRTCAuthDelegate to listen for authorization callbacks.
authorizationService.delegate = self
// Call sdkAuth to perform authorization.
authorizationService.sdkAuth()
}
}
}
// MARK: - MobileRTCAuthDelegate
// Conform AppDelegate to MobileRTCAuthDelegate.
// MobileRTCAuthDelegate listens to authorization events like SDK authorization, user login, etc.
extension AppDelegate: MobileRTCAuthDelegate {
// Result of calling sdkAuth(). MobileRTCAuthError_Success represents a successful authorization.
func onMobileRTCAuthReturn(_ returnValue: MobileRTCAuthError) {
switch returnValue {
case MobileRTCAuthError_Success:
print("SDK successfully initialized.")
case MobileRTCAuthError_KeyOrSecretEmpty:
assertionFailure("SDK Key/Secret was not provided. Relpace sdkKey and sdkSecret at the top of this file with your SDK Key/Secret.")
case MobileRTCAuthError_KeyOrSecretWrong, MobileRTCAuthError_Unknown:
assertionFailure("SDK Key/Secret is not valid.")
default:
assertionFailure("SDK Authorization failed with MobileRTCAuthError: \(returnValue).")
}
}
// Result of calling logIn(). 0 represents a successful log in attempt.
func onMobileRTCLoginReturn(_ returnValue: Int) {
switch returnValue {
case 0:
print("Successfully logged in")
// This alerts the ViewController that log in was successful. This is not a neccesary action.
NotificationCenter.default.post(name: Notification.Name("userLoggedIn"), object: nil)
case 1002:
print("Password incorrect")
default:
print("Could not log in. Error code: \(returnValue)")
}
}
// Result of calling logoutRTC(). 0 represents a successful log out attempt.
func onMobileRTCLogoutReturn(_ returnValue: Int) {
switch returnValue {
case 0:
print("Successfully logged out")
default:
print("Could not log out. Error code: \(returnValue)")
}
}
}
|
[
-1
] |
feac0d55510867b8ca8a54023c474af5dfff34ce
|
9cea99da55afe8712cf74a5290542349bbd042a4
|
/RxExample/RxExample/Services/DownloadableImage.swift
|
40cad200f7ca97d7c1cbaf7521dc974bf064794e
|
[
"MIT"
] |
permissive
|
ReactiveX/RxSwift
|
d6ad5e7fecee4b5fd792a480129461e0e2ee6d94
|
2ff073fc1b9c600ac9b54734aff3348110437c19
|
refs/heads/main
| 2023-08-08T23:29:29.278319 | 2023-07-07T16:58:14 | 2023-07-07T17:17:41 | 33,569,135 | 25,749 | 5,650 |
MIT
| 2023-09-07T11:42:17 | 2015-04-07T21:25:17 |
Swift
|
UTF-8
|
Swift
| false | false | 327 |
swift
|
//
// DownloadableImage.swift
// RxExample
//
// Created by Vodovozov Gleb on 10/31/15.
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//
import RxSwift
#if os(iOS)
import UIKit
#elseif os(macOS)
import Cocoa
#endif
enum DownloadableImage{
case content(image:Image)
case offlinePlaceholder
}
|
[
170728,
286601,
298053
] |
a927ebbe3f3b0b383c4958dcabcc36ab385d796a
|
f7515f1371b18781f23cad8332ef22b002d0331c
|
/Package.swift
|
22907d8197a171a58c5e3586af6b381c13ec2bb4
|
[
"MIT"
] |
permissive
|
gwynne/semver-cli
|
d5950ea5da0c6b331184ec6de7e6b15e5b392278
|
e7a27a28f0574c829094521cafab9bbdfa973111
|
refs/heads/main
| 2023-07-10T19:27:58.621673 | 2023-07-05T06:09:26 | 2023-07-05T06:09:26 | 286,466,053 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,074 |
swift
|
// swift-tools-version:5.2
//===----------------------------------------------------------------------===//
//
// This source file is part of the semver-cli open source project
//
// Copyright (c) Gwynne Raskind
// Licensed under the MIT license
//
// See LICENSE.txt for license information
//
// SPDX-License-Identifier: MIT
//
//===----------------------------------------------------------------------===//
import PackageDescription
let package = Package(
name: "semver-cli",
products: [
.executable(name: "semver", targets: ["semver"]),
],
dependencies: [
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "0.2.2"),
.package(url: "https://github.com/gwynne/swift-semver.git", from: "0.1.0-alpha"),
],
targets: [
.target(name: "semver", dependencies: [
.product(name: "ArgumentParser", package: "swift-argument-parser"),
.product(name: "SwiftSemver", package: "swift-semver"),
]),
.testTarget(name: "semverTests", dependencies: ["semver"]),
]
)
|
[
-1
] |
a5e9a900f1f4022b63a335a1bab98128b548abd2
|
67e9452cebfa8d53d1a1dcc7b9d433f71a6d2efd
|
/FSNotes/View/SidebarProjectView.swift
|
12dc87c4e076263e4eae689a867333b65f551263
|
[
"MIT"
] |
permissive
|
rtimmons/fsnotes
|
c07314f34f66477073874f4d85ca678e359cc6a0
|
40b40ba656ec69521b4a101960ee740fcc808828
|
refs/heads/master
| 2020-03-26T04:08:28.141261 | 2019-04-03T21:40:00 | 2019-04-03T21:40:00 | 144,488,453 | 0 | 0 |
MIT
| 2018-08-12T17:49:43 | 2018-08-12T17:49:43 | null |
UTF-8
|
Swift
| false | false | 24,450 |
swift
|
//
// SidebarProjectView.swift
// FSNotes
//
// Created by Oleksandr Glushchenko on 4/9/18.
// Copyright © 2018 Oleksandr Glushchenko. All rights reserved.
//
import Cocoa
import Foundation
import Carbon.HIToolbox
import FSNotesCore_macOS
class SidebarProjectView: NSOutlineView, NSOutlineViewDelegate, NSOutlineViewDataSource {
var sidebarItems: [SidebarItem]? = nil
var viewDelegate: ViewController? = nil
private var storage = Storage.sharedInstance()
private var isFirstLaunch = true
override func validateMenuItem(_ menuItem: NSMenuItem) -> Bool {
if let sidebarItem = getSidebarItem(), let project = sidebarItem.project, project.isArchive {
if menuItem.title == NSLocalizedString("Reveal folder", comment: "") {
return true
}
return false
}
if menuItem.title == NSLocalizedString("Attach storage", comment: "") {
return true
}
if
let sidebarItem = getSidebarItem(),
let project = sidebarItem.project, project.isDefault,
![
NSLocalizedString("New folder", comment: ""),
NSLocalizedString("Reveal folder", comment: "")
].contains(menuItem.title) {
return false
}
guard let sidebarItem = getSidebarItem(), sidebarItem.project != nil else { return false }
return true
}
override func draw(_ dirtyRect: NSRect) {
delegate = self
dataSource = self
registerForDraggedTypes([
NSPasteboard.PasteboardType(rawValue: "public.data"),
NSPasteboard.PasteboardType.init(rawValue: "notesTable")
])
}
override func keyDown(with event: NSEvent) {
if event.modifierFlags.contains(.option) && event.modifierFlags.contains(.shift) && event.keyCode == kVK_ANSI_N {
addProject("")
return
}
if event.modifierFlags.contains(.option) && event.modifierFlags.contains(.shift) && event.modifierFlags.contains(.command) && event.keyCode == kVK_ANSI_R {
revealInFinder("")
return
}
if event.modifierFlags.contains(.option) && event.modifierFlags.contains(.shift) && event.keyCode == kVK_ANSI_R {
renameMenu("")
return
}
if event.modifierFlags.contains(.option) && event.modifierFlags.contains(.shift) && event.keyCode == kVK_Delete {
deleteMenu("")
return
}
// Tab or right arrow to search
if event.keyCode == 48 || event.keyCode == 124 {
self.viewDelegate?.search.becomeFirstResponder()
return
}
super.keyDown(with: event)
}
func outlineView(_ outlineView: NSOutlineView, acceptDrop info: NSDraggingInfo, item: Any?, childIndex index: Int) -> Bool {
guard let sidebarItem = item as? SidebarItem else { return false }
guard let vc = ViewController.shared() else { return false }
let board = info.draggingPasteboard()
switch sidebarItem.type {
case .Tag:
if let data = board.data(forType: NSPasteboard.PasteboardType.init(rawValue: "notesTable")), let rows = NSKeyedUnarchiver.unarchiveObject(with: data) as? IndexSet {
for row in rows {
let note = vc.notesTableView.noteList[row]
note.addTag(sidebarItem.name)
selectTag(item: sidebarItem)
}
return true
}
break
case .Label, .Category, .Trash, .Archive:
if let data = board.data(forType: NSPasteboard.PasteboardType.init(rawValue: "notesTable")), let rows = NSKeyedUnarchiver.unarchiveObject(with: data) as? IndexSet {
var notes = [Note]()
for row in rows {
let note = vc.notesTableView.noteList[row]
notes.append(note)
}
if let project = sidebarItem.project {
vc.move(notes: notes, project: project)
}
if sidebarItem.isTrash() {
vc.editArea.clear()
vc.storage.removeNotes(notes: notes) { _ in
vc.storageOutlineView.reloadSidebar()
DispatchQueue.main.async {
vc.notesTableView.removeByNotes(notes: notes)
}
}
}
return true
}
guard let urls = board.readObjects(forClasses: [NSURL.self], options: nil) as? [URL],
let project = sidebarItem.project else { return false }
for url in urls {
var isDirectory = ObjCBool(true)
if FileManager.default.fileExists(atPath: url.path, isDirectory: &isDirectory), isDirectory.boolValue {
let newSub = project.url.appendingPathComponent(url.lastPathComponent, isDirectory: true)
let newProject = Project(url: newSub, parent: project)
newProject.create()
_ = self.storage.add(project: newProject)
self.reloadSidebar()
let validFiles = self.storage.readDirectory(url)
for file in validFiles {
vc.copy(project: newProject, url: file.0)
}
} else {
vc.copy(project: project, url: url)
}
}
return true
default:
break
}
return false
}
func outlineView(_ outlineView: NSOutlineView, validateDrop info: NSDraggingInfo, proposedItem item: Any?, proposedChildIndex index: Int) -> NSDragOperation {
guard let sidebarItem = item as? SidebarItem else { return NSDragOperation() }
let board = info.draggingPasteboard()
switch sidebarItem.type {
case .Tag, .Trash:
if let data = board.data(forType: NSPasteboard.PasteboardType.init(rawValue: "notesTable")), !data.isEmpty {
return .copy
}
break
case .Category, .Label, .Archive:
guard sidebarItem.isSelectable() else { break }
if let data = board.data(forType: NSPasteboard.PasteboardType.init(rawValue: "notesTable")), !data.isEmpty {
return .move
}
if let urls = board.readObjects(forClasses: [NSURL.self], options: nil) as? [URL], urls.count > 0 {
return .copy
}
break
default:
break
}
return NSDragOperation()
}
func outlineView(_ outlineView: NSOutlineView, numberOfChildrenOfItem item: Any?) -> Int {
guard let sidebar = sidebarItems else { return 0 }
if item == nil {
return sidebar.count
}
return 0
}
func outlineView(_ outlineView: NSOutlineView, heightOfRowByItem item: Any) -> CGFloat {
if let si = item as? SidebarItem, si.type == .Label {
return 30
}
return 25
}
func outlineView(_ outlineView: NSOutlineView, isItemExpandable item: Any) -> Bool {
return false
}
func outlineView(_ outlineView: NSOutlineView, child index: Int, ofItem item: Any?) -> Any {
guard let sidebar = sidebarItems else { return "" }
if item == nil {
return sidebar[index]
}
return ""
}
func outlineView(_ outlineView: NSOutlineView, objectValueFor tableColumn: NSTableColumn?, byItem item: Any?) -> Any? {
return item
}
func outlineView(_ outlineView: NSOutlineView, viewFor tableColumn: NSTableColumn?, item: Any) -> NSView? {
let cell = outlineView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "DataCell"), owner: self) as! SidebarCellView
if let si = item as? SidebarItem {
cell.textField?.stringValue = si.name
switch si.type {
case .All:
cell.icon.image = NSImage(imageLiteralResourceName: "home.png")
cell.icon.isHidden = false
cell.label.frame.origin.x = 25
case .Trash:
cell.icon.image = NSImage(imageLiteralResourceName: "trash.png")
cell.icon.isHidden = false
cell.label.frame.origin.x = 25
case .Label:
cell.icon.isHidden = true
cell.label.frame.origin.x = 5
case .Category:
cell.icon.image = NSImage(imageLiteralResourceName: "repository.png")
cell.icon.isHidden = false
cell.label.frame.origin.x = 25
case .Tag:
cell.icon.image = NSImage(imageLiteralResourceName: "tag.png")
cell.icon.isHidden = false
cell.label.frame.origin.x = 25
case .Archive:
cell.icon.image = NSImage(imageLiteralResourceName: "archive.png")
cell.icon.isHidden = false
cell.label.frame.origin.x = 25
case .Todo:
cell.icon.image = NSImage(imageLiteralResourceName: "todo_sidebar.png")
cell.icon.isHidden = false
cell.label.frame.origin.x = 25
}
}
return cell
}
func outlineView(_ outlineView: NSOutlineView, isGroupItem item: Any) -> Bool {
if let x = item as? SidebarItem, x.type == .Label {
return true
}
return false
}
func outlineView(_ outlineView: NSOutlineView, shouldSelectItem item: Any) -> Bool {
guard let sidebarItem = item as? SidebarItem else {
return false
}
return sidebarItem.isSelectable()
}
func outlineView(_ outlineView: NSOutlineView, rowViewForItem item: Any) -> NSTableRowView? {
return SidebarTableRowView(frame: NSZeroRect)
}
func outlineViewSelectionDidChange(_ notification: Notification) {
guard !UserDataService.instance.skipListReload else {
UserDataService.instance.skipListReload = false
return
}
if UserDataService.instance.isNotesTableEscape {
UserDataService.instance.isNotesTableEscape = false
}
self.deselectAllTags()
if let view = notification.object as? NSOutlineView {
guard let sidebar = sidebarItems, let vd = viewDelegate else { return }
vd.editArea.clear()
vd.search.stringValue = ""
let i = view.selectedRow
if sidebar.indices.contains(i) {
UserDefaultsManagement.lastProject = i
}
vd.updateTable() {
if self.isFirstLaunch {
if let url = UserDefaultsManagement.lastSelectedURL,
let lastNote = vd.storage.getBy(url: url),
let i = vd.notesTableView.getIndex(lastNote)
{
vd.notesTableView.selectRow(i)
DispatchQueue.main.async {
vd.notesTableView.scrollRowToVisible(i)
}
} else if vd.notesTableView.noteList.count > 0 {
vd.focusTable()
}
self.isFirstLaunch = false
}
}
}
}
override func willOpenMenu(_ menu: NSMenu, with event: NSEvent) {
if (clickedRow > -1) {
selectRowIndexes([clickedRow], byExtendingSelection: false)
guard let si = sidebarItems, si.indices.contains(selectedRow) else { return }
let sidebarItem = si[selectedRow]
if let p = sidebarItem.project, p.isArchive {
return
}
if let p = sidebarItem.project, p.isDefault {
for item in menu.items {
if ![
NSLocalizedString("New folder", comment: ""),
NSLocalizedString("Reveal folder", comment: "")
].contains(item.title) {
item.isHidden = true
} else {
item.isHidden = false
}
}
return
}
let tagsLabel = NSLocalizedString("Tags", comment: "Sidebar label")
let notesLabel = NSLocalizedString("Notes", comment: "Sidebar label")
let trashLabel = NSLocalizedString("Notes", comment: "Sidebar label")
if ([notesLabel, trashLabel].contains(sidebarItem.name) && sidebarItem.project == nil) || sidebarItem.type == .Tag || sidebarItem.name == "# \(tagsLabel)" {
for item in menu.items {
item.isHidden = true
}
return
}
for item in menu.items {
item.isHidden = false
}
if let project = si[selectedRow].project, let i = menu.items.index(where: {$0.title == NSLocalizedString("Notes", comment: "Rename")}) {
if project.isRoot {
menu.item(at: i)?.isHidden = true
} else {
menu.item(at: i)?.isHidden = false
}
}
}
}
@IBAction func revealInFinder(_ sender: Any) {
guard let si = getSidebarItem(), let p = si.project else { return }
NSWorkspace.shared.activateFileViewerSelecting([p.url])
}
@IBAction func renameMenu(_ sender: Any) {
guard let vc = ViewController.shared(), let v = vc.storageOutlineView else { return }
let selected = v.selectedRow
guard let si = v.sidebarItems,
si.indices.contains(selected) else { return }
let sidebarItem = si[selected]
guard
sidebarItem.type == .Category,
let projectRow = v.rowView(atRow: selected, makeIfNecessary: false),
let cell = projectRow.view(atColumn: 0) as? SidebarCellView else { return }
cell.label.isEditable = true
cell.label.becomeFirstResponder()
}
@IBAction func deleteMenu(_ sender: Any) {
guard let vc = ViewController.shared(), let v = vc.storageOutlineView else { return }
let selected = v.selectedRow
guard let si = v.sidebarItems, si.indices.contains(selected) else { return }
let sidebarItem = si[selected]
guard let project = sidebarItem.project, !project.isDefault && sidebarItem.type != .All && sidebarItem.type != .Trash else { return }
if !project.isRoot && sidebarItem.type == .Category {
guard let w = v.superview?.window else {
return
}
let alert = NSAlert.init()
let messageText = NSLocalizedString("Are you sure you want to remove project \"%@\" and all files inside?", comment: "")
alert.messageText = String(format: messageText, project.label)
alert.informativeText = NSLocalizedString("This action cannot be undone.", comment: "Delete menu")
alert.addButton(withTitle: NSLocalizedString("Remove", comment: "Delete menu"))
alert.addButton(withTitle: NSLocalizedString("Cancel", comment: "Delete menu"))
alert.beginSheetModal(for: w) { (returnCode: NSApplication.ModalResponse) -> Void in
if returnCode == NSApplication.ModalResponse.alertFirstButtonReturn {
try? FileManager.default.trashItem(at: project.url, resultingItemURL: nil)
v.removeProject(project: project)
}
}
return
}
SandboxBookmark().removeBy(project.url)
v.removeProject(project: project)
}
@IBAction func addProject(_ sender: Any) {
guard let vc = ViewController.shared(), let v = vc.storageOutlineView else { return }
var unwrappedProject: Project?
if let si = v.getSidebarItem(),
let p = si.project {
unwrappedProject = p
}
if sender is NSMenuItem,
let mi = sender as? NSMenuItem,
mi.title == NSLocalizedString("Attach storage", comment: "") {
unwrappedProject = nil
}
if sender is SidebarCellView, let cell = sender as? SidebarCellView, let si = cell.objectValue as? SidebarItem {
if let p = si.project {
unwrappedProject = p
} else {
addRoot()
return
}
}
guard let project = unwrappedProject else {
addRoot()
return
}
guard let window = MainWindowController.shared() else { return }
let alert = NSAlert()
let field = NSTextField(frame: NSRect(x: 0, y: 0, width: 290, height: 20))
alert.messageText = NSLocalizedString("New project", comment: "")
alert.informativeText = NSLocalizedString("Please enter project name:", comment: "")
alert.accessoryView = field
alert.alertStyle = .informational
alert.addButton(withTitle: NSLocalizedString("Add", comment: ""))
alert.addButton(withTitle: NSLocalizedString("Cancel", comment: ""))
alert.beginSheetModal(for: window) { (returnCode: NSApplication.ModalResponse) -> Void in
if returnCode == NSApplication.ModalResponse.alertFirstButtonReturn {
self.addChild(field: field, project: project)
}
}
field.becomeFirstResponder()
}
private func removeProject(project: Project) {
self.storage.removeBy(project: project)
self.viewDelegate?.fsManager?.restart()
self.viewDelegate?.cleanSearchAndEditArea()
self.sidebarItems = Sidebar().getList()
self.reloadData()
}
private func addChild(field: NSTextField, project: Project) {
let value = field.stringValue
guard value.count > 0 else { return }
do {
let projectURL = project.url.appendingPathComponent(value, isDirectory: true)
try FileManager.default.createDirectory(at: projectURL, withIntermediateDirectories: false, attributes: nil)
let newProject = Project(url: projectURL, parent: project.getParent())
_ = storage.add(project: newProject)
reloadSidebar()
} catch {
let alert = NSAlert()
alert.messageText = error.localizedDescription
alert.runModal()
}
}
private func addRoot() {
let openPanel = NSOpenPanel()
openPanel.allowsMultipleSelection = false
openPanel.canChooseDirectories = true
openPanel.canCreateDirectories = true
openPanel.canChooseFiles = false
openPanel.begin { (result) -> Void in
if result.rawValue == NSFileHandlingPanelOKButton {
guard let url = openPanel.url else {
return
}
guard !self.storage.projectExist(url: url) else {
return
}
let bookmark = SandboxBookmark.sharedInstance()
_ = bookmark.load()
bookmark.store(url: url)
bookmark.save()
let newProject = Project(url: url, isRoot: true)
let projects = self.storage.add(project: newProject)
for project in projects {
self.storage.loadLabel(project, shouldScanCache: true)
}
self.reloadSidebar()
}
}
}
private func getSidebarItem() -> SidebarItem? {
guard let vc = ViewController.shared(), let v = vc.storageOutlineView else { return nil }
let selected = v.selectedRow
guard let si = v.sidebarItems,
si.indices.contains(selected) else { return nil }
let sidebarItem = si[selected]
return sidebarItem
}
@objc public func reloadSidebar() {
guard let vc = ViewController.shared() else { return }
vc.fsManager?.restart()
vc.loadMoveMenu()
let selected = vc.storageOutlineView.selectedRow
vc.storageOutlineView.sidebarItems = Sidebar().getList()
vc.storageOutlineView.reloadData()
vc.storageOutlineView.selectRowIndexes([selected], byExtendingSelection: false)
}
public func deselectTags(_ list: [String]) {
for tag in list {
if
let i = sidebarItems?.index(where: {$0.type == .Tag && $0.name == tag }),
let row = self.rowView(atRow: i, makeIfNecessary: false),
let cell = row.view(atColumn: 0) as? SidebarCellView {
cell.icon.image = NSImage(named: NSImage.Name(rawValue: "tag.png"))
}
}
}
public func selectTag(item: SidebarItem) {
let i = self.row(forItem: item)
if let row = self.rowView(atRow: i, makeIfNecessary: true), let cell = row.view(atColumn: 0) as? SidebarCellView {
cell.icon.image = NSImage(named: NSImage.Name(rawValue: "tag_red.png"))
}
}
public func deselectTag(item: SidebarItem) {
let i = self.row(forItem: item)
if let row = self.rowView(atRow: i, makeIfNecessary: false), let cell = row.view(atColumn: 0) as? SidebarCellView {
cell.icon.image = NSImage(named: NSImage.Name(rawValue: "tag.png"))
}
}
public func deselectAllTags() {
guard let items = self.sidebarItems?.filter({$0.type == .Tag}) else { return }
for item in items {
let i = self.row(forItem: item)
if let row = self.rowView(atRow: i, makeIfNecessary: false), let cell = row.view(atColumn: 0) as? SidebarCellView {
cell.icon.image = NSImage(named: NSImage.Name(rawValue: "tag.png"))
}
}
}
public func remove(sidebarItem: SidebarItem) {
if let i = sidebarItems?.index(where: {$0.type == .Tag && $0.name == sidebarItem.name }) {
sidebarItems?.remove(at: i)
self.removeItems(at: [i], inParent: nil, withAnimation: .effectFade)
}
}
public func addTags(_ tags: [String]) {
for tag in tags {
if let si = sidebarItems, si.first(where: {$0.type == .Tag && $0.name == tag }) == nil {
let sidebarTag = SidebarItem(name: tag, project: nil, type: .Tag, icon: nil)
sidebarItems?.append(sidebarTag)
self.beginUpdates()
self.insertItems(at: [si.count], inParent: nil, withAnimation: .effectFade)
self.endUpdates()
}
}
for tag in tags {
if let item = sidebarItems?.first(where: {$0.type == .Tag && $0.name == tag }) {
selectTag(item: item)
}
}
}
public func removeTags(_ tags: [String]) {
for tag in tags {
if let item = sidebarItems?.first(where: {$0.type == .Tag && $0.name == tag }) {
remove(sidebarItem: item)
}
}
}
public func selectArchive() {
if let i = sidebarItems?.index(where: {$0.type == .Archive }) {
selectRowIndexes([i], byExtendingSelection: false)
}
}
}
|
[
-1
] |
b6868326347b12b35ae63571621e793eb85b635a
|
ea375fa7217c280b5543f18b5ff3e926a8d7558d
|
/jMusic/3rd Party/NetworkReachabilityManager.swift
|
e931a071a16a820893ebed051a5efa53b6b30f8e
|
[
"MIT"
] |
permissive
|
michaelwho/jMusic
|
3836568111358a87af41e92bc9a4635a048f7a3e
|
26cfe81efbc53bdf40883e76ac975ecbaef718c6
|
refs/heads/master
| 2020-04-15T12:55:21.555294 | 2018-02-04T20:03:09 | 2018-02-04T20:03:09 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 9,859 |
swift
|
//
// NetworkReachabilityManager.swift
//
// Copyright (c) 2014-2016 Alamofire Software Foundation (http://alamofire.org/)
//
// 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.
//
// 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.
//
#if !os(watchOS)
import Foundation
import SystemConfiguration
/// The `NetworkReachabilityManager` class listens for reachability changes of hosts and addresses for both WWAN and
/// WiFi network interfaces.
///
/// Reachability can be used to determine background information about why a network operation failed, or to retry
/// network requests when a connection is established. It should not be used to prevent a user from initiating a network
/// request, as it's possible that an initial request may be required to establish reachability.
public class NetworkReachabilityManager {
/// Defines the various states of network reachability.
///
/// - unknown: It is unknown whether the network is reachable.
/// - notReachable: The network is not reachable.
/// - reachable: The network is reachable.
public enum NetworkReachabilityStatus {
case unknown
case notReachable
case reachable(ConnectionType)
}
/// Defines the various connection types detected by reachability flags.
///
/// - ethernetOrWiFi: The connection type is either over Ethernet or WiFi.
/// - wwan: The connection type is a WWAN connection.
public enum ConnectionType {
case ethernetOrWiFi
case wwan
}
/// A closure executed when the network reachability status changes. The closure takes a single argument: the
/// network reachability status.
public typealias Listener = (NetworkReachabilityStatus) -> Void
// MARK: - Properties
/// Whether the network is currently reachable.
public var isReachable: Bool { return isReachableOnWWAN || isReachableOnEthernetOrWiFi }
/// Whether the network is currently reachable over the WWAN interface.
public var isReachableOnWWAN: Bool { return networkReachabilityStatus == .reachable(.wwan) }
/// Whether the network is currently reachable over Ethernet or WiFi interface.
public var isReachableOnEthernetOrWiFi: Bool { return networkReachabilityStatus == .reachable(.ethernetOrWiFi) }
/// The current network reachability status.
public var networkReachabilityStatus: NetworkReachabilityStatus {
guard let flags = self.flags else { return .unknown }
return networkReachabilityStatusForFlags(flags)
}
/// The dispatch queue to execute the `listener` closure on.
public var listenerQueue: DispatchQueue = DispatchQueue.main
/// A closure executed when the network reachability status changes.
public var listener: Listener?
private var flags: SCNetworkReachabilityFlags? {
var flags = SCNetworkReachabilityFlags()
if SCNetworkReachabilityGetFlags(reachability, &flags) {
return flags
}
return nil
}
private let reachability: SCNetworkReachability
private var previousFlags: SCNetworkReachabilityFlags
// MARK: - Initialization
/// Creates a `NetworkReachabilityManager` instance with the specified host.
///
/// - parameter host: The host used to evaluate network reachability.
///
/// - returns: The new `NetworkReachabilityManager` instance.
public convenience init?(host: String) {
guard let reachability = SCNetworkReachabilityCreateWithName(nil, host) else { return nil }
self.init(reachability: reachability)
}
/// Creates a `NetworkReachabilityManager` instance that monitors the address 0.0.0.0.
///
/// Reachability treats the 0.0.0.0 address as a special token that causes it to monitor the general routing
/// status of the device, both IPv4 and IPv6.
///
/// - returns: The new `NetworkReachabilityManager` instance.
public convenience init?() {
var address = sockaddr_in()
address.sin_len = UInt8(MemoryLayout<sockaddr_in>.size)
address.sin_family = sa_family_t(AF_INET)
guard let reachability = withUnsafePointer(to: &address, { pointer in
return pointer.withMemoryRebound(to: sockaddr.self, capacity: MemoryLayout<sockaddr>.size) {
return SCNetworkReachabilityCreateWithAddress(nil, $0)
}
}) else { return nil }
self.init(reachability: reachability)
}
private init(reachability: SCNetworkReachability) {
self.reachability = reachability
self.previousFlags = SCNetworkReachabilityFlags()
}
deinit {
stopListening()
}
// MARK: - Listening
/// Starts listening for changes in network reachability status.
///
/// - returns: `true` if listening was started successfully, `false` otherwise.
@discardableResult
public func startListening() -> Bool {
var context = SCNetworkReachabilityContext(version: 0, info: nil, retain: nil, release: nil, copyDescription: nil)
context.info = Unmanaged.passUnretained(self).toOpaque()
let callbackEnabled = SCNetworkReachabilitySetCallback(
reachability,
{ (_, flags, info) in
let reachability = Unmanaged<NetworkReachabilityManager>.fromOpaque(info!).takeUnretainedValue()
reachability.notifyListener(flags)
},
&context
)
let queueEnabled = SCNetworkReachabilitySetDispatchQueue(reachability, listenerQueue)
listenerQueue.async {
self.previousFlags = SCNetworkReachabilityFlags()
self.notifyListener(self.flags ?? SCNetworkReachabilityFlags())
}
return callbackEnabled && queueEnabled
}
/// Stops listening for changes in network reachability status.
public func stopListening() {
SCNetworkReachabilitySetCallback(reachability, nil, nil)
SCNetworkReachabilitySetDispatchQueue(reachability, nil)
}
// MARK: - Internal - Listener Notification
func notifyListener(_ flags: SCNetworkReachabilityFlags) {
guard previousFlags != flags else { return }
previousFlags = flags
listener?(networkReachabilityStatusForFlags(flags))
}
// MARK: - Internal - Network Reachability Status
func networkReachabilityStatusForFlags(_ flags: SCNetworkReachabilityFlags) -> NetworkReachabilityStatus {
guard flags.contains(.reachable) else { return .notReachable }
var networkStatus: NetworkReachabilityStatus = .notReachable
if !flags.contains(.connectionRequired) { networkStatus = .reachable(.ethernetOrWiFi) }
if flags.contains(.connectionOnDemand) || flags.contains(.connectionOnTraffic) {
if !flags.contains(.interventionRequired) { networkStatus = .reachable(.ethernetOrWiFi) }
}
#if os(iOS)
if flags.contains(.isWWAN) { networkStatus = .reachable(.wwan) }
#endif
return networkStatus
}
}
// MARK: -
extension NetworkReachabilityManager.NetworkReachabilityStatus: Equatable {}
/// Returns whether the two network reachability status values are equal.
///
/// - parameter lhs: The left-hand side value to compare.
/// - parameter rhs: The right-hand side value to compare.
///
/// - returns: `true` if the two values are equal, `false` otherwise.
public func ==(
lhs: NetworkReachabilityManager.NetworkReachabilityStatus,
rhs: NetworkReachabilityManager.NetworkReachabilityStatus)
-> Bool
{
switch (lhs, rhs) {
case (.unknown, .unknown):
return true
case (.notReachable, .notReachable):
return true
case let (.reachable(lhsConnectionType), .reachable(rhsConnectionType)):
return lhsConnectionType == rhsConnectionType
default:
return false
}
}
#endif
|
[
175750,
187115,
64844,
34382,
135694,
52976,
56274,
15476,
113940,
325272,
27482,
105406
] |
51201012a56e3bd033bcad9a20e911ff86816cd1
|
8af721600be02d5046d7b8764b13d1b934c18346
|
/Example/Pods/DashdevsNetworking/DashdevsNetworking/Classes/RequestDescriptor.swift
|
17fe0fd1eaaf57f00e749cc14256cdf7f6817aef
|
[
"MIT"
] |
permissive
|
dashdevs/scannerframework
|
ae155312bf0003122a3069a2ff5af8d27754cc57
|
e9346d286ca69554e84da2cd5e0b2daf82d1df7b
|
refs/heads/master
| 2023-08-19T12:22:20.348584 | 2021-10-15T08:20:28 | 2021-10-15T08:20:28 | 321,954,982 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 951 |
swift
|
//
// RequestDescriptor.swift
// DashdevsNetworking
//
// Copyright (c) 2019 dashdevs.com. All rights reserved.
//
import Foundation
/// Protocol which is used to describe request to remote location
public protocol RequestDescriptor {
associatedtype Parameters
associatedtype Resource
var path: Endpoint { get }
var method: HTTPMethod { get }
var encoding: ParamEncoding<Parameters>? { get }
var headers: [HTTPHeader]? { get }
var response: Deserializator<Resource> { get }
var parameters: Parameters? { get }
var versionPath: Path? { get }
var detailedErrorHandler: DetailedErrorHandler? { get }
}
public extension RequestDescriptor {
var detailedErrorHandler: DetailedErrorHandler? { return nil }
var versionPath: Path? { return nil }
var headers: [HTTPHeader]? { return nil }
var encoding: ParamEncoding<Parameters>? { return nil }
var parameters: Parameters? { return nil }
}
|
[
-1
] |
75e43438676b6f9695236e61a95ad9e97a1b803d
|
68d7d243d8cf27559fa18f4d0808d4b9d68e1137
|
/Dicee/ViewController.swift
|
b803a0c9bf4c97aebd9f05c998cdc424bc8c0dc5
|
[] |
no_license
|
fogset/Dicee
|
ae0d8e0552d03ac6033e97faf0018c53d3fe5823
|
33122b90358e082ab03a8ea8b976fbf96a83891b
|
refs/heads/master
| 2020-03-11T20:46:27.021973 | 2018-04-19T16:47:55 | 2018-04-19T16:47:55 | 130,245,664 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,325 |
swift
|
//
// ViewController.swift
// Dicee
//
// Created by Tian Zhang on 3/29/18.
// Copyright © 2018 Tian Zhang. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
var randomDiceIndex1 : Int = 0
var randomDiceIndex2 : Int = 0
let diceArray = ["dice1", "dice2", "dice3", "dice4", "dice5", "dice6"]
@IBOutlet weak var diceImageView1: UIImageView!
@IBOutlet weak var diceImageView2: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
updateDiceImages()
// 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.
}
@IBAction func rollButtonPressed(_ sender: UIButton) {
updateDiceImages()
}
func updateDiceImages(){
randomDiceIndex1 = Int(arc4random_uniform(6))
randomDiceIndex2 = Int(arc4random_uniform(6))
diceImageView1.image = UIImage(named: diceArray[randomDiceIndex1])
diceImageView2.image = UIImage(named: diceArray[randomDiceIndex2])
}
override func motionEnded(_ motion: UIEventSubtype, with event: UIEvent?) {
updateDiceImages()
}
}
|
[
315168,
304010,
307412,
301014
] |
dbde0e57b7b2237932c446e2cfddb8e11151d456
|
c8991df5ab6bf17d5ffb3f1630eed0850814ca15
|
/Extra Files/iOS Apps/Downloaded/Follow & Unfollow people/ParseSwiftStarterProject/ParseStarterProject/ViewController.swift
|
b5202f277f473c9742221cbe4cc03f6ecbd5e101
|
[] |
no_license
|
za2e13/BarCode-Reader
|
00926c7d0c9e7cbeadea480fff90d22417b1f3ad
|
fb56d34592c530928916570f4277a0078048511b
|
refs/heads/master
| 2021-01-21T18:28:03.550166 | 2015-07-25T19:48:52 | 2015-07-25T19:48:52 | 38,598,788 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 3,895 |
swift
|
//
// ViewController.swift
//
// Copyright 2011-present Parse Inc. All rights reserved.
//
import UIKit
import Parse
class ViewController: UIViewController {
var signupActive = true
@IBOutlet weak var username: UITextField!
@IBOutlet weak var password: UITextField!
@IBOutlet weak var signupButton: UIButton!
@IBOutlet weak var registiredText: UILabel!
@IBOutlet weak var loginButton: UIButton!
var activityIndicator: UIActivityIndicatorView = UIActivityIndicatorView()
func displayAlert (title: String, message: String){
var alert = UIAlertController(title: title, message: message , preferredStyle: UIAlertControllerStyle.Alert)
alert.addAction(UIAlertAction(title: "OK", style: .Default, handler: { (action) -> Void in
self.dismissViewControllerAnimated(true, completion: nil)
}))
self.presentViewController(alert, animated: true, completion: nil)
}
@IBAction func signup(sender: AnyObject) {
if username.text == "" || password.text == "" {
displayAlert("Error in form", message: "Please enter a username & password")
}else{
activityIndicator = UIActivityIndicatorView(frame: CGRectMake(0, 0, 50, 50))
activityIndicator.center = self.view.center
activityIndicator.hidesWhenStopped = true
activityIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray
view.addSubview(activityIndicator)
activityIndicator.startAnimating()
UIApplication.sharedApplication().beginIgnoringInteractionEvents()
var errorMessage = "Plesae try again later"
if signupActive == true{
var user = PFUser()
user.username = username.text
user.password = password.text
user.signUpInBackgroundWithBlock({ (sucess, error) -> Void in
self.activityIndicator.stopAnimating()
UIApplication.sharedApplication().endIgnoringInteractionEvents()
if error == nil {
// signup sucessful
self.performSegueWithIdentifier("login", sender: self)
}else{
if let errorString = error!.userInfo?["error"] as? String{
errorMessage = errorString
}
self.displayAlert("Failed signup", message: errorMessage)
}
})
}else{
PFUser.logInWithUsernameInBackground(username.text, password: password.text, block: { (user, error) -> Void in
self.activityIndicator.stopAnimating()
UIApplication.sharedApplication().endIgnoringInteractionEvents()
if user != nil {
// Login in
self.performSegueWithIdentifier("login", sender: self)
}else{
if let errorString = error!.userInfo?["error"] as? String{
errorMessage = errorString
}
self.displayAlert("Failed signup", message: errorMessage)
}
})
}
}
}
@IBAction func login(sender: AnyObject) {
if signupActive == true {
signupButton.setTitle("Log in", forState: UIControlState.Normal)
registiredText.text = "No registired?"
loginButton.setTitle("Sign up", forState: UIControlState.Normal)
signupActive = false
}else{
signupButton.setTitle("Sign up", forState: UIControlState.Normal)
registiredText.text = "Alredy registired?"
loginButton.setTitle("Log in", forState: UIControlState.Normal)
signupActive = true
}
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func viewDidAppear(animated: Bool) {
if PFUser.currentUser() != nil{
self.performSegueWithIdentifier("login", sender: self)
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
|
[
-1
] |
144dce32e3fea5d64d6f5fc0adb8ecb118a8dd21
|
4b956e6afd1d1c15fcc417a2c56e17e0f06a1801
|
/ScrollViewAutolayoutTutorial/ScrollViewAutolayoutTutorial/View/Label.swift
|
fe1d7343d2db9fdef40e69168798aec8381521a3
|
[
"MIT"
] |
permissive
|
viniciusbonemer/Tutorial-ScrollView-AutoLayout-FinalProject
|
88b8a6d52458b0f75736b150837752a7147bc575
|
677f02f5e1b62cac4cbdf78352b9b48af126cfb2
|
refs/heads/master
| 2020-03-30T04:51:46.714844 | 2018-10-04T18:17:13 | 2018-10-04T18:17:13 | 150,765,929 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 806 |
swift
|
//
// Label.swift
// ScrollViewAutolayoutTutorial
//
// Created by Vinícius Bonemer on 22/09/2018.
// Copyright © 2018 Vinícius Bonemer. All rights reserved.
//
import UIKit
/**
Uma subclasse customizada de UILabel
Fornece um jeito fácil de inicializar um novo Label
*/
class Label: UILabel {
/**
Cria um label customizado
*/
init() {
super.init(frame: .zero)
textColor = .grayLabel
font = UIFont.systemFont(ofSize: 16.0)
}
/**
Cria um novo label e determina seu texto
- Parameter text: O texto do label
*/
convenience init(text: String) {
self.init()
self.text = text
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
|
[
-1
] |
84a3199ca9e714b81da4e2661f5aaed6705f8751
|
78e3404271be0fc4910d73b486d3b256412a2a20
|
/Carnets/ViewController+keyCommands.swift
|
2ee8f8946c5fefe57e6b76fb6b8522799292e420
|
[
"BSD-3-Clause"
] |
permissive
|
Ulysses3/Carnets
|
1a568ff25d0ffcc7866fafa918b74349cfc121ab
|
e44a31b95c69ed733ac84125b86bb1d6597639fe
|
refs/heads/master
| 2020-08-27T07:21:59.790390 | 2019-06-25T12:20:39 | 2019-06-25T12:20:39 | 217,282,802 | 1 | 0 |
BSD-3-Clause
| 2019-10-24T11:28:49 | 2019-10-24T11:28:48 | null |
UTF-8
|
Swift
| false | false | 3,873 |
swift
|
//
// ViewController+keyCommands.swift
// Carnets
//
// Created by Nicolas Holzschuch on 22/05/2019.
// Copyright © 2019 AsheKube. All rights reserved.
//
import Foundation
import UIKit
import WebKit
extension ViewController {
// This works in text-input mode:
@objc func escapeKey(_ sender: UIBarButtonItem) {
webView.evaluateJavaScript("Jupyter.notebook.command_mode();") { (result, error) in
if error != nil {
print(error)
}
if (result != nil) {
print(result)
}
}
}
override var keyCommands: [UIKeyCommand]? {
var basicKeyCommands = [
UIKeyCommand(input: UIKeyCommand.inputEscape, modifierFlags: [], action: #selector(escapeKey), discoverabilityTitle: "Escape Key"),
// Cmd-Z is reserved by Apple. We can register it, but it won't work
// Removed discoverabilityTitle until it works.
UIKeyCommand(input: "z", modifierFlags: .command, action: #selector(undoAction)), // discoverabilityTitle: "Undo"),
UIKeyCommand(input: "z", modifierFlags: [.command, .shift], action: #selector(redoAction)), // discoverabilityTitle: "Redo"),
// control-Z is available
UIKeyCommand(input: "z", modifierFlags: .control, action: #selector(undoAction), discoverabilityTitle: "Undo"),
UIKeyCommand(input: "z", modifierFlags: [.control, .shift], action: #selector(redoAction), discoverabilityTitle: "Redo"),
// Cmd-S is not reserved, so this works:
UIKeyCommand(input: "s", modifierFlags: .command, action: #selector(saveAction), discoverabilityTitle: "Save"),
// Ctrl-Enter: does not work (intercepted/not seen by JS)
// Alt-Enter: managed by JS
// Cmd-Enter: run cell, insert below (run Action)
UIKeyCommand(input: "\r", modifierFlags:.command, action: #selector(runAction), discoverabilityTitle: "Run cell, select next"),
// Tab key in edit mode: does not work with external keyboard (but alt-tab works). But it should ("\t")
]
/* Caps Lock remapped to escape -- only if in a notebook, in insert mode: */
if (UserDefaults.standard.bool(forKey: "escape_preference") && notebookCellInsertMode) {
// If we remapped caps-lock to escape, we need to disable caps-lock, at least with certain keyboards.
// This loop remaps all lowercase characters without a modifier to themselves, thus disabling caps-lock
// It doesn't work for characters produced with alt-key, though.
for key in 0x061...0x2AF { // all lowercase unicode letters
let K = Unicode.Scalar(key)!
if CharacterSet.lowercaseLetters.contains(Unicode.Scalar(key)!) {
// no discoverabilityTitle
basicKeyCommands.append(UIKeyCommand(input: "\(K)", modifierFlags: [], action: #selector(insertKey)))
}
}
// no discoverabilityTitle
basicKeyCommands.append(UIKeyCommand(input: "", modifierFlags:.alphaShift, action: #selector(escapeKey)))
}
return basicKeyCommands
}
// Even if Caps-Lock is activated, send lower case letters.
@objc func insertKey(_ sender: UIKeyCommand) {
guard (sender.input != nil) else { return }
// This function only gets called if we are in a notebook, in edit_mode:
// Only remap the keys if we are in a notebook, editing cell:
let commandString = "Jupyter.notebook.get_selected_cell().code_mirror.replaceSelection('\(sender.input!)');"
self.webView.evaluateJavaScript(commandString) { (result, error) in
if error != nil {
print(error)
print(result)
}
}
}
}
|
[
-1
] |
565196d5ff7332a61b909ff3c5b43408085f51d7
|
86d0c8ff4fa4257a6cb177985aa66e631595e370
|
/CustomLog/AppDelegate.swift
|
304b3aeedc7e24d33e80d2e8cff12adefb448c49
|
[] |
no_license
|
InacLucas/CustomLog
|
782a909bb519e9105be8ab0c1068cc8efb0bac81
|
55705cfd07c79b38444b8f9de1f44793052a0db2
|
refs/heads/master
| 2020-08-01T08:02:58.137507 | 2019-09-25T19:29:49 | 2019-09-25T19:29:49 | 210,923,029 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 2,207 |
swift
|
//
// AppDelegate.swift
// CustomLog
//
// Created by treinamento on 03/09/19.
// Copyright © 2019 in.kpro. All rights reserved.
//
import UIKit
import Firebase
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions:[UIApplication.LaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
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.
}
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.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
|
[
229380,
229383,
229385,
294924,
229388,
229391,
327695,
229394,
229397,
229399,
229402,
229405,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
237618,
229426,
229428,
286774,
286776,
319544,
286778,
204856,
229432,
352318,
286791,
237640,
286797,
237646,
311375,
196692,
319573,
311383,
311400,
303212,
131192,
237693,
303230,
327814,
303241,
131209,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
286924,
286926,
319694,
131278,
131281,
155872,
131299,
319716,
237807,
303345,
286962,
303347,
229622,
327930,
237826,
319751,
286987,
319757,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
319809,
319810,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
229717,
196969,
139638,
213367,
106872,
319872,
311683,
311693,
65943,
319898,
319903,
311719,
139689,
278957,
311728,
311741,
319938,
319945,
188895,
172512,
287202,
172520,
319978,
172526,
311791,
172529,
319989,
172534,
180727,
287230,
303617,
287234,
172550,
303623,
172552,
320007,
172558,
303632,
303637,
172572,
172577,
295459,
172581,
295461,
172591,
172598,
172607,
172609,
172612,
172614,
213575,
172618,
303690,
33357,
303696,
172634,
262752,
254563,
172644,
311911,
172656,
352880,
295538,
172660,
287349,
287355,
295553,
172675,
295557,
311942,
303751,
352905,
311946,
287371,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
172705,
287394,
172707,
303780,
287398,
287400,
172714,
295595,
189102,
172721,
287409,
66227,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
287427,
312006,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
287450,
303835,
189149,
303838,
312035,
295654,
230128,
312048,
312050,
189169,
303871,
230146,
328453,
312077,
295695,
295701,
230169,
295707,
328476,
295710,
295720,
303914,
230202,
312124,
328508,
222018,
295755,
287569,
230237,
230241,
303976,
336744,
303981,
303985,
303987,
328563,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
304007,
304009,
304011,
304013,
295822,
189329,
295825,
304019,
189331,
58262,
304023,
304027,
279461,
304042,
213931,
230327,
304055,
287675,
197564,
230334,
304063,
304065,
295873,
156612,
197580,
312272,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
295945,
230413,
320528,
140312,
295961,
238620,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
238658,
336964,
296004,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
312432,
337018,
115836,
66690,
205968,
296084,
238745,
304285,
238756,
222377,
337067,
165035,
238766,
165038,
230576,
238770,
304311,
230592,
410820,
312518,
230600,
230607,
148690,
320727,
304348,
279777,
304354,
296163,
320740,
304360,
320748,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
214294,
296213,
320792,
230681,
296215,
230689,
173350,
312622,
296243,
312630,
296253,
230718,
296255,
312639,
296259,
296262,
230727,
238919,
296264,
320840,
296267,
296271,
312663,
222556,
337244,
230752,
312676,
230760,
148843,
230763,
230768,
296305,
312692,
230773,
304505,
304506,
181626,
181631,
312711,
312712,
296331,
288140,
288144,
304533,
173472,
288164,
304555,
173488,
288176,
312755,
312759,
288185,
222652,
312766,
173507,
230860,
312783,
288208,
230865,
148946,
222676,
329177,
239070,
288229,
288232,
296435,
288244,
288250,
296446,
321022,
402942,
296450,
230916,
230919,
230923,
304651,
304653,
222752,
108066,
296486,
296488,
157229,
239152,
230961,
157236,
288320,
288325,
124489,
288338,
288344,
239194,
312938,
116354,
419489,
321195,
296622,
321200,
337585,
296634,
296637,
419522,
313027,
419525,
206536,
206539,
206541,
206543,
263888,
313044,
321239,
313052,
288478,
313055,
419555,
321252,
313066,
288494,
321266,
419570,
288502,
288510,
124671,
67330,
198405,
288519,
198416,
296723,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
321336,
296767,
288576,
345921,
304968,
173907,
313171,
313176,
321381,
296812,
313201,
305028,
247688,
124817,
239510,
124827,
214940,
247709,
214944,
321458,
124853,
214966,
296890,
288700,
296894,
190403,
296900,
337862,
165831,
296921,
354265,
354270,
239586,
313320,
354281,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
313358,
305176,
321560,
313371,
305191,
223273,
313386,
124978,
215090,
124980,
288824,
288826,
321595,
313406,
288831,
288836,
215123,
288859,
280669,
149599,
280671,
149601,
321634,
149603,
329830,
280681,
280687,
149618,
215154,
313458,
313464,
329850,
321659,
288895,
321670,
215175,
141459,
280725,
313498,
100520,
280747,
288947,
321717,
313548,
321740,
313557,
338147,
280804,
125171,
182517,
280825,
280831,
125187,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280891,
289087,
305480,
305485,
305489,
248153,
354653,
313700,
313705,
280940,
190832,
313720,
313731,
199051,
240011,
289166,
240017,
297363,
240021,
297365,
297372,
297377,
289186,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
281045,
166378,
305647,
174580,
240124,
305662,
305664,
240129,
305666,
305668,
223749,
240132,
223752,
150025,
338440,
223757,
322074,
150066,
158266,
289342,
322115,
199262,
338528,
338532,
199273,
19053,
158317,
313973,
297594,
158347,
264845,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
297671,
158409,
256716,
289493,
363234,
289513,
289522,
289532,
322303,
322310,
264969,
322314,
322318,
322341,
215850,
289601,
240458,
240468,
322393,
297818,
224110,
207733,
207737,
158596,
183172,
338823,
322440,
314249,
183184,
289687,
240535,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
314441,
322642,
314456,
314461,
248995,
306341,
306344,
306347,
322734,
306354,
199877,
289997,
249045,
363742,
363745,
330988,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
216376,
380226,
224587,
224594,
216404,
306517,
150870,
314714,
314718,
265568,
314723,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
314743,
306552,
290171,
314747,
298365,
306555,
290174,
224641,
298372,
314756,
224647,
298377,
314763,
142733,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
241068,
241070,
241072,
150966,
306618,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
191985,
290291,
241142,
191992,
290298,
151036,
290302,
290305,
306694,
192008,
323084,
290321,
323090,
290325,
241175,
290332,
241181,
290344,
306731,
290349,
290351,
290356,
224849,
282199,
306778,
314979,
323176,
224875,
241260,
323181,
315016,
290445,
175770,
298651,
282269,
323229,
298655,
323231,
306856,
323260,
323266,
241362,
306904,
52959,
241380,
323318,
306945,
323330,
241412,
323333,
323345,
323349,
315167,
315169,
315174,
323367,
241448,
315176,
241450,
306991,
315184,
323376,
315190,
241464,
159545,
298811,
118593,
307009,
413506,
307012,
298822,
315211,
307027,
315221,
315223,
241496,
241498,
307035,
307040,
110433,
241509,
110438,
110445,
315249,
315251,
315253,
315255,
339838,
315267,
241544,
241546,
241548,
298896,
298898,
241556,
298901,
241560,
241563,
241565,
241567,
241569,
241574,
241581,
241583,
323504,
241586,
241588,
241590,
241592,
241598,
290751,
241600,
241605,
241610,
298975,
241632,
298984,
241643,
298988,
241646,
241649,
241652,
323574,
299003,
241661,
299006,
315396,
241669,
315397,
290835,
241693,
241701,
102438,
217127,
323630,
290877,
315463,
315466,
192589,
192596,
307287,
307290,
217179,
315482,
192605,
315483,
233567,
299105,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
299126,
233591,
299136,
307329,
315524,
307338,
241813,
307352,
299164,
241821,
299167,
315552,
315557,
184486,
307370,
168107,
307372,
307374,
307376,
299185,
323763,
184503,
299191,
307385,
307386,
258235,
307388,
307390,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
299225,
233701,
307432,
184586,
323854,
291104,
307508,
315701,
332086,
307510,
307512,
307515,
307518,
282942,
323917,
110926,
233808,
323921,
315733,
323926,
315739,
299357,
242018,
242024,
299373,
250231,
242043,
315771,
291197,
299391,
291202,
242057,
291212,
299405,
291222,
315801,
242075,
61855,
291231,
291241,
127405,
291247,
299440,
127407,
127413,
291254,
291260,
283069,
127424,
299457,
127434,
315856,
176592,
315860,
283095,
299481,
176605,
160221,
242143,
127455,
127457,
291299,
127463,
242152,
291305,
127466,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
127494,
135689,
233994,
127500,
233998,
127506,
234006,
127511,
152087,
234010,
135707,
242202,
135710,
242206,
242208,
291361,
242220,
291378,
152118,
234041,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
135805,
135808,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
135839,
225954,
299684,
135844,
242343,
242345,
373421,
299706,
135873,
135876,
135879,
299720,
299723,
299726,
299740,
201444,
234219,
381677,
316151,
242431,
299778,
234242,
242436,
234246,
234252,
291601,
234258,
242452,
201496,
234264,
234266,
234269,
234272,
152355,
299814,
234281,
234287,
185138,
234296,
160572,
234302,
234307,
316233,
316235,
234319,
185173,
201557,
308063,
234336,
242530,
349027,
234341,
234344,
234347,
234350,
324464,
152435,
177011,
234356,
234358,
234364,
291711,
291714,
201603,
291716,
234373,
234370,
308105,
324504,
234393,
209818,
308123,
324508,
291742,
291748,
234405,
291750,
324518,
324520,
324522,
291754,
291756,
324527,
291760,
201650,
324531,
234422,
275384,
324536,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
234437,
234443,
291788,
234446,
234449,
234452,
234455,
234464,
168935,
324585,
234478,
316400,
234481,
316403,
234485,
234487,
316416,
234496,
308231,
234504,
300054,
316439,
234520,
234519,
234526,
234528,
300066,
300069,
234535,
234540,
144430,
234546,
300085,
234549,
234553,
316479,
234561,
316483,
160835,
234563,
308291,
316491,
234572,
300108,
234574,
300115,
242777,
234593,
234597,
300133,
300139,
234605,
160879,
234610,
300148,
144506,
234620,
234634,
275594,
177293,
234640,
234643,
308373,
324757,
234647,
234648,
234650,
308379,
300189,
324766,
119967,
234653,
324768,
242852,
300197,
177318,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
283844,
300234,
283850,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
275725,
349451,
177424,
349464,
415009,
300344,
243003,
300357,
283973,
283983,
316758,
357722,
316766,
316768,
218464,
292197,
316774,
243046,
218473,
136562,
333178,
275836,
316803,
316806,
316811,
316814,
300433,
234899,
300436,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
284076,
144812,
144814,
144820,
374196,
292279,
144826,
144828,
144830,
144832,
144837,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
218597,
292329,
300523,
300527,
308720,
292338,
316917,
292343,
300537,
300543,
316933,
316947,
308757,
308762,
316959,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
284223,
284226,
284228,
243268,
284231,
284234,
366155,
317004,
284238,
284241,
194130,
284243,
300628,
284245,
284247,
235097,
243290,
284249,
292452,
292454,
292458,
292461,
284272,
284274,
284278,
292470,
292473,
284283,
284286,
292479,
284288,
284290,
325250,
284292,
292485,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
284308,
284312,
284316,
284320,
284327,
284329,
317098,
284331,
284333,
284335,
300726,
284343,
284346,
284350,
358080,
284354,
358083,
284358,
358089,
284362,
284365,
284368,
284370,
358098,
284372,
317138,
284377,
276187,
358114,
358116,
276197,
317158,
358119,
325353,
358122,
358126,
358128,
358133,
358135,
358138,
300795,
358140,
358142,
358146,
317187,
317189,
317191,
300816,
300819,
317207,
300830,
300832,
325408,
300834,
317221,
358183,
300845,
243504,
300850,
325436,
358206,
366406,
292681,
153417,
358224,
178006,
317271,
292700,
317279,
292715,
300912,
292721,
300915,
292729,
317306,
292734,
325512,
317332,
358292,
399252,
284572,
358312,
317353,
292784,
358326,
358330,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
153568,
292839,
292843,
178161,
325624,
317435,
317446,
350218,
350222,
317456,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
243779,
325700,
292934,
243785,
350293,
350295,
309337,
350299,
350302,
350304,
178273,
309346,
194660,
350308,
309350,
309348,
292968,
309352,
309354,
301163,
350313,
350316,
301167,
350321,
350325,
252022,
350328,
292985,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
153765,
350375,
350379,
350381,
350383,
350385,
350387,
350389,
350395,
350397,
350399,
350402,
301252,
350406,
301258,
309450,
309455,
309462,
301272,
194780,
309468,
309471,
317672,
317674,
325867,
309491,
309494,
243960,
325910,
309530,
342298,
211232,
317729,
211241,
325937,
325943,
211260,
235853,
235858,
391523,
293227,
293232,
186744,
211324,
366983,
317833,
227738,
317853,
317858,
342434,
317864,
235955,
293304,
293314,
309707,
317910,
293336,
235996,
317917,
293343,
358880,
293352,
236013,
293364,
301562,
317951,
309764,
301575,
293387,
342541,
113167,
309779,
317971,
309781,
227882,
309804,
236082,
23094,
219714,
301636,
318020,
301639,
301643,
309844,
309849,
326244,
318055,
309871,
121458,
309885,
309888,
301706,
318092,
326285,
334476,
318094,
318108,
318110,
137889,
383658,
318128,
293555,
318132,
342745,
137946,
342747,
342749,
113378,
342760,
56043,
56059,
310015,
285441,
310020,
310029,
293659,
326430,
285474,
293666,
228135,
318248,
318253,
301876,
293685,
301880,
301884,
310080,
293706,
310100,
301911,
301921,
236397,
162671,
326514,
310134,
236408,
15224,
416639,
416640,
113538,
310147,
416648,
187274,
424853,
277411,
310179,
293798,
293802,
236460,
293817,
293820,
203715,
326603,
342994,
318442,
228332,
326638,
351217,
318450,
293876,
285686,
302073,
121850,
293882,
302075,
56313,
293899,
293908,
293917,
293939,
318516,
310336,
293956,
293960,
310344,
203857,
293971,
310355,
310359,
236632,
138332,
203872,
203879,
310376,
228460,
318573,
367737,
302205,
392326,
294026,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
302248,
294063,
302258,
294072,
318651,
318657,
244930,
302275,
130244,
302277,
302282,
310476,
302285,
302288,
310481,
302290,
302292,
302294,
310486,
302296,
310498,
318698,
302315,
294132,
138485,
204026,
64768,
310531,
285958,
285999,
318773,
318776,
286010,
417086,
302403,
384328,
294221,
294223,
326991,
294246,
327015,
310632,
327017,
351594,
351607,
310648,
310651,
310657,
351619,
294276,
310659,
327046,
310665,
318858,
310672,
351633,
310689,
130468,
310703,
310710,
130486,
310712,
310715,
302526,
302534,
310727,
163272,
302541,
302543,
310737,
286169,
310749,
310755,
310764,
310772,
40440,
212472,
40443,
310780,
286203,
40448,
286214,
302603,
302614,
302621,
286240,
146977,
187939,
40484,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
278057,
310831,
286248,
245288,
40499,
40502,
212538,
40507,
40511,
40513,
327240,
40521,
286283,
40525,
40527,
212560,
400976,
40533,
40537,
40539,
40541,
40544,
40548,
40550,
40552,
40554,
310892,
40557,
40560,
294521,
343679,
294537,
310925,
302740,
179870,
327333,
229030,
302764,
278192,
319153,
319163,
302781,
319171,
294601,
302793,
343757,
212690,
319187,
229076,
286420,
286425,
319194,
294625,
294634,
302838,
319226,
286460,
171774,
302852,
278277,
302854,
294664,
311048,
319243,
311053,
302862,
319251,
294682,
188199,
294701,
319280,
319290,
229192,
302925,
188247,
188252,
237409,
294776,
360317,
294785,
327554,
360322,
40851,
237470,
319390,
40865,
319394,
294821,
311209,
180142,
343983,
188340,
40886,
294844,
294847,
24528,
393177,
294876,
294879,
393190,
294890,
311279,
237555,
311283,
237562
] |
e370ad927173f0669ebd5c66de183a720d77f522
|
ba79f1aca859980b32519cf30aefdf4162aa7fcb
|
/S.A.M/S.A.M/Details/EventDetail/ViewModel/EventDetailViewModel.swift
|
d1eac11e25c325207f1dae4dcbea019e95466e8b
|
[] |
no_license
|
victorGomez88/S.A.M
|
b1431544ad48ee29d821b29d80623d36d3994c7e
|
2f86274415c68fb9f087f7033a8f1f279c61c789
|
refs/heads/main
| 2023-01-20T05:06:08.892937 | 2020-11-23T20:38:01 | 2020-11-23T20:38:01 | 312,792,325 | 1 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,587 |
swift
|
//
// EventDetailViewModel.swift
// S.A.M
//
// Created by Victor Gomez on 21/11/2020.
// Copyright © 2020 Victor Gomez. All rights reserved.
//
import Foundation
import RxSwift
class EventDetailViewModel {
private weak var view: EventDetailViewController?
var event: EventDetailModel?
func bind(view: EventDetailViewController) {
self.view = view
}
func getComicData(_ eventId: Int) -> Observable<EventDetailModel> {
return EventsService().getEvent(with: eventId)
}
func obtainImageUrl(event: DetailEventModel) -> String{
return event.imageURL.path + "." + event.imageURL.thumbnailExtension
}
func navigateTo(next: Bool) {
if ((self.event?.data.eventDetail.first?.next?.resourceURI) != nil) {
if let view = view, let navController = view.navigationController {
UIView.transition(with: navController.view, duration: 0.75, options: next ? .transitionFlipFromRight : .transitionFlipFromLeft) {
let eventId = String(self.event?.data.eventDetail.first?.previous?.resourceURI.split(separator: "/").last ?? "")
let storyboard = UIStoryboard(name: "EventDetail", bundle: nil)
let vc : EventDetailViewController = storyboard.instantiateViewController(withIdentifier: "EventDetailViewControllerId") as! EventDetailViewController
vc.eventId = Int(eventId)
navController.pushViewController(vc, animated: true)
}
}
}
}
}
|
[
-1
] |
bc5214602465b70e0be67f9a56f8011c7b08f0d0
|
0a52de87f37433d942e22824d6a3000beed2097f
|
/Barbershop/ViewController.swift
|
9efc0a12398f5d8263597c4dff9b5d5d4aa8d4c0
|
[] |
no_license
|
keji96/BS-updated-master-
|
ef43adc9e7618a79630a579d027035e891bd6b8f
|
dd5ac5f5ccc16cbfac40460f404aa4afc753154c
|
refs/heads/master
| 2021-01-23T02:59:44.487406 | 2015-05-04T19:08:27 | 2015-05-04T19:08:27 | 34,826,480 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 2,995 |
swift
|
//
// ViewController.swift
// Barbershop
//
// Created by kevin campbell on 3/16/15.
// Copyright (c) 2015 kevin campbell. All rights reserved.
//
import UIKit
import CoreLocation
import MapKit
import AddressBook
class ViewController: UIViewController, UIPickerViewDataSource, UIPickerViewDelegate {
@IBOutlet weak var addressTextField: UITextField!
@IBOutlet weak var cityTextField: UITextField!
@IBOutlet weak var stateTextField: UITextField!
@IBOutlet weak var zipCodeTextField: UITextField!
@IBOutlet weak var countryTextBox: UITextField!
var distancePickerArray = ["5","10","20","50","100","3000"]
var distancePicked = 5.0
var locationManager : LocationManager?
override func viewDidLoad() {
super.viewDidLoad()
self.locationManager = LocationManager(viewController: self)
BarbershopGeoLoad().babershopGeoDataLoad()
}
//displayLocationInfo
func displayLocationInfo(currentCity : CLPlacemark){
cityTextField.text = currentCity.locality
stateTextField.text = currentCity.administrativeArea
zipCodeTextField.text = currentCity.postalCode
countryTextBox.text = currentCity.country
addressTextField.text = currentCity.name
let curLoc = currentCity.location
let curCor = curLoc.coordinate
let curLat = curCor.latitude
let curLong = curCor.longitude
let curGeoPoint = PFGeoPoint(latitude:curLat, longitude:curLong)
var currentUser = PFUser.currentUser()
currentUser!.setValue(curGeoPoint, forKey: "location")
currentUser?.saveInBackgroundWithBlock {
(success: Bool, error: NSError?) -> Void in
if (success) {
// The object has been saved.
} else {
// There was a problem, check error.description
}
}
//println(point)
}
//MARK Function for picker view. To pick search area for barbershops
func numberOfComponentsInPickerView(pickerView: UIPickerView) -> Int {
return 1
}
func pickerView(pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return distancePickerArray.count
}
func pickerView(pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String! {
return distancePickerArray[row]
}
func pickerView(pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
let pickdistance = distancePickerArray[row]
distancePicked = (pickdistance as NSString).doubleValue
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.destinationViewController is BarbersTableViewController{
var ViewVC = segue.destinationViewController as! BarbersTableViewController
ViewVC.barberRange = distancePicked
}
}
}
|
[
-1
] |
ab174586e331caf5a20afddde62c458676c45131
|
3881e8a3f128059f7d30651baed64e17b3904a38
|
/Source/svg/SVGSerializer.swift
|
1da73a6fe52a5c211e72ccbba1282623e03fe930
|
[
"MIT"
] |
permissive
|
jeongyookgak/Macaw
|
74c2bb7aef1dbed031451898ddab189870fe005b
|
3fc87a0f097c635c7a856b6605c36c52534a87ee
|
refs/heads/master
| 2023-02-17T20:19:56.120725 | 2021-01-22T04:50:40 | 2021-01-22T04:52:44 | 327,552,901 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 14,870 |
swift
|
//
// SVGSerializer.swift
// Macaw
//
// Created by Yuriy Kashnikov on 8/17/17.
// Copyright © 2017 Exyte. All rights reserved.
//
import Foundation
///
/// This class serializes Macaw Scene into an SVG String
///
open class SVGSerializer {
fileprivate let width: Int?
fileprivate let height: Int?
fileprivate let id: String?
fileprivate init(width: Int?, height: Int?, id: String?) {
self.width = width
self.height = height
self.id = id
}
// header and footer
fileprivate let SVGDefaultHeader = "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" version=\"1.1\""
fileprivate static let SVGDefaultId = ""
fileprivate static let SVGUndefinedSize = -1
fileprivate let SVGFooter = "</svg>"
// groups
fileprivate let SVGGroupOpenTag = "<g"
fileprivate let SVGGroupCloseTag = "</g>"
// shapes
fileprivate let SVGRectOpenTag = "<rect "
fileprivate let SVGCircleOpenTag = "<circle "
fileprivate let SVGEllipseOpenTag = "<ellipse "
fileprivate let SVGLineOpenTag = "<line "
fileprivate let SVGPolylineOpenTag = "<polyline "
fileprivate let SVGPolygonOpenTag = "<polygon "
fileprivate let SVGPathOpenTag = "<path "
fileprivate let SVGImageOpenTag = "<image "
fileprivate let SVGTextOpenTag = "<text "
fileprivate let SVGGenericEndTag = ">"
fileprivate let SVGGenericCloseTag = "/>"
fileprivate let SVGUndefinedTag = "<UNDEFINED "
fileprivate let SVGClipPathName = "clipPath"
fileprivate let SVGMaskName = "mask"
fileprivate let SVGEpsilon: Double = 0.00001
fileprivate let SVGDefaultOpacityValueAsAlpha = 1 * 255
fileprivate func tag(_ tag: String, _ args: [String: String]=[:], close: Bool = false) -> String {
let attrs = args.sorted { a1, a2 -> Bool in a1.key < a2.key }
.map { "\($0)=\"\($1)\"" }.joined(separator: " ")
let closeTag = close ? " />" : ""
return "\(tag) \(attrs) \(closeTag)"
}
fileprivate func arcToSVG(_ arc: Arc) -> String {
if arc.shift == 0.0 && abs(arc.extent - .pi * 2.0) < SVGEpsilon {
return tag(SVGEllipseOpenTag, ["cx": arc.ellipse.cx.serialize(), "cy": arc.ellipse.cy.serialize(), "rx": arc.ellipse.rx.serialize(), "ry": arc.ellipse.ry.serialize()])
} else {
let rx = arc.ellipse.rx
let ry = arc.ellipse.ry
let cx = arc.ellipse.cx
let cy = arc.ellipse.cy
let theta1 = arc.shift
let delta = arc.extent
let theta2 = theta1 + delta
let x1 = cx + rx * cos(theta1)
let y1 = cy + ry * sin(theta1)
let x2 = cx + rx * cos(theta2)
let y2 = cy + ry * sin(theta2)
let largeArcFlag = abs(delta) > .pi ? 1 : 0
let sweepFlag = delta > 0.0 ? 1 : 0
var d = "M\(x1),\(y1) "
d += "A \(rx),\(ry) 0.0 \(largeArcFlag), \(sweepFlag) \(x2),\(y2)"
return tag(SVGPathOpenTag, ["d": d])
}
}
fileprivate func polygonToSVG(_ polygon: Polygon) -> String {
let points = polygon.points.compactMap { String($0) }.joined(separator: ",")
return tag(SVGPolygonOpenTag, ["points": points])
}
fileprivate func polylineToSVG(_ polyline: Polyline) -> String {
let points = polyline.points.compactMap { String($0) }.joined(separator: ",")
return tag(SVGPolylineOpenTag, ["points": points])
}
fileprivate func pathToSVG(_ path: Path) -> String {
var d = ""
for segment in path.segments {
d += "\(segment.type) \(segment.data.compactMap { $0.serialize() }.joined(separator: " "))"
}
return tag(SVGPathOpenTag, ["d": d])
}
fileprivate func lineToSVG(_ line: Line) -> String {
return tag(SVGLineOpenTag, ["x1": line.x1.serialize(), "y1": line.y1.serialize(), "x2": line.x2.serialize(), "y2": line.y2.serialize()])
}
fileprivate func ellipseToSVG(_ ellipse: Ellipse) -> String {
return tag(SVGEllipseOpenTag, ["cx": ellipse.cx.serialize(), "cy": ellipse.cy.serialize(), "rx": ellipse.rx.serialize(), "ry": ellipse.ry.serialize()])
}
fileprivate func circleToSVG(_ circle: Circle) -> String {
return tag(SVGCircleOpenTag, ["cx": circle.cx.serialize(), "cy": circle.cy.serialize(), "r": circle.r.serialize()])
}
fileprivate func roundRectToSVG(_ roundRect: RoundRect) -> String {
return tag(SVGRectOpenTag, ["x": roundRect.rect.x.serialize(), "y": roundRect.rect.y.serialize(), "width": roundRect.rect.w.serialize(), "height": roundRect.rect.h.serialize(), "rx": roundRect.rx.serialize(), "ry": roundRect.ry.serialize()])
}
fileprivate func rectToSVG(_ rect: Rect) -> String {
return tag(SVGRectOpenTag, ["x": rect.x.serialize(), "y": rect.y.serialize(), "width": rect.w.serialize(), "height": rect.h.serialize()])
}
fileprivate func imageToSVG(_ image: MacawImage) -> String {
var result = tag(SVGImageOpenTag, close: false)
result += idToSVG(image.tag)
result += clipToSVG(image.clip)
result += transformToSVG(image.place)
if image.src.contains("memory://") {
if let data = image.base64encoded(type: MacawImage.ImageRepresentationType.PNG) {
result += " xlink:href=\"data:image/png;base64,\(data)\""
}
} else {
result += " xlink:href=\"\(image.src)\" "
}
if let bounds = image.bounds {
result += " width=\"\(String(bounds.w))\" height=\"\(String(bounds.h))\" "
}
result += SVGGenericCloseTag
return result
}
fileprivate func alignToSVG(_ align: Align) -> String {
if align === Align.mid {
return " text-anchor=\"middle\" "
}
if align === Align.max {
return " text-anchor=\"end "
}
return ""
}
fileprivate func baselineToSVG(_ baseline: Baseline) -> String {
if baseline == .top {
return " dominant-baseline=\"text-before-edge\" "
}
return ""
}
fileprivate func textToSVG(_ text: MText) -> String {
var result = tag(SVGTextOpenTag)
result += idToSVG(text.tag)
if let font = text.font {
result += " font-family=\"\(font.name)\" font-size=\"\(font.size)\" "
// TODO: check with enums
if font.name != "normal" {
result += " font-weight=\"\(font.weight)\" "
}
}
result += alignToSVG(text.align)
result += baselineToSVG(text.baseline)
result += clipToSVG(text.clip)
result += fillToSVG(text.fillVar.value)
result += strokeToSVG(text.strokeVar.value)
result += transformToSVG(text.place)
result += SVGGenericEndTag
result += text.text
result += "</text>"
return result
}
fileprivate func colorToSVG(_ color: Color) -> String {
if let c = SVGConstants.valueToColor(color.val) {
return "\(c)"
} else {
let r = color.r()
let g = color.g()
let b = color.b()
return "#\(String(format: "%02X%02X%02X", r, g, b))"
}
}
fileprivate func fillToSVG(_ fill: Fill?) -> String {
if let fillColor = fill as? Color {
var result = " fill=\"\(colorToSVG(fillColor))\""
if let opacity = alphaToSVGOpacity(fillColor.a()) {
result += " fill-opacity=\"\(opacity)\""
}
return result
}
return " fill=\"none\""
}
fileprivate func alphaToSVGOpacity(_ alpha: Int) -> String? {
if alpha == SVGDefaultOpacityValueAsAlpha {
return .none
}
return String(Double(alpha) / Double(SVGDefaultOpacityValueAsAlpha))
}
fileprivate func strokeToSVG(_ stroke: Stroke?) -> String {
var result = ""
if let strokeColor = stroke?.fill as? Color {
result += " stroke=\"\(colorToSVG(strokeColor))\""
if let opacity = alphaToSVGOpacity(strokeColor.a()) {
result += " stroke-opacity=\"\(opacity)\""
}
}
if let strokeWidth = stroke?.width {
result += " stroke-width=\"\(strokeWidth)\""
}
if let strokeCap = stroke?.cap {
if strokeCap != SVGConstants.defaultStrokeLineCap {
result += " stroke-linecap=\"\(strokeCap)\""
}
}
if let strokeJoin = stroke?.join {
if strokeJoin != SVGConstants.defaultStrokeLineJoin {
result += " stroke-linejoin=\"\(strokeJoin)\""
}
}
if let strokeDashes = stroke?.dashes, !strokeDashes.isEmpty {
let dashes = strokeDashes.map { String($0) }.joined(separator: ",")
result += " stroke-dasharray=\"\(dashes)\""
}
if let strokeOffset = stroke?.offset {
if strokeOffset != 0 {
result += " stroke-dashoffset=\"\(strokeOffset)\""
}
}
return result
}
fileprivate func isSignificantMatrixTransform(_ t: Transform) -> Bool {
for k in [t.m11, t.m12, t.m21, t.m22, t.dx, t.dy] {
if abs(k) > SVGEpsilon {
return true
}
}
return false
}
fileprivate func transformToSVG(_ place: Transform) -> String {
if [place.m11, place.m12, place.m21, place.m22] == [1.0, 0.0, 0.0, 1.0] {
if [place.dx, place.dy] == [0.0, 0.0] {
return ""
}
return " transform=\"translate(\(place.dx.serialize()),\(place.dy.serialize()))\" "
}
let matrixArgs = [place.m11, place.m12, place.m21, place.m22, place.dx, place.dy].map { $0.serialize() }.joined(separator: ",")
return " transform=\"matrix(\(matrixArgs))\" "
}
fileprivate func locusToSVG(_ locus: Locus) -> String {
switch locus {
case let arc as Arc:
return arcToSVG(arc)
case let polygon as Polygon:
return polygonToSVG(polygon)
case let polyline as Polyline:
return polylineToSVG(polyline)
case let path as Path:
return pathToSVG(path)
case let line as Line:
return lineToSVG(line)
case let ellipse as Ellipse:
return ellipseToSVG(ellipse)
case let circle as Circle:
return circleToSVG(circle)
case let roundRect as RoundRect:
return roundRectToSVG(roundRect)
case let rect as Rect:
return rectToSVG(rect)
case let transformedLocus as TransformedLocus:
return locusToSVG(transformedLocus.locus) + transformToSVG(transformedLocus.transform)
default:
return "\(SVGUndefinedTag) locus:\(locus)"
}
}
fileprivate var defs: String = ""
fileprivate func getDefs() -> String {
if defs.isEmpty {
return ""
}
return "<defs>" + defs + "</defs>"
}
fileprivate var clipPathCount: Int = 0
fileprivate func addClipToDefs(_ clip: Locus) {
clipPathCount += 1
defs += "<\(SVGClipPathName) id=\"\(SVGClipPathName)\(clipPathCount)\">" + locusToSVG(clip) + SVGGenericCloseTag + "</\(SVGClipPathName)>"
}
fileprivate var maskCount: Int = 0
fileprivate func addMaskToDefs(_ mask: Node) {
maskCount += 1
defs += "<\(SVGMaskName) id=\"\(SVGMaskName)\(maskCount)\">" + serialize(node: mask) + SVGGenericCloseTag + "</\(SVGMaskName)>"
}
fileprivate func idToSVG(_ tag: [String]) -> String {
guard !tag.isEmpty, let id = tag.first else {
return ""
}
return " id=\"\(id)\""
}
fileprivate func clipToSVG(_ clipLocus: Locus?) -> String {
guard let clip = clipLocus else {
return ""
}
addClipToDefs(clip)
return " clip-path=\"url(#\(SVGClipPathName)\(clipPathCount))\" "
}
fileprivate func maskToSVG(_ mask: Node?) -> String {
guard let mask = mask else {
return ""
}
addMaskToDefs(mask)
return " mask=\"url(#\(SVGMaskName)\(maskCount))\" "
}
fileprivate func macawShapeToSvgShape (macawShape: Shape) -> String {
let locus = macawShape.formVar.value
var result = locusToSVG(locus)
result += idToSVG(macawShape.tag)
result += clipToSVG(macawShape.clip)
result += maskToSVG(macawShape.mask)
result += fillToSVG(macawShape.fillVar.value)
result += strokeToSVG(macawShape.strokeVar.value)
result += transformToSVG(macawShape.place)
result += SVGGenericCloseTag
return result
}
fileprivate func serialize(node: Node) -> String {
if let shape = node as? Shape {
return macawShapeToSvgShape(macawShape: shape)
}
if let group = node as? Group {
var result = SVGGroupOpenTag
result += idToSVG(group.tag)
result += clipToSVG(group.clip)
result += transformToSVG(group.place)
result += SVGGenericEndTag
for child in group.contentsVar.value {
result += serialize(node: child)
}
result += SVGGroupCloseTag
return result
}
if let image = node as? MacawImage {
return imageToSVG(image)
}
if let text = node as? MText {
return textToSVG(text)
}
return "SVGUndefinedTag \(node)"
}
fileprivate func serializeRootNode(node: Node) -> String {
var optionalSection = ""
if let w = width {
optionalSection += "width=\"\(w)\""
}
if let h = height {
optionalSection += " height=\"\(h)\""
}
if let i = id {
optionalSection += " id=\"\(i)\""
}
var result = [SVGDefaultHeader, optionalSection, SVGGenericEndTag].joined(separator: " ")
let body = serialize(node: node)
result += getDefs() + body
result += SVGFooter
return result
}
open class func serialize(node: Node, width: Int? = nil, height: Int? = nil, id: String? = nil) -> String {
return SVGSerializer(width: width, height: height, id: id).serializeRootNode(node: node)
}
}
extension Double {
func serialize() -> String {
let formatter = NumberFormatter()
formatter.minimumIntegerDigits = 1
formatter.maximumFractionDigits = 6
formatter.decimalSeparator = "."
return abs(self.remainder(dividingBy: 1)) > 0.00001 ? formatter.string(from: NSNumber(value: self))! : String(Int(self.rounded()))
}
}
|
[
-1
] |
0ed07bbef513e179d2a82087fde7b7c476cc6d0e
|
aaae553b08b00f1fd6c99c54d056b079390be63b
|
/FRCScoreSheet/PitScoutingController.swift
|
c0b01320ccd6dd5ea70707b18983da7f33d1c147
|
[] |
no_license
|
gitter-badger/FRCScoreSheet
|
bed16ef0aee9c68cde932caf39e2197683be2e4f
|
edc6eb485eb74f0eeaa5441dab413f127c3e0145
|
refs/heads/master
| 2021-01-18T12:39:39.750880 | 2016-09-19T15:33:53 | 2016-09-19T15:33:53 | 68,804,388 | 0 | 0 | null | 2016-09-21T10:02:59 | 2016-09-21T10:02:59 | null |
UTF-8
|
Swift
| false | false | 2,319 |
swift
|
//
// SecondViewController.swift
// FRCScoreSheet
//
// Created by Austin Bennett on 8/17/16.
// Copyright © 2016 Austin Bennett. All rights reserved.
//
import UIKit
class PitScoutingController: UIViewController, UITextFieldDelegate {
@IBOutlet weak var teamNumb: UITextField!
@IBOutlet weak var robotWeight: UITextField!
@IBOutlet weak var robotPosition: UISegmentedControl!
@IBOutlet weak var robotHeight: UITextField!
@IBOutlet weak var robotWidth: UITextField!
@IBOutlet weak var robotDepth: UITextField!
@IBOutlet weak var robotImage: UIImageView!
let instanceDataManager = LocalizedData.localizedData
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
self.teamNumb.delegate = self;
self.robotWeight.delegate = self;
self.robotHeight.delegate = self;
self.robotWidth.delegate = self;
self.robotDepth.delegate = self;
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
self.view.endEditing(true)
return false
}
@IBAction func submitButton(sender: UIButton) {
//Make everything an integer, except for the image
let teamNumberInteger = Int((teamNumb.text)!)
let robotWeightInteger = Int((robotWeight.text)!)
let robotPositionInteger = robotPosition.selectedSegmentIndex
let robotHeightInteger = Int((robotHeight.text)!)
let robotWidthInteger = Int((robotWidth.text)!)
let robotDepthInteger = Int((robotDepth.text)!)
//Add data to LocalizedData
instanceDataManager.addPitScout(teamNumber: teamNumberInteger!, robotImageLocation: "", robotWeight: robotWeightInteger!, robotPosition: robotPositionInteger, robotHeight: robotHeightInteger!, robotWidth: robotWidthInteger!, robotDepth: robotDepthInteger!)
//Reset data fields
teamNumb.text = ""
robotWeight.text = ""
robotPosition.selectedSegmentIndex = 0
robotHeight.text = ""
robotWidth.text = ""
robotDepth.text = ""
}
}
|
[
-1
] |
a8d3bc58538877c52a2a18dd826260f489d65895
|
bd68fa6b7f96cfb623ec27b14f873c0208339ff9
|
/exercicios/mediana.swift
|
ed86eb27396cf9a0e2790523574bf03c0a564315
|
[] |
no_license
|
JordyLimaEng/swift
|
2e76ba5f5be9a2a478a466a2fdba0f3de6ef4815
|
fc53aa81c3b1026bb61376bb11e6429f453f85df
|
refs/heads/master
| 2021-03-07T16:33:56.073322 | 2020-03-16T23:26:48 | 2020-03-16T23:26:48 | 246,279,805 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 618 |
swift
|
func Mediana(valores: [Int]) -> Int{
var mediana = 0
let tam_array = valores.count
if(tam_array > 1){
let val_ordenados = valores.sorted{$0>$1}
if(tam_array % 2 != 0){
mediana = val_ordenados[tam_array/2]
}else{
mediana = (val_ordenados[tam_array/2]+val_ordenados[(tam_array/2)-1])/2
}
}else{
mediana = valores[tam_array-1]
}
return mediana
}
let res = Mediana
var vetor_par = [13,15,13,15,15,17,16,16] //mediana é 15
var vetor_impar = [9,8,7,7,3] //mediana é 7
print(res(vetor_par))
print(res(vetor_impar))
|
[
-1
] |
b07b0dddcf2895f050fedbe1d86259604df35fb6
|
aea7f879ee0fc917dadd325e6fd8b36e1ec8fdf8
|
/SwiftUI/Examples/MyFirstBasicTemplate/MyFirstBasicTemplate/OtherModifiers/Preference/Preference_ReduceFunction.swift
|
d54b0654626f475892c3d307b32b6de5dfcf8786
|
[
"MIT"
] |
permissive
|
edgaradrian/iOS-Practices
|
be8591eb30949eedb2fef072ff04dbf2ab5eef3e
|
3660de38e121c874bc702da122126c2e0b13c783
|
refs/heads/master
| 2022-11-18T13:02:53.813942 | 2022-11-07T00:03:03 | 2022-11-07T00:03:03 | 146,809,430 | 1 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,502 |
swift
|
//
// Preference_ReduceFunction.swift
// MyFirstBasicTemplate
//
// Created by Edgar Adrián on 28/07/22.
//
import SwiftUI
struct Preference_ReduceFunction: View {
@State private var highestValue = 0
var body: some View {
ScrollView {
VStack(spacing: 20) {
HeaderView(titulo: "Preferencia", subtitulo: "Función Reducir", description: "Con la función de reducir se administran múltiples valores de preferencia.")
HStack {
ForEach(4 ..< 9) { item in
Image(systemName: "\(item).circle")
.preference(key: GetHighestValue.self, value: item)
}
}
.onPreferenceChange(GetHighestValue.self) { value in
highestValue = value
}
Text("Número más alto: \(highestValue)")
.font(.title2)
}
.font(.title)
}
}
}//Preference_ReduceFunction
struct GetHighestValue: PreferenceKey {
static var defaultValue = 0
static func reduce(value: inout Int, nextValue: () -> Int) {
value = value > nextValue() ? value : nextValue()
}
}//GetHighestValue
struct Preference_ReduceFunction_Previews: PreviewProvider {
static var previews: some View {
Preference_ReduceFunction()
}
}
|
[
-1
] |
6a8f638080d643fe47d1dce077e6644c50f0c99b
|
946d73b6cb354415dbc715db132baac2325fef57
|
/Sources/UserFeedbackTableViewController.swift
|
6b934417eef81ef8e65ed7bb0c9c3d8a0e6debbe
|
[
"MIT"
] |
permissive
|
dasmer/sentry-swift
|
b8d93b8236a4bd59b26c74f1bf841beb6aa10d0c
|
3c577761a7070821698aafbacaa61a2417ff8895
|
refs/heads/master
| 2020-06-13T04:27:19.111095 | 2016-11-21T12:27:55 | 2016-11-21T12:27:55 | 75,448,883 | 0 | 0 | null | 2016-12-03T03:20:47 | 2016-12-03T03:20:46 | null |
UTF-8
|
Swift
| false | false | 6,319 |
swift
|
//
// UserFeedbackTableViewController.swift
// SentrySwift
//
// Created by Daniel Griesser on 16/11/16.
//
//
import UIKit
public final class UserFeedbackTableViewController: UITableViewController, UITextFieldDelegate {
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var subtitleLabel: UILabel!
@IBOutlet weak var nameLabel: UILabel!
@IBOutlet weak var nameTextField: UITextField!
@IBOutlet weak var emailLabel: UILabel!
@IBOutlet weak var emailTextField: UITextField!
@IBOutlet weak var commentsTextField: UITextField!
@IBOutlet weak var sentryLogoImageView: UIImageView!
@IBOutlet weak var emailTableViewCell: UITableViewCell!
@IBOutlet weak var nameTableViewCell: UITableViewCell!
@IBOutlet weak var poweredByTableViewCell: UITableViewCell!
var viewModel: UserFeedbackViewModel?
override public func viewDidLoad() {
super.viewDidLoad()
clearsSelectionOnViewWillAppear = false
tableView.tableFooterView = UIView()
}
public override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
updateInterface()
}
func dismissViewController() {
#if swift(>=3.0)
dismiss(animated: true, completion: nil)
#else
dismissViewControllerAnimated(true, completion: nil)
#endif
}
func onClickSubmit() {
submitUserFeedback()
}
private func updateInterface() {
guard let viewModel = viewModel else {
SentryLog.Error.log("UserFeedbackTableViewController has no UserFeedbackViewModel set")
return
}
titleLabel.text = viewModel.title
subtitleLabel.text = viewModel.subTitle
nameTextField.text = viewModel.nameTextFieldValue
nameLabel.text = viewModel.nameLabel
emailTextField.text = viewModel.emailTextFieldValue
emailLabel.text = viewModel.emailLabel
commentsTextField.text = viewModel.commentsTextFieldValue
commentsTextField.placeholder = viewModel.commentsTextFieldPlaceholder
#if swift(>=3.0)
poweredByTableViewCell.isHidden = !viewModel.showSentryBranding
navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(dismissViewController))
navigationItem.rightBarButtonItem = UIBarButtonItem(title: viewModel.submitButtonText, style: .done, target: self, action: #selector(onClickSubmit))
if let bundleURL = Bundle(for: type(of: self)).url(forResource: "assets", withExtension: "bundle"),
let bundle = Bundle(url: bundleURL) {
sentryLogoImageView.image = UIImage(named: "sentry-glyph-black", in: bundle, compatibleWith: nil)
}
#else
poweredByTableViewCell.hidden = !viewModel.showSentryBranding
navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .Cancel, target: self, action: #selector(dismissViewController))
navigationItem.rightBarButtonItem = UIBarButtonItem(title: viewModel.submitButtonText, style: .Done, target: self, action: #selector(onClickSubmit))
if let bundleURL = NSBundle(forClass: self.dynamicType).URLForResource("assets", withExtension: "bundle"),
let bundle = NSBundle(URL: bundleURL) {
sentryLogoImageView.image = UIImage(named: "sentry-glyph-black", inBundle: bundle, compatibleWithTraitCollection: nil)
}
#endif
title = viewModel.viewControllerTitle
}
private func submitUserFeedback() {
guard let viewModel = viewModel else {
SentryLog.Error.log("UserFeedbackTableViewController has no UserFeedbackViewModel set")
return
}
if let erroredTextField = viewModel.validatedUserFeedback(nameTextField: nameTextField,
emailTextField: emailTextField,
commentsTextField: commentsTextField) {
nameTextField.textColor = viewModel.defaultTextColor
emailTextField.textColor = viewModel.defaultTextColor
commentsTextField.textColor = viewModel.defaultTextColor
erroredTextField.becomeFirstResponder()
erroredTextField.textColor = viewModel.errorTextColor
} else {
viewModel.sendUserFeedback() { [weak self] success in
self?.dismissViewController()
}
}
}
// MARK: UITextFieldDelegate
public func textFieldShouldReturn(_ textField: UITextField) -> Bool {
switch textField {
case nameTextField:
nameTextField.resignFirstResponder()
emailTextField.becomeFirstResponder()
case emailTextField:
emailTextField.resignFirstResponder()
commentsTextField.becomeFirstResponder()
case commentsTextField:
commentsTextField.resignFirstResponder()
submitUserFeedback()
default:
return true
}
return true
}
// MARK: UITableViewControllerDelegate
#if swift(>=3.0)
public override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
guard let cell = tableView.cellForRow(at: indexPath) else {
return
}
switch cell {
case nameTableViewCell:
nameTextField.becomeFirstResponder()
case emailTableViewCell:
emailTextField.becomeFirstResponder()
default:
break
}
}
#else
public override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
guard let cell = tableView.cellForRowAtIndexPath(indexPath) else {
return
}
switch cell {
case nameTableViewCell:
nameTextField.becomeFirstResponder()
case emailTableViewCell:
emailTextField.becomeFirstResponder()
default:
break
}
}
#endif
}
|
[
-1
] |
5e3060c023b0841014483e6c7d8c5d3a5326f8ed
|
53df47ecaa72bb56bd04a2b3e751cdd2f09e518a
|
/iOSApp/iOSAppTests/iOSAppTests.swift
|
15b6a65ff16a15d0aab447aa3ae81fb6391cdbd1
|
[] |
no_license
|
charles-mersereau/KotlinMultiplatform_MVVM
|
01acf96ea0fb1994ba3dbd7d37e95aa21c4b87ed
|
7b713863dacb76d17d6624febfd09339985d7d40
|
refs/heads/master
| 2022-12-30T09:34:15.733469 | 2020-10-19T18:20:49 | 2020-10-19T18:20:49 | 305,475,738 | 1 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 905 |
swift
|
//
// iOSAppTests.swift
// iOSAppTests
//
// Created by Javier Arroyo on 11/12/2019.
// Copyright © 2019 Javier Arroyo. All rights reserved.
//
import XCTest
@testable import iOSApp
class iOSAppTests: XCTestCase {
override func 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.
}
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}
|
[
268288,
282633,
354316,
313357,
182296,
317467,
241692,
98333,
16419,
223268,
329765,
102437,
229413,
315432,
292902,
315434,
325674,
204840,
399405,
354345,
309295,
176175,
243759,
321583,
124975,
241716,
233517,
319542,
243767,
124984,
241720,
346162,
352315,
385084,
229430,
325694,
358456,
288833,
352326,
311372,
354385,
196691,
315476,
280661,
329814,
338007,
278615,
307289,
200794,
354393,
356447,
254048,
309345,
280675,
321637,
329829,
319591,
176232,
280677,
313447,
278634,
315498,
385133,
319598,
288879,
352368,
299121,
333940,
284788,
233589,
280694,
237689,
215164,
313469,
215166,
278655,
292992,
333955,
280712,
215178,
325776,
422033,
323729,
317587,
241808,
278677,
284826,
278685,
346271,
311458,
278691,
49316,
233636,
333991,
333992,
284842,
333996,
32941,
153776,
278704,
239793,
299187,
278708,
125109,
180408,
182456,
131256,
184505,
299198,
379071,
299203,
309444,
301251,
338119,
346314,
377035,
417999,
282831,
321745,
334042,
254170,
194782,
356576,
327904,
338150,
176362,
321772,
385262,
286958,
125169,
338164,
327929,
356602,
243962,
184570,
12542,
125183,
309503,
194820,
125188,
313608,
125193,
375051,
180493,
125198,
125199,
325905,
254226,
319763,
272660,
338197,
125203,
334103,
325912,
260377,
315673,
125208,
299293,
237856,
125217,
278816,
233762,
211235,
217380,
305440,
151847,
282919,
338218,
325931,
321840,
98610,
125235,
127284,
332085,
336183,
125240,
332089,
280887,
278842,
282939,
315706,
389439,
287041,
241986,
260418,
332101,
182598,
323916,
319821,
348492,
254286,
250192,
6481,
323920,
344401,
348500,
366929,
155990,
366930,
272729,
215385,
6489,
379225,
354655,
391520,
106847,
323935,
321894,
242023,
280939,
242029,
160110,
246127,
250226,
354676,
246136,
139640,
315770,
246137,
106874,
317820,
211326,
313727,
291192,
362881,
248194,
225670,
332167,
242058,
311691,
395659,
227725,
395661,
108944,
240016,
291224,
317852,
121245,
39324,
283038,
61857,
285090,
246178,
315810,
61859,
289189,
375207,
340398,
311727,
377264,
61873,
334260,
61880,
283064,
319930,
278970,
336317,
293310,
291265,
342466,
278978,
127427,
127428,
254406,
324039,
283075,
188871,
129483,
317901,
281037,
6606,
281040,
278993,
334290,
326100,
278999,
328152,
176601,
242139,
369116,
256477,
285150,
287198,
279008,
342498,
242148,
340453,
195045,
279013,
127465,
330218,
279018,
319981,
281072,
109042,
319987,
279029,
293367,
254456,
279032,
233978,
279039,
324097,
240131,
342536,
287241,
348682,
279050,
340490,
254488,
410136,
289304,
279065,
342553,
322078,
291358,
207393,
182817,
375333,
377386,
197167,
283184,
236081,
23092,
174648,
315960,
348732,
242237,
352829,
438849,
301638,
348742,
322120,
55881,
348749,
340558,
281166,
244310,
332378,
354911,
436832,
242277,
66150,
344680,
111208,
191082,
184941,
313966,
281199,
313971,
279164,
189057,
311941,
348806,
279177,
369289,
344715,
330379,
184973,
311949,
334481,
330387,
346772,
111253,
316053,
352917,
330388,
227990,
111258,
318107,
363163,
230040,
271000,
342682,
344738,
295590,
279206,
352937,
287404,
295599,
303793,
318130,
299699,
299700,
164533,
338613,
314040,
109241,
342713,
158394,
287417,
285373,
66242,
248517,
363211,
242386,
334547,
278570,
279252,
344107,
318173,
289502,
363230,
385761,
295652,
338662,
246503,
285415,
330474,
342763,
346858,
289518,
418546,
322291,
312052,
312053,
199414,
154359,
344827,
363263,
35583,
205568,
162561,
191235,
299776,
285444,
336648,
264968,
322316,
326414,
312079,
322319,
295697,
166676,
207640,
326429,
336671,
326433,
344865,
279336,
318250,
318252,
353069,
295724,
152365,
312108,
328499,
242485,
353078,
230199,
353079,
355130,
336702,
342847,
355139,
252741,
353094,
353095,
420677,
299849,
355146,
283467,
293711,
355154,
281427,
353109,
244568,
281433,
230234,
322395,
355165,
109409,
293730,
303972,
351077,
342887,
275303,
326505,
355178,
242541,
330609,
246641,
246648,
361337,
269178,
209785,
177019,
279417,
254850,
359299,
359298,
240518,
109447,
287622,
228233,
316298,
349067,
228234,
308107,
426895,
189328,
355217,
56208,
295824,
308112,
326553,
209817,
324506,
318364,
324507,
127902,
289698,
189348,
324517,
256935,
289703,
353195,
140204,
353197,
347055,
252847,
326581,
289722,
353216,
330689,
349121,
363458,
213960,
279498,
316364,
338899,
330708,
340955,
248796,
248797,
207838,
50143,
130016,
340961,
437221,
64485,
314342,
52200,
123881,
324586,
203757,
340974,
383982,
289774,
304110,
320494,
316405,
240630,
349175,
295927,
201720,
304122,
320507,
314362,
328700,
330754,
357379,
328706,
320516,
353290,
330763,
230410,
320527,
146448,
324625,
330772,
418837,
322582,
223274,
320536,
316437,
197657,
201755,
281626,
326685,
252958,
336929,
300068,
357414,
248872,
345132,
410670,
238639,
252980,
300084,
359478,
322612,
324666,
324667,
238651,
302139,
336960,
21569,
361543,
359495,
238664,
250956,
300111,
314448,
341073,
353367,
156764,
156765,
314467,
281700,
250981,
253029,
322663,
300136,
316520,
228458,
207979,
318572,
316526,
357486,
187506,
353397,
337017,
363641,
341115,
160891,
363644,
150657,
187521,
248961,
349316,
302213,
349318,
222343,
279685,
228491,
228493,
285838,
337039,
169104,
162961,
177296,
308372,
326804,
296086,
324760,
119962,
300187,
339100,
296092,
300188,
339102,
302240,
343203,
300201,
300202,
253099,
238765,
3246,
279728,
367799,
339130,
64700,
322749,
343234,
367810,
259268,
113861,
140486,
283847,
353479,
62665,
353481,
353482,
244940,
283853,
283852,
290000,
333011,
228563,
148696,
296153,
357595,
279774,
359647,
298212,
304356,
330984,
222440,
328940,
228588,
234733,
253167,
279792,
353523,
298228,
128251,
216315,
208124,
316669,
363771,
388349,
228609,
320770,
279814,
322824,
242954,
328971,
292107,
312587,
353551,
251153,
349462,
245019,
320796,
126237,
130338,
208164,
304421,
109861,
369956,
130343,
130348,
351537,
345396,
318775,
300343,
312634,
312635,
116026,
347453,
222524,
216386,
286018,
193859,
279875,
345415,
230729,
224586,
372043,
177484,
251213,
238927,
296273,
331090,
120148,
318805,
283991,
316765,
222559,
314720,
292195,
230756,
294243,
314726,
333160,
230765,
296303,
243056,
312689,
327025,
314739,
116084,
314741,
316787,
249205,
279920,
327031,
314751,
318848,
306559,
378244,
298374,
388487,
314758,
314760,
368011,
314766,
296335,
112017,
112018,
9619,
306579,
234898,
212375,
282007,
357786,
212382,
314783,
290207,
333220,
314789,
279974,
314791,
282024,
245161,
241066,
316842,
314798,
286129,
173491,
210358,
284089,
228795,
292283,
302529,
302531,
163268,
380357,
415171,
300487,
361927,
300489,
370123,
148940,
280013,
310732,
64975,
312782,
327121,
222675,
329173,
366037,
210390,
210392,
210391,
353750,
210393,
310748,
228827,
286172,
103909,
310757,
245223,
187878,
280041,
361963,
54765,
191981,
321009,
251378,
343542,
280055,
300536,
288249,
343543,
286205,
300542,
290301,
294400,
210433,
282114,
228867,
366083,
323080,
329225,
230921,
253451,
253452,
359950,
323087,
304656,
323089,
316946,
329232,
413204,
398869,
146964,
374296,
308764,
349726,
230943,
187938,
282146,
286244,
355876,
306723,
245287,
245292,
349741,
347694,
169518,
312880,
230959,
286254,
288309,
290358,
312889,
235070,
425535,
288318,
349763,
124485,
56902,
288326,
288327,
292425,
243274,
128587,
333388,
333393,
290390,
235095,
300630,
196187,
44635,
343647,
345700,
323172,
374372,
282213,
323178,
120427,
312940,
204397,
54893,
138863,
222832,
396915,
333430,
314998,
247416,
396922,
366203,
175741,
325245,
337535,
339584,
294529,
224901,
282245,
282246,
288392,
229001,
310923,
415374,
188048,
323217,
239250,
282259,
345752,
229020,
255649,
245412,
323236,
40613,
40614,
40615,
229029,
282280,
298661,
321199,
364207,
224946,
337591,
321207,
296632,
319162,
280251,
224958,
323263,
323264,
282303,
286399,
321219,
218819,
333509,
319177,
306890,
280267,
212685,
333517,
333520,
245457,
241361,
333523,
302802,
241365,
333521,
181975,
280278,
280280,
298712,
18138,
278234,
294622,
321247,
278240,
325346,
333542,
345833,
12010,
212716,
212717,
294638,
280300,
282348,
360177,
284401,
282358,
313081,
325371,
286459,
124669,
194303,
278272,
319233,
175873,
323331,
323332,
280329,
284429,
284431,
323346,
278291,
321302,
294678,
366360,
116505,
249626,
284442,
325404,
321310,
255776,
339745,
241442,
282400,
341796,
241441,
247590,
325410,
257830,
333610,
317232,
282417,
319288,
321337,
259899,
282427,
204605,
360252,
325439,
315202,
307011,
325445,
153415,
339783,
345929,
159562,
341836,
325457,
337745,
18262,
241495,
362327,
370522,
188251,
345951,
362337,
284514,
345955,
296806,
292712,
288619,
325484,
292720,
362352,
313203,
325492,
317304,
241528,
194429,
124798,
325503,
55167,
182144,
305026,
327557,
247686,
253829,
333701,
67463,
243591,
325515,
243597,
325518,
184208,
282518,
337815,
282519,
124824,
214937,
329622,
118685,
298909,
319392,
253856,
300963,
354212,
292771,
333735,
294823,
284587,
323507,
124852,
243637,
288697,
188348,
214977,
174019,
163781,
321480,
247757,
212942,
344013,
380881,
212946,
212951,
219101,
280541,
360417,
292836,
298980,
294886,
313319,
337895,
174057,
247785,
253929,
327661,
253999,
362480,
325619,
333817,
313339
] |
c5785e2ce6584ced5f79dd67a3e72457765fcc22
|
4cb0c95ba481a3694c2b3d185a324534b7944dbc
|
/Country.swift
|
abcdd4c7c0096c7fe2eed92702122e60924b2887
|
[] |
no_license
|
kaushal9678/CoredataMultithreaded
|
5749064e723fee531ca18bd73695a9ab1b4ccc59
|
8e73cef095af50ca9b0073347274788964bcbee3
|
refs/heads/master
| 2016-09-12T16:11:58.981449 | 2016-04-26T08:25:56 | 2016-04-26T08:25:56 | 57,111,034 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 291 |
swift
|
//
// Country.swift
// CoredataMultithreaded
//
// Created by Mahir Abdi on 25/04/16.
// Copyright © 2016 kaushal. All rights reserved.
//
import Foundation
import CoreData
class Country: NSManagedObject {
// Insert code here to add functionality to your managed object subclass
}
|
[
-1
] |
e1acbd03e85b7d657d39ee37dca6932558716962
|
fe0b15efd099d093ba51b736e0a7a08556940593
|
/JetRubyTest/JetRubyTest/CollectionViewController.swift
|
dce8f7638edc23e151f86ba39bae281cbfe4546c
|
[] |
no_license
|
ooodin/JetRubyTest
|
987c3bf61d6a13bc7dbe9c917eaf3da78d434e0e
|
d0cbc3e2f88faad6819cd9f08cb8e9762704b5a4
|
refs/heads/master
| 2021-01-01T16:12:21.006764 | 2017-07-23T05:35:21 | 2017-07-23T05:35:21 | 97,788,497 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 3,903 |
swift
|
//
// CollectionViewController.swift
// JetRubyTest
//
// Created by Artem Semavin on 21/07/2017.
// Copyright © 2017 Artem Semavin. All rights reserved.
//
import UIKit
import AVFoundation
protocol SessionManagerDelegate {
func updateData() -> Void
}
class CollectionViewController: UICollectionViewController, SessionManagerDelegate {
var shots: [Shot] = []
var network: NetworkManager?
override func viewDidLoad() {
super.viewDidLoad()
network = NetworkManagerImp()
collectionView!.contentInset = UIEdgeInsets(top: 10, left: 5, bottom: 10, right: 5)
collectionView?.refreshControl = UIRefreshControl()
collectionView?.refreshControl?.addTarget(self, action: #selector(updateData), for: .valueChanged)
collectionView?.refreshControl?.beginRefreshing()
let layout = collectionViewLayout as! DribbbleLayout
layout.cellPadding = 5
layout.delegate = self
sessionManager.delegate = self
sessionManager.loadAuthToken()
}
func updateData() {
network?.getShots(success: { [weak self] json in
let result = [Shot].decode(json)
switch result {
case let .success(shots):
self?.setShots(shots)
case let .failure(error):
DialogManager.showErrorMessage(message: error.localizedDescription)
}
self?.collectionView?.refreshControl?.endRefreshing()
}) { (error) in
DialogManager.showErrorMessage(message: error.localizedDescription)
self.collectionView?.refreshControl?.endRefreshing()
}
}
func setShots(_ newShots: [Shot]) {
let temp = Array(newShots.filter{ !$0.animated }.prefix(50))
if self.shots.count == 0 {
self.shots = temp.sorted { $0.0.isCached.hashValue > $0.1.isCached.hashValue }
} else {
self.shots = temp
}
self.collectionView?.reloadData()
}
func loadImage(shot: Shot) {
network?.loadImage(imageURL: shot.imageURL, completion: { (image) in
DispatchQueue.main.async {
shot.image = image
self.collectionView?.reloadData() //TODO: Optimisation
// if self.collectionView?.indexPathsForVisibleItems.contains(index) ?? false {
// self.collectionView?.reloadItems(at: [index])
// }
}
})
}
}
extension CollectionViewController {
override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return shots.count
}
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "DribbbleCell", for: indexPath) as! CollectionViewCell
let shot = shots[indexPath.item]
if shot.image == nil {
loadImage(shot: shot)
}
cell.shot = shot
return cell
}
}
extension CollectionViewController: DribbbleLayoutDelegate {
func collectionView(collectionView: UICollectionView, heightForPhotoAtIndexPath indexPath: IndexPath, withWidth width: CGFloat) -> CGFloat {
let heightSize: CGFloat = UIScreen.main.bounds.height/2
let shot = shots[indexPath.item]
if let image = shot.image {
let boundingRect = CGRect(x: 0, y: 0, width: width, height: CGFloat(MAXFLOAT))
let rect = AVMakeRect(aspectRatio: image.size, insideRect: boundingRect)
return min(rect.height, heightSize)
}
return min(CGFloat(shot.height), heightSize)
}
}
|
[
-1
] |
773472ad5fc99b01020df2ba29752ae4adccd273
|
1ba40510268492b3a4c4fd32ee8318ba5f0d1ad6
|
/SimpleDisplayLight/AppDelegate.swift
|
c15da0e390ea475498c2f70b4722803421623fb3
|
[] |
no_license
|
Kableeeee/SimpleDisplayLight
|
16052329a6a0da5cf2a0da218812db7d27479ccb
|
92ebd7c5f70ff5846b9d689f1d8d3faf40837a96
|
refs/heads/master
| 2021-03-30T21:59:17.289519 | 2018-03-08T15:53:00 | 2018-03-08T15:53:00 | 124,412,038 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 2,183 |
swift
|
//
// AppDelegate.swift
// SimpleDisplayLight
//
// Created by Денис on 08.03.18.
// Copyright © 2018 DenMekhtiiev. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
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.
}
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.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
|
[
229380,
229383,
229385,
294924,
229388,
229391,
327695,
229394,
229397,
229399,
229402,
278556,
229405,
229408,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
311349,
286774,
286776,
319544,
286778,
229432,
204856,
352318,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
303241,
131209,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
303347,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
295220,
287032,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
172534,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
172552,
287238,
320007,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
213575,
172618,
303690,
33357,
287309,
303696,
279124,
172634,
262752,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
295538,
189039,
172660,
287349,
189040,
189044,
287355,
287360,
295553,
172675,
295557,
287365,
311942,
303751,
352905,
279178,
287371,
311946,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
164509,
303773,
172705,
287394,
172707,
303780,
287390,
287398,
205479,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
279231,
287427,
312005,
312006,
107208,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
312035,
279267,
295654,
279272,
230128,
312048,
312050,
230131,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303981,
303985,
328563,
303987,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
213895,
304007,
304009,
304011,
230284,
304013,
295822,
279438,
189325,
189329,
295825,
304019,
189331,
58262,
304023,
304027,
279452,
234648,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
197564,
230334,
304063,
238528,
304065,
213954,
189378,
156612,
295873,
213963,
197580,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
230413,
295949,
197645,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
296044,
279661,
205934,
164973,
312432,
279669,
337018,
189562,
279679,
304258,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
238766,
165038,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
230679,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
230718,
296259,
378181,
296262,
230727,
238919,
296264,
320840,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
148843,
410987,
230763,
230768,
296305,
312692,
230773,
304505,
304506,
181626,
181631,
148865,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
337306,
288154,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
279991,
288185,
337335,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
288212,
222676,
148946,
280021,
239064,
288217,
329177,
280027,
288220,
288214,
239070,
288218,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
370146,
320998,
288234,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
206336,
296450,
148990,
230916,
230919,
214535,
230923,
304651,
304653,
370187,
402969,
230940,
222752,
108066,
296486,
296488,
157229,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
181854,
239202,
370279,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
419489,
190118,
198310,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
419522,
313027,
280260,
419525,
206536,
280264,
206539,
206541,
206543,
313044,
280276,
321239,
280283,
313052,
18140,
288478,
313055,
321252,
313066,
288494,
280302,
280304,
313073,
321266,
288499,
419570,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
337732,
304968,
280393,
280402,
173907,
313171,
313176,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
354265,
354270,
239586,
313320,
354281,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
321560,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
288947,
280755,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
305464,
280891,
289087,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
248153,
215387,
354653,
354656,
313700,
280937,
313705,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
240021,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
289221,
289227,
436684,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
330244,
281095,
223752,
150025,
338440,
240132,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
264845,
182926,
133776,
182929,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
240519,
322440,
314249,
338823,
183184,
289687,
224151,
240535,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
420829,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
380226,
298306,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
298365,
290174,
306555,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
290321,
282130,
323090,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282255,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
282295,
282300,
323260,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
118593,
307009,
413506,
307012,
241475,
298822,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
282481,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
44948,
298901,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241640,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
299003,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
307211,
282639,
290835,
282645,
241693,
282654,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
176213,
307287,
307290,
217179,
315482,
192605,
315483,
233567,
299105,
200801,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
315524,
307338,
233613,
241813,
307352,
299164,
299167,
315552,
184479,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
323763,
184503,
176311,
299191,
307385,
307386,
307388,
258235,
307390,
176316,
299200,
184512,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
323854,
291089,
282906,
291104,
233766,
295583,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
283033,
242075,
291226,
194654,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
127431,
127434,
315856,
176592,
127440,
315860,
176597,
127447,
283095,
299481,
127449,
176605,
242143,
127455,
127457,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
127490,
283142,
127494,
127497,
233994,
135689,
127500,
291341,
233998,
127506,
234003,
127509,
234006,
127511,
152087,
283161,
242202,
234010,
135707,
242206,
135710,
242208,
291361,
242220,
291378,
234038,
152118,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
291456,
135808,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
299740,
242396,
201444,
299750,
283368,
234219,
283372,
185074,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
292433,
316233,
234313,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
242530,
349027,
234338,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
234364,
291711,
234368,
291714,
234370,
291716,
234373,
201603,
226182,
234375,
308105,
324490,
226185,
234379,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
234396,
291742,
226200,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
324522,
234410,
291756,
226220,
291754,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
275384,
324536,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
226245,
234437,
234439,
226239,
234443,
291788,
234446,
275406,
193486,
234449,
316370,
193488,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
324599,
234490,
234493,
316416,
234496,
308226,
234501,
308231,
234504,
234507,
234510,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
234597,
300133,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
275606,
275608,
234650,
324757,
308379,
300189,
324766,
119967,
234653,
324768,
283805,
234657,
242852,
300197,
234661,
283813,
234664,
275626,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
226500,
283844,
300234,
283850,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
283917,
177424,
349451,
275725,
349464,
415009,
283939,
259367,
292143,
283951,
300344,
226617,
243003,
283963,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
292192,
316768,
218464,
292197,
316774,
243046,
218473,
284010,
136562,
324978,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
300436,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
284076,
144814,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
227440,
316917,
308727,
292343,
300537,
316933,
316947,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
292414,
284223,
284226,
284228,
292421,
226886,
284231,
128584,
243268,
284234,
276043,
317004,
366155,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
276053,
284247,
317015,
284249,
243290,
284251,
235097,
284253,
300638,
284255,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
292479,
284288,
292481,
284290,
325250,
284292,
292485,
325251,
276095,
276098,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
276160,
358080,
284354,
358083,
284358,
276166,
358089,
284362,
276170,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
276187,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
276206,
358128,
284399,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
186151,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
292681,
153417,
358224,
284499,
276308,
178006,
317271,
284502,
276315,
292700,
317279,
284511,
227175,
292715,
300912,
292721,
284529,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
317332,
358292,
284564,
399252,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
284585,
276395,
292776,
292784,
276402,
358326,
161718,
358330,
276410,
276411,
276418,
276425,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276448,
276452,
292839,
276455,
350186,
292843,
276460,
276464,
178161,
227314,
276466,
325624,
350200,
276472,
317435,
276476,
276479,
276482,
350210,
276485,
317446,
178181,
276490,
350218,
292876,
350222,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
178224,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
243779,
325700,
284739,
292934,
243785,
350293,
350295,
309337,
194649,
227418,
350299,
350302,
227423,
350304,
178273,
309346,
194657,
194660,
350308,
309350,
309348,
292968,
309352,
227426,
276579,
227430,
276583,
309354,
301167,
276590,
350321,
350313,
350316,
284786,
350325,
252022,
276595,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
284837,
153765,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
309450,
276685,
309455,
276689,
309462,
301272,
276699,
194780,
309468,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
309491,
227571,
309494,
243960,
276735,
227583,
227587,
276739,
211204,
276742,
227593,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
293227,
276843,
293232,
276848,
186744,
211324,
227709,
285061,
366983,
317833,
178572,
285070,
285077,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
129486,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
293387,
236043,
342541,
317963,
113167,
55822,
309779,
317971,
309781,
277011,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
219714,
129603,
301636,
318020,
301639,
301643,
277071,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
121458,
277106,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
293555,
342707,
154292,
318132,
277173,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
342745,
137946,
342747,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
56045,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
310080,
293696,
277317,
277322,
293706,
277329,
162643,
310100,
301911,
277337,
301913,
301921,
400236,
236397,
162671,
326514,
310134,
236408,
15224,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
293811,
293817,
293820,
203715,
326603,
342994,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
351217,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
285690,
244731,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
293960,
310344,
277577,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
285792,
277601,
203872,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
285821,
392326,
285831,
253064,
294026,
302218,
285835,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
310486,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
228601,
204026,
228606,
204031,
64768,
310531,
285958,
138505,
228617,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
384302,
285999,
277804,
113969,
277807,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
294221,
146765,
294223,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
146784,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
228776,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
310727,
64966,
245191,
163272,
277959,
277963,
302541,
277966,
302543,
310737,
277971,
228825,
163290,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
286233,
302617,
302621,
286240,
146977,
187936,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
278057,
310831,
245288,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286313,
40554,
286312,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
278227,
286420,
229076,
286425,
319194,
278235,
301163,
278238,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
278320,
319280,
319290,
229192,
302925,
188247,
188252,
237409,
294776,
360317,
294785,
327554,
360322,
40840,
40851,
294803,
188312,
294811,
237470,
319390,
40865,
319394,
294817,
294821,
311209,
180142,
343983,
294831,
188340,
40886,
319419,
294844,
294847,
393177,
294876,
294879,
294883,
393190,
294890,
311279,
278513,
237555,
278516,
311283,
237562
] |
41752238571f1002a224c420a161b7c4bd015765
|
2b672cd3b477fc1b7d4583e306940b8f2b9c2257
|
/ExchangeRates/Extensions/Dictionary+Extensions.swift
|
ad1a5e5e125ff61e53382fb3131cac51bc51879c
|
[] |
no_license
|
dalalsunil1986/ExchangeRates
|
380fa3c141ebb3cbafb197009a768902ceb9ba75
|
83476aed6152d9540b224b084b66ddb69c526909
|
refs/heads/master
| 2022-02-23T16:50:42.625302 | 2019-07-11T08:52:56 | 2019-07-11T08:52:56 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 336 |
swift
|
//
// Dictionary+Extension.swift
// ExchangeRates
//
// Created by Engineer 144 on 06/07/2019.
// Copyright © 2019 Engineer 144. All rights reserved.
//
import Foundation
public extension Dictionary {
mutating func update(other:Dictionary) {
for (key,value) in other {
self.updateValue(value, forKey:key)
}
}
}
|
[
-1
] |
2be4a1a7fa7a13b9924297fb8bffa52cbbae8faa
|
aac4f239969b36407dd39e6a1b9a7f5afeb4ffff
|
/Sources/TuistKit/Commands/Migration/MigrationSettingsToXCConfigCommand.swift
|
018315c97e0787983f19f56af37a600afbc5610b
|
[
"MIT"
] |
permissive
|
joshdholtz/tuist
|
564472acfe4c71f2a6460ddb3f1e088a47dc8b1d
|
bcd2bfd317c43b849dc72f90e4c1e2f124d81a98
|
refs/heads/main
| 2023-03-05T08:04:01.687991 | 2021-02-18T15:26:02 | 2021-02-18T15:26:02 | 339,881,306 | 1 | 0 |
MIT
| 2021-02-19T10:06:22 | 2021-02-17T23:18:42 |
Swift
|
UTF-8
|
Swift
| false | false | 1,339 |
swift
|
import ArgumentParser
import Foundation
import TSCBasic
import TuistSupport
struct MigrationSettingsToXCConfigCommand: ParsableCommand {
static var configuration: CommandConfiguration {
CommandConfiguration(commandName: "settings-to-xcconfig",
_superCommandName: "migration",
abstract: "It extracts the build settings from a project or a target into an xcconfig file.")
}
@Option(
name: [.customShort("p"), .long],
help: "The path to the Xcode project",
completion: .directory
)
var xcodeprojPath: String
@Option(
name: [.customShort("x"), .long],
help: "The path to the .xcconfig file where build settings will be extracted.",
completion: .directory
)
var xcconfigPath: String
@Option(
name: .shortAndLong,
help: "The name of the target whose build settings will be extracted. When not passed, it extracts the build settings of the project.",
completion: .default
)
var target: String?
func run() throws {
try MigrationSettingsToXCConfigService().run(xcodeprojPath: xcodeprojPath,
xcconfigPath: xcconfigPath,
target: target)
}
}
|
[
-1
] |
4428708e74b9a6d78df9f72151673dcd4d1c67bf
|
afefec8ebedfb5e609c57cd03ec04d6d2345785d
|
/WeatherApp/WeatherApp/AppDelegate.swift
|
4e0f4d6a1ca5d5ede97baf6ab015a93048672509
|
[] |
no_license
|
VanTheMan1234/WeatherApp
|
ec250b0af3f1f9ec539440543f2c6f556ae5aa9e
|
3bbc0e787d7ba7dfc28603ea47821dd84c978e89
|
refs/heads/master
| 2022-11-28T22:02:50.375441 | 2020-08-16T19:35:57 | 2020-08-16T19:35:57 | 286,280,572 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 632 |
swift
|
//
// AppDelegate.swift
// WeatherApp
//
// Created by Vanoshan Ramdhani on 2020/08/09.
// Copyright © 2020 Vanoshan Ramdhani. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
window = UIWindow(frame: UIScreen.main.bounds)
let weather = WeatherViewCOntroller()
window?.rootViewController = weather
window!.makeKeyAndVisible()
return true
}
}
|
[
172568,
330809,
351585
] |
8fe2c469ffb699e227d578bdcd0fce40eea5e0ae
|
4fed7d91ee0a9e99dd239cafe6aea429fda1f285
|
/Baekjoon/2480.swift
|
ec43e0c1cd302eb405b70616827f76903a807b55
|
[] |
no_license
|
TheSongOfSongs/Algorithm
|
33b6da0d98fb0e3de82158115840f26ae04bd86e
|
b7ba601e69296296016b5047102b076b291908ec
|
refs/heads/master
| 2023-02-07T10:35:32.241719 | 2023-01-30T04:52:58 | 2023-01-30T04:52:58 | 247,258,995 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 515 |
swift
|
let arr = readLine()!.split(separator: " ").map({Int($0)!})
var dic: [Int:Int] = [:]
var result = 0
for num in arr {
if dic[num] == nil {
dic[num] = 1
} else {
dic[num]! += 1
}
}
for (key, value) in dic {
if value == 1 {
let current = key * 100
result = result > current ? result : current
} else if value == 2 {
result = 1000 + key * 100
break
} else if value == 3 {
result = 10000 + key * 1000
break
}
}
print(result)
|
[
-1
] |
d9870b4f36c045c68a98413d092dde5f30530f5e
|
b4e3e57f5b312a72ca61c1787c97c94ac29a218c
|
/MVVMRxSwift/AppDelegate.swift
|
5eb9d1c6ca56fdf27b05e37139588d27c9b22ed4
|
[] |
no_license
|
brainox/MVVMRxSwift
|
9b42f76f8a1f746b4212a71b19f0d358be60bb3d
|
978a1af755d761abed20f78f38d3b063453eaff6
|
refs/heads/main
| 2023-06-25T18:14:44.837909 | 2021-07-22T00:47:24 | 2021-07-22T00:47:24 | 388,284,990 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,348 |
swift
|
//
// AppDelegate.swift
// MVVMRxSwift
//
// Created by Decagon on 22/07/2021.
//
import UIKit
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// 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.
}
}
|
[
393222,
393224,
393230,
393250,
344102,
393261,
393266,
213048,
385081,
376889,
393275,
376905,
254030,
368727,
368735,
180320,
376931,
368752,
417924,
262283,
377012,
164028,
180416,
377036,
180431,
377046,
418007,
418010,
377060,
327914,
205036,
393456,
393460,
418043,
336123,
385280,
262404,
180490,
164106,
368911,
262416,
262422,
377117,
262436,
336180,
262454,
393538,
262472,
344403,
213332,
65880,
262496,
418144,
262499,
213352,
246123,
262507,
262510,
213372,
385419,
393612,
262550,
262552,
385440,
385443,
262566,
385451,
262573,
393647,
385458,
262586,
344511,
262592,
360916,
369118,
328177,
328179,
328182,
328189,
328192,
164361,
410128,
393747,
254490,
188958,
385570,
33316,
197159,
377383,
352821,
197177,
418363,
188987,
369223,
385609,
385616,
352864,
369253,
262760,
352874,
352887,
254587,
377472,
148105,
377484,
352918,
98968,
344744,
361129,
336555,
385713,
434867,
164534,
336567,
328378,
164538,
328386,
352968,
344776,
418507,
352971,
352973,
385742,
385748,
361179,
189153,
369381,
361195,
418553,
336643,
344835,
344841,
361230,
336659,
418580,
418585,
434970,
369435,
418589,
262942,
418593,
336675,
328484,
418598,
418605,
336696,
361273,
328515,
336708,
328519,
361288,
336711,
328522,
336714,
426841,
254812,
361309,
197468,
361315,
361322,
328573,
377729,
369542,
361360,
222128,
345035,
386003,
345043,
386011,
386018,
386022,
435187,
328714,
361489,
386069,
336921,
386073,
336925,
345118,
377887,
345133,
345138,
386101,
361536,
345169,
156761,
361567,
148578,
345199,
386167,
361593,
410745,
361598,
214149,
345222,
386186,
337047,
345246,
214175,
337071,
337075,
345267,
386258,
328924,
66782,
222437,
328941,
386285,
386291,
345376,
353570,
345379,
410917,
345382,
337205,
345399,
378169,
369978,
337222,
337229,
337234,
263508,
402791,
345448,
271730,
378227,
271745,
181638,
353673,
181643,
181654,
230809,
181673,
181681,
337329,
181684,
361917,
181696,
337349,
337365,
271839,
329191,
361960,
329194,
116210,
337398,
337415,
329226,
419339,
419343,
419349,
419355,
370205,
419359,
394786,
419362,
370213,
419368,
419376,
206395,
214593,
419400,
419402,
353867,
419406,
419410,
345701,
394853,
222830,
370297,
403070,
353919,
403075,
198280,
345736,
403091,
345749,
419483,
345757,
345762,
419491,
345765,
419497,
419501,
370350,
419506,
419509,
419512,
337592,
419517,
337599,
419527,
419530,
419535,
272081,
419542,
394966,
419544,
181977,
345818,
419547,
419550,
419559,
337642,
419563,
370415,
337659,
337668,
362247,
395021,
362255,
395029,
116509,
345887,
378663,
345905,
354106,
354111,
247617,
354117,
370503,
329544,
345930,
370509,
354130,
247637,
337750,
370519,
313180,
354142,
354150,
354156,
345967,
345970,
345974,
403320,
354172,
247691,
337808,
247700,
329623,
436126,
436132,
362413,
337844,
346057,
247759,
346063,
329697,
354277,
190439,
247789,
354313,
346139,
436289,
378954,
395339,
338004,
100453,
329832,
329855,
329867,
329885,
346272,
362660,
100524,
387249,
379066,
387260,
256191,
395466,
346316,
411861,
411864,
411868,
411873,
379107,
411876,
387301,
346343,
338152,
387306,
387312,
346355,
436473,
379134,
411903,
411916,
379152,
395538,
387349,
338199,
387352,
182558,
248111,
362822,
436555,
190796,
379233,
354673,
248186,
420236,
379278,
272786,
354727,
338352,
330189,
338381,
338386,
256472,
338403,
248308,
199164,
330252,
420376,
354855,
10828,
199249,
174695,
248425,
191084,
338543,
191092,
346742,
354974,
150183,
174774,
248504,
174777,
223934,
355024,
273108,
355028,
264918,
183005,
256734,
436962,
338660,
338664,
264941,
363251,
207619,
264964,
338700,
256786,
199452,
363293,
396066,
346916,
396069,
215853,
355122,
355131,
355140,
355143,
338763,
355150,
330580,
355166,
265055,
265058,
355175,
387944,
355179,
330610,
330642,
355218,
412599,
207808,
379848,
396245,
330710,
248792,
248798,
347105,
257008,
183282,
265207,
330748,
265214,
330760,
330768,
248862,
396328,
347176,
158761,
199728,
330800,
396336,
396339,
339001,
388154,
388161,
347205,
248904,
330826,
248914,
412764,
339036,
257120,
265320,
248951,
420984,
248985,
339097,
44197,
380070,
339112,
249014,
126144,
330958,
330965,
265432,
265436,
388319,
388347,
175375,
159005,
175396,
208166,
273708,
347437,
372015,
347441,
372018,
199988,
44342,
175415,
396600,
437566,
175423,
437570,
437575,
437583,
331088,
437587,
331093,
396633,
175450,
437595,
175457,
208227,
175460,
175463,
265580,
437620,
175477,
249208,
175483,
175486,
249214,
175489,
249218,
249227,
175513,
175516,
396705,
175522,
355748,
380332,
396722,
208311,
388542,
372163,
216517,
380360,
216522,
339404,
372176,
208337,
339412,
413141,
339417,
339420,
249308,
339424,
339428,
339434,
249328,
69113,
372228,
208398,
380432,
175635,
339503,
265778,
265795,
396872,
265805,
224853,
224857,
257633,
224870,
372327,
257646,
372337,
224884,
224887,
224890,
224894,
224897,
372353,
216707,
126596,
421508,
224904,
11918,
159374,
224913,
126610,
339601,
224916,
224919,
126616,
224922,
208538,
224926,
224929,
224932,
224936,
257704,
224942,
257712,
224947,
257716,
257720,
257724,
224959,
257732,
224965,
224969,
339662,
224975,
257747,
224981,
224986,
257761,
224993,
257764,
224999,
339695,
225012,
257787,
225020,
339710,
257790,
225025,
257794,
257801,
339721,
257804,
225038,
257807,
225043,
372499,
167700,
225048,
257819,
225053,
225058,
257833,
225066,
257836,
413484,
225070,
225073,
372532,
257845,
225079,
397112,
225082,
397115,
225087,
225092,
225096,
323402,
257868,
225103,
257871,
397139,
225108,
225112,
257883,
257886,
225119,
257890,
339814,
225127,
274280,
257896,
257901,
225137,
257908,
225141,
257912,
225148,
257916,
257920,
225155,
339844,
225165,
397200,
225170,
380822,
225175,
225180,
118691,
184244,
372664,
372702,
372706,
356335,
380918,
405533,
430129,
266294,
266297,
421960,
356439,
266350,
356466,
266362,
381068,
225423,
250002,
250004,
225429,
356506,
225437,
135327,
225441,
438433,
192673,
225444,
438436,
225447,
438440,
225450,
258222,
225455,
430256,
225458,
225461,
225466,
389307,
225470,
381120,
372929,
430274,
225475,
389320,
225484,
225487,
225490,
225493,
266453,
225496,
225499,
225502,
225505,
356578,
225510,
217318,
225514,
225518,
372976,
381176,
397571,
389380,
61722,
356637,
356640,
356643,
356646,
266536,
356649,
356655,
332080,
340275,
356660,
397622,
332090,
225597,
332097,
348488,
332106,
332117,
348502,
250199,
250202,
250210,
389502,
250238,
332161,
356740,
332172,
373145,
340379,
373148,
389550,
324030,
266687,
160234,
127471,
340472,
381436,
324094,
266754,
324111,
340500,
381481,
356907,
324142,
356916,
324149,
324155,
348733,
324164,
348743,
381512,
324173,
324176,
389723,
332380,
381545,
340627,
373398,
184982,
258721,
332453,
332459,
389805,
332463,
381617,
332471,
332483,
332486,
373449,
332493,
357069,
357073,
332511,
332520,
340718,
332533,
348924,
389892,
373510,
389926,
152370,
348978,
340789,
348982,
398139,
127814,
357201,
357206,
389978,
430939,
357211,
357214,
201579,
349040,
340849,
430965,
381813,
324472,
398201,
340858,
324475,
430972,
340861,
324478,
119674,
324481,
373634,
398211,
324484,
324487,
381833,
324492,
324495,
324498,
430995,
324501,
324510,
422816,
324513,
398245,
324524,
324533,
324538,
324541,
398279,
340939,
340941,
209873,
340957,
431072,
398306,
340963,
209895,
201711,
349172,
381946,
349180,
439294,
431106,
357410,
250914,
185380,
357418,
209979,
341071,
349267,
250967,
210010,
341091,
210025,
210030,
210036,
349308,
349311,
160895,
152703,
210052,
349319,
210055,
210067,
251044,
185511,
210107,
332997,
210127,
333009,
210131,
333014,
210143,
218354,
218360,
251128,
275712,
275715,
275721,
349459,
333078,
251160,
349484,
349491,
415033,
251210,
210260,
259421,
365921,
333154,
333162,
234866,
390516,
333175,
357755,
374160,
112020,
349590,
357792,
259515,
415166,
415185,
366034,
366038,
415191,
415193,
415196,
415199,
423392,
333284,
415207,
366056,
366061,
415216,
210420,
415224,
423423,
415257,
415263,
366117,
415270,
144939,
415278,
415281,
415285,
210487,
415290,
415293,
349761,
415300,
333386,
366172,
423528,
423532,
210544,
415353,
333439,
415361,
267909,
153227,
333498,
210631,
333511,
259788,
358099,
153302,
333534,
366307,
366311,
431851,
366318,
210672,
366321,
366325,
210695,
268041,
210698,
366348,
210706,
399128,
210719,
358191,
366387,
210739,
399159,
358200,
325440,
366401,
341829,
325446,
46920,
341834,
341838,
341843,
415573,
341851,
350045,
399199,
259938,
399206,
268143,
358255,
399215,
358259,
341876,
333689,
243579,
325504,
333698,
333708,
333724,
382890,
350146,
358339,
333774,
358371,
350189,
350193,
350202,
350206,
350213,
268298,
350224,
350231,
333850,
350237,
350240,
350244,
350248,
178218,
350251,
350256,
350259,
350271,
243781,
350285,
374864,
342111,
374902,
432271,
334011,
260289,
260298,
350410,
350416,
350422,
211160,
350425,
268507,
334045,
350445,
375026,
358644,
350458,
350461,
350464,
325891,
350467,
350475,
268559,
350480,
432405,
350486,
325914,
350490,
325917,
350493,
325919,
350498,
194852,
350504,
358700,
350509,
391468,
358704,
358713,
358716,
383306,
334161,
383321,
383330,
383333,
391530,
383341,
334203,
268668,
194941,
391563,
366990,
416157,
342430,
268701,
375208,
375216,
334262,
334275,
326084,
358856,
334304,
334311,
375277,
334321,
350723,
391690,
334358,
342550,
342554,
334363,
358941,
350761,
252461,
334384,
383536,
358961,
334394,
252482,
219718,
334407,
334420,
350822,
375400,
334465,
334468,
326290,
342679,
342683,
260766,
342710,
244409,
260797,
260801,
350917,
391894,
154328,
416473,
64230,
342766,
375535,
203506,
342776,
391937,
391948,
375568,
326416,
375571,
375574,
162591,
326441,
383793,
326451,
326454,
326460,
375612,
260924,
244540,
326467,
244551,
326473,
326477,
326485,
416597,
326490,
342874,
326502,
375656,
433000,
326507,
326510,
211825,
211831,
351097,
392060,
359295,
351104,
342915,
400259,
236430,
342930,
252822,
392091,
400285,
252836,
359334,
211884,
400306,
351168,
359361,
326598,
359366,
359382,
359388,
383967,
343015,
261108,
244726,
261111,
383997,
261129,
359451,
261147,
211998,
261153,
261159,
359470,
359476,
343131,
384098,
384101,
384107,
367723,
187502,
343154,
384114,
212094,
351364,
384135,
384139,
384143,
351381,
384160,
384168,
367794,
384181,
367800,
384191,
351423,
384198,
326855,
244937,
253130,
343244,
146642,
359649,
343270,
351466,
351479,
384249,
343306,
261389,
359694,
384269,
253200,
261393,
384275,
245020,
245029,
171302,
351534,
376110,
245040,
384314,
425276,
384323,
212291,
343365,
212303,
367965,
343393,
343398,
367980,
425328,
343409,
253303,
154999,
343417,
327034,
245127,
384397,
245136,
245142,
245145,
343450,
245148,
245151,
245154,
245157,
245162,
327084,
359865,
384443,
146876,
327107,
384453,
327110,
327115,
327117,
359886,
359890,
343507,
368092,
343534,
343539,
368119,
368122,
409091,
359947,
359955,
359983,
343630,
179802,
327275,
138864,
155254,
155273,
368288,
425638,
425649,
155322,
425662,
155327,
155351,
155354,
212699,
155363,
245475,
155371,
245483,
409335,
155393,
155403,
155422,
360223,
155438,
155442,
155447,
417595,
155461,
360261,
376663,
155482,
261981,
425822,
155487,
376671,
155490,
155491,
327531,
261996,
376685,
261999,
262002,
327539,
147317,
262005,
425845,
262008,
262011,
155516,
155521,
155525,
360326,
376714,
155531,
262027,
262030,
262033,
262036,
262039,
262042,
155549,
262045,
262048,
262051,
327589,
155559,
155562,
155565,
393150,
384977,
393169,
155611,
155619,
253923,
155621,
253926,
204784,
393203,
360438,
253943,
393206,
393212,
155646
] |
82edc4029089e560c2c4f2c262a5d8cd79842a03
|
38d48592856e362cbe4b1aa70462e7b880b75263
|
/MyKit/Extension/Foundation/NSRange+.swift
|
150fbed29539293a20c4149b642768fabce4eca0
|
[] |
no_license
|
smile7827/MyKit
|
9a050e75ae06879098cdc34d8b29ef21e558d4ec
|
9696b7d024e056ddb641a6d3c34979914bf66df5
|
refs/heads/master
| 2021-01-22T15:50:39.096992 | 2016-03-17T18:17:11 | 2016-03-17T18:17:11 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 248 |
swift
|
//
// NSRange+.swift
// MyKit
//
// Created by Hai Nguyen on 12/29/15.
//
//
// :nodoc:
public func == (lhs: NSRange, rhs: NSRange) -> Bool {
return lhs.location == rhs.location && lhs.length == rhs.length
}
extension NSRange: Equatable {}
|
[
-1
] |
d1d26292b1a5d903eab1bfd012341dfbf7eac335
|
5c2d4e5025de1f6f53ae67315e79517edeaf3eee
|
/OneChain/EventsViewController.swift
|
d333c744dcc0fc7559bf5ad5cfbdf1e8845e8595
|
[
"Apache-2.0"
] |
permissive
|
3archers/onechain-ios
|
51ebd9dc63cd87ff63323a293836237a85c007af
|
c43f417108dda515459f5eb35a06f913cd70a4f6
|
refs/heads/master
| 2021-01-17T07:12:16.412547 | 2016-06-21T06:10:27 | 2016-06-21T06:10:27 | 55,109,281 | 0 | 0 | null | 2016-04-24T18:23:28 | 2016-03-31T01:10:22 |
Swift
|
UTF-8
|
Swift
| false | false | 2,858 |
swift
|
//
// EventsViewController.swift
// OneChain
//
// Created by Xiaofei Long on 4/3/16.
// Copyright © 2016 3archers. All rights reserved.
//
import UIKit
import Parse
class EventsViewController: UIViewController {
@IBOutlet weak var tableView: UITableView!
var project: PFObject!
var events = [PFObject]()
override func viewDidLoad() {
super.viewDidLoad()
tableView.dataSource = self
tableView.delegate = self
tableView.rowHeight = 65
}
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
tabBarController?.navigationItem.title = "Events"
tabBarController?.navigationItem.rightBarButtonItem = UIBarButtonItem(
barButtonSystemItem: UIBarButtonSystemItem.Add,
target: self,
action: "onNew:"
)
let events = project["events"] as! [PFObject]
PFObject.fetchAllIfNeededInBackground(events) {
(objects: [AnyObject]?, error: NSError?) -> Void in
if let objects = objects {
self.events = objects as! [PFObject]
self.tableView.reloadData()
} else {
print(error?.localizedDescription)
}
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
func onNew(sender: AnyObject) {
performSegueWithIdentifier("new event", sender: self)
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "new event" {
let navController = segue.destinationViewController as! UINavigationController
let eventCreateViewController = navController.topViewController
as! EventCreateViewController
eventCreateViewController.project = project
} else if segue.identifier == "event detail" {
let row = tableView.indexPathForCell(sender as! UITableViewCell)!.row
let eventDetailViewController = segue.destinationViewController
as! EventDetailViewController
eventDetailViewController.event = events[row]
eventDetailViewController.project = project
}
}
}
extension EventsViewController: UITableViewDataSource {
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return events.count
}
func tableView(
tableView: UITableView,
cellForRowAtIndexPath indexPath: NSIndexPath
) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier(
"Event Cell",
forIndexPath: indexPath
) as! EventTableViewCell
cell.event = events[indexPath.row]
return cell
}
}
extension EventsViewController: UITableViewDelegate {
}
|
[
-1
] |
d4814e71046d2663021c3820302ee0d68a82d449
|
e360a8005119cc51d214edfeaf67aaea81ecc81e
|
/CropToolTests/CropToolTests.swift
|
1d5ba36ee4230a0791abe24280491199e41388ac
|
[] |
no_license
|
jamztang/CropTool
|
0e8804d48aa86676d0765820aef2f3d664f1d035
|
239588330ae9f968c789685ff1ae1960ceea6663
|
refs/heads/main
| 2022-12-30T02:39:51.121023 | 2020-10-14T03:03:32 | 2020-10-14T03:03:32 | 303,152,392 | 1 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 898 |
swift
|
//
// CropToolTests.swift
// CropToolTests
//
// Created by James Tang on 11/10/2020.
//
import XCTest
@testable import CropTool
class CropToolTests: XCTestCase {
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
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 {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() throws {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}
|
[
346118,
358410,
354316,
360462,
16419,
223268,
176175,
253999,
346162,
358456,
376894,
352326,
254027,
356447,
254048,
352368,
346271,
362659,
49316,
258214,
32941,
379071,
417988,
149703,
346314,
417994,
254170,
149760,
375051,
180493,
254226,
272660,
368916,
368923,
151847,
338218,
254251,
348492,
254286,
383311,
344401,
366930,
348500,
155990,
272729,
215385,
354677,
106874,
315770,
362881,
340357,
225670,
106888,
395659,
395661,
149916,
39324,
317852,
342450,
342466,
254406,
188871,
256477,
254456,
254465,
348682,
254488,
207393,
375333,
358954,
377386,
197167,
348732,
352829,
348742,
354911,
436832,
373358,
346737,
346740,
344696,
356989,
152195,
348806,
369289,
330388,
352917,
342682,
363163,
346779,
352937,
164533,
338613,
342713,
361176,
363230,
375526,
422631,
246503,
346858,
348920,
344827,
344828,
363263,
35583,
191235,
322319,
344865,
342820,
189228,
355121,
353078,
355130,
336702,
355137,
355139,
252741,
348998,
420677,
355152,
355154,
189275,
435039,
127841,
357218,
342887,
275303,
355178,
207727,
207729,
211829,
361337,
254850,
359299,
260996,
349067,
127902,
185250,
256935,
140204,
363438,
252847,
373687,
349121,
363458,
359364,
381897,
359387,
343005,
207838,
347103,
64485,
359406,
347123,
349171,
349175,
201720,
314362,
257024,
330754,
357379,
254987,
146448,
418837,
201755,
252958,
357414,
357423,
252980,
359478,
361535,
336960,
257094,
359495,
361543,
250956,
361566,
250981,
173166,
357486,
351344,
349294,
187506,
337017,
363644,
248961,
349316,
349318,
337039,
169104,
347283,
351390,
339102,
343203,
253099,
367799,
367810,
259268,
253125,
62665,
351446,
357595,
333022,
359647,
253167,
66801,
351490,
320770,
66825,
369930,
349462,
257305,
130348,
66862,
353584,
351537,
345396,
116026,
337225,
353616,
159066,
333160,
134506,
382330,
357759,
337281,
378244,
304524,
251298,
343476,
163268,
380357,
361927,
148940,
353750,
366053,
361963,
251378,
359930,
210433,
366083,
253451,
253452,
359950,
146964,
398869,
253463,
423453,
349726,
134686,
355876,
349741,
347694,
169518,
425535,
128587,
349781,
374372,
54893,
138863,
370296,
366203,
337534,
339585,
224901,
345752,
255649,
364207,
224946,
370363,
224958,
345814,
345833,
212716,
212717,
175873,
339715,
360195,
339720,
243472,
345879,
366360,
169754,
255776,
339745,
257830,
362283,
339762,
259899,
360252,
339783,
360264,
345929,
341836,
337745,
255829,
362327,
350044,
345951,
362337,
368488,
362352,
341879,
253829,
350093,
253856,
354212,
362417,
188348,
362431,
362443,
212946,
212951,
354269,
219101,
354272,
360417,
354274,
337895,
354280,
253929,
247791
] |
af18ff628bb7ef7243dd3db1325018b64c2fbac3
|
4dbe283afbd7795cb052d7aa36e837544e5dd14d
|
/Client/Frontend/Tabs/HCTabBarController.swift
|
fb12ba17570fd004b626112b2c763d521a82a612
|
[] |
no_license
|
Renarasup/hotclays-skeet-ios
|
4e1ce7e5c6b8fd9fe5b79de587a9afec1384eb32
|
19b63ccb4b1c336e676bde908c97b0063d2e5e26
|
refs/heads/master
| 2020-04-18T12:40:42.936458 | 2018-08-19T15:53:22 | 2018-08-19T15:53:22 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 839 |
swift
|
//
// HCTabBarController.swift
// HotClays Skeet
//
// Created by Christopher Chute on 1/8/18.
// Copyright © 2018 Christopher Chute. All rights reserved.
//
import UIKit
class HCTabBarController: UITabBarController {
override func viewDidLoad() {
super.viewDidLoad()
self.delegate = self
}
}
extension HCTabBarController: UITabBarControllerDelegate {
func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
// Second tap on tab pops to root view controller.
if viewController == tabBarController.selectedViewController,
let splitViewController = viewController as? HCSplitViewController {
splitViewController.popToRootViewController(animated: true)
}
return true
}
}
|
[
-1
] |
b109c710b1e8a749da250cd6210cb82f03b07402
|
6f934a843c1e8d731f8ffee1b777f65923853762
|
/Sources/Soto/Services/CloudFormation/CloudFormation_Shapes.swift
|
a7916f64d6145b2d45cbfa97e2ad3d33a28117d7
|
[
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"BSD-2-Clause"
] |
permissive
|
patagoniacode/soto
|
f3c0d7a924deab38ff7236d2d0702686ef8bdcb6
|
0e3cec0e8053113ea162e001ee3316242737b54d
|
refs/heads/main
| 2023-07-11T22:33:02.484717 | 2021-08-19T03:02:54 | 2021-08-19T03:02:54 | 397,324,912 | 0 | 0 |
Apache-2.0
| 2021-08-17T16:35:45 | 2021-08-17T16:35:45 | null |
UTF-8
|
Swift
| false | false | 402,371 |
swift
|
//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2021 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto/tree/main/CodeGenerator. DO NOT EDIT.
import Foundation
import SotoCore
extension CloudFormation {
// MARK: Enums
public enum AccountGateStatus: String, CustomStringConvertible, Codable {
case failed = "FAILED"
case skipped = "SKIPPED"
case succeeded = "SUCCEEDED"
public var description: String { return self.rawValue }
}
public enum CallAs: String, CustomStringConvertible, Codable {
case delegatedAdmin = "DELEGATED_ADMIN"
case `self` = "SELF"
public var description: String { return self.rawValue }
}
public enum Capability: String, CustomStringConvertible, Codable {
case capabilityAutoExpand = "CAPABILITY_AUTO_EXPAND"
case capabilityIam = "CAPABILITY_IAM"
case capabilityNamedIam = "CAPABILITY_NAMED_IAM"
public var description: String { return self.rawValue }
}
public enum Category: String, CustomStringConvertible, Codable {
case activated = "ACTIVATED"
case awsTypes = "AWS_TYPES"
case registered = "REGISTERED"
case thirdParty = "THIRD_PARTY"
public var description: String { return self.rawValue }
}
public enum ChangeAction: String, CustomStringConvertible, Codable {
case add = "Add"
case dynamic = "Dynamic"
case `import` = "Import"
case modify = "Modify"
case remove = "Remove"
public var description: String { return self.rawValue }
}
public enum ChangeSetStatus: String, CustomStringConvertible, Codable {
case createComplete = "CREATE_COMPLETE"
case createInProgress = "CREATE_IN_PROGRESS"
case createPending = "CREATE_PENDING"
case deleteComplete = "DELETE_COMPLETE"
case deleteFailed = "DELETE_FAILED"
case deleteInProgress = "DELETE_IN_PROGRESS"
case deletePending = "DELETE_PENDING"
case failed = "FAILED"
public var description: String { return self.rawValue }
}
public enum ChangeSetType: String, CustomStringConvertible, Codable {
case create = "CREATE"
case `import` = "IMPORT"
case update = "UPDATE"
public var description: String { return self.rawValue }
}
public enum ChangeSource: String, CustomStringConvertible, Codable {
case automatic = "Automatic"
case directmodification = "DirectModification"
case parameterreference = "ParameterReference"
case resourceattribute = "ResourceAttribute"
case resourcereference = "ResourceReference"
public var description: String { return self.rawValue }
}
public enum ChangeType: String, CustomStringConvertible, Codable {
case resource = "Resource"
public var description: String { return self.rawValue }
}
public enum DeprecatedStatus: String, CustomStringConvertible, Codable {
case deprecated = "DEPRECATED"
case live = "LIVE"
public var description: String { return self.rawValue }
}
public enum DifferenceType: String, CustomStringConvertible, Codable {
case add = "ADD"
case notEqual = "NOT_EQUAL"
case remove = "REMOVE"
public var description: String { return self.rawValue }
}
public enum EvaluationType: String, CustomStringConvertible, Codable {
case dynamic = "Dynamic"
case `static` = "Static"
public var description: String { return self.rawValue }
}
public enum ExecutionStatus: String, CustomStringConvertible, Codable {
case available = "AVAILABLE"
case executeComplete = "EXECUTE_COMPLETE"
case executeFailed = "EXECUTE_FAILED"
case executeInProgress = "EXECUTE_IN_PROGRESS"
case obsolete = "OBSOLETE"
case unavailable = "UNAVAILABLE"
public var description: String { return self.rawValue }
}
public enum HandlerErrorCode: String, CustomStringConvertible, Codable {
case accessdenied = "AccessDenied"
case alreadyexists = "AlreadyExists"
case generalserviceexception = "GeneralServiceException"
case internalfailure = "InternalFailure"
case invalidcredentials = "InvalidCredentials"
case invalidrequest = "InvalidRequest"
case invalidtypeconfiguration = "InvalidTypeConfiguration"
case networkfailure = "NetworkFailure"
case notfound = "NotFound"
case notstabilized = "NotStabilized"
case notupdatable = "NotUpdatable"
case resourceconflict = "ResourceConflict"
case serviceinternalerror = "ServiceInternalError"
case servicelimitexceeded = "ServiceLimitExceeded"
case throttling = "Throttling"
public var description: String { return self.rawValue }
}
public enum IdentityProvider: String, CustomStringConvertible, Codable {
case awsMarketplace = "AWS_Marketplace"
case bitbucket = "Bitbucket"
case github = "GitHub"
public var description: String { return self.rawValue }
}
public enum OnFailure: String, CustomStringConvertible, Codable {
case delete = "DELETE"
case doNothing = "DO_NOTHING"
case rollback = "ROLLBACK"
public var description: String { return self.rawValue }
}
public enum OperationStatus: String, CustomStringConvertible, Codable {
case failed = "FAILED"
case inProgress = "IN_PROGRESS"
case pending = "PENDING"
case success = "SUCCESS"
public var description: String { return self.rawValue }
}
public enum PermissionModels: String, CustomStringConvertible, Codable {
case selfManaged = "SELF_MANAGED"
case serviceManaged = "SERVICE_MANAGED"
public var description: String { return self.rawValue }
}
public enum ProvisioningType: String, CustomStringConvertible, Codable {
case fullyMutable = "FULLY_MUTABLE"
case immutable = "IMMUTABLE"
case nonProvisionable = "NON_PROVISIONABLE"
public var description: String { return self.rawValue }
}
public enum PublisherStatus: String, CustomStringConvertible, Codable {
case unverified = "UNVERIFIED"
case verified = "VERIFIED"
public var description: String { return self.rawValue }
}
public enum RegionConcurrencyType: String, CustomStringConvertible, Codable {
case parallel = "PARALLEL"
case sequential = "SEQUENTIAL"
public var description: String { return self.rawValue }
}
public enum RegistrationStatus: String, CustomStringConvertible, Codable {
case complete = "COMPLETE"
case failed = "FAILED"
case inProgress = "IN_PROGRESS"
public var description: String { return self.rawValue }
}
public enum RegistryType: String, CustomStringConvertible, Codable {
case module = "MODULE"
case resource = "RESOURCE"
public var description: String { return self.rawValue }
}
public enum Replacement: String, CustomStringConvertible, Codable {
case conditional = "Conditional"
case `false` = "False"
case `true` = "True"
public var description: String { return self.rawValue }
}
public enum RequiresRecreation: String, CustomStringConvertible, Codable {
case always = "Always"
case conditionally = "Conditionally"
case never = "Never"
public var description: String { return self.rawValue }
}
public enum ResourceAttribute: String, CustomStringConvertible, Codable {
case creationpolicy = "CreationPolicy"
case deletionpolicy = "DeletionPolicy"
case metadata = "Metadata"
case properties = "Properties"
case tags = "Tags"
case updatepolicy = "UpdatePolicy"
public var description: String { return self.rawValue }
}
public enum ResourceSignalStatus: String, CustomStringConvertible, Codable {
case failure = "FAILURE"
case success = "SUCCESS"
public var description: String { return self.rawValue }
}
public enum ResourceStatus: String, CustomStringConvertible, Codable {
case createComplete = "CREATE_COMPLETE"
case createFailed = "CREATE_FAILED"
case createInProgress = "CREATE_IN_PROGRESS"
case deleteComplete = "DELETE_COMPLETE"
case deleteFailed = "DELETE_FAILED"
case deleteInProgress = "DELETE_IN_PROGRESS"
case deleteSkipped = "DELETE_SKIPPED"
case importComplete = "IMPORT_COMPLETE"
case importFailed = "IMPORT_FAILED"
case importInProgress = "IMPORT_IN_PROGRESS"
case importRollbackComplete = "IMPORT_ROLLBACK_COMPLETE"
case importRollbackFailed = "IMPORT_ROLLBACK_FAILED"
case importRollbackInProgress = "IMPORT_ROLLBACK_IN_PROGRESS"
case updateComplete = "UPDATE_COMPLETE"
case updateFailed = "UPDATE_FAILED"
case updateInProgress = "UPDATE_IN_PROGRESS"
public var description: String { return self.rawValue }
}
public enum StackDriftDetectionStatus: String, CustomStringConvertible, Codable {
case detectionComplete = "DETECTION_COMPLETE"
case detectionFailed = "DETECTION_FAILED"
case detectionInProgress = "DETECTION_IN_PROGRESS"
public var description: String { return self.rawValue }
}
public enum StackDriftStatus: String, CustomStringConvertible, Codable {
case drifted = "DRIFTED"
case inSync = "IN_SYNC"
case notChecked = "NOT_CHECKED"
case unknown = "UNKNOWN"
public var description: String { return self.rawValue }
}
public enum StackInstanceDetailedStatus: String, CustomStringConvertible, Codable {
case cancelled = "CANCELLED"
case failed = "FAILED"
case inoperable = "INOPERABLE"
case pending = "PENDING"
case running = "RUNNING"
case succeeded = "SUCCEEDED"
public var description: String { return self.rawValue }
}
public enum StackInstanceFilterName: String, CustomStringConvertible, Codable {
case detailedStatus = "DETAILED_STATUS"
public var description: String { return self.rawValue }
}
public enum StackInstanceStatus: String, CustomStringConvertible, Codable {
case current = "CURRENT"
case inoperable = "INOPERABLE"
case outdated = "OUTDATED"
public var description: String { return self.rawValue }
}
public enum StackResourceDriftStatus: String, CustomStringConvertible, Codable {
case deleted = "DELETED"
case inSync = "IN_SYNC"
case modified = "MODIFIED"
case notChecked = "NOT_CHECKED"
public var description: String { return self.rawValue }
}
public enum StackSetDriftDetectionStatus: String, CustomStringConvertible, Codable {
case completed = "COMPLETED"
case failed = "FAILED"
case inProgress = "IN_PROGRESS"
case partialSuccess = "PARTIAL_SUCCESS"
case stopped = "STOPPED"
public var description: String { return self.rawValue }
}
public enum StackSetDriftStatus: String, CustomStringConvertible, Codable {
case drifted = "DRIFTED"
case inSync = "IN_SYNC"
case notChecked = "NOT_CHECKED"
public var description: String { return self.rawValue }
}
public enum StackSetOperationAction: String, CustomStringConvertible, Codable {
case create = "CREATE"
case delete = "DELETE"
case detectDrift = "DETECT_DRIFT"
case update = "UPDATE"
public var description: String { return self.rawValue }
}
public enum StackSetOperationResultStatus: String, CustomStringConvertible, Codable {
case cancelled = "CANCELLED"
case failed = "FAILED"
case pending = "PENDING"
case running = "RUNNING"
case succeeded = "SUCCEEDED"
public var description: String { return self.rawValue }
}
public enum StackSetOperationStatus: String, CustomStringConvertible, Codable {
case failed = "FAILED"
case queued = "QUEUED"
case running = "RUNNING"
case stopped = "STOPPED"
case stopping = "STOPPING"
case succeeded = "SUCCEEDED"
public var description: String { return self.rawValue }
}
public enum StackSetStatus: String, CustomStringConvertible, Codable {
case active = "ACTIVE"
case deleted = "DELETED"
public var description: String { return self.rawValue }
}
public enum StackStatus: String, CustomStringConvertible, Codable {
case createComplete = "CREATE_COMPLETE"
case createFailed = "CREATE_FAILED"
case createInProgress = "CREATE_IN_PROGRESS"
case deleteComplete = "DELETE_COMPLETE"
case deleteFailed = "DELETE_FAILED"
case deleteInProgress = "DELETE_IN_PROGRESS"
case importComplete = "IMPORT_COMPLETE"
case importInProgress = "IMPORT_IN_PROGRESS"
case importRollbackComplete = "IMPORT_ROLLBACK_COMPLETE"
case importRollbackFailed = "IMPORT_ROLLBACK_FAILED"
case importRollbackInProgress = "IMPORT_ROLLBACK_IN_PROGRESS"
case reviewInProgress = "REVIEW_IN_PROGRESS"
case rollbackComplete = "ROLLBACK_COMPLETE"
case rollbackFailed = "ROLLBACK_FAILED"
case rollbackInProgress = "ROLLBACK_IN_PROGRESS"
case updateComplete = "UPDATE_COMPLETE"
case updateCompleteCleanupInProgress = "UPDATE_COMPLETE_CLEANUP_IN_PROGRESS"
case updateFailed = "UPDATE_FAILED"
case updateInProgress = "UPDATE_IN_PROGRESS"
case updateRollbackComplete = "UPDATE_ROLLBACK_COMPLETE"
case updateRollbackCompleteCleanupInProgress = "UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS"
case updateRollbackFailed = "UPDATE_ROLLBACK_FAILED"
case updateRollbackInProgress = "UPDATE_ROLLBACK_IN_PROGRESS"
public var description: String { return self.rawValue }
}
public enum TemplateStage: String, CustomStringConvertible, Codable {
case original = "Original"
case processed = "Processed"
public var description: String { return self.rawValue }
}
public enum ThirdPartyType: String, CustomStringConvertible, Codable {
case module = "MODULE"
case resource = "RESOURCE"
public var description: String { return self.rawValue }
}
public enum TypeTestsStatus: String, CustomStringConvertible, Codable {
case failed = "FAILED"
case inProgress = "IN_PROGRESS"
case notTested = "NOT_TESTED"
case passed = "PASSED"
public var description: String { return self.rawValue }
}
public enum VersionBump: String, CustomStringConvertible, Codable {
case major = "MAJOR"
case minor = "MINOR"
public var description: String { return self.rawValue }
}
public enum Visibility: String, CustomStringConvertible, Codable {
case `private` = "PRIVATE"
case `public` = "PUBLIC"
public var description: String { return self.rawValue }
}
// MARK: Shapes
public struct AccountGateResult: AWSDecodableShape {
/// The status of the account gate function. SUCCEEDED: The account gate function has determined that the account and Region passes any requirements for a stack set operation to occur. AWS CloudFormation proceeds with the stack operation in that account and Region. FAILED: The account gate function has determined that the account and Region does not meet the requirements for a stack set operation to occur. AWS CloudFormation cancels the stack set operation in that account and Region, and sets the stack set operation result status for that account and Region to FAILED. SKIPPED: AWS CloudFormation has skipped calling the account gate function for this account and Region, for one of the following reasons: An account gate function has not been specified for the account and Region. AWS CloudFormation proceeds with the stack set operation in this account and Region. The AWSCloudFormationStackSetExecutionRole of the stack set adminstration account lacks permissions to invoke the function. AWS CloudFormation proceeds with the stack set operation in this account and Region. Either no action is necessary, or no action is possible, on the stack. AWS CloudFormation skips the stack set operation in this account and Region.
public let status: AccountGateStatus?
/// The reason for the account gate status assigned to this account and Region for the stack set operation.
public let statusReason: String?
public init(status: AccountGateStatus? = nil, statusReason: String? = nil) {
self.status = status
self.statusReason = statusReason
}
private enum CodingKeys: String, CodingKey {
case status = "Status"
case statusReason = "StatusReason"
}
}
public struct AccountLimit: AWSDecodableShape {
/// The name of the account limit. Values: ConcurrentResourcesLimit | StackLimit | StackOutputsLimit
public let name: String?
/// The value that is associated with the account limit name.
public let value: Int?
public init(name: String? = nil, value: Int? = nil) {
self.name = name
self.value = value
}
private enum CodingKeys: String, CodingKey {
case name = "Name"
case value = "Value"
}
}
public struct ActivateTypeInput: AWSEncodableShape {
/// Whether to automatically update the extension in this account and region when a new minor version is published by the extension publisher. Major versions released by the publisher must be manually updated. The default is true.
public let autoUpdate: Bool?
/// The name of the IAM execution role to use to activate the extension.
public let executionRoleArn: String?
public let loggingConfig: LoggingConfig?
/// The major version of this extension you want to activate, if multiple major versions are available. The default is the latest major version. CloudFormation uses the latest available minor version of the major version selected. You can specify MajorVersion or VersionBump, but not both.
public let majorVersion: Int64?
/// The Amazon Resource Number (ARN) of the public extension. Conditional: You must specify PublicTypeArn, or TypeName, Type, and PublisherId.
public let publicTypeArn: String?
/// The ID of the extension publisher. Conditional: You must specify PublicTypeArn, or TypeName, Type, and PublisherId.
public let publisherId: String?
/// The extension type. Conditional: You must specify PublicTypeArn, or TypeName, Type, and PublisherId.
public let type: ThirdPartyType?
/// The name of the extension. Conditional: You must specify PublicTypeArn, or TypeName, Type, and PublisherId.
public let typeName: String?
/// An alias to assign to the public extension, in this account and region. If you specify an alias for the extension, CloudFormation treats the alias as the extension type name within this account and region. You must use the alias to refer to the extension in your templates, API calls, and CloudFormation console. An extension alias must be unique within a given account and region. You can activate the same public resource multiple times in the same account and region, using different type name aliases.
public let typeNameAlias: String?
/// Manually updates a previously-activated type to a new major or minor version, if available. You can also use this parameter to update the value of AutoUpdate. MAJOR: CloudFormation updates the extension to the newest major version, if one is available. MINOR: CloudFormation updates the extension to the newest minor version, if one is available.
public let versionBump: VersionBump?
public init(autoUpdate: Bool? = nil, executionRoleArn: String? = nil, loggingConfig: LoggingConfig? = nil, majorVersion: Int64? = nil, publicTypeArn: String? = nil, publisherId: String? = nil, type: ThirdPartyType? = nil, typeName: String? = nil, typeNameAlias: String? = nil, versionBump: VersionBump? = nil) {
self.autoUpdate = autoUpdate
self.executionRoleArn = executionRoleArn
self.loggingConfig = loggingConfig
self.majorVersion = majorVersion
self.publicTypeArn = publicTypeArn
self.publisherId = publisherId
self.type = type
self.typeName = typeName
self.typeNameAlias = typeNameAlias
self.versionBump = versionBump
}
public func validate(name: String) throws {
try self.validate(self.executionRoleArn, name: "executionRoleArn", parent: name, max: 256)
try self.validate(self.executionRoleArn, name: "executionRoleArn", parent: name, min: 1)
try self.validate(self.executionRoleArn, name: "executionRoleArn", parent: name, pattern: "arn:.+:iam::[0-9]{12}:role/.+")
try self.loggingConfig?.validate(name: "\(name).loggingConfig")
try self.validate(self.majorVersion, name: "majorVersion", parent: name, max: 100_000)
try self.validate(self.majorVersion, name: "majorVersion", parent: name, min: 1)
try self.validate(self.publicTypeArn, name: "publicTypeArn", parent: name, max: 1024)
try self.validate(self.publicTypeArn, name: "publicTypeArn", parent: name, pattern: "arn:aws[A-Za-z0-9-]{0,64}:cloudformation:[A-Za-z0-9-]{1,64}::type/.+/[0-9a-zA-Z]{12,40}/.+")
try self.validate(self.publisherId, name: "publisherId", parent: name, max: 40)
try self.validate(self.publisherId, name: "publisherId", parent: name, min: 1)
try self.validate(self.publisherId, name: "publisherId", parent: name, pattern: "[0-9a-zA-Z]{12,40}")
try self.validate(self.typeName, name: "typeName", parent: name, max: 204)
try self.validate(self.typeName, name: "typeName", parent: name, min: 10)
try self.validate(self.typeName, name: "typeName", parent: name, pattern: "[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}(::MODULE){0,1}")
try self.validate(self.typeNameAlias, name: "typeNameAlias", parent: name, max: 204)
try self.validate(self.typeNameAlias, name: "typeNameAlias", parent: name, min: 10)
try self.validate(self.typeNameAlias, name: "typeNameAlias", parent: name, pattern: "[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}(::MODULE){0,1}")
}
private enum CodingKeys: String, CodingKey {
case autoUpdate = "AutoUpdate"
case executionRoleArn = "ExecutionRoleArn"
case loggingConfig = "LoggingConfig"
case majorVersion = "MajorVersion"
case publicTypeArn = "PublicTypeArn"
case publisherId = "PublisherId"
case type = "Type"
case typeName = "TypeName"
case typeNameAlias = "TypeNameAlias"
case versionBump = "VersionBump"
}
}
public struct ActivateTypeOutput: AWSDecodableShape {
/// The Amazon Resource Number (ARN) of the activated extension, in this account and region.
public let arn: String?
public init(arn: String? = nil) {
self.arn = arn
}
private enum CodingKeys: String, CodingKey {
case arn = "Arn"
}
}
public struct AutoDeployment: AWSEncodableShape & AWSDecodableShape {
/// If set to true, StackSets automatically deploys additional stack instances to AWS Organizations accounts that are added to a target organization or organizational unit (OU) in the specified Regions. If an account is removed from a target organization or OU, StackSets deletes stack instances from the account in the specified Regions.
public let enabled: Bool?
/// If set to true, stack resources are retained when an account is removed from a target organization or OU. If set to false, stack resources are deleted. Specify only if Enabled is set to True.
public let retainStacksOnAccountRemoval: Bool?
public init(enabled: Bool? = nil, retainStacksOnAccountRemoval: Bool? = nil) {
self.enabled = enabled
self.retainStacksOnAccountRemoval = retainStacksOnAccountRemoval
}
private enum CodingKeys: String, CodingKey {
case enabled = "Enabled"
case retainStacksOnAccountRemoval = "RetainStacksOnAccountRemoval"
}
}
public struct BatchDescribeTypeConfigurationsError: AWSDecodableShape {
/// The error code.
public let errorCode: String?
/// The error message.
public let errorMessage: String?
public let typeConfigurationIdentifier: TypeConfigurationIdentifier?
public init(errorCode: String? = nil, errorMessage: String? = nil, typeConfigurationIdentifier: TypeConfigurationIdentifier? = nil) {
self.errorCode = errorCode
self.errorMessage = errorMessage
self.typeConfigurationIdentifier = typeConfigurationIdentifier
}
private enum CodingKeys: String, CodingKey {
case errorCode = "ErrorCode"
case errorMessage = "ErrorMessage"
case typeConfigurationIdentifier = "TypeConfigurationIdentifier"
}
}
public struct BatchDescribeTypeConfigurationsInput: AWSEncodableShape {
/// The list of identifiers for the desired extension configurations.
@CustomCoding<StandardArrayCoder>
public var typeConfigurationIdentifiers: [TypeConfigurationIdentifier]
public init(typeConfigurationIdentifiers: [TypeConfigurationIdentifier]) {
self.typeConfigurationIdentifiers = typeConfigurationIdentifiers
}
public func validate(name: String) throws {
try self.typeConfigurationIdentifiers.forEach {
try $0.validate(name: "\(name).typeConfigurationIdentifiers[]")
}
try self.validate(self.typeConfigurationIdentifiers, name: "typeConfigurationIdentifiers", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case typeConfigurationIdentifiers = "TypeConfigurationIdentifiers"
}
}
public struct BatchDescribeTypeConfigurationsOutput: AWSDecodableShape {
/// A list of information concerning any errors generated during the setting of the specified configurations.
@OptionalCustomCoding<StandardArrayCoder>
public var errors: [BatchDescribeTypeConfigurationsError]?
/// A list of any of the specified extension configurations from the CloudFormation registry.
@OptionalCustomCoding<StandardArrayCoder>
public var typeConfigurations: [TypeConfigurationDetails]?
/// A list of any of the specified extension configurations that CloudFormation could not process for any reason.
@OptionalCustomCoding<StandardArrayCoder>
public var unprocessedTypeConfigurations: [TypeConfigurationIdentifier]?
public init(errors: [BatchDescribeTypeConfigurationsError]? = nil, typeConfigurations: [TypeConfigurationDetails]? = nil, unprocessedTypeConfigurations: [TypeConfigurationIdentifier]? = nil) {
self.errors = errors
self.typeConfigurations = typeConfigurations
self.unprocessedTypeConfigurations = unprocessedTypeConfigurations
}
private enum CodingKeys: String, CodingKey {
case errors = "Errors"
case typeConfigurations = "TypeConfigurations"
case unprocessedTypeConfigurations = "UnprocessedTypeConfigurations"
}
}
public struct CancelUpdateStackInput: AWSEncodableShape {
/// A unique identifier for this CancelUpdateStack request. Specify this token if you plan to retry requests so that AWS CloudFormation knows that you're not attempting to cancel an update on a stack with the same name. You might retry CancelUpdateStack requests to ensure that AWS CloudFormation successfully received them.
public let clientRequestToken: String?
/// The name or the unique stack ID that is associated with the stack.
public let stackName: String
public init(clientRequestToken: String? = nil, stackName: String) {
self.clientRequestToken = clientRequestToken
self.stackName = stackName
}
public func validate(name: String) throws {
try self.validate(self.clientRequestToken, name: "clientRequestToken", parent: name, max: 128)
try self.validate(self.clientRequestToken, name: "clientRequestToken", parent: name, min: 1)
try self.validate(self.clientRequestToken, name: "clientRequestToken", parent: name, pattern: "[a-zA-Z0-9][-a-zA-Z0-9]*")
}
private enum CodingKeys: String, CodingKey {
case clientRequestToken = "ClientRequestToken"
case stackName = "StackName"
}
}
public struct Change: AWSDecodableShape {
/// A ResourceChange structure that describes the resource and action that AWS CloudFormation will perform.
public let resourceChange: ResourceChange?
/// The type of entity that AWS CloudFormation changes. Currently, the only entity type is Resource.
public let type: ChangeType?
public init(resourceChange: ResourceChange? = nil, type: ChangeType? = nil) {
self.resourceChange = resourceChange
self.type = type
}
private enum CodingKeys: String, CodingKey {
case resourceChange = "ResourceChange"
case type = "Type"
}
}
public struct ChangeSetSummary: AWSDecodableShape {
/// The ID of the change set.
public let changeSetId: String?
/// The name of the change set.
public let changeSetName: String?
/// The start time when the change set was created, in UTC.
public let creationTime: Date?
/// Descriptive information about the change set.
public let description: String?
/// If the change set execution status is AVAILABLE, you can execute the change set. If you can’t execute the change set, the status indicates why. For example, a change set might be in an UNAVAILABLE state because AWS CloudFormation is still creating it or in an OBSOLETE state because the stack was already updated.
public let executionStatus: ExecutionStatus?
/// Specifies the current setting of IncludeNestedStacks for the change set.
public let includeNestedStacks: Bool?
/// The parent change set ID.
public let parentChangeSetId: String?
/// The root change set ID.
public let rootChangeSetId: String?
/// The ID of the stack with which the change set is associated.
public let stackId: String?
/// The name of the stack with which the change set is associated.
public let stackName: String?
/// The state of the change set, such as CREATE_IN_PROGRESS, CREATE_COMPLETE, or FAILED.
public let status: ChangeSetStatus?
/// A description of the change set's status. For example, if your change set is in the FAILED state, AWS CloudFormation shows the error message.
public let statusReason: String?
public init(changeSetId: String? = nil, changeSetName: String? = nil, creationTime: Date? = nil, description: String? = nil, executionStatus: ExecutionStatus? = nil, includeNestedStacks: Bool? = nil, parentChangeSetId: String? = nil, rootChangeSetId: String? = nil, stackId: String? = nil, stackName: String? = nil, status: ChangeSetStatus? = nil, statusReason: String? = nil) {
self.changeSetId = changeSetId
self.changeSetName = changeSetName
self.creationTime = creationTime
self.description = description
self.executionStatus = executionStatus
self.includeNestedStacks = includeNestedStacks
self.parentChangeSetId = parentChangeSetId
self.rootChangeSetId = rootChangeSetId
self.stackId = stackId
self.stackName = stackName
self.status = status
self.statusReason = statusReason
}
private enum CodingKeys: String, CodingKey {
case changeSetId = "ChangeSetId"
case changeSetName = "ChangeSetName"
case creationTime = "CreationTime"
case description = "Description"
case executionStatus = "ExecutionStatus"
case includeNestedStacks = "IncludeNestedStacks"
case parentChangeSetId = "ParentChangeSetId"
case rootChangeSetId = "RootChangeSetId"
case stackId = "StackId"
case stackName = "StackName"
case status = "Status"
case statusReason = "StatusReason"
}
}
public struct ContinueUpdateRollbackInput: AWSEncodableShape {
/// A unique identifier for this ContinueUpdateRollback request. Specify this token if you plan to retry requests so that AWS CloudFormation knows that you're not attempting to continue the rollback to a stack with the same name. You might retry ContinueUpdateRollback requests to ensure that AWS CloudFormation successfully received them.
public let clientRequestToken: String?
/// A list of the logical IDs of the resources that AWS CloudFormation skips during the continue update rollback operation. You can specify only resources that are in the UPDATE_FAILED state because a rollback failed. You can't specify resources that are in the UPDATE_FAILED state for other reasons, for example, because an update was cancelled. To check why a resource update failed, use the DescribeStackResources action, and view the resource status reason. Specify this property to skip rolling back resources that AWS CloudFormation can't successfully roll back. We recommend that you troubleshoot resources before skipping them. AWS CloudFormation sets the status of the specified resources to UPDATE_COMPLETE and continues to roll back the stack. After the rollback is complete, the state of the skipped resources will be inconsistent with the state of the resources in the stack template. Before performing another stack update, you must update the stack or resources to be consistent with each other. If you don't, subsequent stack updates might fail, and the stack will become unrecoverable. Specify the minimum number of resources required to successfully roll back your stack. For example, a failed resource update might cause dependent resources to fail. In this case, it might not be necessary to skip the dependent resources. To skip resources that are part of nested stacks, use the following format: NestedStackName.ResourceLogicalID. If you want to specify the logical ID of a stack resource (Type: AWS::CloudFormation::Stack) in the ResourcesToSkip list, then its corresponding embedded stack must be in one of the following states: DELETE_IN_PROGRESS, DELETE_COMPLETE, or DELETE_FAILED. Don't confuse a child stack's name with its corresponding logical ID defined in the parent stack. For an example of a continue update rollback operation with nested stacks, see Using ResourcesToSkip to recover a nested stacks hierarchy.
@OptionalCustomCoding<StandardArrayCoder>
public var resourcesToSkip: [String]?
/// The Amazon Resource Name (ARN) of an AWS Identity and Access Management (IAM) role that AWS CloudFormation assumes to roll back the stack. AWS CloudFormation uses the role's credentials to make calls on your behalf. AWS CloudFormation always uses this role for all future operations on the stack. As long as users have permission to operate on the stack, AWS CloudFormation uses this role even if the users don't have permission to pass it. Ensure that the role grants least privilege. If you don't specify a value, AWS CloudFormation uses the role that was previously associated with the stack. If no role is available, AWS CloudFormation uses a temporary session that is generated from your user credentials.
public let roleARN: String?
/// The name or the unique ID of the stack that you want to continue rolling back. Don't specify the name of a nested stack (a stack that was created by using the AWS::CloudFormation::Stack resource). Instead, use this operation on the parent stack (the stack that contains the AWS::CloudFormation::Stack resource).
public let stackName: String
public init(clientRequestToken: String? = nil, resourcesToSkip: [String]? = nil, roleARN: String? = nil, stackName: String) {
self.clientRequestToken = clientRequestToken
self.resourcesToSkip = resourcesToSkip
self.roleARN = roleARN
self.stackName = stackName
}
public func validate(name: String) throws {
try self.validate(self.clientRequestToken, name: "clientRequestToken", parent: name, max: 128)
try self.validate(self.clientRequestToken, name: "clientRequestToken", parent: name, min: 1)
try self.validate(self.clientRequestToken, name: "clientRequestToken", parent: name, pattern: "[a-zA-Z0-9][-a-zA-Z0-9]*")
try self.resourcesToSkip?.forEach {
try validate($0, name: "resourcesToSkip[]", parent: name, pattern: "[a-zA-Z0-9]+|[a-zA-Z][-a-zA-Z0-9]*\\.[a-zA-Z0-9]+")
}
try self.validate(self.roleARN, name: "roleARN", parent: name, max: 2048)
try self.validate(self.roleARN, name: "roleARN", parent: name, min: 20)
try self.validate(self.stackName, name: "stackName", parent: name, min: 1)
try self.validate(self.stackName, name: "stackName", parent: name, pattern: "([a-zA-Z][-a-zA-Z0-9]*)|(arn:\\b(aws|aws-us-gov|aws-cn)\\b:[-a-zA-Z0-9:/._+]*)")
}
private enum CodingKeys: String, CodingKey {
case clientRequestToken = "ClientRequestToken"
case resourcesToSkip = "ResourcesToSkip"
case roleARN = "RoleARN"
case stackName = "StackName"
}
}
public struct ContinueUpdateRollbackOutput: AWSDecodableShape {
public init() {}
}
public struct CreateChangeSetInput: AWSEncodableShape {
/// In some cases, you must explicitly acknowledge that your stack template contains certain capabilities in order for AWS CloudFormation to create the stack. CAPABILITY_IAM and CAPABILITY_NAMED_IAM Some stack templates might include resources that can affect permissions in your AWS account; for example, by creating new AWS Identity and Access Management (IAM) users. For those stacks, you must explicitly acknowledge this by specifying one of these capabilities. The following IAM resources require you to specify either the CAPABILITY_IAM or CAPABILITY_NAMED_IAM capability. If you have IAM resources, you can specify either capability. If you have IAM resources with custom names, you must specify CAPABILITY_NAMED_IAM. If you don't specify either of these capabilities, AWS CloudFormation returns an InsufficientCapabilities error. If your stack template contains these resources, we recommend that you review all permissions associated with them and edit their permissions if necessary. AWS::IAM::AccessKey AWS::IAM::Group AWS::IAM::InstanceProfile AWS::IAM::Policy AWS::IAM::Role AWS::IAM::User AWS::IAM::UserToGroupAddition For more information, see Acknowledging IAM Resources in AWS CloudFormation Templates. CAPABILITY_AUTO_EXPAND Some template contain macros. Macros perform custom processing on templates; this can include simple actions like find-and-replace operations, all the way to extensive transformations of entire templates. Because of this, users typically create a change set from the processed template, so that they can review the changes resulting from the macros before actually creating the stack. If your stack template contains one or more macros, and you choose to create a stack directly from the processed template, without first reviewing the resulting changes in a change set, you must acknowledge this capability. This includes the AWS::Include and AWS::Serverless transforms, which are macros hosted by AWS CloudFormation. This capacity does not apply to creating change sets, and specifying it when creating change sets has no effect. If you want to create a stack from a stack template that contains macros and nested stacks, you must create or update the stack directly from the template using the CreateStack or UpdateStack action, and specifying this capability. For more information on macros, see Using AWS CloudFormation Macros to Perform Custom Processing on Templates.
@OptionalCustomCoding<StandardArrayCoder>
public var capabilities: [Capability]?
/// The name of the change set. The name must be unique among all change sets that are associated with the specified stack. A change set name can contain only alphanumeric, case sensitive characters and hyphens. It must start with an alphabetic character and cannot exceed 128 characters.
public let changeSetName: String
/// The type of change set operation. To create a change set for a new stack, specify CREATE. To create a change set for an existing stack, specify UPDATE. To create a change set for an import operation, specify IMPORT. If you create a change set for a new stack, AWS Cloudformation creates a stack with a unique stack ID, but no template or resources. The stack will be in the REVIEW_IN_PROGRESS state until you execute the change set. By default, AWS CloudFormation specifies UPDATE. You can't use the UPDATE type to create a change set for a new stack or the CREATE type to create a change set for an existing stack.
public let changeSetType: ChangeSetType?
/// A unique identifier for this CreateChangeSet request. Specify this token if you plan to retry requests so that AWS CloudFormation knows that you're not attempting to create another change set with the same name. You might retry CreateChangeSet requests to ensure that AWS CloudFormation successfully received them.
public let clientToken: String?
/// A description to help you identify this change set.
public let description: String?
/// Creates a change set for the all nested stacks specified in the template. The default behavior of this action is set to False. To include nested sets in a change set, specify True.
public let includeNestedStacks: Bool?
/// The Amazon Resource Names (ARNs) of Amazon Simple Notification Service (Amazon SNS) topics that AWS CloudFormation associates with the stack. To remove all associated notification topics, specify an empty list.
@OptionalCustomCoding<StandardArrayCoder>
public var notificationARNs: [String]?
/// A list of Parameter structures that specify input parameters for the change set. For more information, see the Parameter data type.
@OptionalCustomCoding<StandardArrayCoder>
public var parameters: [Parameter]?
/// The resources to import into your stack.
@OptionalCustomCoding<StandardArrayCoder>
public var resourcesToImport: [ResourceToImport]?
/// The template resource types that you have permissions to work with if you execute this change set, such as AWS::EC2::Instance, AWS::EC2::*, or Custom::MyCustomInstance. If the list of resource types doesn't include a resource type that you're updating, the stack update fails. By default, AWS CloudFormation grants permissions to all resource types. AWS Identity and Access Management (IAM) uses this parameter for condition keys in IAM policies for AWS CloudFormation. For more information, see Controlling Access with AWS Identity and Access Management in the AWS CloudFormation User Guide.
@OptionalCustomCoding<StandardArrayCoder>
public var resourceTypes: [String]?
/// The Amazon Resource Name (ARN) of an AWS Identity and Access Management (IAM) role that AWS CloudFormation assumes when executing the change set. AWS CloudFormation uses the role's credentials to make calls on your behalf. AWS CloudFormation uses this role for all future operations on the stack. As long as users have permission to operate on the stack, AWS CloudFormation uses this role even if the users don't have permission to pass it. Ensure that the role grants least privilege. If you don't specify a value, AWS CloudFormation uses the role that was previously associated with the stack. If no role is available, AWS CloudFormation uses a temporary session that is generated from your user credentials.
public let roleARN: String?
/// The rollback triggers for AWS CloudFormation to monitor during stack creation and updating operations, and for the specified monitoring period afterwards.
public let rollbackConfiguration: RollbackConfiguration?
/// The name or the unique ID of the stack for which you are creating a change set. AWS CloudFormation generates the change set by comparing this stack's information with the information that you submit, such as a modified template or different parameter input values.
public let stackName: String
/// Key-value pairs to associate with this stack. AWS CloudFormation also propagates these tags to resources in the stack. You can specify a maximum of 50 tags.
@OptionalCustomCoding<StandardArrayCoder>
public var tags: [Tag]?
/// A structure that contains the body of the revised template, with a minimum length of 1 byte and a maximum length of 51,200 bytes. AWS CloudFormation generates the change set by comparing this template with the template of the stack that you specified. Conditional: You must specify only TemplateBody or TemplateURL.
public let templateBody: String?
/// The location of the file that contains the revised template. The URL must point to a template (max size: 460,800 bytes) that is located in an S3 bucket or a Systems Manager document. AWS CloudFormation generates the change set by comparing this template with the stack that you specified. Conditional: You must specify only TemplateBody or TemplateURL.
public let templateURL: String?
/// Whether to reuse the template that is associated with the stack to create the change set.
public let usePreviousTemplate: Bool?
public init(capabilities: [Capability]? = nil, changeSetName: String, changeSetType: ChangeSetType? = nil, clientToken: String? = nil, description: String? = nil, includeNestedStacks: Bool? = nil, notificationARNs: [String]? = nil, parameters: [Parameter]? = nil, resourcesToImport: [ResourceToImport]? = nil, resourceTypes: [String]? = nil, roleARN: String? = nil, rollbackConfiguration: RollbackConfiguration? = nil, stackName: String, tags: [Tag]? = nil, templateBody: String? = nil, templateURL: String? = nil, usePreviousTemplate: Bool? = nil) {
self.capabilities = capabilities
self.changeSetName = changeSetName
self.changeSetType = changeSetType
self.clientToken = clientToken
self.description = description
self.includeNestedStacks = includeNestedStacks
self.notificationARNs = notificationARNs
self.parameters = parameters
self.resourcesToImport = resourcesToImport
self.resourceTypes = resourceTypes
self.roleARN = roleARN
self.rollbackConfiguration = rollbackConfiguration
self.stackName = stackName
self.tags = tags
self.templateBody = templateBody
self.templateURL = templateURL
self.usePreviousTemplate = usePreviousTemplate
}
public func validate(name: String) throws {
try self.validate(self.changeSetName, name: "changeSetName", parent: name, max: 128)
try self.validate(self.changeSetName, name: "changeSetName", parent: name, min: 1)
try self.validate(self.changeSetName, name: "changeSetName", parent: name, pattern: "[a-zA-Z][-a-zA-Z0-9]*")
try self.validate(self.clientToken, name: "clientToken", parent: name, max: 128)
try self.validate(self.clientToken, name: "clientToken", parent: name, min: 1)
try self.validate(self.description, name: "description", parent: name, max: 1024)
try self.validate(self.description, name: "description", parent: name, min: 1)
try self.validate(self.notificationARNs, name: "notificationARNs", parent: name, max: 5)
try self.resourcesToImport?.forEach {
try $0.validate(name: "\(name).resourcesToImport[]")
}
try self.validate(self.resourcesToImport, name: "resourcesToImport", parent: name, max: 200)
try self.resourceTypes?.forEach {
try validate($0, name: "resourceTypes[]", parent: name, max: 256)
try validate($0, name: "resourceTypes[]", parent: name, min: 1)
}
try self.validate(self.roleARN, name: "roleARN", parent: name, max: 2048)
try self.validate(self.roleARN, name: "roleARN", parent: name, min: 20)
try self.rollbackConfiguration?.validate(name: "\(name).rollbackConfiguration")
try self.validate(self.stackName, name: "stackName", parent: name, min: 1)
try self.validate(self.stackName, name: "stackName", parent: name, pattern: "([a-zA-Z][-a-zA-Z0-9]*)|(arn:\\b(aws|aws-us-gov|aws-cn)\\b:[-a-zA-Z0-9:/._+]*)")
try self.tags?.forEach {
try $0.validate(name: "\(name).tags[]")
}
try self.validate(self.tags, name: "tags", parent: name, max: 50)
try self.validate(self.templateBody, name: "templateBody", parent: name, min: 1)
try self.validate(self.templateURL, name: "templateURL", parent: name, max: 1024)
try self.validate(self.templateURL, name: "templateURL", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case capabilities = "Capabilities"
case changeSetName = "ChangeSetName"
case changeSetType = "ChangeSetType"
case clientToken = "ClientToken"
case description = "Description"
case includeNestedStacks = "IncludeNestedStacks"
case notificationARNs = "NotificationARNs"
case parameters = "Parameters"
case resourcesToImport = "ResourcesToImport"
case resourceTypes = "ResourceTypes"
case roleARN = "RoleARN"
case rollbackConfiguration = "RollbackConfiguration"
case stackName = "StackName"
case tags = "Tags"
case templateBody = "TemplateBody"
case templateURL = "TemplateURL"
case usePreviousTemplate = "UsePreviousTemplate"
}
}
public struct CreateChangeSetOutput: AWSDecodableShape {
/// The Amazon Resource Name (ARN) of the change set.
public let id: String?
/// The unique ID of the stack.
public let stackId: String?
public init(id: String? = nil, stackId: String? = nil) {
self.id = id
self.stackId = stackId
}
private enum CodingKeys: String, CodingKey {
case id = "Id"
case stackId = "StackId"
}
}
public struct CreateStackInput: AWSEncodableShape {
/// In some cases, you must explicitly acknowledge that your stack template contains certain capabilities in order for AWS CloudFormation to create the stack. CAPABILITY_IAM and CAPABILITY_NAMED_IAM Some stack templates might include resources that can affect permissions in your AWS account; for example, by creating new AWS Identity and Access Management (IAM) users. For those stacks, you must explicitly acknowledge this by specifying one of these capabilities. The following IAM resources require you to specify either the CAPABILITY_IAM or CAPABILITY_NAMED_IAM capability. If you have IAM resources, you can specify either capability. If you have IAM resources with custom names, you must specify CAPABILITY_NAMED_IAM. If you don't specify either of these capabilities, AWS CloudFormation returns an InsufficientCapabilities error. If your stack template contains these resources, we recommend that you review all permissions associated with them and edit their permissions if necessary. AWS::IAM::AccessKey AWS::IAM::Group AWS::IAM::InstanceProfile AWS::IAM::Policy AWS::IAM::Role AWS::IAM::User AWS::IAM::UserToGroupAddition For more information, see Acknowledging IAM Resources in AWS CloudFormation Templates. CAPABILITY_AUTO_EXPAND Some template contain macros. Macros perform custom processing on templates; this can include simple actions like find-and-replace operations, all the way to extensive transformations of entire templates. Because of this, users typically create a change set from the processed template, so that they can review the changes resulting from the macros before actually creating the stack. If your stack template contains one or more macros, and you choose to create a stack directly from the processed template, without first reviewing the resulting changes in a change set, you must acknowledge this capability. This includes the AWS::Include and AWS::Serverless transforms, which are macros hosted by AWS CloudFormation. If you want to create a stack from a stack template that contains macros and nested stacks, you must create the stack directly from the template using this capability. You should only create stacks directly from a stack template that contains macros if you know what processing the macro performs. Each macro relies on an underlying Lambda service function for processing stack templates. Be aware that the Lambda function owner can update the function operation without AWS CloudFormation being notified. For more information, see Using AWS CloudFormation Macros to Perform Custom Processing on Templates.
@OptionalCustomCoding<StandardArrayCoder>
public var capabilities: [Capability]?
/// A unique identifier for this CreateStack request. Specify this token if you plan to retry requests so that AWS CloudFormation knows that you're not attempting to create a stack with the same name. You might retry CreateStack requests to ensure that AWS CloudFormation successfully received them. All events triggered by a given stack operation are assigned the same client request token, which you can use to track operations. For example, if you execute a CreateStack operation with the token token1, then all the StackEvents generated by that operation will have ClientRequestToken set as token1. In the console, stack operations display the client request token on the Events tab. Stack operations that are initiated from the console use the token format Console-StackOperation-ID, which helps you easily identify the stack operation . For example, if you create a stack using the console, each stack event would be assigned the same token in the following format: Console-CreateStack-7f59c3cf-00d2-40c7-b2ff-e75db0987002.
public let clientRequestToken: String?
/// Set to true to disable rollback of the stack if stack creation failed. You can specify either DisableRollback or OnFailure, but not both. Default: false
public let disableRollback: Bool?
/// Whether to enable termination protection on the specified stack. If a user attempts to delete a stack with termination protection enabled, the operation fails and the stack remains unchanged. For more information, see Protecting a Stack From Being Deleted in the AWS CloudFormation User Guide. Termination protection is disabled on stacks by default. For nested stacks, termination protection is set on the root stack and cannot be changed directly on the nested stack.
public let enableTerminationProtection: Bool?
/// The Simple Notification Service (SNS) topic ARNs to publish stack related events. You can find your SNS topic ARNs using the SNS console or your Command Line Interface (CLI).
@OptionalCustomCoding<StandardArrayCoder>
public var notificationARNs: [String]?
/// Determines what action will be taken if stack creation fails. This must be one of: DO_NOTHING, ROLLBACK, or DELETE. You can specify either OnFailure or DisableRollback, but not both. Default: ROLLBACK
public let onFailure: OnFailure?
/// A list of Parameter structures that specify input parameters for the stack. For more information, see the Parameter data type.
@OptionalCustomCoding<StandardArrayCoder>
public var parameters: [Parameter]?
/// The template resource types that you have permissions to work with for this create stack action, such as AWS::EC2::Instance, AWS::EC2::*, or Custom::MyCustomInstance. Use the following syntax to describe template resource types: AWS::* (for all AWS resource), Custom::* (for all custom resources), Custom::logical_ID (for a specific custom resource), AWS::service_name::* (for all resources of a particular AWS service), and AWS::service_name::resource_logical_ID (for a specific AWS resource). If the list of resource types doesn't include a resource that you're creating, the stack creation fails. By default, AWS CloudFormation grants permissions to all resource types. AWS Identity and Access Management (IAM) uses this parameter for AWS CloudFormation-specific condition keys in IAM policies. For more information, see Controlling Access with AWS Identity and Access Management.
@OptionalCustomCoding<StandardArrayCoder>
public var resourceTypes: [String]?
/// The Amazon Resource Name (ARN) of an AWS Identity and Access Management (IAM) role that AWS CloudFormation assumes to create the stack. AWS CloudFormation uses the role's credentials to make calls on your behalf. AWS CloudFormation always uses this role for all future operations on the stack. As long as users have permission to operate on the stack, AWS CloudFormation uses this role even if the users don't have permission to pass it. Ensure that the role grants least privilege. If you don't specify a value, AWS CloudFormation uses the role that was previously associated with the stack. If no role is available, AWS CloudFormation uses a temporary session that is generated from your user credentials.
public let roleARN: String?
/// The rollback triggers for AWS CloudFormation to monitor during stack creation and updating operations, and for the specified monitoring period afterwards.
public let rollbackConfiguration: RollbackConfiguration?
/// The name that is associated with the stack. The name must be unique in the Region in which you are creating the stack. A stack name can contain only alphanumeric characters (case sensitive) and hyphens. It must start with an alphabetic character and cannot be longer than 128 characters.
public let stackName: String
/// Structure containing the stack policy body. For more information, go to Prevent Updates to Stack Resources in the AWS CloudFormation User Guide. You can specify either the StackPolicyBody or the StackPolicyURL parameter, but not both.
public let stackPolicyBody: String?
/// Location of a file containing the stack policy. The URL must point to a policy (maximum size: 16 KB) located in an S3 bucket in the same Region as the stack. You can specify either the StackPolicyBody or the StackPolicyURL parameter, but not both.
public let stackPolicyURL: String?
/// Key-value pairs to associate with this stack. AWS CloudFormation also propagates these tags to the resources created in the stack. A maximum number of 50 tags can be specified.
@OptionalCustomCoding<StandardArrayCoder>
public var tags: [Tag]?
/// Structure containing the template body with a minimum length of 1 byte and a maximum length of 51,200 bytes. For more information, go to Template Anatomy in the AWS CloudFormation User Guide. Conditional: You must specify either the TemplateBody or the TemplateURL parameter, but not both.
public let templateBody: String?
/// Location of file containing the template body. The URL must point to a template (max size: 460,800 bytes) that is located in an Amazon S3 bucket or a Systems Manager document. For more information, go to the Template Anatomy in the AWS CloudFormation User Guide. Conditional: You must specify either the TemplateBody or the TemplateURL parameter, but not both.
public let templateURL: String?
/// The amount of time that can pass before the stack status becomes CREATE_FAILED; if DisableRollback is not set or is set to false, the stack will be rolled back.
public let timeoutInMinutes: Int?
public init(capabilities: [Capability]? = nil, clientRequestToken: String? = nil, disableRollback: Bool? = nil, enableTerminationProtection: Bool? = nil, notificationARNs: [String]? = nil, onFailure: OnFailure? = nil, parameters: [Parameter]? = nil, resourceTypes: [String]? = nil, roleARN: String? = nil, rollbackConfiguration: RollbackConfiguration? = nil, stackName: String, stackPolicyBody: String? = nil, stackPolicyURL: String? = nil, tags: [Tag]? = nil, templateBody: String? = nil, templateURL: String? = nil, timeoutInMinutes: Int? = nil) {
self.capabilities = capabilities
self.clientRequestToken = clientRequestToken
self.disableRollback = disableRollback
self.enableTerminationProtection = enableTerminationProtection
self.notificationARNs = notificationARNs
self.onFailure = onFailure
self.parameters = parameters
self.resourceTypes = resourceTypes
self.roleARN = roleARN
self.rollbackConfiguration = rollbackConfiguration
self.stackName = stackName
self.stackPolicyBody = stackPolicyBody
self.stackPolicyURL = stackPolicyURL
self.tags = tags
self.templateBody = templateBody
self.templateURL = templateURL
self.timeoutInMinutes = timeoutInMinutes
}
public func validate(name: String) throws {
try self.validate(self.clientRequestToken, name: "clientRequestToken", parent: name, max: 128)
try self.validate(self.clientRequestToken, name: "clientRequestToken", parent: name, min: 1)
try self.validate(self.clientRequestToken, name: "clientRequestToken", parent: name, pattern: "[a-zA-Z0-9][-a-zA-Z0-9]*")
try self.validate(self.notificationARNs, name: "notificationARNs", parent: name, max: 5)
try self.resourceTypes?.forEach {
try validate($0, name: "resourceTypes[]", parent: name, max: 256)
try validate($0, name: "resourceTypes[]", parent: name, min: 1)
}
try self.validate(self.roleARN, name: "roleARN", parent: name, max: 2048)
try self.validate(self.roleARN, name: "roleARN", parent: name, min: 20)
try self.rollbackConfiguration?.validate(name: "\(name).rollbackConfiguration")
try self.validate(self.stackPolicyBody, name: "stackPolicyBody", parent: name, max: 16384)
try self.validate(self.stackPolicyBody, name: "stackPolicyBody", parent: name, min: 1)
try self.validate(self.stackPolicyURL, name: "stackPolicyURL", parent: name, max: 1350)
try self.validate(self.stackPolicyURL, name: "stackPolicyURL", parent: name, min: 1)
try self.tags?.forEach {
try $0.validate(name: "\(name).tags[]")
}
try self.validate(self.tags, name: "tags", parent: name, max: 50)
try self.validate(self.templateBody, name: "templateBody", parent: name, min: 1)
try self.validate(self.templateURL, name: "templateURL", parent: name, max: 1024)
try self.validate(self.templateURL, name: "templateURL", parent: name, min: 1)
try self.validate(self.timeoutInMinutes, name: "timeoutInMinutes", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case capabilities = "Capabilities"
case clientRequestToken = "ClientRequestToken"
case disableRollback = "DisableRollback"
case enableTerminationProtection = "EnableTerminationProtection"
case notificationARNs = "NotificationARNs"
case onFailure = "OnFailure"
case parameters = "Parameters"
case resourceTypes = "ResourceTypes"
case roleARN = "RoleARN"
case rollbackConfiguration = "RollbackConfiguration"
case stackName = "StackName"
case stackPolicyBody = "StackPolicyBody"
case stackPolicyURL = "StackPolicyURL"
case tags = "Tags"
case templateBody = "TemplateBody"
case templateURL = "TemplateURL"
case timeoutInMinutes = "TimeoutInMinutes"
}
}
public struct CreateStackInstancesInput: AWSEncodableShape {
/// [Self-managed permissions] The names of one or more AWS accounts that you want to create stack instances in the specified Region(s) for. You can specify Accounts or DeploymentTargets, but not both.
@OptionalCustomCoding<StandardArrayCoder>
public var accounts: [String]?
/// [Service-managed permissions] Specifies whether you are acting as an account administrator in the organization's management account or as a delegated administrator in a member account. By default, SELF is specified. Use SELF for stack sets with self-managed permissions. If you are signed in to the management account, specify SELF. If you are signed in to a delegated administrator account, specify DELEGATED_ADMIN. Your AWS account must be registered as a delegated administrator in the management account. For more information, see Register a delegated administrator in the AWS CloudFormation User Guide.
public let callAs: CallAs?
/// [Service-managed permissions] The AWS Organizations accounts for which to create stack instances in the specified Regions. You can specify Accounts or DeploymentTargets, but not both.
public let deploymentTargets: DeploymentTargets?
/// The unique identifier for this stack set operation. The operation ID also functions as an idempotency token, to ensure that AWS CloudFormation performs the stack set operation only once, even if you retry the request multiple times. You might retry stack set operation requests to ensure that AWS CloudFormation successfully received them. If you don't specify an operation ID, the SDK generates one automatically. Repeating this stack set operation with a new operation ID retries all stack instances whose status is OUTDATED.
public let operationId: String?
/// Preferences for how AWS CloudFormation performs this stack set operation.
public let operationPreferences: StackSetOperationPreferences?
/// A list of stack set parameters whose values you want to override in the selected stack instances. Any overridden parameter values will be applied to all stack instances in the specified accounts and Regions. When specifying parameters and their values, be aware of how AWS CloudFormation sets parameter values during stack instance operations: To override the current value for a parameter, include the parameter and specify its value. To leave a parameter set to its present value, you can do one of the following: Do not include the parameter in the list. Include the parameter and specify UsePreviousValue as true. (You cannot specify both a value and set UsePreviousValue to true.) To set all overridden parameter back to the values specified in the stack set, specify a parameter list but do not include any parameters. To leave all parameters set to their present values, do not specify this property at all. During stack set updates, any parameter values overridden for a stack instance are not updated, but retain their overridden value. You can only override the parameter values that are specified in the stack set; to add or delete a parameter itself, use UpdateStackSet to update the stack set template.
@OptionalCustomCoding<StandardArrayCoder>
public var parameterOverrides: [Parameter]?
/// The names of one or more Regions where you want to create stack instances using the specified AWS account(s).
@CustomCoding<StandardArrayCoder>
public var regions: [String]
/// The name or unique ID of the stack set that you want to create stack instances from.
public let stackSetName: String
public init(accounts: [String]? = nil, callAs: CallAs? = nil, deploymentTargets: DeploymentTargets? = nil, operationId: String? = CreateStackInstancesInput.idempotencyToken(), operationPreferences: StackSetOperationPreferences? = nil, parameterOverrides: [Parameter]? = nil, regions: [String], stackSetName: String) {
self.accounts = accounts
self.callAs = callAs
self.deploymentTargets = deploymentTargets
self.operationId = operationId
self.operationPreferences = operationPreferences
self.parameterOverrides = parameterOverrides
self.regions = regions
self.stackSetName = stackSetName
}
public func validate(name: String) throws {
try self.accounts?.forEach {
try validate($0, name: "accounts[]", parent: name, pattern: "^[0-9]{12}$")
}
try self.deploymentTargets?.validate(name: "\(name).deploymentTargets")
try self.validate(self.operationId, name: "operationId", parent: name, max: 128)
try self.validate(self.operationId, name: "operationId", parent: name, min: 1)
try self.validate(self.operationId, name: "operationId", parent: name, pattern: "[a-zA-Z0-9][-a-zA-Z0-9]*")
try self.operationPreferences?.validate(name: "\(name).operationPreferences")
try self.regions.forEach {
try validate($0, name: "regions[]", parent: name, pattern: "^[a-zA-Z0-9-]{1,128}$")
}
}
private enum CodingKeys: String, CodingKey {
case accounts = "Accounts"
case callAs = "CallAs"
case deploymentTargets = "DeploymentTargets"
case operationId = "OperationId"
case operationPreferences = "OperationPreferences"
case parameterOverrides = "ParameterOverrides"
case regions = "Regions"
case stackSetName = "StackSetName"
}
}
public struct CreateStackInstancesOutput: AWSDecodableShape {
/// The unique identifier for this stack set operation.
public let operationId: String?
public init(operationId: String? = nil) {
self.operationId = operationId
}
private enum CodingKeys: String, CodingKey {
case operationId = "OperationId"
}
}
public struct CreateStackOutput: AWSDecodableShape {
/// Unique identifier of the stack.
public let stackId: String?
public init(stackId: String? = nil) {
self.stackId = stackId
}
private enum CodingKeys: String, CodingKey {
case stackId = "StackId"
}
}
public struct CreateStackSetInput: AWSEncodableShape {
/// The Amazon Resource Number (ARN) of the IAM role to use to create this stack set. Specify an IAM role only if you are using customized administrator roles to control which users or groups can manage specific stack sets within the same administrator account. For more information, see Prerequisites: Granting Permissions for Stack Set Operations in the AWS CloudFormation User Guide.
public let administrationRoleARN: String?
/// Describes whether StackSets automatically deploys to AWS Organizations accounts that are added to the target organization or organizational unit (OU). Specify only if PermissionModel is SERVICE_MANAGED.
public let autoDeployment: AutoDeployment?
/// [Service-managed permissions] Specifies whether you are acting as an account administrator in the organization's management account or as a delegated administrator in a member account. By default, SELF is specified. Use SELF for stack sets with self-managed permissions. To create a stack set with service-managed permissions while signed in to the management account, specify SELF. To create a stack set with service-managed permissions while signed in to a delegated administrator account, specify DELEGATED_ADMIN. Your AWS account must be registered as a delegated admin in the management account. For more information, see Register a delegated administrator in the AWS CloudFormation User Guide. Stack sets with service-managed permissions are created in the management account, including stack sets that are created by delegated administrators.
public let callAs: CallAs?
/// In some cases, you must explicitly acknowledge that your stack set template contains certain capabilities in order for AWS CloudFormation to create the stack set and related stack instances. CAPABILITY_IAM and CAPABILITY_NAMED_IAM Some stack templates might include resources that can affect permissions in your AWS account; for example, by creating new AWS Identity and Access Management (IAM) users. For those stack sets, you must explicitly acknowledge this by specifying one of these capabilities. The following IAM resources require you to specify either the CAPABILITY_IAM or CAPABILITY_NAMED_IAM capability. If you have IAM resources, you can specify either capability. If you have IAM resources with custom names, you must specify CAPABILITY_NAMED_IAM. If you don't specify either of these capabilities, AWS CloudFormation returns an InsufficientCapabilities error. If your stack template contains these resources, we recommend that you review all permissions associated with them and edit their permissions if necessary. AWS::IAM::AccessKey AWS::IAM::Group AWS::IAM::InstanceProfile AWS::IAM::Policy AWS::IAM::Role AWS::IAM::User AWS::IAM::UserToGroupAddition For more information, see Acknowledging IAM Resources in AWS CloudFormation Templates. CAPABILITY_AUTO_EXPAND Some templates reference macros. If your stack set template references one or more macros, you must create the stack set directly from the processed template, without first reviewing the resulting changes in a change set. To create the stack set directly, you must acknowledge this capability. For more information, see Using AWS CloudFormation Macros to Perform Custom Processing on Templates. Stack sets with service-managed permissions do not currently support the use of macros in templates. (This includes the AWS::Include and AWS::Serverless transforms, which are macros hosted by AWS CloudFormation.) Even if you specify this capability for a stack set with service-managed permissions, if you reference a macro in your template the stack set operation will fail.
@OptionalCustomCoding<StandardArrayCoder>
public var capabilities: [Capability]?
/// A unique identifier for this CreateStackSet request. Specify this token if you plan to retry requests so that AWS CloudFormation knows that you're not attempting to create another stack set with the same name. You might retry CreateStackSet requests to ensure that AWS CloudFormation successfully received them. If you don't specify an operation ID, the SDK generates one automatically.
public let clientRequestToken: String?
/// A description of the stack set. You can use the description to identify the stack set's purpose or other important information.
public let description: String?
/// The name of the IAM execution role to use to create the stack set. If you do not specify an execution role, AWS CloudFormation uses the AWSCloudFormationStackSetExecutionRole role for the stack set operation. Specify an IAM role only if you are using customized execution roles to control which stack resources users and groups can include in their stack sets.
public let executionRoleName: String?
/// The input parameters for the stack set template.
@OptionalCustomCoding<StandardArrayCoder>
public var parameters: [Parameter]?
/// Describes how the IAM roles required for stack set operations are created. By default, SELF-MANAGED is specified. With self-managed permissions, you must create the administrator and execution roles required to deploy to target accounts. For more information, see Grant Self-Managed Stack Set Permissions. With service-managed permissions, StackSets automatically creates the IAM roles required to deploy to accounts managed by AWS Organizations. For more information, see Grant Service-Managed Stack Set Permissions.
public let permissionModel: PermissionModels?
/// The name to associate with the stack set. The name must be unique in the Region where you create your stack set. A stack name can contain only alphanumeric characters (case-sensitive) and hyphens. It must start with an alphabetic character and can't be longer than 128 characters.
public let stackSetName: String
/// The key-value pairs to associate with this stack set and the stacks created from it. AWS CloudFormation also propagates these tags to supported resources that are created in the stacks. A maximum number of 50 tags can be specified. If you specify tags as part of a CreateStackSet action, AWS CloudFormation checks to see if you have the required IAM permission to tag resources. If you don't, the entire CreateStackSet action fails with an access denied error, and the stack set is not created.
@OptionalCustomCoding<StandardArrayCoder>
public var tags: [Tag]?
/// The structure that contains the template body, with a minimum length of 1 byte and a maximum length of 51,200 bytes. For more information, see Template Anatomy in the AWS CloudFormation User Guide. Conditional: You must specify either the TemplateBody or the TemplateURL parameter, but not both.
public let templateBody: String?
/// The location of the file that contains the template body. The URL must point to a template (maximum size: 460,800 bytes) that's located in an Amazon S3 bucket or a Systems Manager document. For more information, see Template Anatomy in the AWS CloudFormation User Guide. Conditional: You must specify either the TemplateBody or the TemplateURL parameter, but not both.
public let templateURL: String?
public init(administrationRoleARN: String? = nil, autoDeployment: AutoDeployment? = nil, callAs: CallAs? = nil, capabilities: [Capability]? = nil, clientRequestToken: String? = CreateStackSetInput.idempotencyToken(), description: String? = nil, executionRoleName: String? = nil, parameters: [Parameter]? = nil, permissionModel: PermissionModels? = nil, stackSetName: String, tags: [Tag]? = nil, templateBody: String? = nil, templateURL: String? = nil) {
self.administrationRoleARN = administrationRoleARN
self.autoDeployment = autoDeployment
self.callAs = callAs
self.capabilities = capabilities
self.clientRequestToken = clientRequestToken
self.description = description
self.executionRoleName = executionRoleName
self.parameters = parameters
self.permissionModel = permissionModel
self.stackSetName = stackSetName
self.tags = tags
self.templateBody = templateBody
self.templateURL = templateURL
}
public func validate(name: String) throws {
try self.validate(self.administrationRoleARN, name: "administrationRoleARN", parent: name, max: 2048)
try self.validate(self.administrationRoleARN, name: "administrationRoleARN", parent: name, min: 20)
try self.validate(self.clientRequestToken, name: "clientRequestToken", parent: name, max: 128)
try self.validate(self.clientRequestToken, name: "clientRequestToken", parent: name, min: 1)
try self.validate(self.clientRequestToken, name: "clientRequestToken", parent: name, pattern: "[a-zA-Z0-9][-a-zA-Z0-9]*")
try self.validate(self.description, name: "description", parent: name, max: 1024)
try self.validate(self.description, name: "description", parent: name, min: 1)
try self.validate(self.executionRoleName, name: "executionRoleName", parent: name, max: 64)
try self.validate(self.executionRoleName, name: "executionRoleName", parent: name, min: 1)
try self.validate(self.executionRoleName, name: "executionRoleName", parent: name, pattern: "[a-zA-Z_0-9+=,.@-]+")
try self.tags?.forEach {
try $0.validate(name: "\(name).tags[]")
}
try self.validate(self.tags, name: "tags", parent: name, max: 50)
try self.validate(self.templateBody, name: "templateBody", parent: name, min: 1)
try self.validate(self.templateURL, name: "templateURL", parent: name, max: 1024)
try self.validate(self.templateURL, name: "templateURL", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case administrationRoleARN = "AdministrationRoleARN"
case autoDeployment = "AutoDeployment"
case callAs = "CallAs"
case capabilities = "Capabilities"
case clientRequestToken = "ClientRequestToken"
case description = "Description"
case executionRoleName = "ExecutionRoleName"
case parameters = "Parameters"
case permissionModel = "PermissionModel"
case stackSetName = "StackSetName"
case tags = "Tags"
case templateBody = "TemplateBody"
case templateURL = "TemplateURL"
}
}
public struct CreateStackSetOutput: AWSDecodableShape {
/// The ID of the stack set that you're creating.
public let stackSetId: String?
public init(stackSetId: String? = nil) {
self.stackSetId = stackSetId
}
private enum CodingKeys: String, CodingKey {
case stackSetId = "StackSetId"
}
}
public struct DeactivateTypeInput: AWSEncodableShape {
/// The Amazon Resource Name (ARN) for the extension, in this account and region. Conditional: You must specify either Arn, or TypeName and Type.
public let arn: String?
/// The extension type. Conditional: You must specify either Arn, or TypeName and Type.
public let type: ThirdPartyType?
/// The type name of the extension, in this account and region. If you specified a type name alias when enabling the extension, use the type name alias. Conditional: You must specify either Arn, or TypeName and Type.
public let typeName: String?
public init(arn: String? = nil, type: ThirdPartyType? = nil, typeName: String? = nil) {
self.arn = arn
self.type = type
self.typeName = typeName
}
public func validate(name: String) throws {
try self.validate(self.arn, name: "arn", parent: name, max: 1024)
try self.validate(self.arn, name: "arn", parent: name, pattern: "arn:aws[A-Za-z0-9-]{0,64}:cloudformation:[A-Za-z0-9-]{1,64}:[0-9]{12}:type/.+")
try self.validate(self.typeName, name: "typeName", parent: name, max: 204)
try self.validate(self.typeName, name: "typeName", parent: name, min: 10)
try self.validate(self.typeName, name: "typeName", parent: name, pattern: "[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}(::MODULE){0,1}")
}
private enum CodingKeys: String, CodingKey {
case arn = "Arn"
case type = "Type"
case typeName = "TypeName"
}
}
public struct DeactivateTypeOutput: AWSDecodableShape {
public init() {}
}
public struct DeleteChangeSetInput: AWSEncodableShape {
/// The name or Amazon Resource Name (ARN) of the change set that you want to delete.
public let changeSetName: String
/// If you specified the name of a change set to delete, specify the stack name or ID (ARN) that is associated with it.
public let stackName: String?
public init(changeSetName: String, stackName: String? = nil) {
self.changeSetName = changeSetName
self.stackName = stackName
}
public func validate(name: String) throws {
try self.validate(self.changeSetName, name: "changeSetName", parent: name, max: 1600)
try self.validate(self.changeSetName, name: "changeSetName", parent: name, min: 1)
try self.validate(self.changeSetName, name: "changeSetName", parent: name, pattern: "[a-zA-Z][-a-zA-Z0-9]*|arn:[-a-zA-Z0-9:/]*")
try self.validate(self.stackName, name: "stackName", parent: name, min: 1)
try self.validate(self.stackName, name: "stackName", parent: name, pattern: "([a-zA-Z][-a-zA-Z0-9]*)|(arn:\\b(aws|aws-us-gov|aws-cn)\\b:[-a-zA-Z0-9:/._+]*)")
}
private enum CodingKeys: String, CodingKey {
case changeSetName = "ChangeSetName"
case stackName = "StackName"
}
}
public struct DeleteChangeSetOutput: AWSDecodableShape {
public init() {}
}
public struct DeleteStackInput: AWSEncodableShape {
/// A unique identifier for this DeleteStack request. Specify this token if you plan to retry requests so that AWS CloudFormation knows that you're not attempting to delete a stack with the same name. You might retry DeleteStack requests to ensure that AWS CloudFormation successfully received them. All events triggered by a given stack operation are assigned the same client request token, which you can use to track operations. For example, if you execute a CreateStack operation with the token token1, then all the StackEvents generated by that operation will have ClientRequestToken set as token1. In the console, stack operations display the client request token on the Events tab. Stack operations that are initiated from the console use the token format Console-StackOperation-ID, which helps you easily identify the stack operation . For example, if you create a stack using the console, each stack event would be assigned the same token in the following format: Console-CreateStack-7f59c3cf-00d2-40c7-b2ff-e75db0987002.
public let clientRequestToken: String?
/// For stacks in the DELETE_FAILED state, a list of resource logical IDs that are associated with the resources you want to retain. During deletion, AWS CloudFormation deletes the stack but does not delete the retained resources. Retaining resources is useful when you cannot delete a resource, such as a non-empty S3 bucket, but you want to delete the stack.
@OptionalCustomCoding<StandardArrayCoder>
public var retainResources: [String]?
/// The Amazon Resource Name (ARN) of an AWS Identity and Access Management (IAM) role that AWS CloudFormation assumes to delete the stack. AWS CloudFormation uses the role's credentials to make calls on your behalf. If you don't specify a value, AWS CloudFormation uses the role that was previously associated with the stack. If no role is available, AWS CloudFormation uses a temporary session that is generated from your user credentials.
public let roleARN: String?
/// The name or the unique stack ID that is associated with the stack.
public let stackName: String
public init(clientRequestToken: String? = nil, retainResources: [String]? = nil, roleARN: String? = nil, stackName: String) {
self.clientRequestToken = clientRequestToken
self.retainResources = retainResources
self.roleARN = roleARN
self.stackName = stackName
}
public func validate(name: String) throws {
try self.validate(self.clientRequestToken, name: "clientRequestToken", parent: name, max: 128)
try self.validate(self.clientRequestToken, name: "clientRequestToken", parent: name, min: 1)
try self.validate(self.clientRequestToken, name: "clientRequestToken", parent: name, pattern: "[a-zA-Z0-9][-a-zA-Z0-9]*")
try self.validate(self.roleARN, name: "roleARN", parent: name, max: 2048)
try self.validate(self.roleARN, name: "roleARN", parent: name, min: 20)
}
private enum CodingKeys: String, CodingKey {
case clientRequestToken = "ClientRequestToken"
case retainResources = "RetainResources"
case roleARN = "RoleARN"
case stackName = "StackName"
}
}
public struct DeleteStackInstancesInput: AWSEncodableShape {
/// [Self-managed permissions] The names of the AWS accounts that you want to delete stack instances for. You can specify Accounts or DeploymentTargets, but not both.
@OptionalCustomCoding<StandardArrayCoder>
public var accounts: [String]?
/// [Service-managed permissions] Specifies whether you are acting as an account administrator in the organization's management account or as a delegated administrator in a member account. By default, SELF is specified. Use SELF for stack sets with self-managed permissions. If you are signed in to the management account, specify SELF. If you are signed in to a delegated administrator account, specify DELEGATED_ADMIN. Your AWS account must be registered as a delegated administrator in the management account. For more information, see Register a delegated administrator in the AWS CloudFormation User Guide.
public let callAs: CallAs?
/// [Service-managed permissions] The AWS Organizations accounts from which to delete stack instances. You can specify Accounts or DeploymentTargets, but not both.
public let deploymentTargets: DeploymentTargets?
/// The unique identifier for this stack set operation. If you don't specify an operation ID, the SDK generates one automatically. The operation ID also functions as an idempotency token, to ensure that AWS CloudFormation performs the stack set operation only once, even if you retry the request multiple times. You can retry stack set operation requests to ensure that AWS CloudFormation successfully received them. Repeating this stack set operation with a new operation ID retries all stack instances whose status is OUTDATED.
public let operationId: String?
/// Preferences for how AWS CloudFormation performs this stack set operation.
public let operationPreferences: StackSetOperationPreferences?
/// The Regions where you want to delete stack set instances.
@CustomCoding<StandardArrayCoder>
public var regions: [String]
/// Removes the stack instances from the specified stack set, but doesn't delete the stacks. You can't reassociate a retained stack or add an existing, saved stack to a new stack set. For more information, see Stack set operation options.
public let retainStacks: Bool
/// The name or unique ID of the stack set that you want to delete stack instances for.
public let stackSetName: String
public init(accounts: [String]? = nil, callAs: CallAs? = nil, deploymentTargets: DeploymentTargets? = nil, operationId: String? = DeleteStackInstancesInput.idempotencyToken(), operationPreferences: StackSetOperationPreferences? = nil, regions: [String], retainStacks: Bool, stackSetName: String) {
self.accounts = accounts
self.callAs = callAs
self.deploymentTargets = deploymentTargets
self.operationId = operationId
self.operationPreferences = operationPreferences
self.regions = regions
self.retainStacks = retainStacks
self.stackSetName = stackSetName
}
public func validate(name: String) throws {
try self.accounts?.forEach {
try validate($0, name: "accounts[]", parent: name, pattern: "^[0-9]{12}$")
}
try self.deploymentTargets?.validate(name: "\(name).deploymentTargets")
try self.validate(self.operationId, name: "operationId", parent: name, max: 128)
try self.validate(self.operationId, name: "operationId", parent: name, min: 1)
try self.validate(self.operationId, name: "operationId", parent: name, pattern: "[a-zA-Z0-9][-a-zA-Z0-9]*")
try self.operationPreferences?.validate(name: "\(name).operationPreferences")
try self.regions.forEach {
try validate($0, name: "regions[]", parent: name, pattern: "^[a-zA-Z0-9-]{1,128}$")
}
}
private enum CodingKeys: String, CodingKey {
case accounts = "Accounts"
case callAs = "CallAs"
case deploymentTargets = "DeploymentTargets"
case operationId = "OperationId"
case operationPreferences = "OperationPreferences"
case regions = "Regions"
case retainStacks = "RetainStacks"
case stackSetName = "StackSetName"
}
}
public struct DeleteStackInstancesOutput: AWSDecodableShape {
/// The unique identifier for this stack set operation.
public let operationId: String?
public init(operationId: String? = nil) {
self.operationId = operationId
}
private enum CodingKeys: String, CodingKey {
case operationId = "OperationId"
}
}
public struct DeleteStackSetInput: AWSEncodableShape {
/// [Service-managed permissions] Specifies whether you are acting as an account administrator in the organization's management account or as a delegated administrator in a member account. By default, SELF is specified. Use SELF for stack sets with self-managed permissions. If you are signed in to the management account, specify SELF. If you are signed in to a delegated administrator account, specify DELEGATED_ADMIN. Your AWS account must be registered as a delegated administrator in the management account. For more information, see Register a delegated administrator in the AWS CloudFormation User Guide.
public let callAs: CallAs?
/// The name or unique ID of the stack set that you're deleting. You can obtain this value by running ListStackSets.
public let stackSetName: String
public init(callAs: CallAs? = nil, stackSetName: String) {
self.callAs = callAs
self.stackSetName = stackSetName
}
private enum CodingKeys: String, CodingKey {
case callAs = "CallAs"
case stackSetName = "StackSetName"
}
}
public struct DeleteStackSetOutput: AWSDecodableShape {
public init() {}
}
public struct DeploymentTargets: AWSEncodableShape & AWSDecodableShape {
/// The names of one or more AWS accounts for which you want to deploy stack set updates.
@OptionalCustomCoding<StandardArrayCoder>
public var accounts: [String]?
/// Returns the value of the AccountsUrl property.
public let accountsUrl: String?
/// The organization root ID or organizational unit (OU) IDs to which StackSets deploys.
@OptionalCustomCoding<StandardArrayCoder>
public var organizationalUnitIds: [String]?
public init(accounts: [String]? = nil, accountsUrl: String? = nil, organizationalUnitIds: [String]? = nil) {
self.accounts = accounts
self.accountsUrl = accountsUrl
self.organizationalUnitIds = organizationalUnitIds
}
public func validate(name: String) throws {
try self.accounts?.forEach {
try validate($0, name: "accounts[]", parent: name, pattern: "^[0-9]{12}$")
}
try self.validate(self.accountsUrl, name: "accountsUrl", parent: name, max: 5120)
try self.validate(self.accountsUrl, name: "accountsUrl", parent: name, min: 1)
try self.validate(self.accountsUrl, name: "accountsUrl", parent: name, pattern: "(s3://|http(s?)://).+")
try self.organizationalUnitIds?.forEach {
try validate($0, name: "organizationalUnitIds[]", parent: name, pattern: "^(ou-[a-z0-9]{4,32}-[a-z0-9]{8,32}|r-[a-z0-9]{4,32})$")
}
}
private enum CodingKeys: String, CodingKey {
case accounts = "Accounts"
case accountsUrl = "AccountsUrl"
case organizationalUnitIds = "OrganizationalUnitIds"
}
}
public struct DeregisterTypeInput: AWSEncodableShape {
/// The Amazon Resource Name (ARN) of the extension. Conditional: You must specify either TypeName and Type, or Arn.
public let arn: String?
/// The kind of extension. Conditional: You must specify either TypeName and Type, or Arn.
public let type: RegistryType?
/// The name of the extension. Conditional: You must specify either TypeName and Type, or Arn.
public let typeName: String?
/// The ID of a specific version of the extension. The version ID is the value at the end of the Amazon Resource Name (ARN) assigned to the extension version when it is registered.
public let versionId: String?
public init(arn: String? = nil, type: RegistryType? = nil, typeName: String? = nil, versionId: String? = nil) {
self.arn = arn
self.type = type
self.typeName = typeName
self.versionId = versionId
}
public func validate(name: String) throws {
try self.validate(self.arn, name: "arn", parent: name, max: 1024)
try self.validate(self.arn, name: "arn", parent: name, pattern: "arn:aws[A-Za-z0-9-]{0,64}:cloudformation:[A-Za-z0-9-]{1,64}:[0-9]{12}:type/.+")
try self.validate(self.typeName, name: "typeName", parent: name, max: 204)
try self.validate(self.typeName, name: "typeName", parent: name, min: 10)
try self.validate(self.typeName, name: "typeName", parent: name, pattern: "[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}(::MODULE){0,1}")
try self.validate(self.versionId, name: "versionId", parent: name, max: 128)
try self.validate(self.versionId, name: "versionId", parent: name, min: 1)
try self.validate(self.versionId, name: "versionId", parent: name, pattern: "[A-Za-z0-9-]+")
}
private enum CodingKeys: String, CodingKey {
case arn = "Arn"
case type = "Type"
case typeName = "TypeName"
case versionId = "VersionId"
}
}
public struct DeregisterTypeOutput: AWSDecodableShape {
public init() {}
}
public struct DescribeAccountLimitsInput: AWSEncodableShape {
/// A string that identifies the next page of limits that you want to retrieve.
public let nextToken: String?
public init(nextToken: String? = nil) {
self.nextToken = nextToken
}
public func validate(name: String) throws {
try self.validate(self.nextToken, name: "nextToken", parent: name, max: 1024)
try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case nextToken = "NextToken"
}
}
public struct DescribeAccountLimitsOutput: AWSDecodableShape {
/// An account limit structure that contain a list of AWS CloudFormation account limits and their values.
@OptionalCustomCoding<StandardArrayCoder>
public var accountLimits: [AccountLimit]?
/// If the output exceeds 1 MB in size, a string that identifies the next page of limits. If no additional page exists, this value is null.
public let nextToken: String?
public init(accountLimits: [AccountLimit]? = nil, nextToken: String? = nil) {
self.accountLimits = accountLimits
self.nextToken = nextToken
}
private enum CodingKeys: String, CodingKey {
case accountLimits = "AccountLimits"
case nextToken = "NextToken"
}
}
public struct DescribeChangeSetInput: AWSEncodableShape {
/// The name or Amazon Resource Name (ARN) of the change set that you want to describe.
public let changeSetName: String
/// A string (provided by the DescribeChangeSet response output) that identifies the next page of information that you want to retrieve.
public let nextToken: String?
/// If you specified the name of a change set, specify the stack name or ID (ARN) of the change set you want to describe.
public let stackName: String?
public init(changeSetName: String, nextToken: String? = nil, stackName: String? = nil) {
self.changeSetName = changeSetName
self.nextToken = nextToken
self.stackName = stackName
}
public func validate(name: String) throws {
try self.validate(self.changeSetName, name: "changeSetName", parent: name, max: 1600)
try self.validate(self.changeSetName, name: "changeSetName", parent: name, min: 1)
try self.validate(self.changeSetName, name: "changeSetName", parent: name, pattern: "[a-zA-Z][-a-zA-Z0-9]*|arn:[-a-zA-Z0-9:/]*")
try self.validate(self.nextToken, name: "nextToken", parent: name, max: 1024)
try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
try self.validate(self.stackName, name: "stackName", parent: name, min: 1)
try self.validate(self.stackName, name: "stackName", parent: name, pattern: "([a-zA-Z][-a-zA-Z0-9]*)|(arn:\\b(aws|aws-us-gov|aws-cn)\\b:[-a-zA-Z0-9:/._+]*)")
}
private enum CodingKeys: String, CodingKey {
case changeSetName = "ChangeSetName"
case nextToken = "NextToken"
case stackName = "StackName"
}
}
public struct DescribeChangeSetOutput: AWSDecodableShape {
/// If you execute the change set, the list of capabilities that were explicitly acknowledged when the change set was created.
@OptionalCustomCoding<StandardArrayCoder>
public var capabilities: [Capability]?
/// A list of Change structures that describes the resources AWS CloudFormation changes if you execute the change set.
@OptionalCustomCoding<StandardArrayCoder>
public var changes: [Change]?
/// The ARN of the change set.
public let changeSetId: String?
/// The name of the change set.
public let changeSetName: String?
/// The start time when the change set was created, in UTC.
public let creationTime: Date?
/// Information about the change set.
public let description: String?
/// If the change set execution status is AVAILABLE, you can execute the change set. If you can’t execute the change set, the status indicates why. For example, a change set might be in an UNAVAILABLE state because AWS CloudFormation is still creating it or in an OBSOLETE state because the stack was already updated.
public let executionStatus: ExecutionStatus?
/// Verifies if IncludeNestedStacks is set to True.
public let includeNestedStacks: Bool?
/// If the output exceeds 1 MB, a string that identifies the next page of changes. If there is no additional page, this value is null.
public let nextToken: String?
/// The ARNs of the Amazon Simple Notification Service (Amazon SNS) topics that will be associated with the stack if you execute the change set.
@OptionalCustomCoding<StandardArrayCoder>
public var notificationARNs: [String]?
/// A list of Parameter structures that describes the input parameters and their values used to create the change set. For more information, see the Parameter data type.
@OptionalCustomCoding<StandardArrayCoder>
public var parameters: [Parameter]?
/// Specifies the change set ID of the parent change set in the current nested change set hierarchy.
public let parentChangeSetId: String?
/// The rollback triggers for AWS CloudFormation to monitor during stack creation and updating operations, and for the specified monitoring period afterwards.
public let rollbackConfiguration: RollbackConfiguration?
/// Specifies the change set ID of the root change set in the current nested change set hierarchy.
public let rootChangeSetId: String?
/// The ARN of the stack that is associated with the change set.
public let stackId: String?
/// The name of the stack that is associated with the change set.
public let stackName: String?
/// The current status of the change set, such as CREATE_IN_PROGRESS, CREATE_COMPLETE, or FAILED.
public let status: ChangeSetStatus?
/// A description of the change set's status. For example, if your attempt to create a change set failed, AWS CloudFormation shows the error message.
public let statusReason: String?
/// If you execute the change set, the tags that will be associated with the stack.
@OptionalCustomCoding<StandardArrayCoder>
public var tags: [Tag]?
public init(capabilities: [Capability]? = nil, changes: [Change]? = nil, changeSetId: String? = nil, changeSetName: String? = nil, creationTime: Date? = nil, description: String? = nil, executionStatus: ExecutionStatus? = nil, includeNestedStacks: Bool? = nil, nextToken: String? = nil, notificationARNs: [String]? = nil, parameters: [Parameter]? = nil, parentChangeSetId: String? = nil, rollbackConfiguration: RollbackConfiguration? = nil, rootChangeSetId: String? = nil, stackId: String? = nil, stackName: String? = nil, status: ChangeSetStatus? = nil, statusReason: String? = nil, tags: [Tag]? = nil) {
self.capabilities = capabilities
self.changes = changes
self.changeSetId = changeSetId
self.changeSetName = changeSetName
self.creationTime = creationTime
self.description = description
self.executionStatus = executionStatus
self.includeNestedStacks = includeNestedStacks
self.nextToken = nextToken
self.notificationARNs = notificationARNs
self.parameters = parameters
self.parentChangeSetId = parentChangeSetId
self.rollbackConfiguration = rollbackConfiguration
self.rootChangeSetId = rootChangeSetId
self.stackId = stackId
self.stackName = stackName
self.status = status
self.statusReason = statusReason
self.tags = tags
}
private enum CodingKeys: String, CodingKey {
case capabilities = "Capabilities"
case changes = "Changes"
case changeSetId = "ChangeSetId"
case changeSetName = "ChangeSetName"
case creationTime = "CreationTime"
case description = "Description"
case executionStatus = "ExecutionStatus"
case includeNestedStacks = "IncludeNestedStacks"
case nextToken = "NextToken"
case notificationARNs = "NotificationARNs"
case parameters = "Parameters"
case parentChangeSetId = "ParentChangeSetId"
case rollbackConfiguration = "RollbackConfiguration"
case rootChangeSetId = "RootChangeSetId"
case stackId = "StackId"
case stackName = "StackName"
case status = "Status"
case statusReason = "StatusReason"
case tags = "Tags"
}
}
public struct DescribePublisherInput: AWSEncodableShape {
/// The ID of the extension publisher. If you do not supply a PublisherId, and you have registered as an extension publisher, DescribePublisher returns information about your own publisher account.
public let publisherId: String?
public init(publisherId: String? = nil) {
self.publisherId = publisherId
}
public func validate(name: String) throws {
try self.validate(self.publisherId, name: "publisherId", parent: name, max: 40)
try self.validate(self.publisherId, name: "publisherId", parent: name, min: 1)
try self.validate(self.publisherId, name: "publisherId", parent: name, pattern: "[0-9a-zA-Z]{12,40}")
}
private enum CodingKeys: String, CodingKey {
case publisherId = "PublisherId"
}
}
public struct DescribePublisherOutput: AWSDecodableShape {
/// The type of account used as the identity provider when registering this publisher with CloudFormation.
public let identityProvider: IdentityProvider?
/// The ID of the extension publisher.
public let publisherId: String?
/// The URL to the publisher's profile with the identity provider.
public let publisherProfile: String?
/// Whether the publisher is verified. Currently, all registered publishers are verified.
public let publisherStatus: PublisherStatus?
public init(identityProvider: IdentityProvider? = nil, publisherId: String? = nil, publisherProfile: String? = nil, publisherStatus: PublisherStatus? = nil) {
self.identityProvider = identityProvider
self.publisherId = publisherId
self.publisherProfile = publisherProfile
self.publisherStatus = publisherStatus
}
private enum CodingKeys: String, CodingKey {
case identityProvider = "IdentityProvider"
case publisherId = "PublisherId"
case publisherProfile = "PublisherProfile"
case publisherStatus = "PublisherStatus"
}
}
public struct DescribeStackDriftDetectionStatusInput: AWSEncodableShape {
/// The ID of the drift detection results of this operation. AWS CloudFormation generates new results, with a new drift detection ID, each time this operation is run. However, the number of drift results AWS CloudFormation retains for any given stack, and for how long, may vary.
public let stackDriftDetectionId: String
public init(stackDriftDetectionId: String) {
self.stackDriftDetectionId = stackDriftDetectionId
}
public func validate(name: String) throws {
try self.validate(self.stackDriftDetectionId, name: "stackDriftDetectionId", parent: name, max: 36)
try self.validate(self.stackDriftDetectionId, name: "stackDriftDetectionId", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case stackDriftDetectionId = "StackDriftDetectionId"
}
}
public struct DescribeStackDriftDetectionStatusOutput: AWSDecodableShape {
/// The status of the stack drift detection operation. DETECTION_COMPLETE: The stack drift detection operation has successfully completed for all resources in the stack that support drift detection. (Resources that do not currently support stack detection remain unchecked.) If you specified logical resource IDs for AWS CloudFormation to use as a filter for the stack drift detection operation, only the resources with those logical IDs are checked for drift. DETECTION_FAILED: The stack drift detection operation has failed for at least one resource in the stack. Results will be available for resources on which AWS CloudFormation successfully completed drift detection. DETECTION_IN_PROGRESS: The stack drift detection operation is currently in progress.
public let detectionStatus: StackDriftDetectionStatus
/// The reason the stack drift detection operation has its current status.
public let detectionStatusReason: String?
/// Total number of stack resources that have drifted. This is NULL until the drift detection operation reaches a status of DETECTION_COMPLETE. This value will be 0 for stacks whose drift status is IN_SYNC.
public let driftedStackResourceCount: Int?
/// The ID of the drift detection results of this operation. AWS CloudFormation generates new results, with a new drift detection ID, each time this operation is run. However, the number of reports AWS CloudFormation retains for any given stack, and for how long, may vary.
public let stackDriftDetectionId: String
/// Status of the stack's actual configuration compared to its expected configuration. DRIFTED: The stack differs from its expected template configuration. A stack is considered to have drifted if one or more of its resources have drifted. NOT_CHECKED: AWS CloudFormation has not checked if the stack differs from its expected template configuration. IN_SYNC: The stack's actual configuration matches its expected template configuration. UNKNOWN: This value is reserved for future use.
public let stackDriftStatus: StackDriftStatus?
/// The ID of the stack.
public let stackId: String
/// Time at which the stack drift detection operation was initiated.
public let timestamp: Date
public init(detectionStatus: StackDriftDetectionStatus, detectionStatusReason: String? = nil, driftedStackResourceCount: Int? = nil, stackDriftDetectionId: String, stackDriftStatus: StackDriftStatus? = nil, stackId: String, timestamp: Date) {
self.detectionStatus = detectionStatus
self.detectionStatusReason = detectionStatusReason
self.driftedStackResourceCount = driftedStackResourceCount
self.stackDriftDetectionId = stackDriftDetectionId
self.stackDriftStatus = stackDriftStatus
self.stackId = stackId
self.timestamp = timestamp
}
private enum CodingKeys: String, CodingKey {
case detectionStatus = "DetectionStatus"
case detectionStatusReason = "DetectionStatusReason"
case driftedStackResourceCount = "DriftedStackResourceCount"
case stackDriftDetectionId = "StackDriftDetectionId"
case stackDriftStatus = "StackDriftStatus"
case stackId = "StackId"
case timestamp = "Timestamp"
}
}
public struct DescribeStackEventsInput: AWSEncodableShape {
/// A string that identifies the next page of events that you want to retrieve.
public let nextToken: String?
/// The name or the unique stack ID that is associated with the stack, which are not always interchangeable: Running stacks: You can specify either the stack's name or its unique stack ID. Deleted stacks: You must specify the unique stack ID. Default: There is no default value.
public let stackName: String?
public init(nextToken: String? = nil, stackName: String? = nil) {
self.nextToken = nextToken
self.stackName = stackName
}
public func validate(name: String) throws {
try self.validate(self.nextToken, name: "nextToken", parent: name, max: 1024)
try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case nextToken = "NextToken"
case stackName = "StackName"
}
}
public struct DescribeStackEventsOutput: AWSDecodableShape {
/// If the output exceeds 1 MB in size, a string that identifies the next page of events. If no additional page exists, this value is null.
public let nextToken: String?
/// A list of StackEvents structures.
@OptionalCustomCoding<StandardArrayCoder>
public var stackEvents: [StackEvent]?
public init(nextToken: String? = nil, stackEvents: [StackEvent]? = nil) {
self.nextToken = nextToken
self.stackEvents = stackEvents
}
private enum CodingKeys: String, CodingKey {
case nextToken = "NextToken"
case stackEvents = "StackEvents"
}
}
public struct DescribeStackInstanceInput: AWSEncodableShape {
/// [Service-managed permissions] Specifies whether you are acting as an account administrator in the organization's management account or as a delegated administrator in a member account. By default, SELF is specified. Use SELF for stack sets with self-managed permissions. If you are signed in to the management account, specify SELF. If you are signed in to a delegated administrator account, specify DELEGATED_ADMIN. Your AWS account must be registered as a delegated administrator in the management account. For more information, see Register a delegated administrator in the AWS CloudFormation User Guide.
public let callAs: CallAs?
/// The ID of an AWS account that's associated with this stack instance.
public let stackInstanceAccount: String
/// The name of a Region that's associated with this stack instance.
public let stackInstanceRegion: String
/// The name or the unique stack ID of the stack set that you want to get stack instance information for.
public let stackSetName: String
public init(callAs: CallAs? = nil, stackInstanceAccount: String, stackInstanceRegion: String, stackSetName: String) {
self.callAs = callAs
self.stackInstanceAccount = stackInstanceAccount
self.stackInstanceRegion = stackInstanceRegion
self.stackSetName = stackSetName
}
public func validate(name: String) throws {
try self.validate(self.stackInstanceAccount, name: "stackInstanceAccount", parent: name, pattern: "^[0-9]{12}$")
try self.validate(self.stackInstanceRegion, name: "stackInstanceRegion", parent: name, pattern: "^[a-zA-Z0-9-]{1,128}$")
}
private enum CodingKeys: String, CodingKey {
case callAs = "CallAs"
case stackInstanceAccount = "StackInstanceAccount"
case stackInstanceRegion = "StackInstanceRegion"
case stackSetName = "StackSetName"
}
}
public struct DescribeStackInstanceOutput: AWSDecodableShape {
/// The stack instance that matches the specified request parameters.
public let stackInstance: StackInstance?
public init(stackInstance: StackInstance? = nil) {
self.stackInstance = stackInstance
}
private enum CodingKeys: String, CodingKey {
case stackInstance = "StackInstance"
}
}
public struct DescribeStackResourceDriftsInput: AWSEncodableShape {
/// The maximum number of results to be returned with a single call. If the number of available results exceeds this maximum, the response includes a NextToken value that you can assign to the NextToken request parameter to get the next set of results.
public let maxResults: Int?
/// A string that identifies the next page of stack resource drift results.
public let nextToken: String?
/// The name of the stack for which you want drift information.
public let stackName: String
/// The resource drift status values to use as filters for the resource drift results returned. DELETED: The resource differs from its expected template configuration in that the resource has been deleted. MODIFIED: One or more resource properties differ from their expected template values. IN_SYNC: The resources's actual configuration matches its expected template configuration. NOT_CHECKED: AWS CloudFormation does not currently return this value.
@OptionalCustomCoding<StandardArrayCoder>
public var stackResourceDriftStatusFilters: [StackResourceDriftStatus]?
public init(maxResults: Int? = nil, nextToken: String? = nil, stackName: String, stackResourceDriftStatusFilters: [StackResourceDriftStatus]? = nil) {
self.maxResults = maxResults
self.nextToken = nextToken
self.stackName = stackName
self.stackResourceDriftStatusFilters = stackResourceDriftStatusFilters
}
public func validate(name: String) throws {
try self.validate(self.maxResults, name: "maxResults", parent: name, max: 100)
try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
try self.validate(self.nextToken, name: "nextToken", parent: name, max: 1024)
try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
try self.validate(self.stackName, name: "stackName", parent: name, min: 1)
try self.validate(self.stackName, name: "stackName", parent: name, pattern: "([a-zA-Z][-a-zA-Z0-9]*)|(arn:\\b(aws|aws-us-gov|aws-cn)\\b:[-a-zA-Z0-9:/._+]*)")
try self.validate(self.stackResourceDriftStatusFilters, name: "stackResourceDriftStatusFilters", parent: name, max: 4)
try self.validate(self.stackResourceDriftStatusFilters, name: "stackResourceDriftStatusFilters", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case maxResults = "MaxResults"
case nextToken = "NextToken"
case stackName = "StackName"
case stackResourceDriftStatusFilters = "StackResourceDriftStatusFilters"
}
}
public struct DescribeStackResourceDriftsOutput: AWSDecodableShape {
/// If the request doesn't return all of the remaining results, NextToken is set to a token. To retrieve the next set of results, call DescribeStackResourceDrifts again and assign that token to the request object's NextToken parameter. If the request returns all results, NextToken is set to null.
public let nextToken: String?
/// Drift information for the resources that have been checked for drift in the specified stack. This includes actual and expected configuration values for resources where AWS CloudFormation detects drift. For a given stack, there will be one StackResourceDrift for each stack resource that has been checked for drift. Resources that have not yet been checked for drift are not included. Resources that do not currently support drift detection are not checked, and so not included. For a list of resources that support drift detection, see Resources that Support Drift Detection.
@CustomCoding<StandardArrayCoder>
public var stackResourceDrifts: [StackResourceDrift]
public init(nextToken: String? = nil, stackResourceDrifts: [StackResourceDrift]) {
self.nextToken = nextToken
self.stackResourceDrifts = stackResourceDrifts
}
private enum CodingKeys: String, CodingKey {
case nextToken = "NextToken"
case stackResourceDrifts = "StackResourceDrifts"
}
}
public struct DescribeStackResourceInput: AWSEncodableShape {
/// The logical name of the resource as specified in the template. Default: There is no default value.
public let logicalResourceId: String
/// The name or the unique stack ID that is associated with the stack, which are not always interchangeable: Running stacks: You can specify either the stack's name or its unique stack ID. Deleted stacks: You must specify the unique stack ID. Default: There is no default value.
public let stackName: String
public init(logicalResourceId: String, stackName: String) {
self.logicalResourceId = logicalResourceId
self.stackName = stackName
}
private enum CodingKeys: String, CodingKey {
case logicalResourceId = "LogicalResourceId"
case stackName = "StackName"
}
}
public struct DescribeStackResourceOutput: AWSDecodableShape {
/// A StackResourceDetail structure containing the description of the specified resource in the specified stack.
public let stackResourceDetail: StackResourceDetail?
public init(stackResourceDetail: StackResourceDetail? = nil) {
self.stackResourceDetail = stackResourceDetail
}
private enum CodingKeys: String, CodingKey {
case stackResourceDetail = "StackResourceDetail"
}
}
public struct DescribeStackResourcesInput: AWSEncodableShape {
/// The logical name of the resource as specified in the template. Default: There is no default value.
public let logicalResourceId: String?
/// The name or unique identifier that corresponds to a physical instance ID of a resource supported by AWS CloudFormation. For example, for an Amazon Elastic Compute Cloud (EC2) instance, PhysicalResourceId corresponds to the InstanceId. You can pass the EC2 InstanceId to DescribeStackResources to find which stack the instance belongs to and what other resources are part of the stack. Required: Conditional. If you do not specify PhysicalResourceId, you must specify StackName. Default: There is no default value.
public let physicalResourceId: String?
/// The name or the unique stack ID that is associated with the stack, which are not always interchangeable: Running stacks: You can specify either the stack's name or its unique stack ID. Deleted stacks: You must specify the unique stack ID. Default: There is no default value. Required: Conditional. If you do not specify StackName, you must specify PhysicalResourceId.
public let stackName: String?
public init(logicalResourceId: String? = nil, physicalResourceId: String? = nil, stackName: String? = nil) {
self.logicalResourceId = logicalResourceId
self.physicalResourceId = physicalResourceId
self.stackName = stackName
}
private enum CodingKeys: String, CodingKey {
case logicalResourceId = "LogicalResourceId"
case physicalResourceId = "PhysicalResourceId"
case stackName = "StackName"
}
}
public struct DescribeStackResourcesOutput: AWSDecodableShape {
/// A list of StackResource structures.
@OptionalCustomCoding<StandardArrayCoder>
public var stackResources: [StackResource]?
public init(stackResources: [StackResource]? = nil) {
self.stackResources = stackResources
}
private enum CodingKeys: String, CodingKey {
case stackResources = "StackResources"
}
}
public struct DescribeStackSetInput: AWSEncodableShape {
/// [Service-managed permissions] Specifies whether you are acting as an account administrator in the organization's management account or as a delegated administrator in a member account. By default, SELF is specified. Use SELF for stack sets with self-managed permissions. If you are signed in to the management account, specify SELF. If you are signed in to a delegated administrator account, specify DELEGATED_ADMIN. Your AWS account must be registered as a delegated administrator in the management account. For more information, see Register a delegated administrator in the AWS CloudFormation User Guide.
public let callAs: CallAs?
/// The name or unique ID of the stack set whose description you want.
public let stackSetName: String
public init(callAs: CallAs? = nil, stackSetName: String) {
self.callAs = callAs
self.stackSetName = stackSetName
}
private enum CodingKeys: String, CodingKey {
case callAs = "CallAs"
case stackSetName = "StackSetName"
}
}
public struct DescribeStackSetOperationInput: AWSEncodableShape {
/// [Service-managed permissions] Specifies whether you are acting as an account administrator in the organization's management account or as a delegated administrator in a member account. By default, SELF is specified. Use SELF for stack sets with self-managed permissions. If you are signed in to the management account, specify SELF. If you are signed in to a delegated administrator account, specify DELEGATED_ADMIN. Your AWS account must be registered as a delegated administrator in the management account. For more information, see Register a delegated administrator in the AWS CloudFormation User Guide.
public let callAs: CallAs?
/// The unique ID of the stack set operation.
public let operationId: String
/// The name or the unique stack ID of the stack set for the stack operation.
public let stackSetName: String
public init(callAs: CallAs? = nil, operationId: String, stackSetName: String) {
self.callAs = callAs
self.operationId = operationId
self.stackSetName = stackSetName
}
public func validate(name: String) throws {
try self.validate(self.operationId, name: "operationId", parent: name, max: 128)
try self.validate(self.operationId, name: "operationId", parent: name, min: 1)
try self.validate(self.operationId, name: "operationId", parent: name, pattern: "[a-zA-Z0-9][-a-zA-Z0-9]*")
}
private enum CodingKeys: String, CodingKey {
case callAs = "CallAs"
case operationId = "OperationId"
case stackSetName = "StackSetName"
}
}
public struct DescribeStackSetOperationOutput: AWSDecodableShape {
/// The specified stack set operation.
public let stackSetOperation: StackSetOperation?
public init(stackSetOperation: StackSetOperation? = nil) {
self.stackSetOperation = stackSetOperation
}
private enum CodingKeys: String, CodingKey {
case stackSetOperation = "StackSetOperation"
}
}
public struct DescribeStackSetOutput: AWSDecodableShape {
/// The specified stack set.
public let stackSet: StackSet?
public init(stackSet: StackSet? = nil) {
self.stackSet = stackSet
}
private enum CodingKeys: String, CodingKey {
case stackSet = "StackSet"
}
}
public struct DescribeStacksInput: AWSEncodableShape {
/// A string that identifies the next page of stacks that you want to retrieve.
public let nextToken: String?
/// The name or the unique stack ID that is associated with the stack, which are not always interchangeable: Running stacks: You can specify either the stack's name or its unique stack ID. Deleted stacks: You must specify the unique stack ID. Default: There is no default value.
public let stackName: String?
public init(nextToken: String? = nil, stackName: String? = nil) {
self.nextToken = nextToken
self.stackName = stackName
}
public func validate(name: String) throws {
try self.validate(self.nextToken, name: "nextToken", parent: name, max: 1024)
try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case nextToken = "NextToken"
case stackName = "StackName"
}
}
public struct DescribeStacksOutput: AWSDecodableShape {
/// If the output exceeds 1 MB in size, a string that identifies the next page of stacks. If no additional page exists, this value is null.
public let nextToken: String?
/// A list of stack structures.
@OptionalCustomCoding<StandardArrayCoder>
public var stacks: [Stack]?
public init(nextToken: String? = nil, stacks: [Stack]? = nil) {
self.nextToken = nextToken
self.stacks = stacks
}
private enum CodingKeys: String, CodingKey {
case nextToken = "NextToken"
case stacks = "Stacks"
}
}
public struct DescribeTypeInput: AWSEncodableShape {
/// The Amazon Resource Name (ARN) of the extension. Conditional: You must specify either TypeName and Type, or Arn.
public let arn: String?
/// The version number of a public third-party extension.
public let publicVersionNumber: String?
/// The publisher ID of the extension publisher. Extensions provided by Amazon are not assigned a publisher ID.
public let publisherId: String?
/// The kind of extension. Conditional: You must specify either TypeName and Type, or Arn.
public let type: RegistryType?
/// The name of the extension. Conditional: You must specify either TypeName and Type, or Arn.
public let typeName: String?
/// The ID of a specific version of the extension. The version ID is the value at the end of the Amazon Resource Name (ARN) assigned to the extension version when it is registered. If you specify a VersionId, DescribeType returns information about that specific extension version. Otherwise, it returns information about the default extension version.
public let versionId: String?
public init(arn: String? = nil, publicVersionNumber: String? = nil, publisherId: String? = nil, type: RegistryType? = nil, typeName: String? = nil, versionId: String? = nil) {
self.arn = arn
self.publicVersionNumber = publicVersionNumber
self.publisherId = publisherId
self.type = type
self.typeName = typeName
self.versionId = versionId
}
public func validate(name: String) throws {
try self.validate(self.arn, name: "arn", parent: name, max: 1024)
try self.validate(self.arn, name: "arn", parent: name, pattern: "arn:aws[A-Za-z0-9-]{0,64}:cloudformation:[A-Za-z0-9-]{1,64}:([0-9]{12})?:type/.+")
try self.validate(self.publicVersionNumber, name: "publicVersionNumber", parent: name, min: 5)
try self.validate(self.publicVersionNumber, name: "publicVersionNumber", parent: name, pattern: "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(.*)$")
try self.validate(self.publisherId, name: "publisherId", parent: name, max: 40)
try self.validate(self.publisherId, name: "publisherId", parent: name, min: 1)
try self.validate(self.publisherId, name: "publisherId", parent: name, pattern: "[0-9a-zA-Z]{12,40}")
try self.validate(self.typeName, name: "typeName", parent: name, max: 204)
try self.validate(self.typeName, name: "typeName", parent: name, min: 10)
try self.validate(self.typeName, name: "typeName", parent: name, pattern: "[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}(::MODULE){0,1}")
try self.validate(self.versionId, name: "versionId", parent: name, max: 128)
try self.validate(self.versionId, name: "versionId", parent: name, min: 1)
try self.validate(self.versionId, name: "versionId", parent: name, pattern: "[A-Za-z0-9-]+")
}
private enum CodingKeys: String, CodingKey {
case arn = "Arn"
case publicVersionNumber = "PublicVersionNumber"
case publisherId = "PublisherId"
case type = "Type"
case typeName = "TypeName"
case versionId = "VersionId"
}
}
public struct DescribeTypeOutput: AWSDecodableShape {
/// The Amazon Resource Name (ARN) of the extension.
public let arn: String?
/// Whether CloudFormation automatically updates the extension in this account and region when a new minor version is published by the extension publisher. Major versions released by the publisher must be manually updated. For more information, see Activating public extensions for use in your account in the AWS CloudFormation User Guide.
public let autoUpdate: Bool?
/// A JSON string that represent the current configuration data for the extension in this account and region. To set the configuration data for an extension, use SetTypeConfiguration. For more information, see Configuring extensions at the account level in the CloudFormation User Guide.
public let configurationSchema: String?
/// The ID of the default version of the extension. The default version is used when the extension version is not specified. This applies only to private extensions you have registered in your account. For public extensions, both those provided by Amazon and published by third parties, CloudFormation returns null. For more information, see RegisterType. To set the default version of an extension, use SetTypeDefaultVersion .
public let defaultVersionId: String?
/// The deprecation status of the extension version. Valid values include: LIVE: The extension is activated or registered and can be used in CloudFormation operations, dependent on its provisioning behavior and visibility scope. DEPRECATED: The extension has been deactivated or deregistered and can no longer be used in CloudFormation operations. For public third-party extensions, CloudFormation returns null.
public let deprecatedStatus: DeprecatedStatus?
/// The description of the extension.
public let description: String?
/// The URL of a page providing detailed documentation for this extension.
public let documentationUrl: String?
/// The Amazon Resource Name (ARN) of the IAM execution role used to register the extension. This applies only to private extensions you have registered in your account. For more information, see RegisterType. If the registered extension calls any AWS APIs, you must create an IAM execution role that includes the necessary permissions to call those AWS APIs, and provision that execution role in your account. CloudFormation then assumes that execution role to provide your extension with the appropriate credentials.
public let executionRoleArn: String?
/// Whether or not the extension is activated in the account and region. This only applies to public third-party extensions. For all other extensions, CloudFormation returns null.
public let isActivated: Bool?
/// Whether the specified extension version is set as the default version. This applies only to private extensions you have registered in your account, and extensions published by Amazon. For public third-party extensions, whether or not they are activated in your account, CloudFormation returns null.
public let isDefaultVersion: Bool?
/// When the specified extension version was registered. This applies only to: Private extensions you have registered in your account. For more information, see RegisterType. Public extensions you have activated in your account with auto-update specified. For more information, see ActivateType.
public let lastUpdated: Date?
/// The latest version of a public extension that is available for use. This only applies if you specify a public extension, and you do not specify a version. For all other requests, CloudFormation returns null.
public let latestPublicVersion: String?
/// Contains logging configuration information for private extensions. This applies only to private extensions you have registered in your account. For public extensions, both those provided by Amazon and published by third parties, CloudFormation returns null. For more information, see RegisterType.
public let loggingConfig: LoggingConfig?
/// For public extensions that have been activated for this account and region, the Amazon Resource Name (ARN) of the public extension.
public let originalTypeArn: String?
/// For public extensions that have been activated for this account and region, the type name of the public extension. If you specified a TypeNameAlias when enabling the extension in this account and region, CloudFormation treats that alias as the extension's type name within the account and region, not the type name of the public extension. For more information, see Specifying aliases to refer to extensions in the CloudFormation User Guide.
public let originalTypeName: String?
/// For resource type extensions, the provisioning behavior of the resource type. AWS CloudFormation determines the provisioning type during registration, based on the types of handlers in the schema handler package submitted. Valid values include: FULLY_MUTABLE: The resource type includes an update handler to process updates to the type during stack update operations. IMMUTABLE: The resource type does not include an update handler, so the type cannot be updated and must instead be replaced during stack update operations. NON_PROVISIONABLE: The resource type does not include all of the following handlers, and therefore cannot actually be provisioned. create read delete
public let provisioningType: ProvisioningType?
/// The version number of a public third-party extension. This applies only if you specify a public extension you have activated in your account, or specify a public extension without specifying a version. For all other extensions, CloudFormation returns null.
public let publicVersionNumber: String?
/// The publisher ID of the extension publisher. This applies only to public third-party extensions. For private registered extensions, and extensions provided by Amazon, CloudFormation returns null.
public let publisherId: String?
/// For extensions that are modules, the public third-party extensions that must be activated in your account in order for the module itself to be activated.
@OptionalCustomCoding<StandardArrayCoder>
public var requiredActivatedTypes: [RequiredActivatedType]?
/// The schema that defines the extension. For more information on extension schemas, see Resource Provider Schema in the CloudFormation CLI User Guide.
public let schema: String?
/// The URL of the source code for the extension.
public let sourceUrl: String?
/// When the specified private extension version was registered or activated in your account.
public let timeCreated: Date?
/// The kind of extension.
public let type: RegistryType?
/// The name of the extension. If the extension is a public third-party type you have activated with a type name alias, CloudFormation returns the type name alias. For more information, see ActivateType.
public let typeName: String?
/// The contract test status of the registered extension version. To return the extension test status of a specifc extension version, you must specify VersionId. This applies only to registered private extension versions. CloudFormation does not return this information for public extensions, whether or not they are activated in your account. PASSED: The extension has passed all its contract tests. An extension must have a test status of PASSED before it can be published. For more information, see Publishing extensions to make them available for public use in the CloudFormation Command Line Interface User Guide. FAILED: The extension has failed one or more contract tests. IN_PROGRESS: Contract tests are currently being performed on the extension. NOT_TESTED: Contract tests have not been performed on the extension.
public let typeTestsStatus: TypeTestsStatus?
/// The description of the test status. To return the extension test status of a specifc extension version, you must specify VersionId. This applies only to registered private extension versions. CloudFormation does not return this information for public extensions, whether or not they are activated in your account.
public let typeTestsStatusDescription: String?
/// The scope at which the extension is visible and usable in CloudFormation operations. Valid values include: PRIVATE: The extension is only visible and usable within the account in which it is registered. AWS CloudFormation marks any extensions you register as PRIVATE. PUBLIC: The extension is publically visible and usable within any Amazon account.
public let visibility: Visibility?
public init(arn: String? = nil, autoUpdate: Bool? = nil, configurationSchema: String? = nil, defaultVersionId: String? = nil, deprecatedStatus: DeprecatedStatus? = nil, description: String? = nil, documentationUrl: String? = nil, executionRoleArn: String? = nil, isActivated: Bool? = nil, isDefaultVersion: Bool? = nil, lastUpdated: Date? = nil, latestPublicVersion: String? = nil, loggingConfig: LoggingConfig? = nil, originalTypeArn: String? = nil, originalTypeName: String? = nil, provisioningType: ProvisioningType? = nil, publicVersionNumber: String? = nil, publisherId: String? = nil, requiredActivatedTypes: [RequiredActivatedType]? = nil, schema: String? = nil, sourceUrl: String? = nil, timeCreated: Date? = nil, type: RegistryType? = nil, typeName: String? = nil, typeTestsStatus: TypeTestsStatus? = nil, typeTestsStatusDescription: String? = nil, visibility: Visibility? = nil) {
self.arn = arn
self.autoUpdate = autoUpdate
self.configurationSchema = configurationSchema
self.defaultVersionId = defaultVersionId
self.deprecatedStatus = deprecatedStatus
self.description = description
self.documentationUrl = documentationUrl
self.executionRoleArn = executionRoleArn
self.isActivated = isActivated
self.isDefaultVersion = isDefaultVersion
self.lastUpdated = lastUpdated
self.latestPublicVersion = latestPublicVersion
self.loggingConfig = loggingConfig
self.originalTypeArn = originalTypeArn
self.originalTypeName = originalTypeName
self.provisioningType = provisioningType
self.publicVersionNumber = publicVersionNumber
self.publisherId = publisherId
self.requiredActivatedTypes = requiredActivatedTypes
self.schema = schema
self.sourceUrl = sourceUrl
self.timeCreated = timeCreated
self.type = type
self.typeName = typeName
self.typeTestsStatus = typeTestsStatus
self.typeTestsStatusDescription = typeTestsStatusDescription
self.visibility = visibility
}
private enum CodingKeys: String, CodingKey {
case arn = "Arn"
case autoUpdate = "AutoUpdate"
case configurationSchema = "ConfigurationSchema"
case defaultVersionId = "DefaultVersionId"
case deprecatedStatus = "DeprecatedStatus"
case description = "Description"
case documentationUrl = "DocumentationUrl"
case executionRoleArn = "ExecutionRoleArn"
case isActivated = "IsActivated"
case isDefaultVersion = "IsDefaultVersion"
case lastUpdated = "LastUpdated"
case latestPublicVersion = "LatestPublicVersion"
case loggingConfig = "LoggingConfig"
case originalTypeArn = "OriginalTypeArn"
case originalTypeName = "OriginalTypeName"
case provisioningType = "ProvisioningType"
case publicVersionNumber = "PublicVersionNumber"
case publisherId = "PublisherId"
case requiredActivatedTypes = "RequiredActivatedTypes"
case schema = "Schema"
case sourceUrl = "SourceUrl"
case timeCreated = "TimeCreated"
case type = "Type"
case typeName = "TypeName"
case typeTestsStatus = "TypeTestsStatus"
case typeTestsStatusDescription = "TypeTestsStatusDescription"
case visibility = "Visibility"
}
}
public struct DescribeTypeRegistrationInput: AWSEncodableShape {
/// The identifier for this registration request. This registration token is generated by CloudFormation when you initiate a registration request using RegisterType .
public let registrationToken: String
public init(registrationToken: String) {
self.registrationToken = registrationToken
}
public func validate(name: String) throws {
try self.validate(self.registrationToken, name: "registrationToken", parent: name, max: 128)
try self.validate(self.registrationToken, name: "registrationToken", parent: name, min: 1)
try self.validate(self.registrationToken, name: "registrationToken", parent: name, pattern: "[a-zA-Z0-9][-a-zA-Z0-9]*")
}
private enum CodingKeys: String, CodingKey {
case registrationToken = "RegistrationToken"
}
}
public struct DescribeTypeRegistrationOutput: AWSDecodableShape {
/// The description of the extension registration request.
public let description: String?
/// The current status of the extension registration request.
public let progressStatus: RegistrationStatus?
/// The Amazon Resource Name (ARN) of the extension being registered. For registration requests with a ProgressStatus of other than COMPLETE, this will be null.
public let typeArn: String?
/// The Amazon Resource Name (ARN) of this specific version of the extension being registered. For registration requests with a ProgressStatus of other than COMPLETE, this will be null.
public let typeVersionArn: String?
public init(description: String? = nil, progressStatus: RegistrationStatus? = nil, typeArn: String? = nil, typeVersionArn: String? = nil) {
self.description = description
self.progressStatus = progressStatus
self.typeArn = typeArn
self.typeVersionArn = typeVersionArn
}
private enum CodingKeys: String, CodingKey {
case description = "Description"
case progressStatus = "ProgressStatus"
case typeArn = "TypeArn"
case typeVersionArn = "TypeVersionArn"
}
}
public struct DetectStackDriftInput: AWSEncodableShape {
/// The logical names of any resources you want to use as filters.
@OptionalCustomCoding<StandardArrayCoder>
public var logicalResourceIds: [String]?
/// The name of the stack for which you want to detect drift.
public let stackName: String
public init(logicalResourceIds: [String]? = nil, stackName: String) {
self.logicalResourceIds = logicalResourceIds
self.stackName = stackName
}
public func validate(name: String) throws {
try self.validate(self.logicalResourceIds, name: "logicalResourceIds", parent: name, max: 200)
try self.validate(self.logicalResourceIds, name: "logicalResourceIds", parent: name, min: 1)
try self.validate(self.stackName, name: "stackName", parent: name, min: 1)
try self.validate(self.stackName, name: "stackName", parent: name, pattern: "([a-zA-Z][-a-zA-Z0-9]*)|(arn:\\b(aws|aws-us-gov|aws-cn)\\b:[-a-zA-Z0-9:/._+]*)")
}
private enum CodingKeys: String, CodingKey {
case logicalResourceIds = "LogicalResourceIds"
case stackName = "StackName"
}
}
public struct DetectStackDriftOutput: AWSDecodableShape {
/// The ID of the drift detection results of this operation. AWS CloudFormation generates new results, with a new drift detection ID, each time this operation is run. However, the number of drift results AWS CloudFormation retains for any given stack, and for how long, may vary.
public let stackDriftDetectionId: String
public init(stackDriftDetectionId: String) {
self.stackDriftDetectionId = stackDriftDetectionId
}
private enum CodingKeys: String, CodingKey {
case stackDriftDetectionId = "StackDriftDetectionId"
}
}
public struct DetectStackResourceDriftInput: AWSEncodableShape {
/// The logical name of the resource for which to return drift information.
public let logicalResourceId: String
/// The name of the stack to which the resource belongs.
public let stackName: String
public init(logicalResourceId: String, stackName: String) {
self.logicalResourceId = logicalResourceId
self.stackName = stackName
}
public func validate(name: String) throws {
try self.validate(self.stackName, name: "stackName", parent: name, min: 1)
try self.validate(self.stackName, name: "stackName", parent: name, pattern: "([a-zA-Z][-a-zA-Z0-9]*)|(arn:\\b(aws|aws-us-gov|aws-cn)\\b:[-a-zA-Z0-9:/._+]*)")
}
private enum CodingKeys: String, CodingKey {
case logicalResourceId = "LogicalResourceId"
case stackName = "StackName"
}
}
public struct DetectStackResourceDriftOutput: AWSDecodableShape {
/// Information about whether the resource's actual configuration has drifted from its expected template configuration, including actual and expected property values and any differences detected.
public let stackResourceDrift: StackResourceDrift
public init(stackResourceDrift: StackResourceDrift) {
self.stackResourceDrift = stackResourceDrift
}
private enum CodingKeys: String, CodingKey {
case stackResourceDrift = "StackResourceDrift"
}
}
public struct DetectStackSetDriftInput: AWSEncodableShape {
/// [Service-managed permissions] Specifies whether you are acting as an account administrator in the organization's management account or as a delegated administrator in a member account. By default, SELF is specified. Use SELF for stack sets with self-managed permissions. If you are signed in to the management account, specify SELF. If you are signed in to a delegated administrator account, specify DELEGATED_ADMIN. Your AWS account must be registered as a delegated administrator in the management account. For more information, see Register a delegated administrator in the AWS CloudFormation User Guide.
public let callAs: CallAs?
/// The ID of the stack set operation.
public let operationId: String?
public let operationPreferences: StackSetOperationPreferences?
/// The name of the stack set on which to perform the drift detection operation.
public let stackSetName: String
public init(callAs: CallAs? = nil, operationId: String? = DetectStackSetDriftInput.idempotencyToken(), operationPreferences: StackSetOperationPreferences? = nil, stackSetName: String) {
self.callAs = callAs
self.operationId = operationId
self.operationPreferences = operationPreferences
self.stackSetName = stackSetName
}
public func validate(name: String) throws {
try self.validate(self.operationId, name: "operationId", parent: name, max: 128)
try self.validate(self.operationId, name: "operationId", parent: name, min: 1)
try self.validate(self.operationId, name: "operationId", parent: name, pattern: "[a-zA-Z0-9][-a-zA-Z0-9]*")
try self.operationPreferences?.validate(name: "\(name).operationPreferences")
try self.validate(self.stackSetName, name: "stackSetName", parent: name, pattern: "[a-zA-Z][-a-zA-Z0-9]*(?::[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12})?")
}
private enum CodingKeys: String, CodingKey {
case callAs = "CallAs"
case operationId = "OperationId"
case operationPreferences = "OperationPreferences"
case stackSetName = "StackSetName"
}
}
public struct DetectStackSetDriftOutput: AWSDecodableShape {
/// The ID of the drift detection stack set operation. you can use this operation id with DescribeStackSetOperation to monitor the progress of the drift detection operation.
public let operationId: String?
public init(operationId: String? = nil) {
self.operationId = operationId
}
private enum CodingKeys: String, CodingKey {
case operationId = "OperationId"
}
}
public struct EstimateTemplateCostInput: AWSEncodableShape {
/// A list of Parameter structures that specify input parameters.
@OptionalCustomCoding<StandardArrayCoder>
public var parameters: [Parameter]?
/// Structure containing the template body with a minimum length of 1 byte and a maximum length of 51,200 bytes. (For more information, go to Template Anatomy in the AWS CloudFormation User Guide.) Conditional: You must pass TemplateBody or TemplateURL. If both are passed, only TemplateBody is used.
public let templateBody: String?
/// Location of file containing the template body. The URL must point to a template that is located in an Amazon S3 bucket or a Systems Manager document. For more information, go to Template Anatomy in the AWS CloudFormation User Guide. Conditional: You must pass TemplateURL or TemplateBody. If both are passed, only TemplateBody is used.
public let templateURL: String?
public init(parameters: [Parameter]? = nil, templateBody: String? = nil, templateURL: String? = nil) {
self.parameters = parameters
self.templateBody = templateBody
self.templateURL = templateURL
}
public func validate(name: String) throws {
try self.validate(self.templateBody, name: "templateBody", parent: name, min: 1)
try self.validate(self.templateURL, name: "templateURL", parent: name, max: 1024)
try self.validate(self.templateURL, name: "templateURL", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case parameters = "Parameters"
case templateBody = "TemplateBody"
case templateURL = "TemplateURL"
}
}
public struct EstimateTemplateCostOutput: AWSDecodableShape {
/// An AWS Simple Monthly Calculator URL with a query string that describes the resources required to run the template.
public let url: String?
public init(url: String? = nil) {
self.url = url
}
private enum CodingKeys: String, CodingKey {
case url = "Url"
}
}
public struct ExecuteChangeSetInput: AWSEncodableShape {
/// The name or ARN of the change set that you want use to update the specified stack.
public let changeSetName: String
/// A unique identifier for this ExecuteChangeSet request. Specify this token if you plan to retry requests so that AWS CloudFormation knows that you're not attempting to execute a change set to update a stack with the same name. You might retry ExecuteChangeSet requests to ensure that AWS CloudFormation successfully received them.
public let clientRequestToken: String?
/// If you specified the name of a change set, specify the stack name or ID (ARN) that is associated with the change set you want to execute.
public let stackName: String?
public init(changeSetName: String, clientRequestToken: String? = nil, stackName: String? = nil) {
self.changeSetName = changeSetName
self.clientRequestToken = clientRequestToken
self.stackName = stackName
}
public func validate(name: String) throws {
try self.validate(self.changeSetName, name: "changeSetName", parent: name, max: 1600)
try self.validate(self.changeSetName, name: "changeSetName", parent: name, min: 1)
try self.validate(self.changeSetName, name: "changeSetName", parent: name, pattern: "[a-zA-Z][-a-zA-Z0-9]*|arn:[-a-zA-Z0-9:/]*")
try self.validate(self.clientRequestToken, name: "clientRequestToken", parent: name, max: 128)
try self.validate(self.clientRequestToken, name: "clientRequestToken", parent: name, min: 1)
try self.validate(self.clientRequestToken, name: "clientRequestToken", parent: name, pattern: "[a-zA-Z0-9][-a-zA-Z0-9]*")
try self.validate(self.stackName, name: "stackName", parent: name, min: 1)
try self.validate(self.stackName, name: "stackName", parent: name, pattern: "([a-zA-Z][-a-zA-Z0-9]*)|(arn:\\b(aws|aws-us-gov|aws-cn)\\b:[-a-zA-Z0-9:/._+]*)")
}
private enum CodingKeys: String, CodingKey {
case changeSetName = "ChangeSetName"
case clientRequestToken = "ClientRequestToken"
case stackName = "StackName"
}
}
public struct ExecuteChangeSetOutput: AWSDecodableShape {
public init() {}
}
public struct Export: AWSDecodableShape {
/// The stack that contains the exported output name and value.
public let exportingStackId: String?
/// The name of exported output value. Use this name and the Fn::ImportValue function to import the associated value into other stacks. The name is defined in the Export field in the associated stack's Outputs section.
public let name: String?
/// The value of the exported output, such as a resource physical ID. This value is defined in the Export field in the associated stack's Outputs section.
public let value: String?
public init(exportingStackId: String? = nil, name: String? = nil, value: String? = nil) {
self.exportingStackId = exportingStackId
self.name = name
self.value = value
}
private enum CodingKeys: String, CodingKey {
case exportingStackId = "ExportingStackId"
case name = "Name"
case value = "Value"
}
}
public struct GetStackPolicyInput: AWSEncodableShape {
/// The name or unique stack ID that is associated with the stack whose policy you want to get.
public let stackName: String
public init(stackName: String) {
self.stackName = stackName
}
private enum CodingKeys: String, CodingKey {
case stackName = "StackName"
}
}
public struct GetStackPolicyOutput: AWSDecodableShape {
/// Structure containing the stack policy body. (For more information, go to Prevent Updates to Stack Resources in the AWS CloudFormation User Guide.)
public let stackPolicyBody: String?
public init(stackPolicyBody: String? = nil) {
self.stackPolicyBody = stackPolicyBody
}
private enum CodingKeys: String, CodingKey {
case stackPolicyBody = "StackPolicyBody"
}
}
public struct GetTemplateInput: AWSEncodableShape {
/// The name or Amazon Resource Name (ARN) of a change set for which AWS CloudFormation returns the associated template. If you specify a name, you must also specify the StackName.
public let changeSetName: String?
/// The name or the unique stack ID that is associated with the stack, which are not always interchangeable: Running stacks: You can specify either the stack's name or its unique stack ID. Deleted stacks: You must specify the unique stack ID. Default: There is no default value.
public let stackName: String?
/// For templates that include transforms, the stage of the template that AWS CloudFormation returns. To get the user-submitted template, specify Original. To get the template after AWS CloudFormation has processed all transforms, specify Processed. If the template doesn't include transforms, Original and Processed return the same template. By default, AWS CloudFormation specifies Processed.
public let templateStage: TemplateStage?
public init(changeSetName: String? = nil, stackName: String? = nil, templateStage: TemplateStage? = nil) {
self.changeSetName = changeSetName
self.stackName = stackName
self.templateStage = templateStage
}
public func validate(name: String) throws {
try self.validate(self.changeSetName, name: "changeSetName", parent: name, max: 1600)
try self.validate(self.changeSetName, name: "changeSetName", parent: name, min: 1)
try self.validate(self.changeSetName, name: "changeSetName", parent: name, pattern: "[a-zA-Z][-a-zA-Z0-9]*|arn:[-a-zA-Z0-9:/]*")
}
private enum CodingKeys: String, CodingKey {
case changeSetName = "ChangeSetName"
case stackName = "StackName"
case templateStage = "TemplateStage"
}
}
public struct GetTemplateOutput: AWSDecodableShape {
/// The stage of the template that you can retrieve. For stacks, the Original and Processed templates are always available. For change sets, the Original template is always available. After AWS CloudFormation finishes creating the change set, the Processed template becomes available.
@OptionalCustomCoding<StandardArrayCoder>
public var stagesAvailable: [TemplateStage]?
/// Structure containing the template body. (For more information, go to Template Anatomy in the AWS CloudFormation User Guide.) AWS CloudFormation returns the same template that was used when the stack was created.
public let templateBody: String?
public init(stagesAvailable: [TemplateStage]? = nil, templateBody: String? = nil) {
self.stagesAvailable = stagesAvailable
self.templateBody = templateBody
}
private enum CodingKeys: String, CodingKey {
case stagesAvailable = "StagesAvailable"
case templateBody = "TemplateBody"
}
}
public struct GetTemplateSummaryInput: AWSEncodableShape {
/// [Service-managed permissions] Specifies whether you are acting as an account administrator in the organization's management account or as a delegated administrator in a member account. By default, SELF is specified. Use SELF for stack sets with self-managed permissions. If you are signed in to the management account, specify SELF. If you are signed in to a delegated administrator account, specify DELEGATED_ADMIN. Your AWS account must be registered as a delegated administrator in the management account. For more information, see Register a delegated administrator in the AWS CloudFormation User Guide.
public let callAs: CallAs?
/// The name or the stack ID that is associated with the stack, which are not always interchangeable. For running stacks, you can specify either the stack's name or its unique stack ID. For deleted stack, you must specify the unique stack ID. Conditional: You must specify only one of the following parameters: StackName, StackSetName, TemplateBody, or TemplateURL.
public let stackName: String?
/// The name or unique ID of the stack set from which the stack was created. Conditional: You must specify only one of the following parameters: StackName, StackSetName, TemplateBody, or TemplateURL.
public let stackSetName: String?
/// Structure containing the template body with a minimum length of 1 byte and a maximum length of 51,200 bytes. For more information about templates, see Template Anatomy in the AWS CloudFormation User Guide. Conditional: You must specify only one of the following parameters: StackName, StackSetName, TemplateBody, or TemplateURL.
public let templateBody: String?
/// Location of file containing the template body. The URL must point to a template (max size: 460,800 bytes) that is located in an Amazon S3 bucket or a Systems Manager document. For more information about templates, see Template Anatomy in the AWS CloudFormation User Guide. Conditional: You must specify only one of the following parameters: StackName, StackSetName, TemplateBody, or TemplateURL.
public let templateURL: String?
public init(callAs: CallAs? = nil, stackName: String? = nil, stackSetName: String? = nil, templateBody: String? = nil, templateURL: String? = nil) {
self.callAs = callAs
self.stackName = stackName
self.stackSetName = stackSetName
self.templateBody = templateBody
self.templateURL = templateURL
}
public func validate(name: String) throws {
try self.validate(self.stackName, name: "stackName", parent: name, min: 1)
try self.validate(self.stackName, name: "stackName", parent: name, pattern: "([a-zA-Z][-a-zA-Z0-9]*)|(arn:\\b(aws|aws-us-gov|aws-cn)\\b:[-a-zA-Z0-9:/._+]*)")
try self.validate(self.stackSetName, name: "stackSetName", parent: name, pattern: "[a-zA-Z][-a-zA-Z0-9]*(?::[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12})?")
try self.validate(self.templateBody, name: "templateBody", parent: name, min: 1)
try self.validate(self.templateURL, name: "templateURL", parent: name, max: 1024)
try self.validate(self.templateURL, name: "templateURL", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case callAs = "CallAs"
case stackName = "StackName"
case stackSetName = "StackSetName"
case templateBody = "TemplateBody"
case templateURL = "TemplateURL"
}
}
public struct GetTemplateSummaryOutput: AWSDecodableShape {
/// The capabilities found within the template. If your template contains IAM resources, you must specify the CAPABILITY_IAM or CAPABILITY_NAMED_IAM value for this parameter when you use the CreateStack or UpdateStack actions with your template; otherwise, those actions return an InsufficientCapabilities error. For more information, see Acknowledging IAM Resources in AWS CloudFormation Templates.
@OptionalCustomCoding<StandardArrayCoder>
public var capabilities: [Capability]?
/// The list of resources that generated the values in the Capabilities response element.
public let capabilitiesReason: String?
/// A list of the transforms that are declared in the template.
@OptionalCustomCoding<StandardArrayCoder>
public var declaredTransforms: [String]?
/// The value that is defined in the Description property of the template.
public let description: String?
/// The value that is defined for the Metadata property of the template.
public let metadata: String?
/// A list of parameter declarations that describe various properties for each parameter.
@OptionalCustomCoding<StandardArrayCoder>
public var parameters: [ParameterDeclaration]?
/// A list of resource identifier summaries that describe the target resources of an import operation and the properties you can provide during the import to identify the target resources. For example, BucketName is a possible identifier property for an AWS::S3::Bucket resource.
@OptionalCustomCoding<StandardArrayCoder>
public var resourceIdentifierSummaries: [ResourceIdentifierSummary]?
/// A list of all the template resource types that are defined in the template, such as AWS::EC2::Instance, AWS::Dynamo::Table, and Custom::MyCustomInstance.
@OptionalCustomCoding<StandardArrayCoder>
public var resourceTypes: [String]?
/// The AWS template format version, which identifies the capabilities of the template.
public let version: String?
public init(capabilities: [Capability]? = nil, capabilitiesReason: String? = nil, declaredTransforms: [String]? = nil, description: String? = nil, metadata: String? = nil, parameters: [ParameterDeclaration]? = nil, resourceIdentifierSummaries: [ResourceIdentifierSummary]? = nil, resourceTypes: [String]? = nil, version: String? = nil) {
self.capabilities = capabilities
self.capabilitiesReason = capabilitiesReason
self.declaredTransforms = declaredTransforms
self.description = description
self.metadata = metadata
self.parameters = parameters
self.resourceIdentifierSummaries = resourceIdentifierSummaries
self.resourceTypes = resourceTypes
self.version = version
}
private enum CodingKeys: String, CodingKey {
case capabilities = "Capabilities"
case capabilitiesReason = "CapabilitiesReason"
case declaredTransforms = "DeclaredTransforms"
case description = "Description"
case metadata = "Metadata"
case parameters = "Parameters"
case resourceIdentifierSummaries = "ResourceIdentifierSummaries"
case resourceTypes = "ResourceTypes"
case version = "Version"
}
}
public struct ListChangeSetsInput: AWSEncodableShape {
/// A string (provided by the ListChangeSets response output) that identifies the next page of change sets that you want to retrieve.
public let nextToken: String?
/// The name or the Amazon Resource Name (ARN) of the stack for which you want to list change sets.
public let stackName: String
public init(nextToken: String? = nil, stackName: String) {
self.nextToken = nextToken
self.stackName = stackName
}
public func validate(name: String) throws {
try self.validate(self.nextToken, name: "nextToken", parent: name, max: 1024)
try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
try self.validate(self.stackName, name: "stackName", parent: name, min: 1)
try self.validate(self.stackName, name: "stackName", parent: name, pattern: "([a-zA-Z][-a-zA-Z0-9]*)|(arn:\\b(aws|aws-us-gov|aws-cn)\\b:[-a-zA-Z0-9:/._+]*)")
}
private enum CodingKeys: String, CodingKey {
case nextToken = "NextToken"
case stackName = "StackName"
}
}
public struct ListChangeSetsOutput: AWSDecodableShape {
/// If the output exceeds 1 MB, a string that identifies the next page of change sets. If there is no additional page, this value is null.
public let nextToken: String?
/// A list of ChangeSetSummary structures that provides the ID and status of each change set for the specified stack.
@OptionalCustomCoding<StandardArrayCoder>
public var summaries: [ChangeSetSummary]?
public init(nextToken: String? = nil, summaries: [ChangeSetSummary]? = nil) {
self.nextToken = nextToken
self.summaries = summaries
}
private enum CodingKeys: String, CodingKey {
case nextToken = "NextToken"
case summaries = "Summaries"
}
}
public struct ListExportsInput: AWSEncodableShape {
/// A string (provided by the ListExports response output) that identifies the next page of exported output values that you asked to retrieve.
public let nextToken: String?
public init(nextToken: String? = nil) {
self.nextToken = nextToken
}
public func validate(name: String) throws {
try self.validate(self.nextToken, name: "nextToken", parent: name, max: 1024)
try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case nextToken = "NextToken"
}
}
public struct ListExportsOutput: AWSDecodableShape {
/// The output for the ListExports action.
@OptionalCustomCoding<StandardArrayCoder>
public var exports: [Export]?
/// If the output exceeds 100 exported output values, a string that identifies the next page of exports. If there is no additional page, this value is null.
public let nextToken: String?
public init(exports: [Export]? = nil, nextToken: String? = nil) {
self.exports = exports
self.nextToken = nextToken
}
private enum CodingKeys: String, CodingKey {
case exports = "Exports"
case nextToken = "NextToken"
}
}
public struct ListImportsInput: AWSEncodableShape {
/// The name of the exported output value. AWS CloudFormation returns the stack names that are importing this value.
public let exportName: String
/// A string (provided by the ListImports response output) that identifies the next page of stacks that are importing the specified exported output value.
public let nextToken: String?
public init(exportName: String, nextToken: String? = nil) {
self.exportName = exportName
self.nextToken = nextToken
}
public func validate(name: String) throws {
try self.validate(self.nextToken, name: "nextToken", parent: name, max: 1024)
try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case exportName = "ExportName"
case nextToken = "NextToken"
}
}
public struct ListImportsOutput: AWSDecodableShape {
/// A list of stack names that are importing the specified exported output value.
@OptionalCustomCoding<StandardArrayCoder>
public var imports: [String]?
/// A string that identifies the next page of exports. If there is no additional page, this value is null.
public let nextToken: String?
public init(imports: [String]? = nil, nextToken: String? = nil) {
self.imports = imports
self.nextToken = nextToken
}
private enum CodingKeys: String, CodingKey {
case imports = "Imports"
case nextToken = "NextToken"
}
}
public struct ListStackInstancesInput: AWSEncodableShape {
/// [Service-managed permissions] Specifies whether you are acting as an account administrator in the organization's management account or as a delegated administrator in a member account. By default, SELF is specified. Use SELF for stack sets with self-managed permissions. If you are signed in to the management account, specify SELF. If you are signed in to a delegated administrator account, specify DELEGATED_ADMIN. Your AWS account must be registered as a delegated administrator in the management account. For more information, see Register a delegated administrator in the AWS CloudFormation User Guide.
public let callAs: CallAs?
/// The status that stack instances are filtered by.
@OptionalCustomCoding<StandardArrayCoder>
public var filters: [StackInstanceFilter]?
/// The maximum number of results to be returned with a single call. If the number of available results exceeds this maximum, the response includes a NextToken value that you can assign to the NextToken request parameter to get the next set of results.
public let maxResults: Int?
/// If the previous request didn't return all of the remaining results, the response's NextToken parameter value is set to a token. To retrieve the next set of results, call ListStackInstances again and assign that token to the request object's NextToken parameter. If there are no remaining results, the previous response object's NextToken parameter is set to null.
public let nextToken: String?
/// The name of the AWS account that you want to list stack instances for.
public let stackInstanceAccount: String?
/// The name of the Region where you want to list stack instances.
public let stackInstanceRegion: String?
/// The name or unique ID of the stack set that you want to list stack instances for.
public let stackSetName: String
public init(callAs: CallAs? = nil, filters: [StackInstanceFilter]? = nil, maxResults: Int? = nil, nextToken: String? = nil, stackInstanceAccount: String? = nil, stackInstanceRegion: String? = nil, stackSetName: String) {
self.callAs = callAs
self.filters = filters
self.maxResults = maxResults
self.nextToken = nextToken
self.stackInstanceAccount = stackInstanceAccount
self.stackInstanceRegion = stackInstanceRegion
self.stackSetName = stackSetName
}
public func validate(name: String) throws {
try self.filters?.forEach {
try $0.validate(name: "\(name).filters[]")
}
try self.validate(self.filters, name: "filters", parent: name, max: 1)
try self.validate(self.maxResults, name: "maxResults", parent: name, max: 100)
try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
try self.validate(self.nextToken, name: "nextToken", parent: name, max: 1024)
try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
try self.validate(self.stackInstanceAccount, name: "stackInstanceAccount", parent: name, pattern: "^[0-9]{12}$")
try self.validate(self.stackInstanceRegion, name: "stackInstanceRegion", parent: name, pattern: "^[a-zA-Z0-9-]{1,128}$")
}
private enum CodingKeys: String, CodingKey {
case callAs = "CallAs"
case filters = "Filters"
case maxResults = "MaxResults"
case nextToken = "NextToken"
case stackInstanceAccount = "StackInstanceAccount"
case stackInstanceRegion = "StackInstanceRegion"
case stackSetName = "StackSetName"
}
}
public struct ListStackInstancesOutput: AWSDecodableShape {
/// If the request doesn't return all of the remaining results, NextToken is set to a token. To retrieve the next set of results, call ListStackInstances again and assign that token to the request object's NextToken parameter. If the request returns all results, NextToken is set to null.
public let nextToken: String?
/// A list of StackInstanceSummary structures that contain information about the specified stack instances.
@OptionalCustomCoding<StandardArrayCoder>
public var summaries: [StackInstanceSummary]?
public init(nextToken: String? = nil, summaries: [StackInstanceSummary]? = nil) {
self.nextToken = nextToken
self.summaries = summaries
}
private enum CodingKeys: String, CodingKey {
case nextToken = "NextToken"
case summaries = "Summaries"
}
}
public struct ListStackResourcesInput: AWSEncodableShape {
/// A string that identifies the next page of stack resources that you want to retrieve.
public let nextToken: String?
/// The name or the unique stack ID that is associated with the stack, which are not always interchangeable: Running stacks: You can specify either the stack's name or its unique stack ID. Deleted stacks: You must specify the unique stack ID. Default: There is no default value.
public let stackName: String
public init(nextToken: String? = nil, stackName: String) {
self.nextToken = nextToken
self.stackName = stackName
}
public func validate(name: String) throws {
try self.validate(self.nextToken, name: "nextToken", parent: name, max: 1024)
try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case nextToken = "NextToken"
case stackName = "StackName"
}
}
public struct ListStackResourcesOutput: AWSDecodableShape {
/// If the output exceeds 1 MB, a string that identifies the next page of stack resources. If no additional page exists, this value is null.
public let nextToken: String?
/// A list of StackResourceSummary structures.
@OptionalCustomCoding<StandardArrayCoder>
public var stackResourceSummaries: [StackResourceSummary]?
public init(nextToken: String? = nil, stackResourceSummaries: [StackResourceSummary]? = nil) {
self.nextToken = nextToken
self.stackResourceSummaries = stackResourceSummaries
}
private enum CodingKeys: String, CodingKey {
case nextToken = "NextToken"
case stackResourceSummaries = "StackResourceSummaries"
}
}
public struct ListStackSetOperationResultsInput: AWSEncodableShape {
/// [Service-managed permissions] Specifies whether you are acting as an account administrator in the organization's management account or as a delegated administrator in a member account. By default, SELF is specified. Use SELF for stack sets with self-managed permissions. If you are signed in to the management account, specify SELF. If you are signed in to a delegated administrator account, specify DELEGATED_ADMIN. Your AWS account must be registered as a delegated administrator in the management account. For more information, see Register a delegated administrator in the AWS CloudFormation User Guide.
public let callAs: CallAs?
/// The maximum number of results to be returned with a single call. If the number of available results exceeds this maximum, the response includes a NextToken value that you can assign to the NextToken request parameter to get the next set of results.
public let maxResults: Int?
/// If the previous request didn't return all of the remaining results, the response object's NextToken parameter value is set to a token. To retrieve the next set of results, call ListStackSetOperationResults again and assign that token to the request object's NextToken parameter. If there are no remaining results, the previous response object's NextToken parameter is set to null.
public let nextToken: String?
/// The ID of the stack set operation.
public let operationId: String
/// The name or unique ID of the stack set that you want to get operation results for.
public let stackSetName: String
public init(callAs: CallAs? = nil, maxResults: Int? = nil, nextToken: String? = nil, operationId: String, stackSetName: String) {
self.callAs = callAs
self.maxResults = maxResults
self.nextToken = nextToken
self.operationId = operationId
self.stackSetName = stackSetName
}
public func validate(name: String) throws {
try self.validate(self.maxResults, name: "maxResults", parent: name, max: 100)
try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
try self.validate(self.nextToken, name: "nextToken", parent: name, max: 1024)
try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
try self.validate(self.operationId, name: "operationId", parent: name, max: 128)
try self.validate(self.operationId, name: "operationId", parent: name, min: 1)
try self.validate(self.operationId, name: "operationId", parent: name, pattern: "[a-zA-Z0-9][-a-zA-Z0-9]*")
}
private enum CodingKeys: String, CodingKey {
case callAs = "CallAs"
case maxResults = "MaxResults"
case nextToken = "NextToken"
case operationId = "OperationId"
case stackSetName = "StackSetName"
}
}
public struct ListStackSetOperationResultsOutput: AWSDecodableShape {
/// If the request doesn't return all results, NextToken is set to a token. To retrieve the next set of results, call ListOperationResults again and assign that token to the request object's NextToken parameter. If there are no remaining results, NextToken is set to null.
public let nextToken: String?
/// A list of StackSetOperationResultSummary structures that contain information about the specified operation results, for accounts and Regions that are included in the operation.
@OptionalCustomCoding<StandardArrayCoder>
public var summaries: [StackSetOperationResultSummary]?
public init(nextToken: String? = nil, summaries: [StackSetOperationResultSummary]? = nil) {
self.nextToken = nextToken
self.summaries = summaries
}
private enum CodingKeys: String, CodingKey {
case nextToken = "NextToken"
case summaries = "Summaries"
}
}
public struct ListStackSetOperationsInput: AWSEncodableShape {
/// [Service-managed permissions] Specifies whether you are acting as an account administrator in the organization's management account or as a delegated administrator in a member account. By default, SELF is specified. Use SELF for stack sets with self-managed permissions. If you are signed in to the management account, specify SELF. If you are signed in to a delegated administrator account, specify DELEGATED_ADMIN. Your AWS account must be registered as a delegated administrator in the management account. For more information, see Register a delegated administrator in the AWS CloudFormation User Guide.
public let callAs: CallAs?
/// The maximum number of results to be returned with a single call. If the number of available results exceeds this maximum, the response includes a NextToken value that you can assign to the NextToken request parameter to get the next set of results.
public let maxResults: Int?
/// If the previous paginated request didn't return all of the remaining results, the response object's NextToken parameter value is set to a token. To retrieve the next set of results, call ListStackSetOperations again and assign that token to the request object's NextToken parameter. If there are no remaining results, the previous response object's NextToken parameter is set to null.
public let nextToken: String?
/// The name or unique ID of the stack set that you want to get operation summaries for.
public let stackSetName: String
public init(callAs: CallAs? = nil, maxResults: Int? = nil, nextToken: String? = nil, stackSetName: String) {
self.callAs = callAs
self.maxResults = maxResults
self.nextToken = nextToken
self.stackSetName = stackSetName
}
public func validate(name: String) throws {
try self.validate(self.maxResults, name: "maxResults", parent: name, max: 100)
try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
try self.validate(self.nextToken, name: "nextToken", parent: name, max: 1024)
try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case callAs = "CallAs"
case maxResults = "MaxResults"
case nextToken = "NextToken"
case stackSetName = "StackSetName"
}
}
public struct ListStackSetOperationsOutput: AWSDecodableShape {
/// If the request doesn't return all results, NextToken is set to a token. To retrieve the next set of results, call ListOperationResults again and assign that token to the request object's NextToken parameter. If there are no remaining results, NextToken is set to null.
public let nextToken: String?
/// A list of StackSetOperationSummary structures that contain summary information about operations for the specified stack set.
@OptionalCustomCoding<StandardArrayCoder>
public var summaries: [StackSetOperationSummary]?
public init(nextToken: String? = nil, summaries: [StackSetOperationSummary]? = nil) {
self.nextToken = nextToken
self.summaries = summaries
}
private enum CodingKeys: String, CodingKey {
case nextToken = "NextToken"
case summaries = "Summaries"
}
}
public struct ListStackSetsInput: AWSEncodableShape {
/// [Service-managed permissions] Specifies whether you are acting as an account administrator in the management account or as a delegated administrator in a member account. By default, SELF is specified. Use SELF for stack sets with self-managed permissions. If you are signed in to the management account, specify SELF. If you are signed in to a delegated administrator account, specify DELEGATED_ADMIN. Your AWS account must be registered as a delegated administrator in the management account. For more information, see Register a delegated administrator in the AWS CloudFormation User Guide.
public let callAs: CallAs?
/// The maximum number of results to be returned with a single call. If the number of available results exceeds this maximum, the response includes a NextToken value that you can assign to the NextToken request parameter to get the next set of results.
public let maxResults: Int?
/// If the previous paginated request didn't return all of the remaining results, the response object's NextToken parameter value is set to a token. To retrieve the next set of results, call ListStackSets again and assign that token to the request object's NextToken parameter. If there are no remaining results, the previous response object's NextToken parameter is set to null.
public let nextToken: String?
/// The status of the stack sets that you want to get summary information about.
public let status: StackSetStatus?
public init(callAs: CallAs? = nil, maxResults: Int? = nil, nextToken: String? = nil, status: StackSetStatus? = nil) {
self.callAs = callAs
self.maxResults = maxResults
self.nextToken = nextToken
self.status = status
}
public func validate(name: String) throws {
try self.validate(self.maxResults, name: "maxResults", parent: name, max: 100)
try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
try self.validate(self.nextToken, name: "nextToken", parent: name, max: 1024)
try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case callAs = "CallAs"
case maxResults = "MaxResults"
case nextToken = "NextToken"
case status = "Status"
}
}
public struct ListStackSetsOutput: AWSDecodableShape {
/// If the request doesn't return all of the remaining results, NextToken is set to a token. To retrieve the next set of results, call ListStackInstances again and assign that token to the request object's NextToken parameter. If the request returns all results, NextToken is set to null.
public let nextToken: String?
/// A list of StackSetSummary structures that contain information about the user's stack sets.
@OptionalCustomCoding<StandardArrayCoder>
public var summaries: [StackSetSummary]?
public init(nextToken: String? = nil, summaries: [StackSetSummary]? = nil) {
self.nextToken = nextToken
self.summaries = summaries
}
private enum CodingKeys: String, CodingKey {
case nextToken = "NextToken"
case summaries = "Summaries"
}
}
public struct ListStacksInput: AWSEncodableShape {
/// A string that identifies the next page of stacks that you want to retrieve.
public let nextToken: String?
/// Stack status to use as a filter. Specify one or more stack status codes to list only stacks with the specified status codes. For a complete list of stack status codes, see the StackStatus parameter of the Stack data type.
@OptionalCustomCoding<StandardArrayCoder>
public var stackStatusFilter: [StackStatus]?
public init(nextToken: String? = nil, stackStatusFilter: [StackStatus]? = nil) {
self.nextToken = nextToken
self.stackStatusFilter = stackStatusFilter
}
public func validate(name: String) throws {
try self.validate(self.nextToken, name: "nextToken", parent: name, max: 1024)
try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case nextToken = "NextToken"
case stackStatusFilter = "StackStatusFilter"
}
}
public struct ListStacksOutput: AWSDecodableShape {
/// If the output exceeds 1 MB in size, a string that identifies the next page of stacks. If no additional page exists, this value is null.
public let nextToken: String?
/// A list of StackSummary structures containing information about the specified stacks.
@OptionalCustomCoding<StandardArrayCoder>
public var stackSummaries: [StackSummary]?
public init(nextToken: String? = nil, stackSummaries: [StackSummary]? = nil) {
self.nextToken = nextToken
self.stackSummaries = stackSummaries
}
private enum CodingKeys: String, CodingKey {
case nextToken = "NextToken"
case stackSummaries = "StackSummaries"
}
}
public struct ListTypeRegistrationsInput: AWSEncodableShape {
/// The maximum number of results to be returned with a single call. If the number of available results exceeds this maximum, the response includes a NextToken value that you can assign to the NextToken request parameter to get the next set of results.
public let maxResults: Int?
/// If the previous paginated request didn't return all of the remaining results, the response object's NextToken parameter value is set to a token. To retrieve the next set of results, call this action again and assign that token to the request object's NextToken parameter. If there are no remaining results, the previous response object's NextToken parameter is set to null.
public let nextToken: String?
/// The current status of the extension registration request. The default is IN_PROGRESS.
public let registrationStatusFilter: RegistrationStatus?
/// The kind of extension. Conditional: You must specify either TypeName and Type, or Arn.
public let type: RegistryType?
/// The Amazon Resource Name (ARN) of the extension. Conditional: You must specify either TypeName and Type, or Arn.
public let typeArn: String?
/// The name of the extension. Conditional: You must specify either TypeName and Type, or Arn.
public let typeName: String?
public init(maxResults: Int? = nil, nextToken: String? = nil, registrationStatusFilter: RegistrationStatus? = nil, type: RegistryType? = nil, typeArn: String? = nil, typeName: String? = nil) {
self.maxResults = maxResults
self.nextToken = nextToken
self.registrationStatusFilter = registrationStatusFilter
self.type = type
self.typeArn = typeArn
self.typeName = typeName
}
public func validate(name: String) throws {
try self.validate(self.maxResults, name: "maxResults", parent: name, max: 100)
try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
try self.validate(self.nextToken, name: "nextToken", parent: name, max: 1024)
try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
try self.validate(self.typeArn, name: "typeArn", parent: name, max: 1024)
try self.validate(self.typeArn, name: "typeArn", parent: name, pattern: "arn:aws[A-Za-z0-9-]{0,64}:cloudformation:[A-Za-z0-9-]{1,64}:([0-9]{12})?:type/.+")
try self.validate(self.typeName, name: "typeName", parent: name, max: 204)
try self.validate(self.typeName, name: "typeName", parent: name, min: 10)
try self.validate(self.typeName, name: "typeName", parent: name, pattern: "[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}(::MODULE){0,1}")
}
private enum CodingKeys: String, CodingKey {
case maxResults = "MaxResults"
case nextToken = "NextToken"
case registrationStatusFilter = "RegistrationStatusFilter"
case type = "Type"
case typeArn = "TypeArn"
case typeName = "TypeName"
}
}
public struct ListTypeRegistrationsOutput: AWSDecodableShape {
/// If the request doesn't return all of the remaining results, NextToken is set to a token. To retrieve the next set of results, call this action again and assign that token to the request object's NextToken parameter. If the request returns all results, NextToken is set to null.
public let nextToken: String?
/// A list of extension registration tokens. Use DescribeTypeRegistration to return detailed information about a type registration request.
@OptionalCustomCoding<StandardArrayCoder>
public var registrationTokenList: [String]?
public init(nextToken: String? = nil, registrationTokenList: [String]? = nil) {
self.nextToken = nextToken
self.registrationTokenList = registrationTokenList
}
private enum CodingKeys: String, CodingKey {
case nextToken = "NextToken"
case registrationTokenList = "RegistrationTokenList"
}
}
public struct ListTypeVersionsInput: AWSEncodableShape {
/// The Amazon Resource Name (ARN) of the extension for which you want version summary information. Conditional: You must specify either TypeName and Type, or Arn.
public let arn: String?
/// The deprecation status of the extension versions that you want to get summary information about. Valid values include: LIVE: The extension version is registered and can be used in CloudFormation operations, dependent on its provisioning behavior and visibility scope. DEPRECATED: The extension version has been deregistered and can no longer be used in CloudFormation operations. The default is LIVE.
public let deprecatedStatus: DeprecatedStatus?
/// The maximum number of results to be returned with a single call. If the number of available results exceeds this maximum, the response includes a NextToken value that you can assign to the NextToken request parameter to get the next set of results.
public let maxResults: Int?
/// If the previous paginated request didn't return all of the remaining results, the response object's NextToken parameter value is set to a token. To retrieve the next set of results, call this action again and assign that token to the request object's NextToken parameter. If there are no remaining results, the previous response object's NextToken parameter is set to null.
public let nextToken: String?
/// The publisher ID of the extension publisher. Extensions published by Amazon are not assigned a publisher ID.
public let publisherId: String?
/// The kind of the extension. Conditional: You must specify either TypeName and Type, or Arn.
public let type: RegistryType?
/// The name of the extension for which you want version summary information. Conditional: You must specify either TypeName and Type, or Arn.
public let typeName: String?
public init(arn: String? = nil, deprecatedStatus: DeprecatedStatus? = nil, maxResults: Int? = nil, nextToken: String? = nil, publisherId: String? = nil, type: RegistryType? = nil, typeName: String? = nil) {
self.arn = arn
self.deprecatedStatus = deprecatedStatus
self.maxResults = maxResults
self.nextToken = nextToken
self.publisherId = publisherId
self.type = type
self.typeName = typeName
}
public func validate(name: String) throws {
try self.validate(self.arn, name: "arn", parent: name, max: 1024)
try self.validate(self.arn, name: "arn", parent: name, pattern: "arn:aws[A-Za-z0-9-]{0,64}:cloudformation:[A-Za-z0-9-]{1,64}:([0-9]{12})?:type/.+")
try self.validate(self.maxResults, name: "maxResults", parent: name, max: 100)
try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
try self.validate(self.nextToken, name: "nextToken", parent: name, max: 1024)
try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
try self.validate(self.publisherId, name: "publisherId", parent: name, max: 40)
try self.validate(self.publisherId, name: "publisherId", parent: name, min: 1)
try self.validate(self.publisherId, name: "publisherId", parent: name, pattern: "[0-9a-zA-Z]{12,40}")
try self.validate(self.typeName, name: "typeName", parent: name, max: 204)
try self.validate(self.typeName, name: "typeName", parent: name, min: 10)
try self.validate(self.typeName, name: "typeName", parent: name, pattern: "[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}(::MODULE){0,1}")
}
private enum CodingKeys: String, CodingKey {
case arn = "Arn"
case deprecatedStatus = "DeprecatedStatus"
case maxResults = "MaxResults"
case nextToken = "NextToken"
case publisherId = "PublisherId"
case type = "Type"
case typeName = "TypeName"
}
}
public struct ListTypeVersionsOutput: AWSDecodableShape {
/// If the request doesn't return all of the remaining results, NextToken is set to a token. To retrieve the next set of results, call this action again and assign that token to the request object's NextToken parameter. If the request returns all results, NextToken is set to null.
public let nextToken: String?
/// A list of TypeVersionSummary structures that contain information about the specified extension's versions.
@OptionalCustomCoding<StandardArrayCoder>
public var typeVersionSummaries: [TypeVersionSummary]?
public init(nextToken: String? = nil, typeVersionSummaries: [TypeVersionSummary]? = nil) {
self.nextToken = nextToken
self.typeVersionSummaries = typeVersionSummaries
}
private enum CodingKeys: String, CodingKey {
case nextToken = "NextToken"
case typeVersionSummaries = "TypeVersionSummaries"
}
}
public struct ListTypesInput: AWSEncodableShape {
/// The deprecation status of the extension that you want to get summary information about. Valid values include: LIVE: The extension is registered for use in CloudFormation operations. DEPRECATED: The extension has been deregistered and can no longer be used in CloudFormation operations.
public let deprecatedStatus: DeprecatedStatus?
/// Filter criteria to use in determining which extensions to return. If you specify a filter, CloudFormation ignores any specified Visibility value when returning the list of types.
public let filters: TypeFilters?
/// The maximum number of results to be returned with a single call. If the number of available results exceeds this maximum, the response includes a NextToken value that you can assign to the NextToken request parameter to get the next set of results.
public let maxResults: Int?
/// If the previous paginated request didn't return all of the remaining results, the response object's NextToken parameter value is set to a token. To retrieve the next set of results, call this action again and assign that token to the request object's NextToken parameter. If there are no remaining results, the previous response object's NextToken parameter is set to null.
public let nextToken: String?
/// For resource types, the provisioning behavior of the resource type. AWS CloudFormation determines the provisioning type during registration, based on the types of handlers in the schema handler package submitted. Valid values include: FULLY_MUTABLE: The resource type includes an update handler to process updates to the type during stack update operations. IMMUTABLE: The resource type does not include an update handler, so the type cannot be updated and must instead be replaced during stack update operations. NON_PROVISIONABLE: The resource type does not include create, read, and delete handlers, and therefore cannot actually be provisioned. The default is FULLY_MUTABLE.
public let provisioningType: ProvisioningType?
/// The type of extension.
public let type: RegistryType?
/// The scope at which the extensions are visible and usable in CloudFormation operations. Valid values include: PRIVATE: Extensions that are visible and usable within this account and region. This includes: Private extensions you have registered in this account and region. Public extensions that you have activated in this account and region. PUBLIC: Extensions that are publicly visible and available to be activated within any Amazon account. This includes extensions from Amazon, as well as third-party publishers. The default is PRIVATE.
public let visibility: Visibility?
public init(deprecatedStatus: DeprecatedStatus? = nil, filters: TypeFilters? = nil, maxResults: Int? = nil, nextToken: String? = nil, provisioningType: ProvisioningType? = nil, type: RegistryType? = nil, visibility: Visibility? = nil) {
self.deprecatedStatus = deprecatedStatus
self.filters = filters
self.maxResults = maxResults
self.nextToken = nextToken
self.provisioningType = provisioningType
self.type = type
self.visibility = visibility
}
public func validate(name: String) throws {
try self.filters?.validate(name: "\(name).filters")
try self.validate(self.maxResults, name: "maxResults", parent: name, max: 100)
try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
try self.validate(self.nextToken, name: "nextToken", parent: name, max: 1024)
try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case deprecatedStatus = "DeprecatedStatus"
case filters = "Filters"
case maxResults = "MaxResults"
case nextToken = "NextToken"
case provisioningType = "ProvisioningType"
case type = "Type"
case visibility = "Visibility"
}
}
public struct ListTypesOutput: AWSDecodableShape {
/// If the request doesn't return all of the remaining results, NextToken is set to a token. To retrieve the next set of results, call this action again and assign that token to the request object's NextToken parameter. If the request returns all results, NextToken is set to null.
public let nextToken: String?
/// A list of TypeSummary structures that contain information about the specified extensions.
@OptionalCustomCoding<StandardArrayCoder>
public var typeSummaries: [TypeSummary]?
public init(nextToken: String? = nil, typeSummaries: [TypeSummary]? = nil) {
self.nextToken = nextToken
self.typeSummaries = typeSummaries
}
private enum CodingKeys: String, CodingKey {
case nextToken = "NextToken"
case typeSummaries = "TypeSummaries"
}
}
public struct LoggingConfig: AWSEncodableShape & AWSDecodableShape {
/// The Amazon CloudWatch log group to which CloudFormation sends error logging information when invoking the extension's handlers.
public let logGroupName: String
/// The ARN of the role that CloudFormation should assume when sending log entries to CloudWatch logs.
public let logRoleArn: String
public init(logGroupName: String, logRoleArn: String) {
self.logGroupName = logGroupName
self.logRoleArn = logRoleArn
}
public func validate(name: String) throws {
try self.validate(self.logGroupName, name: "logGroupName", parent: name, max: 512)
try self.validate(self.logGroupName, name: "logGroupName", parent: name, min: 1)
try self.validate(self.logGroupName, name: "logGroupName", parent: name, pattern: "[\\.\\-_/#A-Za-z0-9]+")
try self.validate(self.logRoleArn, name: "logRoleArn", parent: name, max: 256)
try self.validate(self.logRoleArn, name: "logRoleArn", parent: name, min: 1)
try self.validate(self.logRoleArn, name: "logRoleArn", parent: name, pattern: "arn:.+:iam::[0-9]{12}:role/.+")
}
private enum CodingKeys: String, CodingKey {
case logGroupName = "LogGroupName"
case logRoleArn = "LogRoleArn"
}
}
public struct ModuleInfo: AWSDecodableShape {
/// A concantenated list of the logical IDs of the module or modules containing the resource. Modules are listed starting with the inner-most nested module, and separated by /. In the following example, the resource was created from a module, moduleA, that is nested inside a parent module, moduleB. moduleA/moduleB For more information, see Referencing resources in a module in the CloudFormation User Guide.
public let logicalIdHierarchy: String?
/// A concantenated list of the the module type or types containing the resource. Module types are listed starting with the inner-most nested module, and separated by /. In the following example, the resource was created from a module of type AWS::First::Example::MODULE, that is nested inside a parent module of type AWS::Second::Example::MODULE. AWS::First::Example::MODULE/AWS::Second::Example::MODULE
public let typeHierarchy: String?
public init(logicalIdHierarchy: String? = nil, typeHierarchy: String? = nil) {
self.logicalIdHierarchy = logicalIdHierarchy
self.typeHierarchy = typeHierarchy
}
private enum CodingKeys: String, CodingKey {
case logicalIdHierarchy = "LogicalIdHierarchy"
case typeHierarchy = "TypeHierarchy"
}
}
public struct Output: AWSDecodableShape {
/// User defined description associated with the output.
public let description: String?
/// The name of the export associated with the output.
public let exportName: String?
/// The key associated with the output.
public let outputKey: String?
/// The value associated with the output.
public let outputValue: String?
public init(description: String? = nil, exportName: String? = nil, outputKey: String? = nil, outputValue: String? = nil) {
self.description = description
self.exportName = exportName
self.outputKey = outputKey
self.outputValue = outputValue
}
private enum CodingKeys: String, CodingKey {
case description = "Description"
case exportName = "ExportName"
case outputKey = "OutputKey"
case outputValue = "OutputValue"
}
}
public struct Parameter: AWSEncodableShape & AWSDecodableShape {
/// The key associated with the parameter. If you don't specify a key and value for a particular parameter, AWS CloudFormation uses the default value that is specified in your template.
public let parameterKey: String?
/// The input value associated with the parameter.
public let parameterValue: String?
/// Read-only. The value that corresponds to a Systems Manager parameter key. This field is returned only for SSM parameter types in the template.
public let resolvedValue: String?
/// During a stack update, use the existing parameter value that the stack is using for a given parameter key. If you specify true, do not specify a parameter value.
public let usePreviousValue: Bool?
public init(parameterKey: String? = nil, parameterValue: String? = nil, resolvedValue: String? = nil, usePreviousValue: Bool? = nil) {
self.parameterKey = parameterKey
self.parameterValue = parameterValue
self.resolvedValue = resolvedValue
self.usePreviousValue = usePreviousValue
}
private enum CodingKeys: String, CodingKey {
case parameterKey = "ParameterKey"
case parameterValue = "ParameterValue"
case resolvedValue = "ResolvedValue"
case usePreviousValue = "UsePreviousValue"
}
}
public struct ParameterConstraints: AWSDecodableShape {
/// A list of values that are permitted for a parameter.
@OptionalCustomCoding<StandardArrayCoder>
public var allowedValues: [String]?
public init(allowedValues: [String]? = nil) {
self.allowedValues = allowedValues
}
private enum CodingKeys: String, CodingKey {
case allowedValues = "AllowedValues"
}
}
public struct ParameterDeclaration: AWSDecodableShape {
/// The default value of the parameter.
public let defaultValue: String?
/// The description that is associate with the parameter.
public let description: String?
/// Flag that indicates whether the parameter value is shown as plain text in logs and in the AWS Management Console.
public let noEcho: Bool?
/// The criteria that AWS CloudFormation uses to validate parameter values.
public let parameterConstraints: ParameterConstraints?
/// The name that is associated with the parameter.
public let parameterKey: String?
/// The type of parameter.
public let parameterType: String?
public init(defaultValue: String? = nil, description: String? = nil, noEcho: Bool? = nil, parameterConstraints: ParameterConstraints? = nil, parameterKey: String? = nil, parameterType: String? = nil) {
self.defaultValue = defaultValue
self.description = description
self.noEcho = noEcho
self.parameterConstraints = parameterConstraints
self.parameterKey = parameterKey
self.parameterType = parameterType
}
private enum CodingKeys: String, CodingKey {
case defaultValue = "DefaultValue"
case description = "Description"
case noEcho = "NoEcho"
case parameterConstraints = "ParameterConstraints"
case parameterKey = "ParameterKey"
case parameterType = "ParameterType"
}
}
public struct PhysicalResourceIdContextKeyValuePair: AWSDecodableShape {
/// The resource context key.
public let key: String
/// The resource context value.
public let value: String
public init(key: String, value: String) {
self.key = key
self.value = value
}
private enum CodingKeys: String, CodingKey {
case key = "Key"
case value = "Value"
}
}
public struct PropertyDifference: AWSDecodableShape {
/// The actual property value of the resource property.
public let actualValue: String
/// The type of property difference. ADD: A value has been added to a resource property that is an array or list data type. REMOVE: The property has been removed from the current resource configuration. NOT_EQUAL: The current property value differs from its expected value (as defined in the stack template and any values specified as template parameters).
public let differenceType: DifferenceType
/// The expected property value of the resource property, as defined in the stack template and any values specified as template parameters.
public let expectedValue: String
/// The fully-qualified path to the resource property.
public let propertyPath: String
public init(actualValue: String, differenceType: DifferenceType, expectedValue: String, propertyPath: String) {
self.actualValue = actualValue
self.differenceType = differenceType
self.expectedValue = expectedValue
self.propertyPath = propertyPath
}
private enum CodingKeys: String, CodingKey {
case actualValue = "ActualValue"
case differenceType = "DifferenceType"
case expectedValue = "ExpectedValue"
case propertyPath = "PropertyPath"
}
}
public struct PublishTypeInput: AWSEncodableShape {
/// The Amazon Resource Number (ARN) of the extension. Conditional: You must specify Arn, or TypeName and Type.
public let arn: String?
/// The version number to assign to this version of the extension. Use the following format, and adhere to semantic versioning when assigning a version number to your extension: MAJOR.MINOR.PATCH For more information, see Semantic Versioning 2.0.0. If you do not specify a version number, CloudFormation increments the version number by one minor version release.
public let publicVersionNumber: String?
/// The type of the extension. Conditional: You must specify Arn, or TypeName and Type.
public let type: ThirdPartyType?
/// The name of the extension. Conditional: You must specify Arn, or TypeName and Type.
public let typeName: String?
public init(arn: String? = nil, publicVersionNumber: String? = nil, type: ThirdPartyType? = nil, typeName: String? = nil) {
self.arn = arn
self.publicVersionNumber = publicVersionNumber
self.type = type
self.typeName = typeName
}
public func validate(name: String) throws {
try self.validate(self.arn, name: "arn", parent: name, max: 1024)
try self.validate(self.arn, name: "arn", parent: name, pattern: "arn:aws[A-Za-z0-9-]{0,64}:cloudformation:[A-Za-z0-9-]{1,64}:[0-9]{12}:type/.+")
try self.validate(self.publicVersionNumber, name: "publicVersionNumber", parent: name, min: 5)
try self.validate(self.publicVersionNumber, name: "publicVersionNumber", parent: name, pattern: "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(.*)$")
try self.validate(self.typeName, name: "typeName", parent: name, max: 204)
try self.validate(self.typeName, name: "typeName", parent: name, min: 10)
try self.validate(self.typeName, name: "typeName", parent: name, pattern: "[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}(::MODULE){0,1}")
}
private enum CodingKeys: String, CodingKey {
case arn = "Arn"
case publicVersionNumber = "PublicVersionNumber"
case type = "Type"
case typeName = "TypeName"
}
}
public struct PublishTypeOutput: AWSDecodableShape {
/// The Amazon Resource Number (ARN) assigned to the public extension upon publication.
public let publicTypeArn: String?
public init(publicTypeArn: String? = nil) {
self.publicTypeArn = publicTypeArn
}
private enum CodingKeys: String, CodingKey {
case publicTypeArn = "PublicTypeArn"
}
}
public struct RecordHandlerProgressInput: AWSEncodableShape {
/// Reserved for use by the CloudFormation CLI.
public let bearerToken: String
/// Reserved for use by the CloudFormation CLI.
public let clientRequestToken: String?
/// Reserved for use by the CloudFormation CLI.
public let currentOperationStatus: OperationStatus?
/// Reserved for use by the CloudFormation CLI.
public let errorCode: HandlerErrorCode?
/// Reserved for use by the CloudFormation CLI.
public let operationStatus: OperationStatus
/// Reserved for use by the CloudFormation CLI.
public let resourceModel: String?
/// Reserved for use by the CloudFormation CLI.
public let statusMessage: String?
public init(bearerToken: String, clientRequestToken: String? = nil, currentOperationStatus: OperationStatus? = nil, errorCode: HandlerErrorCode? = nil, operationStatus: OperationStatus, resourceModel: String? = nil, statusMessage: String? = nil) {
self.bearerToken = bearerToken
self.clientRequestToken = clientRequestToken
self.currentOperationStatus = currentOperationStatus
self.errorCode = errorCode
self.operationStatus = operationStatus
self.resourceModel = resourceModel
self.statusMessage = statusMessage
}
public func validate(name: String) throws {
try self.validate(self.bearerToken, name: "bearerToken", parent: name, max: 128)
try self.validate(self.bearerToken, name: "bearerToken", parent: name, min: 1)
try self.validate(self.clientRequestToken, name: "clientRequestToken", parent: name, max: 128)
try self.validate(self.clientRequestToken, name: "clientRequestToken", parent: name, min: 1)
try self.validate(self.clientRequestToken, name: "clientRequestToken", parent: name, pattern: "[a-zA-Z0-9][-a-zA-Z0-9]*")
try self.validate(self.resourceModel, name: "resourceModel", parent: name, max: 16384)
try self.validate(self.resourceModel, name: "resourceModel", parent: name, min: 1)
try self.validate(self.statusMessage, name: "statusMessage", parent: name, max: 1024)
}
private enum CodingKeys: String, CodingKey {
case bearerToken = "BearerToken"
case clientRequestToken = "ClientRequestToken"
case currentOperationStatus = "CurrentOperationStatus"
case errorCode = "ErrorCode"
case operationStatus = "OperationStatus"
case resourceModel = "ResourceModel"
case statusMessage = "StatusMessage"
}
}
public struct RecordHandlerProgressOutput: AWSDecodableShape {
public init() {}
}
public struct RegisterPublisherInput: AWSEncodableShape {
/// Whether you accept the terms and conditions for publishing extensions in the CloudFormation registry. You must accept the terms and conditions in order to register to publish public extensions to the CloudFormation registry. The default is false.
public let acceptTermsAndConditions: Bool?
/// If you are using a Bitbucket or GitHub account for identity verification, the Amazon Resource Name (ARN) for your connection to that account. For more information, see Registering your account to publish CloudFormation extensions in the CloudFormation CLI User Guide.
public let connectionArn: String?
public init(acceptTermsAndConditions: Bool? = nil, connectionArn: String? = nil) {
self.acceptTermsAndConditions = acceptTermsAndConditions
self.connectionArn = connectionArn
}
public func validate(name: String) throws {
try self.validate(self.connectionArn, name: "connectionArn", parent: name, max: 256)
try self.validate(self.connectionArn, name: "connectionArn", parent: name, min: 1)
try self.validate(self.connectionArn, name: "connectionArn", parent: name, pattern: "arn:aws(-[\\w]+)*:.+:.+:[0-9]{12}:.+")
}
private enum CodingKeys: String, CodingKey {
case acceptTermsAndConditions = "AcceptTermsAndConditions"
case connectionArn = "ConnectionArn"
}
}
public struct RegisterPublisherOutput: AWSDecodableShape {
/// The ID assigned this account by CloudFormation for publishing extensions.
public let publisherId: String?
public init(publisherId: String? = nil) {
self.publisherId = publisherId
}
private enum CodingKeys: String, CodingKey {
case publisherId = "PublisherId"
}
}
public struct RegisterTypeInput: AWSEncodableShape {
/// A unique identifier that acts as an idempotency key for this registration request. Specifying a client request token prevents CloudFormation from generating more than one version of an extension from the same registeration request, even if the request is submitted multiple times.
public let clientRequestToken: String?
/// The Amazon Resource Name (ARN) of the IAM role for CloudFormation to assume when invoking the extension. For CloudFormation to assume the specified execution role, the role must contain a trust relationship with the CloudFormation service principle (resources.cloudformation.amazonaws.com). For more information on adding trust relationships, see Modifying a role trust policy in the AWS Identity and Access Management User Guide. If your extension calls AWS APIs in any of its handlers, you must create an IAM execution role that includes the necessary permissions to call those AWS APIs, and provision that execution role in your account. When CloudFormation needs to invoke the resource type handler, CloudFormation assumes this execution role to create a temporary session token, which it then passes to the resource type handler, thereby supplying your resource type with the appropriate credentials.
public let executionRoleArn: String?
/// Specifies logging configuration information for an extension.
public let loggingConfig: LoggingConfig?
/// A url to the S3 bucket containing the extension project package that contains the neccessary files for the extension you want to register. For information on generating a schema handler package for the extension you want to register, see submit in the CloudFormation CLI User Guide. The user registering the extension must be able to access the package in the S3 bucket. That is, the user needs to have GetObject permissions for the schema handler package. For more information, see Actions, Resources, and Condition Keys for Amazon S3 in the AWS Identity and Access Management User Guide.
public let schemaHandlerPackage: String
/// The kind of extension.
public let type: RegistryType?
/// The name of the extension being registered. We recommend that extension names adhere to the following patterns: For resource types, company_or_organization::service::type. For modules, company_or_organization::service::type::MODULE. The following organization namespaces are reserved and cannot be used in your extension names: Alexa AMZN Amazon AWS Custom Dev
public let typeName: String
public init(clientRequestToken: String? = nil, executionRoleArn: String? = nil, loggingConfig: LoggingConfig? = nil, schemaHandlerPackage: String, type: RegistryType? = nil, typeName: String) {
self.clientRequestToken = clientRequestToken
self.executionRoleArn = executionRoleArn
self.loggingConfig = loggingConfig
self.schemaHandlerPackage = schemaHandlerPackage
self.type = type
self.typeName = typeName
}
public func validate(name: String) throws {
try self.validate(self.clientRequestToken, name: "clientRequestToken", parent: name, max: 128)
try self.validate(self.clientRequestToken, name: "clientRequestToken", parent: name, min: 1)
try self.validate(self.clientRequestToken, name: "clientRequestToken", parent: name, pattern: "[a-zA-Z0-9][-a-zA-Z0-9]*")
try self.validate(self.executionRoleArn, name: "executionRoleArn", parent: name, max: 256)
try self.validate(self.executionRoleArn, name: "executionRoleArn", parent: name, min: 1)
try self.validate(self.executionRoleArn, name: "executionRoleArn", parent: name, pattern: "arn:.+:iam::[0-9]{12}:role/.+")
try self.loggingConfig?.validate(name: "\(name).loggingConfig")
try self.validate(self.schemaHandlerPackage, name: "schemaHandlerPackage", parent: name, max: 4096)
try self.validate(self.schemaHandlerPackage, name: "schemaHandlerPackage", parent: name, min: 1)
try self.validate(self.typeName, name: "typeName", parent: name, max: 204)
try self.validate(self.typeName, name: "typeName", parent: name, min: 10)
try self.validate(self.typeName, name: "typeName", parent: name, pattern: "[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}(::MODULE){0,1}")
}
private enum CodingKeys: String, CodingKey {
case clientRequestToken = "ClientRequestToken"
case executionRoleArn = "ExecutionRoleArn"
case loggingConfig = "LoggingConfig"
case schemaHandlerPackage = "SchemaHandlerPackage"
case type = "Type"
case typeName = "TypeName"
}
}
public struct RegisterTypeOutput: AWSDecodableShape {
/// The identifier for this registration request. Use this registration token when calling DescribeTypeRegistration , which returns information about the status and IDs of the extension registration.
public let registrationToken: String?
public init(registrationToken: String? = nil) {
self.registrationToken = registrationToken
}
private enum CodingKeys: String, CodingKey {
case registrationToken = "RegistrationToken"
}
}
public struct RequiredActivatedType: AWSDecodableShape {
/// The type name of the public extension. If you specified a TypeNameAlias when enabling the extension in this account and region, CloudFormation treats that alias as the extension's type name within the account and region, not the type name of the public extension. For more information, see Specifying aliases to refer to extensions in the CloudFormation User Guide.
public let originalTypeName: String?
/// The publisher ID of the extension publisher.
public let publisherId: String?
/// A list of the major versions of the extension type that the macro supports.
@OptionalCustomCoding<StandardArrayCoder>
public var supportedMajorVersions: [Int]?
/// An alias assigned to the public extension, in this account and region. If you specify an alias for the extension, CloudFormation treats the alias as the extension type name within this account and region. You must use the alias to refer to the extension in your templates, API calls, and CloudFormation console.
public let typeNameAlias: String?
public init(originalTypeName: String? = nil, publisherId: String? = nil, supportedMajorVersions: [Int]? = nil, typeNameAlias: String? = nil) {
self.originalTypeName = originalTypeName
self.publisherId = publisherId
self.supportedMajorVersions = supportedMajorVersions
self.typeNameAlias = typeNameAlias
}
private enum CodingKeys: String, CodingKey {
case originalTypeName = "OriginalTypeName"
case publisherId = "PublisherId"
case supportedMajorVersions = "SupportedMajorVersions"
case typeNameAlias = "TypeNameAlias"
}
}
public struct ResourceChange: AWSDecodableShape {
/// The action that AWS CloudFormation takes on the resource, such as Add (adds a new resource), Modify (changes a resource), Remove (deletes a resource), Import (imports a resource), or Dynamic (exact action for the resource cannot be determined).
public let action: ChangeAction?
/// The change set ID of the nested change set.
public let changeSetId: String?
/// For the Modify action, a list of ResourceChangeDetail structures that describes the changes that AWS CloudFormation will make to the resource.
@OptionalCustomCoding<StandardArrayCoder>
public var details: [ResourceChangeDetail]?
/// The resource's logical ID, which is defined in the stack's template.
public let logicalResourceId: String?
/// Contains information about the module from which the resource was created, if the resource was created from a module included in the stack template.
public let moduleInfo: ModuleInfo?
/// The resource's physical ID (resource name). Resources that you are adding don't have physical IDs because they haven't been created.
public let physicalResourceId: String?
/// For the Modify action, indicates whether AWS CloudFormation will replace the resource by creating a new one and deleting the old one. This value depends on the value of the RequiresRecreation property in the ResourceTargetDefinition structure. For example, if the RequiresRecreation field is Always and the Evaluation field is Static, Replacement is True. If the RequiresRecreation field is Always and the Evaluation field is Dynamic, Replacement is Conditionally. If you have multiple changes with different RequiresRecreation values, the Replacement value depends on the change with the most impact. A RequiresRecreation value of Always has the most impact, followed by Conditionally, and then Never.
public let replacement: Replacement?
/// The type of AWS CloudFormation resource, such as AWS::S3::Bucket.
public let resourceType: String?
/// For the Modify action, indicates which resource attribute is triggering this update, such as a change in the resource attribute's Metadata, Properties, or Tags.
@OptionalCustomCoding<StandardArrayCoder>
public var scope: [ResourceAttribute]?
public init(action: ChangeAction? = nil, changeSetId: String? = nil, details: [ResourceChangeDetail]? = nil, logicalResourceId: String? = nil, moduleInfo: ModuleInfo? = nil, physicalResourceId: String? = nil, replacement: Replacement? = nil, resourceType: String? = nil, scope: [ResourceAttribute]? = nil) {
self.action = action
self.changeSetId = changeSetId
self.details = details
self.logicalResourceId = logicalResourceId
self.moduleInfo = moduleInfo
self.physicalResourceId = physicalResourceId
self.replacement = replacement
self.resourceType = resourceType
self.scope = scope
}
private enum CodingKeys: String, CodingKey {
case action = "Action"
case changeSetId = "ChangeSetId"
case details = "Details"
case logicalResourceId = "LogicalResourceId"
case moduleInfo = "ModuleInfo"
case physicalResourceId = "PhysicalResourceId"
case replacement = "Replacement"
case resourceType = "ResourceType"
case scope = "Scope"
}
}
public struct ResourceChangeDetail: AWSDecodableShape {
/// The identity of the entity that triggered this change. This entity is a member of the group that is specified by the ChangeSource field. For example, if you modified the value of the KeyPairName parameter, the CausingEntity is the name of the parameter (KeyPairName). If the ChangeSource value is DirectModification, no value is given for CausingEntity.
public let causingEntity: String?
/// The group to which the CausingEntity value belongs. There are five entity groups: ResourceReference entities are Ref intrinsic functions that refer to resources in the template, such as { "Ref" : "MyEC2InstanceResource" }. ParameterReference entities are Ref intrinsic functions that get template parameter values, such as { "Ref" : "MyPasswordParameter" }. ResourceAttribute entities are Fn::GetAtt intrinsic functions that get resource attribute values, such as { "Fn::GetAtt" : [ "MyEC2InstanceResource", "PublicDnsName" ] }. DirectModification entities are changes that are made directly to the template. Automatic entities are AWS::CloudFormation::Stack resource types, which are also known as nested stacks. If you made no changes to the AWS::CloudFormation::Stack resource, AWS CloudFormation sets the ChangeSource to Automatic because the nested stack's template might have changed. Changes to a nested stack's template aren't visible to AWS CloudFormation until you run an update on the parent stack.
public let changeSource: ChangeSource?
/// Indicates whether AWS CloudFormation can determine the target value, and whether the target value will change before you execute a change set. For Static evaluations, AWS CloudFormation can determine that the target value will change, and its value. For example, if you directly modify the InstanceType property of an EC2 instance, AWS CloudFormation knows that this property value will change, and its value, so this is a Static evaluation. For Dynamic evaluations, cannot determine the target value because it depends on the result of an intrinsic function, such as a Ref or Fn::GetAtt intrinsic function, when the stack is updated. For example, if your template includes a reference to a resource that is conditionally recreated, the value of the reference (the physical ID of the resource) might change, depending on if the resource is recreated. If the resource is recreated, it will have a new physical ID, so all references to that resource will also be updated.
public let evaluation: EvaluationType?
/// A ResourceTargetDefinition structure that describes the field that AWS CloudFormation will change and whether the resource will be recreated.
public let target: ResourceTargetDefinition?
public init(causingEntity: String? = nil, changeSource: ChangeSource? = nil, evaluation: EvaluationType? = nil, target: ResourceTargetDefinition? = nil) {
self.causingEntity = causingEntity
self.changeSource = changeSource
self.evaluation = evaluation
self.target = target
}
private enum CodingKeys: String, CodingKey {
case causingEntity = "CausingEntity"
case changeSource = "ChangeSource"
case evaluation = "Evaluation"
case target = "Target"
}
}
public struct ResourceIdentifierSummary: AWSDecodableShape {
/// The logical IDs of the target resources of the specified ResourceType, as defined in the import template.
@OptionalCustomCoding<StandardArrayCoder>
public var logicalResourceIds: [String]?
/// The resource properties you can provide during the import to identify your target resources. For example, BucketName is a possible identifier property for AWS::S3::Bucket resources.
@OptionalCustomCoding<StandardArrayCoder>
public var resourceIdentifiers: [String]?
/// The template resource type of the target resources, such as AWS::S3::Bucket.
public let resourceType: String?
public init(logicalResourceIds: [String]? = nil, resourceIdentifiers: [String]? = nil, resourceType: String? = nil) {
self.logicalResourceIds = logicalResourceIds
self.resourceIdentifiers = resourceIdentifiers
self.resourceType = resourceType
}
private enum CodingKeys: String, CodingKey {
case logicalResourceIds = "LogicalResourceIds"
case resourceIdentifiers = "ResourceIdentifiers"
case resourceType = "ResourceType"
}
}
public struct ResourceTargetDefinition: AWSDecodableShape {
/// Indicates which resource attribute is triggering this update, such as a change in the resource attribute's Metadata, Properties, or Tags.
public let attribute: ResourceAttribute?
/// If the Attribute value is Properties, the name of the property. For all other attributes, the value is null.
public let name: String?
/// If the Attribute value is Properties, indicates whether a change to this property causes the resource to be recreated. The value can be Never, Always, or Conditionally. To determine the conditions for a Conditionally recreation, see the update behavior for that property in the AWS CloudFormation User Guide.
public let requiresRecreation: RequiresRecreation?
public init(attribute: ResourceAttribute? = nil, name: String? = nil, requiresRecreation: RequiresRecreation? = nil) {
self.attribute = attribute
self.name = name
self.requiresRecreation = requiresRecreation
}
private enum CodingKeys: String, CodingKey {
case attribute = "Attribute"
case name = "Name"
case requiresRecreation = "RequiresRecreation"
}
}
public struct ResourceToImport: AWSEncodableShape {
/// The logical ID of the target resource as specified in the template.
public let logicalResourceId: String
/// A key-value pair that identifies the target resource. The key is an identifier property (for example, BucketName for AWS::S3::Bucket resources) and the value is the actual property value (for example, MyS3Bucket).
@CustomCoding<StandardDictionaryCoder>
public var resourceIdentifier: [String: String]
/// The type of resource to import into your stack, such as AWS::S3::Bucket. For a list of supported resource types, see Resources that support import operations in the AWS CloudFormation User Guide.
public let resourceType: String
public init(logicalResourceId: String, resourceIdentifier: [String: String], resourceType: String) {
self.logicalResourceId = logicalResourceId
self.resourceIdentifier = resourceIdentifier
self.resourceType = resourceType
}
public func validate(name: String) throws {
try self.resourceIdentifier.forEach {
try validate($0.key, name: "resourceIdentifier.key", parent: name, max: 2048)
try validate($0.key, name: "resourceIdentifier.key", parent: name, min: 1)
try validate($0.value, name: "resourceIdentifier[\"\($0.key)\"]", parent: name, max: 2048)
try validate($0.value, name: "resourceIdentifier[\"\($0.key)\"]", parent: name, min: 1)
}
try self.validate(self.resourceType, name: "resourceType", parent: name, max: 256)
try self.validate(self.resourceType, name: "resourceType", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case logicalResourceId = "LogicalResourceId"
case resourceIdentifier = "ResourceIdentifier"
case resourceType = "ResourceType"
}
}
public struct RollbackConfiguration: AWSEncodableShape & AWSDecodableShape {
/// The amount of time, in minutes, during which CloudFormation should monitor all the rollback triggers after the stack creation or update operation deploys all necessary resources. The default is 0 minutes. If you specify a monitoring period but do not specify any rollback triggers, CloudFormation still waits the specified period of time before cleaning up old resources after update operations. You can use this monitoring period to perform any manual stack validation desired, and manually cancel the stack creation or update (using CancelUpdateStack, for example) as necessary. If you specify 0 for this parameter, CloudFormation still monitors the specified rollback triggers during stack creation and update operations. Then, for update operations, it begins disposing of old resources immediately once the operation completes.
public let monitoringTimeInMinutes: Int?
/// The triggers to monitor during stack creation or update actions. By default, AWS CloudFormation saves the rollback triggers specified for a stack and applies them to any subsequent update operations for the stack, unless you specify otherwise. If you do specify rollback triggers for this parameter, those triggers replace any list of triggers previously specified for the stack. This means: To use the rollback triggers previously specified for this stack, if any, don't specify this parameter. To specify new or updated rollback triggers, you must specify all the triggers that you want used for this stack, even triggers you've specifed before (for example, when creating the stack or during a previous stack update). Any triggers that you don't include in the updated list of triggers are no longer applied to the stack. To remove all currently specified triggers, specify an empty list for this parameter. If a specified trigger is missing, the entire stack operation fails and is rolled back.
@OptionalCustomCoding<StandardArrayCoder>
public var rollbackTriggers: [RollbackTrigger]?
public init(monitoringTimeInMinutes: Int? = nil, rollbackTriggers: [RollbackTrigger]? = nil) {
self.monitoringTimeInMinutes = monitoringTimeInMinutes
self.rollbackTriggers = rollbackTriggers
}
public func validate(name: String) throws {
try self.validate(self.monitoringTimeInMinutes, name: "monitoringTimeInMinutes", parent: name, max: 180)
try self.validate(self.monitoringTimeInMinutes, name: "monitoringTimeInMinutes", parent: name, min: 0)
try self.validate(self.rollbackTriggers, name: "rollbackTriggers", parent: name, max: 5)
}
private enum CodingKeys: String, CodingKey {
case monitoringTimeInMinutes = "MonitoringTimeInMinutes"
case rollbackTriggers = "RollbackTriggers"
}
}
public struct RollbackTrigger: AWSEncodableShape & AWSDecodableShape {
/// The Amazon Resource Name (ARN) of the rollback trigger. If a specified trigger is missing, the entire stack operation fails and is rolled back.
public let arn: String
/// The resource type of the rollback trigger. Currently, AWS::CloudWatch::Alarm is the only supported resource type.
public let type: String
public init(arn: String, type: String) {
self.arn = arn
self.type = type
}
private enum CodingKeys: String, CodingKey {
case arn = "Arn"
case type = "Type"
}
}
public struct SetStackPolicyInput: AWSEncodableShape {
/// The name or unique stack ID that you want to associate a policy with.
public let stackName: String
/// Structure containing the stack policy body. For more information, go to Prevent Updates to Stack Resources in the AWS CloudFormation User Guide. You can specify either the StackPolicyBody or the StackPolicyURL parameter, but not both.
public let stackPolicyBody: String?
/// Location of a file containing the stack policy. The URL must point to a policy (maximum size: 16 KB) located in an S3 bucket in the same Region as the stack. You can specify either the StackPolicyBody or the StackPolicyURL parameter, but not both.
public let stackPolicyURL: String?
public init(stackName: String, stackPolicyBody: String? = nil, stackPolicyURL: String? = nil) {
self.stackName = stackName
self.stackPolicyBody = stackPolicyBody
self.stackPolicyURL = stackPolicyURL
}
public func validate(name: String) throws {
try self.validate(self.stackPolicyBody, name: "stackPolicyBody", parent: name, max: 16384)
try self.validate(self.stackPolicyBody, name: "stackPolicyBody", parent: name, min: 1)
try self.validate(self.stackPolicyURL, name: "stackPolicyURL", parent: name, max: 1350)
try self.validate(self.stackPolicyURL, name: "stackPolicyURL", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case stackName = "StackName"
case stackPolicyBody = "StackPolicyBody"
case stackPolicyURL = "StackPolicyURL"
}
}
public struct SetTypeConfigurationInput: AWSEncodableShape {
/// The configuration data for the extension, in this account and region. The configuration data must be formatted as JSON, and validate against the schema returned in the ConfigurationSchema response element of API_DescribeType. For more information, see Defining account-level configuration data for an extension in the CloudFormation CLI User Guide.
public let configuration: String
/// An alias by which to refer to this extension configuration data. Conditional: Specifying a configuration alias is required when setting a configuration for a resource type extension.
public let configurationAlias: String?
/// The type of extension. Conditional: You must specify ConfigurationArn, or Type and TypeName.
public let type: ThirdPartyType?
/// The Amazon Resource Name (ARN) for the extension, in this account and region. For public extensions, this will be the ARN assigned when you activate the type in this account and region. For private extensions, this will be the ARN assigned when you register the type in this account and region. Do not include the extension versions suffix at the end of the ARN. You can set the configuration for an extension, but not for a specific extension version.
public let typeArn: String?
/// The name of the extension. Conditional: You must specify ConfigurationArn, or Type and TypeName.
public let typeName: String?
public init(configuration: String, configurationAlias: String? = nil, type: ThirdPartyType? = nil, typeArn: String? = nil, typeName: String? = nil) {
self.configuration = configuration
self.configurationAlias = configurationAlias
self.type = type
self.typeArn = typeArn
self.typeName = typeName
}
public func validate(name: String) throws {
try self.validate(self.configuration, name: "configuration", parent: name, max: 204_800)
try self.validate(self.configuration, name: "configuration", parent: name, min: 1)
try self.validate(self.configuration, name: "configuration", parent: name, pattern: "[\\s\\S]+")
try self.validate(self.configurationAlias, name: "configurationAlias", parent: name, max: 256)
try self.validate(self.configurationAlias, name: "configurationAlias", parent: name, min: 1)
try self.validate(self.configurationAlias, name: "configurationAlias", parent: name, pattern: "^[a-zA-Z0-9]{1,256}$")
try self.validate(self.typeArn, name: "typeArn", parent: name, max: 1024)
try self.validate(self.typeArn, name: "typeArn", parent: name, pattern: "arn:aws[A-Za-z0-9-]{0,64}:cloudformation:[A-Za-z0-9-]{1,64}:([0-9]{12})?:type/.+")
try self.validate(self.typeName, name: "typeName", parent: name, max: 204)
try self.validate(self.typeName, name: "typeName", parent: name, min: 10)
try self.validate(self.typeName, name: "typeName", parent: name, pattern: "[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}(::MODULE){0,1}")
}
private enum CodingKeys: String, CodingKey {
case configuration = "Configuration"
case configurationAlias = "ConfigurationAlias"
case type = "Type"
case typeArn = "TypeArn"
case typeName = "TypeName"
}
}
public struct SetTypeConfigurationOutput: AWSDecodableShape {
/// The Amazon Resource Name (ARN) for the configuration data, in this account and region. Conditional: You must specify ConfigurationArn, or Type and TypeName.
public let configurationArn: String?
public init(configurationArn: String? = nil) {
self.configurationArn = configurationArn
}
private enum CodingKeys: String, CodingKey {
case configurationArn = "ConfigurationArn"
}
}
public struct SetTypeDefaultVersionInput: AWSEncodableShape {
/// The Amazon Resource Name (ARN) of the extension for which you want version summary information. Conditional: You must specify either TypeName and Type, or Arn.
public let arn: String?
/// The kind of extension. Conditional: You must specify either TypeName and Type, or Arn.
public let type: RegistryType?
/// The name of the extension. Conditional: You must specify either TypeName and Type, or Arn.
public let typeName: String?
/// The ID of a specific version of the extension. The version ID is the value at the end of the Amazon Resource Name (ARN) assigned to the extension version when it is registered.
public let versionId: String?
public init(arn: String? = nil, type: RegistryType? = nil, typeName: String? = nil, versionId: String? = nil) {
self.arn = arn
self.type = type
self.typeName = typeName
self.versionId = versionId
}
public func validate(name: String) throws {
try self.validate(self.arn, name: "arn", parent: name, max: 1024)
try self.validate(self.arn, name: "arn", parent: name, pattern: "arn:aws[A-Za-z0-9-]{0,64}:cloudformation:[A-Za-z0-9-]{1,64}:[0-9]{12}:type/.+")
try self.validate(self.typeName, name: "typeName", parent: name, max: 204)
try self.validate(self.typeName, name: "typeName", parent: name, min: 10)
try self.validate(self.typeName, name: "typeName", parent: name, pattern: "[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}(::MODULE){0,1}")
try self.validate(self.versionId, name: "versionId", parent: name, max: 128)
try self.validate(self.versionId, name: "versionId", parent: name, min: 1)
try self.validate(self.versionId, name: "versionId", parent: name, pattern: "[A-Za-z0-9-]+")
}
private enum CodingKeys: String, CodingKey {
case arn = "Arn"
case type = "Type"
case typeName = "TypeName"
case versionId = "VersionId"
}
}
public struct SetTypeDefaultVersionOutput: AWSDecodableShape {
public init() {}
}
public struct SignalResourceInput: AWSEncodableShape {
/// The logical ID of the resource that you want to signal. The logical ID is the name of the resource that given in the template.
public let logicalResourceId: String
/// The stack name or unique stack ID that includes the resource that you want to signal.
public let stackName: String
/// The status of the signal, which is either success or failure. A failure signal causes AWS CloudFormation to immediately fail the stack creation or update.
public let status: ResourceSignalStatus
/// A unique ID of the signal. When you signal Amazon EC2 instances or Auto Scaling groups, specify the instance ID that you are signaling as the unique ID. If you send multiple signals to a single resource (such as signaling a wait condition), each signal requires a different unique ID.
public let uniqueId: String
public init(logicalResourceId: String, stackName: String, status: ResourceSignalStatus, uniqueId: String) {
self.logicalResourceId = logicalResourceId
self.stackName = stackName
self.status = status
self.uniqueId = uniqueId
}
public func validate(name: String) throws {
try self.validate(self.stackName, name: "stackName", parent: name, min: 1)
try self.validate(self.stackName, name: "stackName", parent: name, pattern: "([a-zA-Z][-a-zA-Z0-9]*)|(arn:\\b(aws|aws-us-gov|aws-cn)\\b:[-a-zA-Z0-9:/._+]*)")
try self.validate(self.uniqueId, name: "uniqueId", parent: name, max: 64)
try self.validate(self.uniqueId, name: "uniqueId", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case logicalResourceId = "LogicalResourceId"
case stackName = "StackName"
case status = "Status"
case uniqueId = "UniqueId"
}
}
public struct Stack: AWSDecodableShape {
/// The capabilities allowed in the stack.
@OptionalCustomCoding<StandardArrayCoder>
public var capabilities: [Capability]?
/// The unique ID of the change set.
public let changeSetId: String?
/// The time at which the stack was created.
public let creationTime: Date
/// The time the stack was deleted.
public let deletionTime: Date?
/// A user-defined description associated with the stack.
public let description: String?
/// Boolean to enable or disable rollback on stack creation failures: true: disable rollback false: enable rollback
public let disableRollback: Bool?
/// Information on whether a stack's actual configuration differs, or has drifted, from it's expected configuration, as defined in the stack template and any values specified as template parameters. For more information, see Detecting Unregulated Configuration Changes to Stacks and Resources.
public let driftInformation: StackDriftInformation?
/// Whether termination protection is enabled for the stack. For nested stacks, termination protection is set on the root stack and cannot be changed directly on the nested stack. For more information, see Protecting a Stack From Being Deleted in the AWS CloudFormation User Guide.
public let enableTerminationProtection: Bool?
/// The time the stack was last updated. This field will only be returned if the stack has been updated at least once.
public let lastUpdatedTime: Date?
/// SNS topic ARNs to which stack related events are published.
@OptionalCustomCoding<StandardArrayCoder>
public var notificationARNs: [String]?
/// A list of output structures.
@OptionalCustomCoding<StandardArrayCoder>
public var outputs: [Output]?
/// A list of Parameter structures.
@OptionalCustomCoding<StandardArrayCoder>
public var parameters: [Parameter]?
/// For nested stacks--stacks created as resources for another stack--the stack ID of the direct parent of this stack. For the first level of nested stacks, the root stack is also the parent stack. For more information, see Working with Nested Stacks in the AWS CloudFormation User Guide.
public let parentId: String?
/// The Amazon Resource Name (ARN) of an AWS Identity and Access Management (IAM) role that is associated with the stack. During a stack operation, AWS CloudFormation uses this role's credentials to make calls on your behalf.
public let roleARN: String?
/// The rollback triggers for AWS CloudFormation to monitor during stack creation and updating operations, and for the specified monitoring period afterwards.
public let rollbackConfiguration: RollbackConfiguration?
/// For nested stacks--stacks created as resources for another stack--the stack ID of the top-level stack to which the nested stack ultimately belongs. For more information, see Working with Nested Stacks in the AWS CloudFormation User Guide.
public let rootId: String?
/// Unique identifier of the stack.
public let stackId: String?
/// The name associated with the stack.
public let stackName: String
/// Current status of the stack.
public let stackStatus: StackStatus
/// Success/failure message associated with the stack status.
public let stackStatusReason: String?
/// A list of Tags that specify information about the stack.
@OptionalCustomCoding<StandardArrayCoder>
public var tags: [Tag]?
/// The amount of time within which stack creation should complete.
public let timeoutInMinutes: Int?
public init(capabilities: [Capability]? = nil, changeSetId: String? = nil, creationTime: Date, deletionTime: Date? = nil, description: String? = nil, disableRollback: Bool? = nil, driftInformation: StackDriftInformation? = nil, enableTerminationProtection: Bool? = nil, lastUpdatedTime: Date? = nil, notificationARNs: [String]? = nil, outputs: [Output]? = nil, parameters: [Parameter]? = nil, parentId: String? = nil, roleARN: String? = nil, rollbackConfiguration: RollbackConfiguration? = nil, rootId: String? = nil, stackId: String? = nil, stackName: String, stackStatus: StackStatus, stackStatusReason: String? = nil, tags: [Tag]? = nil, timeoutInMinutes: Int? = nil) {
self.capabilities = capabilities
self.changeSetId = changeSetId
self.creationTime = creationTime
self.deletionTime = deletionTime
self.description = description
self.disableRollback = disableRollback
self.driftInformation = driftInformation
self.enableTerminationProtection = enableTerminationProtection
self.lastUpdatedTime = lastUpdatedTime
self.notificationARNs = notificationARNs
self.outputs = outputs
self.parameters = parameters
self.parentId = parentId
self.roleARN = roleARN
self.rollbackConfiguration = rollbackConfiguration
self.rootId = rootId
self.stackId = stackId
self.stackName = stackName
self.stackStatus = stackStatus
self.stackStatusReason = stackStatusReason
self.tags = tags
self.timeoutInMinutes = timeoutInMinutes
}
private enum CodingKeys: String, CodingKey {
case capabilities = "Capabilities"
case changeSetId = "ChangeSetId"
case creationTime = "CreationTime"
case deletionTime = "DeletionTime"
case description = "Description"
case disableRollback = "DisableRollback"
case driftInformation = "DriftInformation"
case enableTerminationProtection = "EnableTerminationProtection"
case lastUpdatedTime = "LastUpdatedTime"
case notificationARNs = "NotificationARNs"
case outputs = "Outputs"
case parameters = "Parameters"
case parentId = "ParentId"
case roleARN = "RoleARN"
case rollbackConfiguration = "RollbackConfiguration"
case rootId = "RootId"
case stackId = "StackId"
case stackName = "StackName"
case stackStatus = "StackStatus"
case stackStatusReason = "StackStatusReason"
case tags = "Tags"
case timeoutInMinutes = "TimeoutInMinutes"
}
}
public struct StackDriftInformation: AWSDecodableShape {
/// Most recent time when a drift detection operation was initiated on the stack, or any of its individual resources that support drift detection.
public let lastCheckTimestamp: Date?
/// Status of the stack's actual configuration compared to its expected template configuration. DRIFTED: The stack differs from its expected template configuration. A stack is considered to have drifted if one or more of its resources have drifted. NOT_CHECKED: AWS CloudFormation has not checked if the stack differs from its expected template configuration. IN_SYNC: The stack's actual configuration matches its expected template configuration. UNKNOWN: This value is reserved for future use.
public let stackDriftStatus: StackDriftStatus
public init(lastCheckTimestamp: Date? = nil, stackDriftStatus: StackDriftStatus) {
self.lastCheckTimestamp = lastCheckTimestamp
self.stackDriftStatus = stackDriftStatus
}
private enum CodingKeys: String, CodingKey {
case lastCheckTimestamp = "LastCheckTimestamp"
case stackDriftStatus = "StackDriftStatus"
}
}
public struct StackDriftInformationSummary: AWSDecodableShape {
/// Most recent time when a drift detection operation was initiated on the stack, or any of its individual resources that support drift detection.
public let lastCheckTimestamp: Date?
/// Status of the stack's actual configuration compared to its expected template configuration. DRIFTED: The stack differs from its expected template configuration. A stack is considered to have drifted if one or more of its resources have drifted. NOT_CHECKED: AWS CloudFormation has not checked if the stack differs from its expected template configuration. IN_SYNC: The stack's actual configuration matches its expected template configuration. UNKNOWN: This value is reserved for future use.
public let stackDriftStatus: StackDriftStatus
public init(lastCheckTimestamp: Date? = nil, stackDriftStatus: StackDriftStatus) {
self.lastCheckTimestamp = lastCheckTimestamp
self.stackDriftStatus = stackDriftStatus
}
private enum CodingKeys: String, CodingKey {
case lastCheckTimestamp = "LastCheckTimestamp"
case stackDriftStatus = "StackDriftStatus"
}
}
public struct StackEvent: AWSDecodableShape {
/// The token passed to the operation that generated this event. All events triggered by a given stack operation are assigned the same client request token, which you can use to track operations. For example, if you execute a CreateStack operation with the token token1, then all the StackEvents generated by that operation will have ClientRequestToken set as token1. In the console, stack operations display the client request token on the Events tab. Stack operations that are initiated from the console use the token format Console-StackOperation-ID, which helps you easily identify the stack operation . For example, if you create a stack using the console, each stack event would be assigned the same token in the following format: Console-CreateStack-7f59c3cf-00d2-40c7-b2ff-e75db0987002.
public let clientRequestToken: String?
/// The unique ID of this event.
public let eventId: String
/// The logical name of the resource specified in the template.
public let logicalResourceId: String?
/// The name or unique identifier associated with the physical instance of the resource.
public let physicalResourceId: String?
/// BLOB of the properties used to create the resource.
public let resourceProperties: String?
/// Current status of the resource.
public let resourceStatus: ResourceStatus?
/// Success/failure message associated with the resource.
public let resourceStatusReason: String?
/// Type of resource. (For more information, go to AWS Resource Types Reference in the AWS CloudFormation User Guide.)
public let resourceType: String?
/// The unique ID name of the instance of the stack.
public let stackId: String
/// The name associated with a stack.
public let stackName: String
/// Time the status was updated.
public let timestamp: Date
public init(clientRequestToken: String? = nil, eventId: String, logicalResourceId: String? = nil, physicalResourceId: String? = nil, resourceProperties: String? = nil, resourceStatus: ResourceStatus? = nil, resourceStatusReason: String? = nil, resourceType: String? = nil, stackId: String, stackName: String, timestamp: Date) {
self.clientRequestToken = clientRequestToken
self.eventId = eventId
self.logicalResourceId = logicalResourceId
self.physicalResourceId = physicalResourceId
self.resourceProperties = resourceProperties
self.resourceStatus = resourceStatus
self.resourceStatusReason = resourceStatusReason
self.resourceType = resourceType
self.stackId = stackId
self.stackName = stackName
self.timestamp = timestamp
}
private enum CodingKeys: String, CodingKey {
case clientRequestToken = "ClientRequestToken"
case eventId = "EventId"
case logicalResourceId = "LogicalResourceId"
case physicalResourceId = "PhysicalResourceId"
case resourceProperties = "ResourceProperties"
case resourceStatus = "ResourceStatus"
case resourceStatusReason = "ResourceStatusReason"
case resourceType = "ResourceType"
case stackId = "StackId"
case stackName = "StackName"
case timestamp = "Timestamp"
}
}
public struct StackInstance: AWSDecodableShape {
/// [Self-managed permissions] The name of the AWS account that the stack instance is associated with.
public let account: String?
/// Status of the stack instance's actual configuration compared to the expected template and parameter configuration of the stack set to which it belongs. DRIFTED: The stack differs from the expected template and parameter configuration of the stack set to which it belongs. A stack instance is considered to have drifted if one or more of the resources in the associated stack have drifted. NOT_CHECKED: AWS CloudFormation has not checked if the stack instance differs from its expected stack set configuration. IN_SYNC: The stack instance's actual configuration matches its expected stack set configuration. UNKNOWN: This value is reserved for future use.
public let driftStatus: StackDriftStatus?
/// Most recent time when CloudFormation performed a drift detection operation on the stack instance. This value will be NULL for any stack instance on which drift detection has not yet been performed.
public let lastDriftCheckTimestamp: Date?
/// [Service-managed permissions] The organization root ID or organizational unit (OU) IDs that you specified for DeploymentTargets.
public let organizationalUnitId: String?
/// A list of parameters from the stack set template whose values have been overridden in this stack instance.
@OptionalCustomCoding<StandardArrayCoder>
public var parameterOverrides: [Parameter]?
/// The name of the AWS Region that the stack instance is associated with.
public let region: String?
/// The ID of the stack instance.
public let stackId: String?
/// The detailed status of the stack instance.
public let stackInstanceStatus: StackInstanceComprehensiveStatus?
/// The name or unique ID of the stack set that the stack instance is associated with.
public let stackSetId: String?
/// The status of the stack instance, in terms of its synchronization with its associated stack set. INOPERABLE: A DeleteStackInstances operation has failed and left the stack in an unstable state. Stacks in this state are excluded from further UpdateStackSet operations. You might need to perform a DeleteStackInstances operation, with RetainStacks set to true, to delete the stack instance, and then delete the stack manually. OUTDATED: The stack isn't currently up to date with the stack set because: The associated stack failed during a CreateStackSet or UpdateStackSet operation. The stack was part of a CreateStackSet or UpdateStackSet operation that failed or was stopped before the stack was created or updated. CURRENT: The stack is currently up to date with the stack set.
public let status: StackInstanceStatus?
/// The explanation for the specific status code that is assigned to this stack instance.
public let statusReason: String?
public init(account: String? = nil, driftStatus: StackDriftStatus? = nil, lastDriftCheckTimestamp: Date? = nil, organizationalUnitId: String? = nil, parameterOverrides: [Parameter]? = nil, region: String? = nil, stackId: String? = nil, stackInstanceStatus: StackInstanceComprehensiveStatus? = nil, stackSetId: String? = nil, status: StackInstanceStatus? = nil, statusReason: String? = nil) {
self.account = account
self.driftStatus = driftStatus
self.lastDriftCheckTimestamp = lastDriftCheckTimestamp
self.organizationalUnitId = organizationalUnitId
self.parameterOverrides = parameterOverrides
self.region = region
self.stackId = stackId
self.stackInstanceStatus = stackInstanceStatus
self.stackSetId = stackSetId
self.status = status
self.statusReason = statusReason
}
private enum CodingKeys: String, CodingKey {
case account = "Account"
case driftStatus = "DriftStatus"
case lastDriftCheckTimestamp = "LastDriftCheckTimestamp"
case organizationalUnitId = "OrganizationalUnitId"
case parameterOverrides = "ParameterOverrides"
case region = "Region"
case stackId = "StackId"
case stackInstanceStatus = "StackInstanceStatus"
case stackSetId = "StackSetId"
case status = "Status"
case statusReason = "StatusReason"
}
}
public struct StackInstanceComprehensiveStatus: AWSDecodableShape {
/// CANCELLED: The operation in the specified account and Region has been cancelled. This is either because a user has stopped the stack set operation, or because the failure tolerance of the stack set operation has been exceeded. FAILED: The operation in the specified account and Region failed. If the stack set operation fails in enough accounts within a Region, the failure tolerance for the stack set operation as a whole might be exceeded. INOPERABLE: A DeleteStackInstances operation has failed and left the stack in an unstable state. Stacks in this state are excluded from further UpdateStackSet operations. You might need to perform a DeleteStackInstances operation, with RetainStacks set to true, to delete the stack instance, and then delete the stack manually. PENDING: The operation in the specified account and Region has yet to start. RUNNING: The operation in the specified account and Region is currently in progress. SUCCEEDED: The operation in the specified account and Region completed successfully.
public let detailedStatus: StackInstanceDetailedStatus?
public init(detailedStatus: StackInstanceDetailedStatus? = nil) {
self.detailedStatus = detailedStatus
}
private enum CodingKeys: String, CodingKey {
case detailedStatus = "DetailedStatus"
}
}
public struct StackInstanceFilter: AWSEncodableShape {
/// The type of filter to apply.
public let name: StackInstanceFilterName?
/// The status to filter by.
public let values: String?
public init(name: StackInstanceFilterName? = nil, values: String? = nil) {
self.name = name
self.values = values
}
public func validate(name: String) throws {
try self.validate(self.values, name: "values", parent: name, max: 10)
try self.validate(self.values, name: "values", parent: name, min: 6)
}
private enum CodingKeys: String, CodingKey {
case name = "Name"
case values = "Values"
}
}
public struct StackInstanceSummary: AWSDecodableShape {
/// [Self-managed permissions] The name of the AWS account that the stack instance is associated with.
public let account: String?
/// Status of the stack instance's actual configuration compared to the expected template and parameter configuration of the stack set to which it belongs. DRIFTED: The stack differs from the expected template and parameter configuration of the stack set to which it belongs. A stack instance is considered to have drifted if one or more of the resources in the associated stack have drifted. NOT_CHECKED: AWS CloudFormation has not checked if the stack instance differs from its expected stack set configuration. IN_SYNC: The stack instance's actual configuration matches its expected stack set configuration. UNKNOWN: This value is reserved for future use.
public let driftStatus: StackDriftStatus?
/// Most recent time when CloudFormation performed a drift detection operation on the stack instance. This value will be NULL for any stack instance on which drift detection has not yet been performed.
public let lastDriftCheckTimestamp: Date?
/// [Service-managed permissions] The organization root ID or organizational unit (OU) IDs that you specified for DeploymentTargets.
public let organizationalUnitId: String?
/// The name of the AWS Region that the stack instance is associated with.
public let region: String?
/// The ID of the stack instance.
public let stackId: String?
/// The detailed status of the stack instance.
public let stackInstanceStatus: StackInstanceComprehensiveStatus?
/// The name or unique ID of the stack set that the stack instance is associated with.
public let stackSetId: String?
/// The status of the stack instance, in terms of its synchronization with its associated stack set. INOPERABLE: A DeleteStackInstances operation has failed and left the stack in an unstable state. Stacks in this state are excluded from further UpdateStackSet operations. You might need to perform a DeleteStackInstances operation, with RetainStacks set to true, to delete the stack instance, and then delete the stack manually. OUTDATED: The stack isn't currently up to date with the stack set because: The associated stack failed during a CreateStackSet or UpdateStackSet operation. The stack was part of a CreateStackSet or UpdateStackSet operation that failed or was stopped before the stack was created or updated. CURRENT: The stack is currently up to date with the stack set.
public let status: StackInstanceStatus?
/// The explanation for the specific status code assigned to this stack instance.
public let statusReason: String?
public init(account: String? = nil, driftStatus: StackDriftStatus? = nil, lastDriftCheckTimestamp: Date? = nil, organizationalUnitId: String? = nil, region: String? = nil, stackId: String? = nil, stackInstanceStatus: StackInstanceComprehensiveStatus? = nil, stackSetId: String? = nil, status: StackInstanceStatus? = nil, statusReason: String? = nil) {
self.account = account
self.driftStatus = driftStatus
self.lastDriftCheckTimestamp = lastDriftCheckTimestamp
self.organizationalUnitId = organizationalUnitId
self.region = region
self.stackId = stackId
self.stackInstanceStatus = stackInstanceStatus
self.stackSetId = stackSetId
self.status = status
self.statusReason = statusReason
}
private enum CodingKeys: String, CodingKey {
case account = "Account"
case driftStatus = "DriftStatus"
case lastDriftCheckTimestamp = "LastDriftCheckTimestamp"
case organizationalUnitId = "OrganizationalUnitId"
case region = "Region"
case stackId = "StackId"
case stackInstanceStatus = "StackInstanceStatus"
case stackSetId = "StackSetId"
case status = "Status"
case statusReason = "StatusReason"
}
}
public struct StackResource: AWSDecodableShape {
/// User defined description associated with the resource.
public let description: String?
/// Information about whether the resource's actual configuration differs, or has drifted, from its expected configuration, as defined in the stack template and any values specified as template parameters. For more information, see Detecting Unregulated Configuration Changes to Stacks and Resources.
public let driftInformation: StackResourceDriftInformation?
/// The logical name of the resource specified in the template.
public let logicalResourceId: String
/// Contains information about the module from which the resource was created, if the resource was created from a module included in the stack template.
public let moduleInfo: ModuleInfo?
/// The name or unique identifier that corresponds to a physical instance ID of a resource supported by AWS CloudFormation.
public let physicalResourceId: String?
/// Current status of the resource.
public let resourceStatus: ResourceStatus
/// Success/failure message associated with the resource.
public let resourceStatusReason: String?
/// Type of resource. (For more information, go to AWS Resource Types Reference in the AWS CloudFormation User Guide.)
public let resourceType: String
/// Unique identifier of the stack.
public let stackId: String?
/// The name associated with the stack.
public let stackName: String?
/// Time the status was updated.
public let timestamp: Date
public init(description: String? = nil, driftInformation: StackResourceDriftInformation? = nil, logicalResourceId: String, moduleInfo: ModuleInfo? = nil, physicalResourceId: String? = nil, resourceStatus: ResourceStatus, resourceStatusReason: String? = nil, resourceType: String, stackId: String? = nil, stackName: String? = nil, timestamp: Date) {
self.description = description
self.driftInformation = driftInformation
self.logicalResourceId = logicalResourceId
self.moduleInfo = moduleInfo
self.physicalResourceId = physicalResourceId
self.resourceStatus = resourceStatus
self.resourceStatusReason = resourceStatusReason
self.resourceType = resourceType
self.stackId = stackId
self.stackName = stackName
self.timestamp = timestamp
}
private enum CodingKeys: String, CodingKey {
case description = "Description"
case driftInformation = "DriftInformation"
case logicalResourceId = "LogicalResourceId"
case moduleInfo = "ModuleInfo"
case physicalResourceId = "PhysicalResourceId"
case resourceStatus = "ResourceStatus"
case resourceStatusReason = "ResourceStatusReason"
case resourceType = "ResourceType"
case stackId = "StackId"
case stackName = "StackName"
case timestamp = "Timestamp"
}
}
public struct StackResourceDetail: AWSDecodableShape {
/// User defined description associated with the resource.
public let description: String?
/// Information about whether the resource's actual configuration differs, or has drifted, from its expected configuration, as defined in the stack template and any values specified as template parameters. For more information, see Detecting Unregulated Configuration Changes to Stacks and Resources.
public let driftInformation: StackResourceDriftInformation?
/// Time the status was updated.
public let lastUpdatedTimestamp: Date
/// The logical name of the resource specified in the template.
public let logicalResourceId: String
/// The content of the Metadata attribute declared for the resource. For more information, see Metadata Attribute in the AWS CloudFormation User Guide.
public let metadata: String?
/// Contains information about the module from which the resource was created, if the resource was created from a module included in the stack template.
public let moduleInfo: ModuleInfo?
/// The name or unique identifier that corresponds to a physical instance ID of a resource supported by AWS CloudFormation.
public let physicalResourceId: String?
/// Current status of the resource.
public let resourceStatus: ResourceStatus
/// Success/failure message associated with the resource.
public let resourceStatusReason: String?
/// Type of resource. ((For more information, go to AWS Resource Types Reference in the AWS CloudFormation User Guide.)
public let resourceType: String
/// Unique identifier of the stack.
public let stackId: String?
/// The name associated with the stack.
public let stackName: String?
public init(description: String? = nil, driftInformation: StackResourceDriftInformation? = nil, lastUpdatedTimestamp: Date, logicalResourceId: String, metadata: String? = nil, moduleInfo: ModuleInfo? = nil, physicalResourceId: String? = nil, resourceStatus: ResourceStatus, resourceStatusReason: String? = nil, resourceType: String, stackId: String? = nil, stackName: String? = nil) {
self.description = description
self.driftInformation = driftInformation
self.lastUpdatedTimestamp = lastUpdatedTimestamp
self.logicalResourceId = logicalResourceId
self.metadata = metadata
self.moduleInfo = moduleInfo
self.physicalResourceId = physicalResourceId
self.resourceStatus = resourceStatus
self.resourceStatusReason = resourceStatusReason
self.resourceType = resourceType
self.stackId = stackId
self.stackName = stackName
}
private enum CodingKeys: String, CodingKey {
case description = "Description"
case driftInformation = "DriftInformation"
case lastUpdatedTimestamp = "LastUpdatedTimestamp"
case logicalResourceId = "LogicalResourceId"
case metadata = "Metadata"
case moduleInfo = "ModuleInfo"
case physicalResourceId = "PhysicalResourceId"
case resourceStatus = "ResourceStatus"
case resourceStatusReason = "ResourceStatusReason"
case resourceType = "ResourceType"
case stackId = "StackId"
case stackName = "StackName"
}
}
public struct StackResourceDrift: AWSDecodableShape {
/// A JSON structure containing the actual property values of the stack resource. For resources whose StackResourceDriftStatus is DELETED, this structure will not be present.
public let actualProperties: String?
/// A JSON structure containing the expected property values of the stack resource, as defined in the stack template and any values specified as template parameters. For resources whose StackResourceDriftStatus is DELETED, this structure will not be present.
public let expectedProperties: String?
/// The logical name of the resource specified in the template.
public let logicalResourceId: String
/// Contains information about the module from which the resource was created, if the resource was created from a module included in the stack template.
public let moduleInfo: ModuleInfo?
/// The name or unique identifier that corresponds to a physical instance ID of a resource supported by AWS CloudFormation.
public let physicalResourceId: String?
/// Context information that enables AWS CloudFormation to uniquely identify a resource. AWS CloudFormation uses context key-value pairs in cases where a resource's logical and physical IDs are not enough to uniquely identify that resource. Each context key-value pair specifies a unique resource that contains the targeted resource.
@OptionalCustomCoding<StandardArrayCoder>
public var physicalResourceIdContext: [PhysicalResourceIdContextKeyValuePair]?
/// A collection of the resource properties whose actual values differ from their expected values. These will be present only for resources whose StackResourceDriftStatus is MODIFIED.
@OptionalCustomCoding<StandardArrayCoder>
public var propertyDifferences: [PropertyDifference]?
/// The type of the resource.
public let resourceType: String
/// The ID of the stack.
public let stackId: String
/// Status of the resource's actual configuration compared to its expected configuration DELETED: The resource differs from its expected template configuration because the resource has been deleted. MODIFIED: One or more resource properties differ from their expected values (as defined in the stack template and any values specified as template parameters). IN_SYNC: The resources's actual configuration matches its expected template configuration. NOT_CHECKED: AWS CloudFormation does not currently return this value.
public let stackResourceDriftStatus: StackResourceDriftStatus
/// Time at which AWS CloudFormation performed drift detection on the stack resource.
public let timestamp: Date
public init(actualProperties: String? = nil, expectedProperties: String? = nil, logicalResourceId: String, moduleInfo: ModuleInfo? = nil, physicalResourceId: String? = nil, physicalResourceIdContext: [PhysicalResourceIdContextKeyValuePair]? = nil, propertyDifferences: [PropertyDifference]? = nil, resourceType: String, stackId: String, stackResourceDriftStatus: StackResourceDriftStatus, timestamp: Date) {
self.actualProperties = actualProperties
self.expectedProperties = expectedProperties
self.logicalResourceId = logicalResourceId
self.moduleInfo = moduleInfo
self.physicalResourceId = physicalResourceId
self.physicalResourceIdContext = physicalResourceIdContext
self.propertyDifferences = propertyDifferences
self.resourceType = resourceType
self.stackId = stackId
self.stackResourceDriftStatus = stackResourceDriftStatus
self.timestamp = timestamp
}
private enum CodingKeys: String, CodingKey {
case actualProperties = "ActualProperties"
case expectedProperties = "ExpectedProperties"
case logicalResourceId = "LogicalResourceId"
case moduleInfo = "ModuleInfo"
case physicalResourceId = "PhysicalResourceId"
case physicalResourceIdContext = "PhysicalResourceIdContext"
case propertyDifferences = "PropertyDifferences"
case resourceType = "ResourceType"
case stackId = "StackId"
case stackResourceDriftStatus = "StackResourceDriftStatus"
case timestamp = "Timestamp"
}
}
public struct StackResourceDriftInformation: AWSDecodableShape {
/// When AWS CloudFormation last checked if the resource had drifted from its expected configuration.
public let lastCheckTimestamp: Date?
/// Status of the resource's actual configuration compared to its expected configuration DELETED: The resource differs from its expected configuration in that it has been deleted. MODIFIED: The resource differs from its expected configuration. NOT_CHECKED: AWS CloudFormation has not checked if the resource differs from its expected configuration. Any resources that do not currently support drift detection have a status of NOT_CHECKED. For more information, see Resources that Support Drift Detection. IN_SYNC: The resources's actual configuration matches its expected configuration.
public let stackResourceDriftStatus: StackResourceDriftStatus
public init(lastCheckTimestamp: Date? = nil, stackResourceDriftStatus: StackResourceDriftStatus) {
self.lastCheckTimestamp = lastCheckTimestamp
self.stackResourceDriftStatus = stackResourceDriftStatus
}
private enum CodingKeys: String, CodingKey {
case lastCheckTimestamp = "LastCheckTimestamp"
case stackResourceDriftStatus = "StackResourceDriftStatus"
}
}
public struct StackResourceDriftInformationSummary: AWSDecodableShape {
/// When AWS CloudFormation last checked if the resource had drifted from its expected configuration.
public let lastCheckTimestamp: Date?
/// Status of the resource's actual configuration compared to its expected configuration DELETED: The resource differs from its expected configuration in that it has been deleted. MODIFIED: The resource differs from its expected configuration. NOT_CHECKED: AWS CloudFormation has not checked if the resource differs from its expected configuration. Any resources that do not currently support drift detection have a status of NOT_CHECKED. For more information, see Resources that Support Drift Detection. If you performed an ContinueUpdateRollback operation on a stack, any resources included in ResourcesToSkip will also have a status of NOT_CHECKED. For more information on skipping resources during rollback operations, see Continue Rolling Back an Update in the AWS CloudFormation User Guide. IN_SYNC: The resources's actual configuration matches its expected configuration.
public let stackResourceDriftStatus: StackResourceDriftStatus
public init(lastCheckTimestamp: Date? = nil, stackResourceDriftStatus: StackResourceDriftStatus) {
self.lastCheckTimestamp = lastCheckTimestamp
self.stackResourceDriftStatus = stackResourceDriftStatus
}
private enum CodingKeys: String, CodingKey {
case lastCheckTimestamp = "LastCheckTimestamp"
case stackResourceDriftStatus = "StackResourceDriftStatus"
}
}
public struct StackResourceSummary: AWSDecodableShape {
/// Information about whether the resource's actual configuration differs, or has drifted, from its expected configuration, as defined in the stack template and any values specified as template parameters. For more information, see Detecting Unregulated Configuration Changes to Stacks and Resources.
public let driftInformation: StackResourceDriftInformationSummary?
/// Time the status was updated.
public let lastUpdatedTimestamp: Date
/// The logical name of the resource specified in the template.
public let logicalResourceId: String
/// Contains information about the module from which the resource was created, if the resource was created from a module included in the stack template.
public let moduleInfo: ModuleInfo?
/// The name or unique identifier that corresponds to a physical instance ID of the resource.
public let physicalResourceId: String?
/// Current status of the resource.
public let resourceStatus: ResourceStatus
/// Success/failure message associated with the resource.
public let resourceStatusReason: String?
/// Type of resource. (For more information, go to AWS Resource Types Reference in the AWS CloudFormation User Guide.)
public let resourceType: String
public init(driftInformation: StackResourceDriftInformationSummary? = nil, lastUpdatedTimestamp: Date, logicalResourceId: String, moduleInfo: ModuleInfo? = nil, physicalResourceId: String? = nil, resourceStatus: ResourceStatus, resourceStatusReason: String? = nil, resourceType: String) {
self.driftInformation = driftInformation
self.lastUpdatedTimestamp = lastUpdatedTimestamp
self.logicalResourceId = logicalResourceId
self.moduleInfo = moduleInfo
self.physicalResourceId = physicalResourceId
self.resourceStatus = resourceStatus
self.resourceStatusReason = resourceStatusReason
self.resourceType = resourceType
}
private enum CodingKeys: String, CodingKey {
case driftInformation = "DriftInformation"
case lastUpdatedTimestamp = "LastUpdatedTimestamp"
case logicalResourceId = "LogicalResourceId"
case moduleInfo = "ModuleInfo"
case physicalResourceId = "PhysicalResourceId"
case resourceStatus = "ResourceStatus"
case resourceStatusReason = "ResourceStatusReason"
case resourceType = "ResourceType"
}
}
public struct StackSet: AWSDecodableShape {
/// The Amazon Resource Number (ARN) of the IAM role used to create or update the stack set. Use customized administrator roles to control which users or groups can manage specific stack sets within the same administrator account. For more information, see Prerequisites: Granting Permissions for Stack Set Operations in the AWS CloudFormation User Guide.
public let administrationRoleARN: String?
/// [Service-managed permissions] Describes whether StackSets automatically deploys to AWS Organizations accounts that are added to a target organization or organizational unit (OU).
public let autoDeployment: AutoDeployment?
/// The capabilities that are allowed in the stack set. Some stack set templates might include resources that can affect permissions in your AWS account—for example, by creating new AWS Identity and Access Management (IAM) users. For more information, see Acknowledging IAM Resources in AWS CloudFormation Templates.
@OptionalCustomCoding<StandardArrayCoder>
public var capabilities: [Capability]?
/// A description of the stack set that you specify when the stack set is created or updated.
public let description: String?
/// The name of the IAM execution role used to create or update the stack set. Use customized execution roles to control which stack resources users and groups can include in their stack sets.
public let executionRoleName: String?
/// [Service-managed permissions] The organization root ID or organizational unit (OU) IDs that you specified for DeploymentTargets.
@OptionalCustomCoding<StandardArrayCoder>
public var organizationalUnitIds: [String]?
/// A list of input parameters for a stack set.
@OptionalCustomCoding<StandardArrayCoder>
public var parameters: [Parameter]?
/// Describes how the IAM roles required for stack set operations are created. With self-managed permissions, you must create the administrator and execution roles required to deploy to target accounts. For more information, see Grant Self-Managed Stack Set Permissions. With service-managed permissions, StackSets automatically creates the IAM roles required to deploy to accounts managed by AWS Organizations. For more information, see Grant Service-Managed Stack Set Permissions.
public let permissionModel: PermissionModels?
/// The Amazon Resource Number (ARN) of the stack set.
public let stackSetARN: String?
/// Detailed information about the drift status of the stack set. For stack sets, contains information about the last completed drift operation performed on the stack set. Information about drift operations currently in progress is not included.
public let stackSetDriftDetectionDetails: StackSetDriftDetectionDetails?
/// The ID of the stack set.
public let stackSetId: String?
/// The name that's associated with the stack set.
public let stackSetName: String?
/// The status of the stack set.
public let status: StackSetStatus?
/// A list of tags that specify information about the stack set. A maximum number of 50 tags can be specified.
@OptionalCustomCoding<StandardArrayCoder>
public var tags: [Tag]?
/// The structure that contains the body of the template that was used to create or update the stack set.
public let templateBody: String?
public init(administrationRoleARN: String? = nil, autoDeployment: AutoDeployment? = nil, capabilities: [Capability]? = nil, description: String? = nil, executionRoleName: String? = nil, organizationalUnitIds: [String]? = nil, parameters: [Parameter]? = nil, permissionModel: PermissionModels? = nil, stackSetARN: String? = nil, stackSetDriftDetectionDetails: StackSetDriftDetectionDetails? = nil, stackSetId: String? = nil, stackSetName: String? = nil, status: StackSetStatus? = nil, tags: [Tag]? = nil, templateBody: String? = nil) {
self.administrationRoleARN = administrationRoleARN
self.autoDeployment = autoDeployment
self.capabilities = capabilities
self.description = description
self.executionRoleName = executionRoleName
self.organizationalUnitIds = organizationalUnitIds
self.parameters = parameters
self.permissionModel = permissionModel
self.stackSetARN = stackSetARN
self.stackSetDriftDetectionDetails = stackSetDriftDetectionDetails
self.stackSetId = stackSetId
self.stackSetName = stackSetName
self.status = status
self.tags = tags
self.templateBody = templateBody
}
private enum CodingKeys: String, CodingKey {
case administrationRoleARN = "AdministrationRoleARN"
case autoDeployment = "AutoDeployment"
case capabilities = "Capabilities"
case description = "Description"
case executionRoleName = "ExecutionRoleName"
case organizationalUnitIds = "OrganizationalUnitIds"
case parameters = "Parameters"
case permissionModel = "PermissionModel"
case stackSetARN = "StackSetARN"
case stackSetDriftDetectionDetails = "StackSetDriftDetectionDetails"
case stackSetId = "StackSetId"
case stackSetName = "StackSetName"
case status = "Status"
case tags = "Tags"
case templateBody = "TemplateBody"
}
}
public struct StackSetDriftDetectionDetails: AWSDecodableShape {
/// The status of the stack set drift detection operation. COMPLETED: The drift detection operation completed without failing on any stack instances. FAILED: The drift detection operation exceeded the specified failure tolerance. PARTIAL_SUCCESS: The drift detection operation completed without exceeding the failure tolerance for the operation. IN_PROGRESS: The drift detection operation is currently being performed. STOPPED: The user has cancelled the drift detection operation.
public let driftDetectionStatus: StackSetDriftDetectionStatus?
/// The number of stack instances that have drifted from the expected template and parameter configuration of the stack set. A stack instance is considered to have drifted if one or more of the resources in the associated stack do not match their expected configuration.
public let driftedStackInstancesCount: Int?
/// Status of the stack set's actual configuration compared to its expected template and parameter configuration. A stack set is considered to have drifted if one or more of its stack instances have drifted from their expected template and parameter configuration. DRIFTED: One or more of the stack instances belonging to the stack set stack differs from the expected template and parameter configuration. A stack instance is considered to have drifted if one or more of the resources in the associated stack have drifted. NOT_CHECKED: AWS CloudFormation has not checked the stack set for drift. IN_SYNC: All of the stack instances belonging to the stack set stack match from the expected template and parameter configuration.
public let driftStatus: StackSetDriftStatus?
/// The number of stack instances for which the drift detection operation failed.
public let failedStackInstancesCount: Int?
/// The number of stack instances that are currently being checked for drift.
public let inProgressStackInstancesCount: Int?
/// The number of stack instances which match the expected template and parameter configuration of the stack set.
public let inSyncStackInstancesCount: Int?
/// Most recent time when CloudFormation performed a drift detection operation on the stack set. This value will be NULL for any stack set on which drift detection has not yet been performed.
public let lastDriftCheckTimestamp: Date?
/// The total number of stack instances belonging to this stack set. The total number of stack instances is equal to the total of: Stack instances that match the stack set configuration. Stack instances that have drifted from the stack set configuration. Stack instances where the drift detection operation has failed. Stack instances currently being checked for drift.
public let totalStackInstancesCount: Int?
public init(driftDetectionStatus: StackSetDriftDetectionStatus? = nil, driftedStackInstancesCount: Int? = nil, driftStatus: StackSetDriftStatus? = nil, failedStackInstancesCount: Int? = nil, inProgressStackInstancesCount: Int? = nil, inSyncStackInstancesCount: Int? = nil, lastDriftCheckTimestamp: Date? = nil, totalStackInstancesCount: Int? = nil) {
self.driftDetectionStatus = driftDetectionStatus
self.driftedStackInstancesCount = driftedStackInstancesCount
self.driftStatus = driftStatus
self.failedStackInstancesCount = failedStackInstancesCount
self.inProgressStackInstancesCount = inProgressStackInstancesCount
self.inSyncStackInstancesCount = inSyncStackInstancesCount
self.lastDriftCheckTimestamp = lastDriftCheckTimestamp
self.totalStackInstancesCount = totalStackInstancesCount
}
private enum CodingKeys: String, CodingKey {
case driftDetectionStatus = "DriftDetectionStatus"
case driftedStackInstancesCount = "DriftedStackInstancesCount"
case driftStatus = "DriftStatus"
case failedStackInstancesCount = "FailedStackInstancesCount"
case inProgressStackInstancesCount = "InProgressStackInstancesCount"
case inSyncStackInstancesCount = "InSyncStackInstancesCount"
case lastDriftCheckTimestamp = "LastDriftCheckTimestamp"
case totalStackInstancesCount = "TotalStackInstancesCount"
}
}
public struct StackSetOperation: AWSDecodableShape {
/// The type of stack set operation: CREATE, UPDATE, or DELETE. Create and delete operations affect only the specified stack set instances that are associated with the specified stack set. Update operations affect both the stack set itself, as well as all associated stack set instances.
public let action: StackSetOperationAction?
/// The Amazon Resource Number (ARN) of the IAM role used to perform this stack set operation. Use customized administrator roles to control which users or groups can manage specific stack sets within the same administrator account. For more information, see Define Permissions for Multiple Administrators in the AWS CloudFormation User Guide.
public let administrationRoleARN: String?
/// The time at which the operation was initiated. Note that the creation times for the stack set operation might differ from the creation time of the individual stacks themselves. This is because AWS CloudFormation needs to perform preparatory work for the operation, such as dispatching the work to the requested Regions, before actually creating the first stacks.
public let creationTimestamp: Date?
/// [Service-managed permissions] The AWS Organizations accounts affected by the stack operation.
public let deploymentTargets: DeploymentTargets?
/// The time at which the stack set operation ended, across all accounts and Regions specified. Note that this doesn't necessarily mean that the stack set operation was successful, or even attempted, in each account or Region.
public let endTimestamp: Date?
/// The name of the IAM execution role used to create or update the stack set. Use customized execution roles to control which stack resources users and groups can include in their stack sets.
public let executionRoleName: String?
/// The unique ID of a stack set operation.
public let operationId: String?
/// The preferences for how AWS CloudFormation performs this stack set operation.
public let operationPreferences: StackSetOperationPreferences?
/// For stack set operations of action type DELETE, specifies whether to remove the stack instances from the specified stack set, but doesn't delete the stacks. You can't reassociate a retained stack, or add an existing, saved stack to a new stack set.
public let retainStacks: Bool?
/// Detailed information about the drift status of the stack set. This includes information about drift operations currently being performed on the stack set. this information will only be present for stack set operations whose Action type is DETECT_DRIFT. For more information, see Detecting Unmanaged Changes in Stack Sets in the AWS CloudFormation User Guide.
public let stackSetDriftDetectionDetails: StackSetDriftDetectionDetails?
/// The ID of the stack set.
public let stackSetId: String?
/// The status of the operation. FAILED: The operation exceeded the specified failure tolerance. The failure tolerance value that you've set for an operation is applied for each Region during stack create and update operations. If the number of failed stacks within a Region exceeds the failure tolerance, the status of the operation in the Region is set to FAILED. This in turn sets the status of the operation as a whole to FAILED, and AWS CloudFormation cancels the operation in any remaining Regions. QUEUED: [Service-managed permissions] For automatic deployments that require a sequence of operations, the operation is queued to be performed. For more information, see the stack set operation status codes in the AWS CloudFormation User Guide. RUNNING: The operation is currently being performed. STOPPED: The user has cancelled the operation. STOPPING: The operation is in the process of stopping, at user request. SUCCEEDED: The operation completed creating or updating all the specified stacks without exceeding the failure tolerance for the operation.
public let status: StackSetOperationStatus?
public init(action: StackSetOperationAction? = nil, administrationRoleARN: String? = nil, creationTimestamp: Date? = nil, deploymentTargets: DeploymentTargets? = nil, endTimestamp: Date? = nil, executionRoleName: String? = nil, operationId: String? = nil, operationPreferences: StackSetOperationPreferences? = nil, retainStacks: Bool? = nil, stackSetDriftDetectionDetails: StackSetDriftDetectionDetails? = nil, stackSetId: String? = nil, status: StackSetOperationStatus? = nil) {
self.action = action
self.administrationRoleARN = administrationRoleARN
self.creationTimestamp = creationTimestamp
self.deploymentTargets = deploymentTargets
self.endTimestamp = endTimestamp
self.executionRoleName = executionRoleName
self.operationId = operationId
self.operationPreferences = operationPreferences
self.retainStacks = retainStacks
self.stackSetDriftDetectionDetails = stackSetDriftDetectionDetails
self.stackSetId = stackSetId
self.status = status
}
private enum CodingKeys: String, CodingKey {
case action = "Action"
case administrationRoleARN = "AdministrationRoleARN"
case creationTimestamp = "CreationTimestamp"
case deploymentTargets = "DeploymentTargets"
case endTimestamp = "EndTimestamp"
case executionRoleName = "ExecutionRoleName"
case operationId = "OperationId"
case operationPreferences = "OperationPreferences"
case retainStacks = "RetainStacks"
case stackSetDriftDetectionDetails = "StackSetDriftDetectionDetails"
case stackSetId = "StackSetId"
case status = "Status"
}
}
public struct StackSetOperationPreferences: AWSEncodableShape & AWSDecodableShape {
/// The number of accounts, per Region, for which this operation can fail before AWS CloudFormation stops the operation in that Region. If the operation is stopped in a Region, AWS CloudFormation doesn't attempt the operation in any subsequent Regions. Conditional: You must specify either FailureToleranceCount or FailureTolerancePercentage (but not both). By default, 0 is specified.
public let failureToleranceCount: Int?
/// The percentage of accounts, per Region, for which this stack operation can fail before AWS CloudFormation stops the operation in that Region. If the operation is stopped in a Region, AWS CloudFormation doesn't attempt the operation in any subsequent Regions. When calculating the number of accounts based on the specified percentage, AWS CloudFormation rounds down to the next whole number. Conditional: You must specify either FailureToleranceCount or FailureTolerancePercentage, but not both. By default, 0 is specified.
public let failureTolerancePercentage: Int?
/// The maximum number of accounts in which to perform this operation at one time. This is dependent on the value of FailureToleranceCount. MaxConcurrentCount is at most one more than the FailureToleranceCount. Note that this setting lets you specify the maximum for operations. For large deployments, under certain circumstances the actual number of accounts acted upon concurrently may be lower due to service throttling. Conditional: You must specify either MaxConcurrentCount or MaxConcurrentPercentage, but not both. By default, 1 is specified.
public let maxConcurrentCount: Int?
/// The maximum percentage of accounts in which to perform this operation at one time. When calculating the number of accounts based on the specified percentage, AWS CloudFormation rounds down to the next whole number. This is true except in cases where rounding down would result is zero. In this case, CloudFormation sets the number as one instead. Note that this setting lets you specify the maximum for operations. For large deployments, under certain circumstances the actual number of accounts acted upon concurrently may be lower due to service throttling. Conditional: You must specify either MaxConcurrentCount or MaxConcurrentPercentage, but not both. By default, 1 is specified.
public let maxConcurrentPercentage: Int?
/// The concurrency type of deploying StackSets operations in regions, could be in parallel or one region at a time.
public let regionConcurrencyType: RegionConcurrencyType?
/// The order of the Regions in where you want to perform the stack operation.
@OptionalCustomCoding<StandardArrayCoder>
public var regionOrder: [String]?
public init(failureToleranceCount: Int? = nil, failureTolerancePercentage: Int? = nil, maxConcurrentCount: Int? = nil, maxConcurrentPercentage: Int? = nil, regionConcurrencyType: RegionConcurrencyType? = nil, regionOrder: [String]? = nil) {
self.failureToleranceCount = failureToleranceCount
self.failureTolerancePercentage = failureTolerancePercentage
self.maxConcurrentCount = maxConcurrentCount
self.maxConcurrentPercentage = maxConcurrentPercentage
self.regionConcurrencyType = regionConcurrencyType
self.regionOrder = regionOrder
}
public func validate(name: String) throws {
try self.validate(self.failureToleranceCount, name: "failureToleranceCount", parent: name, min: 0)
try self.validate(self.failureTolerancePercentage, name: "failureTolerancePercentage", parent: name, max: 100)
try self.validate(self.failureTolerancePercentage, name: "failureTolerancePercentage", parent: name, min: 0)
try self.validate(self.maxConcurrentCount, name: "maxConcurrentCount", parent: name, min: 1)
try self.validate(self.maxConcurrentPercentage, name: "maxConcurrentPercentage", parent: name, max: 100)
try self.validate(self.maxConcurrentPercentage, name: "maxConcurrentPercentage", parent: name, min: 1)
try self.regionOrder?.forEach {
try validate($0, name: "regionOrder[]", parent: name, pattern: "^[a-zA-Z0-9-]{1,128}$")
}
}
private enum CodingKeys: String, CodingKey {
case failureToleranceCount = "FailureToleranceCount"
case failureTolerancePercentage = "FailureTolerancePercentage"
case maxConcurrentCount = "MaxConcurrentCount"
case maxConcurrentPercentage = "MaxConcurrentPercentage"
case regionConcurrencyType = "RegionConcurrencyType"
case regionOrder = "RegionOrder"
}
}
public struct StackSetOperationResultSummary: AWSDecodableShape {
/// [Self-managed permissions] The name of the AWS account for this operation result.
public let account: String?
/// The results of the account gate function AWS CloudFormation invokes, if present, before proceeding with stack set operations in an account
public let accountGateResult: AccountGateResult?
/// [Service-managed permissions] The organization root ID or organizational unit (OU) IDs that you specified for DeploymentTargets.
public let organizationalUnitId: String?
/// The name of the AWS Region for this operation result.
public let region: String?
/// The result status of the stack set operation for the given account in the given Region. CANCELLED: The operation in the specified account and Region has been cancelled. This is either because a user has stopped the stack set operation, or because the failure tolerance of the stack set operation has been exceeded. FAILED: The operation in the specified account and Region failed. If the stack set operation fails in enough accounts within a Region, the failure tolerance for the stack set operation as a whole might be exceeded. RUNNING: The operation in the specified account and Region is currently in progress. PENDING: The operation in the specified account and Region has yet to start. SUCCEEDED: The operation in the specified account and Region completed successfully.
public let status: StackSetOperationResultStatus?
/// The reason for the assigned result status.
public let statusReason: String?
public init(account: String? = nil, accountGateResult: AccountGateResult? = nil, organizationalUnitId: String? = nil, region: String? = nil, status: StackSetOperationResultStatus? = nil, statusReason: String? = nil) {
self.account = account
self.accountGateResult = accountGateResult
self.organizationalUnitId = organizationalUnitId
self.region = region
self.status = status
self.statusReason = statusReason
}
private enum CodingKeys: String, CodingKey {
case account = "Account"
case accountGateResult = "AccountGateResult"
case organizationalUnitId = "OrganizationalUnitId"
case region = "Region"
case status = "Status"
case statusReason = "StatusReason"
}
}
public struct StackSetOperationSummary: AWSDecodableShape {
/// The type of operation: CREATE, UPDATE, or DELETE. Create and delete operations affect only the specified stack instances that are associated with the specified stack set. Update operations affect both the stack set itself as well as all associated stack set instances.
public let action: StackSetOperationAction?
/// The time at which the operation was initiated. Note that the creation times for the stack set operation might differ from the creation time of the individual stacks themselves. This is because AWS CloudFormation needs to perform preparatory work for the operation, such as dispatching the work to the requested Regions, before actually creating the first stacks.
public let creationTimestamp: Date?
/// The time at which the stack set operation ended, across all accounts and Regions specified. Note that this doesn't necessarily mean that the stack set operation was successful, or even attempted, in each account or Region.
public let endTimestamp: Date?
/// The unique ID of the stack set operation.
public let operationId: String?
/// The overall status of the operation. FAILED: The operation exceeded the specified failure tolerance. The failure tolerance value that you've set for an operation is applied for each Region during stack create and update operations. If the number of failed stacks within a Region exceeds the failure tolerance, the status of the operation in the Region is set to FAILED. This in turn sets the status of the operation as a whole to FAILED, and AWS CloudFormation cancels the operation in any remaining Regions. QUEUED: [Service-managed permissions] For automatic deployments that require a sequence of operations, the operation is queued to be performed. For more information, see the stack set operation status codes in the AWS CloudFormation User Guide. RUNNING: The operation is currently being performed. STOPPED: The user has cancelled the operation. STOPPING: The operation is in the process of stopping, at user request. SUCCEEDED: The operation completed creating or updating all the specified stacks without exceeding the failure tolerance for the operation.
public let status: StackSetOperationStatus?
public init(action: StackSetOperationAction? = nil, creationTimestamp: Date? = nil, endTimestamp: Date? = nil, operationId: String? = nil, status: StackSetOperationStatus? = nil) {
self.action = action
self.creationTimestamp = creationTimestamp
self.endTimestamp = endTimestamp
self.operationId = operationId
self.status = status
}
private enum CodingKeys: String, CodingKey {
case action = "Action"
case creationTimestamp = "CreationTimestamp"
case endTimestamp = "EndTimestamp"
case operationId = "OperationId"
case status = "Status"
}
}
public struct StackSetSummary: AWSDecodableShape {
/// [Service-managed permissions] Describes whether StackSets automatically deploys to AWS Organizations accounts that are added to a target organizational unit (OU).
public let autoDeployment: AutoDeployment?
/// A description of the stack set that you specify when the stack set is created or updated.
public let description: String?
/// Status of the stack set's actual configuration compared to its expected template and parameter configuration. A stack set is considered to have drifted if one or more of its stack instances have drifted from their expected template and parameter configuration. DRIFTED: One or more of the stack instances belonging to the stack set stack differs from the expected template and parameter configuration. A stack instance is considered to have drifted if one or more of the resources in the associated stack have drifted. NOT_CHECKED: AWS CloudFormation has not checked the stack set for drift. IN_SYNC: All of the stack instances belonging to the stack set stack match from the expected template and parameter configuration. UNKNOWN: This value is reserved for future use.
public let driftStatus: StackDriftStatus?
/// Most recent time when CloudFormation performed a drift detection operation on the stack set. This value will be NULL for any stack set on which drift detection has not yet been performed.
public let lastDriftCheckTimestamp: Date?
/// Describes how the IAM roles required for stack set operations are created. With self-managed permissions, you must create the administrator and execution roles required to deploy to target accounts. For more information, see Grant Self-Managed Stack Set Permissions. With service-managed permissions, StackSets automatically creates the IAM roles required to deploy to accounts managed by AWS Organizations. For more information, see Grant Service-Managed Stack Set Permissions.
public let permissionModel: PermissionModels?
/// The ID of the stack set.
public let stackSetId: String?
/// The name of the stack set.
public let stackSetName: String?
/// The status of the stack set.
public let status: StackSetStatus?
public init(autoDeployment: AutoDeployment? = nil, description: String? = nil, driftStatus: StackDriftStatus? = nil, lastDriftCheckTimestamp: Date? = nil, permissionModel: PermissionModels? = nil, stackSetId: String? = nil, stackSetName: String? = nil, status: StackSetStatus? = nil) {
self.autoDeployment = autoDeployment
self.description = description
self.driftStatus = driftStatus
self.lastDriftCheckTimestamp = lastDriftCheckTimestamp
self.permissionModel = permissionModel
self.stackSetId = stackSetId
self.stackSetName = stackSetName
self.status = status
}
private enum CodingKeys: String, CodingKey {
case autoDeployment = "AutoDeployment"
case description = "Description"
case driftStatus = "DriftStatus"
case lastDriftCheckTimestamp = "LastDriftCheckTimestamp"
case permissionModel = "PermissionModel"
case stackSetId = "StackSetId"
case stackSetName = "StackSetName"
case status = "Status"
}
}
public struct StackSummary: AWSDecodableShape {
/// The time the stack was created.
public let creationTime: Date
/// The time the stack was deleted.
public let deletionTime: Date?
/// Summarizes information on whether a stack's actual configuration differs, or has drifted, from it's expected configuration, as defined in the stack template and any values specified as template parameters. For more information, see Detecting Unregulated Configuration Changes to Stacks and Resources.
public let driftInformation: StackDriftInformationSummary?
/// The time the stack was last updated. This field will only be returned if the stack has been updated at least once.
public let lastUpdatedTime: Date?
/// For nested stacks--stacks created as resources for another stack--the stack ID of the direct parent of this stack. For the first level of nested stacks, the root stack is also the parent stack. For more information, see Working with Nested Stacks in the AWS CloudFormation User Guide.
public let parentId: String?
/// For nested stacks--stacks created as resources for another stack--the stack ID of the top-level stack to which the nested stack ultimately belongs. For more information, see Working with Nested Stacks in the AWS CloudFormation User Guide.
public let rootId: String?
/// Unique stack identifier.
public let stackId: String?
/// The name associated with the stack.
public let stackName: String
/// The current status of the stack.
public let stackStatus: StackStatus
/// Success/Failure message associated with the stack status.
public let stackStatusReason: String?
/// The template description of the template used to create the stack.
public let templateDescription: String?
public init(creationTime: Date, deletionTime: Date? = nil, driftInformation: StackDriftInformationSummary? = nil, lastUpdatedTime: Date? = nil, parentId: String? = nil, rootId: String? = nil, stackId: String? = nil, stackName: String, stackStatus: StackStatus, stackStatusReason: String? = nil, templateDescription: String? = nil) {
self.creationTime = creationTime
self.deletionTime = deletionTime
self.driftInformation = driftInformation
self.lastUpdatedTime = lastUpdatedTime
self.parentId = parentId
self.rootId = rootId
self.stackId = stackId
self.stackName = stackName
self.stackStatus = stackStatus
self.stackStatusReason = stackStatusReason
self.templateDescription = templateDescription
}
private enum CodingKeys: String, CodingKey {
case creationTime = "CreationTime"
case deletionTime = "DeletionTime"
case driftInformation = "DriftInformation"
case lastUpdatedTime = "LastUpdatedTime"
case parentId = "ParentId"
case rootId = "RootId"
case stackId = "StackId"
case stackName = "StackName"
case stackStatus = "StackStatus"
case stackStatusReason = "StackStatusReason"
case templateDescription = "TemplateDescription"
}
}
public struct StopStackSetOperationInput: AWSEncodableShape {
/// [Service-managed permissions] Specifies whether you are acting as an account administrator in the organization's management account or as a delegated administrator in a member account. By default, SELF is specified. Use SELF for stack sets with self-managed permissions. If you are signed in to the management account, specify SELF. If you are signed in to a delegated administrator account, specify DELEGATED_ADMIN. Your AWS account must be registered as a delegated administrator in the management account. For more information, see Register a delegated administrator in the AWS CloudFormation User Guide.
public let callAs: CallAs?
/// The ID of the stack operation.
public let operationId: String
/// The name or unique ID of the stack set that you want to stop the operation for.
public let stackSetName: String
public init(callAs: CallAs? = nil, operationId: String, stackSetName: String) {
self.callAs = callAs
self.operationId = operationId
self.stackSetName = stackSetName
}
public func validate(name: String) throws {
try self.validate(self.operationId, name: "operationId", parent: name, max: 128)
try self.validate(self.operationId, name: "operationId", parent: name, min: 1)
try self.validate(self.operationId, name: "operationId", parent: name, pattern: "[a-zA-Z0-9][-a-zA-Z0-9]*")
}
private enum CodingKeys: String, CodingKey {
case callAs = "CallAs"
case operationId = "OperationId"
case stackSetName = "StackSetName"
}
}
public struct StopStackSetOperationOutput: AWSDecodableShape {
public init() {}
}
public struct Tag: AWSEncodableShape & AWSDecodableShape {
/// Required. A string used to identify this tag. You can specify a maximum of 128 characters for a tag key. Tags owned by Amazon Web Services (AWS) have the reserved prefix: aws:.
public let key: String
/// Required. A string containing the value for this tag. You can specify a maximum of 256 characters for a tag value.
public let value: String
public init(key: String, value: String) {
self.key = key
self.value = value
}
public func validate(name: String) throws {
try self.validate(self.key, name: "key", parent: name, max: 128)
try self.validate(self.key, name: "key", parent: name, min: 1)
try self.validate(self.value, name: "value", parent: name, max: 256)
try self.validate(self.value, name: "value", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case key = "Key"
case value = "Value"
}
}
public struct TemplateParameter: AWSDecodableShape {
/// The default value associated with the parameter.
public let defaultValue: String?
/// User defined description associated with the parameter.
public let description: String?
/// Flag indicating whether the parameter should be displayed as plain text in logs and UIs.
public let noEcho: Bool?
/// The name associated with the parameter.
public let parameterKey: String?
public init(defaultValue: String? = nil, description: String? = nil, noEcho: Bool? = nil, parameterKey: String? = nil) {
self.defaultValue = defaultValue
self.description = description
self.noEcho = noEcho
self.parameterKey = parameterKey
}
private enum CodingKeys: String, CodingKey {
case defaultValue = "DefaultValue"
case description = "Description"
case noEcho = "NoEcho"
case parameterKey = "ParameterKey"
}
}
public struct TestTypeInput: AWSEncodableShape {
/// The Amazon Resource Number (ARN) of the extension. Conditional: You must specify Arn, or TypeName and Type.
public let arn: String?
/// The S3 bucket to which CloudFormation delivers the contract test execution logs. CloudFormation delivers the logs by the time contract testing has completed and the extension has been assigned a test type status of PASSED or FAILED. The user calling TestType must be able to access items in the specified S3 bucket. Specifically, the user needs the following permissions: GetObject PutObject For more information, see Actions, Resources, and Condition Keys for Amazon S3 in the AWS Identity and Access Management User Guide.
public let logDeliveryBucket: String?
/// The type of the extension to test. Conditional: You must specify Arn, or TypeName and Type.
public let type: ThirdPartyType?
/// The name of the extension to test. Conditional: You must specify Arn, or TypeName and Type.
public let typeName: String?
/// The version of the extension to test. You can specify the version id with either Arn, or with TypeName and Type. If you do not specify a version, CloudFormation uses the default version of the extension in this account and region for testing.
public let versionId: String?
public init(arn: String? = nil, logDeliveryBucket: String? = nil, type: ThirdPartyType? = nil, typeName: String? = nil, versionId: String? = nil) {
self.arn = arn
self.logDeliveryBucket = logDeliveryBucket
self.type = type
self.typeName = typeName
self.versionId = versionId
}
public func validate(name: String) throws {
try self.validate(self.arn, name: "arn", parent: name, max: 1024)
try self.validate(self.arn, name: "arn", parent: name, pattern: "arn:aws[A-Za-z0-9-]{0,64}:cloudformation:[A-Za-z0-9-]{1,64}:([0-9]{12})?:type/.+")
try self.validate(self.logDeliveryBucket, name: "logDeliveryBucket", parent: name, max: 63)
try self.validate(self.logDeliveryBucket, name: "logDeliveryBucket", parent: name, min: 3)
try self.validate(self.logDeliveryBucket, name: "logDeliveryBucket", parent: name, pattern: "[\\s\\S]+")
try self.validate(self.typeName, name: "typeName", parent: name, max: 204)
try self.validate(self.typeName, name: "typeName", parent: name, min: 10)
try self.validate(self.typeName, name: "typeName", parent: name, pattern: "[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}(::MODULE){0,1}")
try self.validate(self.versionId, name: "versionId", parent: name, max: 128)
try self.validate(self.versionId, name: "versionId", parent: name, min: 1)
try self.validate(self.versionId, name: "versionId", parent: name, pattern: "[A-Za-z0-9-]+")
}
private enum CodingKeys: String, CodingKey {
case arn = "Arn"
case logDeliveryBucket = "LogDeliveryBucket"
case type = "Type"
case typeName = "TypeName"
case versionId = "VersionId"
}
}
public struct TestTypeOutput: AWSDecodableShape {
/// The Amazon Resource Number (ARN) of the extension.
public let typeVersionArn: String?
public init(typeVersionArn: String? = nil) {
self.typeVersionArn = typeVersionArn
}
private enum CodingKeys: String, CodingKey {
case typeVersionArn = "TypeVersionArn"
}
}
public struct TypeConfigurationDetails: AWSDecodableShape {
/// The alias specified for this configuration, if one was specified when the configuration was set.
public let alias: String?
/// The Amazon Resource Name (ARN) for the configuration data, in this account and region.
public let arn: String?
/// A JSON string specifying the configuration data for the extension, in this account and region. If a configuration has not been set for a specified extension, CloudFormation returns {}.
public let configuration: String?
/// Whether or not this configuration data is the default configuration for the extension.
public let isDefaultConfiguration: Bool?
/// When the configuration data was last updated for this extension. If a configuration has not been set for a specified extension, CloudFormation returns null.
public let lastUpdated: Date?
/// The Amazon Resource Name (ARN) for the extension, in this account and region. For public extensions, this will be the ARN assigned when you activate the type in this account and region. For private extensions, this will be the ARN assigned when you register the type in this account and region.
public let typeArn: String?
/// The name of the extension.
public let typeName: String?
public init(alias: String? = nil, arn: String? = nil, configuration: String? = nil, isDefaultConfiguration: Bool? = nil, lastUpdated: Date? = nil, typeArn: String? = nil, typeName: String? = nil) {
self.alias = alias
self.arn = arn
self.configuration = configuration
self.isDefaultConfiguration = isDefaultConfiguration
self.lastUpdated = lastUpdated
self.typeArn = typeArn
self.typeName = typeName
}
private enum CodingKeys: String, CodingKey {
case alias = "Alias"
case arn = "Arn"
case configuration = "Configuration"
case isDefaultConfiguration = "IsDefaultConfiguration"
case lastUpdated = "LastUpdated"
case typeArn = "TypeArn"
case typeName = "TypeName"
}
}
public struct TypeConfigurationIdentifier: AWSEncodableShape & AWSDecodableShape {
/// The type of extension.
public let type: ThirdPartyType?
/// The Amazon Resource Name (ARN) for the extension, in this account and region. For public extensions, this will be the ARN assigned when you activate the type in this account and region. For private extensions, this will be the ARN assigned when you register the type in this account and region.
public let typeArn: String?
/// The alias specified for this configuration, if one was specified when the configuration was set.
public let typeConfigurationAlias: String?
/// The Amazon Resource Name (ARN) for the configuration, in this account and region.
public let typeConfigurationArn: String?
/// The name of the extension type to which this configuration applies.
public let typeName: String?
public init(type: ThirdPartyType? = nil, typeArn: String? = nil, typeConfigurationAlias: String? = nil, typeConfigurationArn: String? = nil, typeName: String? = nil) {
self.type = type
self.typeArn = typeArn
self.typeConfigurationAlias = typeConfigurationAlias
self.typeConfigurationArn = typeConfigurationArn
self.typeName = typeName
}
public func validate(name: String) throws {
try self.validate(self.typeArn, name: "typeArn", parent: name, max: 1024)
try self.validate(self.typeArn, name: "typeArn", parent: name, pattern: "arn:aws[A-Za-z0-9-]{0,64}:cloudformation:[A-Za-z0-9-]{1,64}:([0-9]{12})?:type/.+")
try self.validate(self.typeConfigurationAlias, name: "typeConfigurationAlias", parent: name, max: 256)
try self.validate(self.typeConfigurationAlias, name: "typeConfigurationAlias", parent: name, min: 1)
try self.validate(self.typeConfigurationAlias, name: "typeConfigurationAlias", parent: name, pattern: "^[a-zA-Z0-9]{1,256}$")
try self.validate(self.typeConfigurationArn, name: "typeConfigurationArn", parent: name, max: 1024)
try self.validate(self.typeConfigurationArn, name: "typeConfigurationArn", parent: name, pattern: "arn:aws[A-Za-z0-9-]{0,64}:cloudformation:[A-Za-z0-9-]{1,64}:([0-9]{12})?:type-configuration/.+")
try self.validate(self.typeName, name: "typeName", parent: name, max: 204)
try self.validate(self.typeName, name: "typeName", parent: name, min: 10)
try self.validate(self.typeName, name: "typeName", parent: name, pattern: "[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}(::MODULE){0,1}")
}
private enum CodingKeys: String, CodingKey {
case type = "Type"
case typeArn = "TypeArn"
case typeConfigurationAlias = "TypeConfigurationAlias"
case typeConfigurationArn = "TypeConfigurationArn"
case typeName = "TypeName"
}
}
public struct TypeFilters: AWSEncodableShape {
/// The category of extensions to return. REGISTERED: Private extensions that have been registered for this account and region. ACTIVATED: Public extensions that have been activated for this account and region. THIRD-PARTY: Extensions available for use from publishers other than Amazon. This includes: Private extensions registered in the account. Public extensions from publishers other than Amazon, whether activated or not. AWS-TYPES: Extensions available for use from Amazon.
public let category: Category?
/// The id of the publisher of the extension. Extensions published by Amazon are not assigned a publisher ID. Use the AWS-TYPES category to specify a list of types published by Amazon.
public let publisherId: String?
/// A prefix to use as a filter for results.
public let typeNamePrefix: String?
public init(category: Category? = nil, publisherId: String? = nil, typeNamePrefix: String? = nil) {
self.category = category
self.publisherId = publisherId
self.typeNamePrefix = typeNamePrefix
}
public func validate(name: String) throws {
try self.validate(self.publisherId, name: "publisherId", parent: name, max: 40)
try self.validate(self.publisherId, name: "publisherId", parent: name, min: 1)
try self.validate(self.publisherId, name: "publisherId", parent: name, pattern: "[0-9a-zA-Z]{12,40}")
try self.validate(self.typeNamePrefix, name: "typeNamePrefix", parent: name, max: 204)
try self.validate(self.typeNamePrefix, name: "typeNamePrefix", parent: name, min: 1)
try self.validate(self.typeNamePrefix, name: "typeNamePrefix", parent: name, pattern: "([A-Za-z0-9]{2,64}::){0,2}([A-Za-z0-9]{2,64}:?){0,1}")
}
private enum CodingKeys: String, CodingKey {
case category = "Category"
case publisherId = "PublisherId"
case typeNamePrefix = "TypeNamePrefix"
}
}
public struct TypeSummary: AWSDecodableShape {
/// The ID of the default version of the extension. The default version is used when the extension version is not specified. This applies only to private extensions you have registered in your account. For public extensions, both those provided by Amazon and published by third parties, CloudFormation returns null. For more information, see RegisterType. To set the default version of an extension, use SetTypeDefaultVersion .
public let defaultVersionId: String?
/// The description of the extension.
public let description: String?
/// Whether or not the extension is activated for this account and region. This applies only to third-party public extensions. Extensions published by Amazon are activated by default.
public let isActivated: Bool?
/// When the specified extension version was registered. This applies only to: Private extensions you have registered in your account. For more information, see RegisterType. Public extensions you have activated in your account with auto-update specified. For more information, see ActivateType. For all other extension types, CloudFormation returns null.
public let lastUpdated: Date?
/// For public extensions that have been activated for this account and region, the latest version of the public extension that is available. For any extensions other than activated third-arty extensions, CloudFormation returns null. How you specified AutoUpdate when enabling the extension affects whether CloudFormation automatically updates the extention in this account and region when a new version is released. For more information, see Setting CloudFormation to automatically use new versions of extensions in the CloudFormation User Guide.
public let latestPublicVersion: String?
/// For public extensions that have been activated for this account and region, the type name of the public extension. If you specified a TypeNameAlias when enabling the extension in this account and region, CloudFormation treats that alias as the extension's type name within the account and region, not the type name of the public extension. For more information, see Specifying aliases to refer to extensions in the CloudFormation User Guide.
public let originalTypeName: String?
/// For public extensions that have been activated for this account and region, the version of the public extension to be used for CloudFormation operations in this account and region. How you specified AutoUpdate when enabling the extension affects whether CloudFormation automatically updates the extention in this account and region when a new version is released. For more information, see Setting CloudFormation to automatically use new versions of extensions in the CloudFormation User Guide.
public let publicVersionNumber: String?
/// The ID of the extension publisher, if the extension is published by a third party. Extensions published by Amazon do not return a publisher ID.
public let publisherId: String?
/// The service used to verify the publisher identity. For more information, see Registering your account to publish CloudFormation extensions in the CFN-CLI User Guide for Extension Development.
public let publisherIdentity: IdentityProvider?
/// The publisher name, as defined in the public profile for that publisher in the service used to verify the publisher identity.
public let publisherName: String?
/// The kind of extension.
public let type: RegistryType?
/// The Amazon Resource Name (ARN) of the extension.
public let typeArn: String?
/// The name of the extension. If you specified a TypeNameAlias when you activate this extension in your account and region, CloudFormation considers that alias as the type name.
public let typeName: String?
public init(defaultVersionId: String? = nil, description: String? = nil, isActivated: Bool? = nil, lastUpdated: Date? = nil, latestPublicVersion: String? = nil, originalTypeName: String? = nil, publicVersionNumber: String? = nil, publisherId: String? = nil, publisherIdentity: IdentityProvider? = nil, publisherName: String? = nil, type: RegistryType? = nil, typeArn: String? = nil, typeName: String? = nil) {
self.defaultVersionId = defaultVersionId
self.description = description
self.isActivated = isActivated
self.lastUpdated = lastUpdated
self.latestPublicVersion = latestPublicVersion
self.originalTypeName = originalTypeName
self.publicVersionNumber = publicVersionNumber
self.publisherId = publisherId
self.publisherIdentity = publisherIdentity
self.publisherName = publisherName
self.type = type
self.typeArn = typeArn
self.typeName = typeName
}
private enum CodingKeys: String, CodingKey {
case defaultVersionId = "DefaultVersionId"
case description = "Description"
case isActivated = "IsActivated"
case lastUpdated = "LastUpdated"
case latestPublicVersion = "LatestPublicVersion"
case originalTypeName = "OriginalTypeName"
case publicVersionNumber = "PublicVersionNumber"
case publisherId = "PublisherId"
case publisherIdentity = "PublisherIdentity"
case publisherName = "PublisherName"
case type = "Type"
case typeArn = "TypeArn"
case typeName = "TypeName"
}
}
public struct TypeVersionSummary: AWSDecodableShape {
/// The Amazon Resource Name (ARN) of the extension version.
public let arn: String?
/// The description of the extension version.
public let description: String?
/// Whether the specified extension version is set as the default version. This applies only to private extensions you have registered in your account, and extensions published by Amazon. For public third-party extensions, whether or not they are activated in your account, CloudFormation returns null.
public let isDefaultVersion: Bool?
/// For public extensions that have been activated for this account and region, the version of the public extension to be used for CloudFormation operations in this account and region. For any extensions other than activated third-arty extensions, CloudFormation returns null. How you specified AutoUpdate when enabling the extension affects whether CloudFormation automatically updates the extention in this account and region when a new version is released. For more information, see Setting CloudFormation to automatically use new versions of extensions in the CloudFormation User Guide.
public let publicVersionNumber: String?
/// When the version was registered.
public let timeCreated: Date?
/// The kind of extension.
public let type: RegistryType?
/// The name of the extension.
public let typeName: String?
/// The ID of a specific version of the extension. The version ID is the value at the end of the Amazon Resource Name (ARN) assigned to the extension version when it is registered.
public let versionId: String?
public init(arn: String? = nil, description: String? = nil, isDefaultVersion: Bool? = nil, publicVersionNumber: String? = nil, timeCreated: Date? = nil, type: RegistryType? = nil, typeName: String? = nil, versionId: String? = nil) {
self.arn = arn
self.description = description
self.isDefaultVersion = isDefaultVersion
self.publicVersionNumber = publicVersionNumber
self.timeCreated = timeCreated
self.type = type
self.typeName = typeName
self.versionId = versionId
}
private enum CodingKeys: String, CodingKey {
case arn = "Arn"
case description = "Description"
case isDefaultVersion = "IsDefaultVersion"
case publicVersionNumber = "PublicVersionNumber"
case timeCreated = "TimeCreated"
case type = "Type"
case typeName = "TypeName"
case versionId = "VersionId"
}
}
public struct UpdateStackInput: AWSEncodableShape {
/// In some cases, you must explicitly acknowledge that your stack template contains certain capabilities in order for AWS CloudFormation to update the stack. CAPABILITY_IAM and CAPABILITY_NAMED_IAM Some stack templates might include resources that can affect permissions in your AWS account; for example, by creating new AWS Identity and Access Management (IAM) users. For those stacks, you must explicitly acknowledge this by specifying one of these capabilities. The following IAM resources require you to specify either the CAPABILITY_IAM or CAPABILITY_NAMED_IAM capability. If you have IAM resources, you can specify either capability. If you have IAM resources with custom names, you must specify CAPABILITY_NAMED_IAM. If you don't specify either of these capabilities, AWS CloudFormation returns an InsufficientCapabilities error. If your stack template contains these resources, we recommend that you review all permissions associated with them and edit their permissions if necessary. AWS::IAM::AccessKey AWS::IAM::Group AWS::IAM::InstanceProfile AWS::IAM::Policy AWS::IAM::Role AWS::IAM::User AWS::IAM::UserToGroupAddition For more information, see Acknowledging IAM Resources in AWS CloudFormation Templates. CAPABILITY_AUTO_EXPAND Some template contain macros. Macros perform custom processing on templates; this can include simple actions like find-and-replace operations, all the way to extensive transformations of entire templates. Because of this, users typically create a change set from the processed template, so that they can review the changes resulting from the macros before actually updating the stack. If your stack template contains one or more macros, and you choose to update a stack directly from the processed template, without first reviewing the resulting changes in a change set, you must acknowledge this capability. This includes the AWS::Include and AWS::Serverless transforms, which are macros hosted by AWS CloudFormation. If you want to update a stack from a stack template that contains macros and nested stacks, you must update the stack directly from the template using this capability. You should only update stacks directly from a stack template that contains macros if you know what processing the macro performs. Each macro relies on an underlying Lambda service function for processing stack templates. Be aware that the Lambda function owner can update the function operation without AWS CloudFormation being notified. For more information, see Using AWS CloudFormation Macros to Perform Custom Processing on Templates.
@OptionalCustomCoding<StandardArrayCoder>
public var capabilities: [Capability]?
/// A unique identifier for this UpdateStack request. Specify this token if you plan to retry requests so that AWS CloudFormation knows that you're not attempting to update a stack with the same name. You might retry UpdateStack requests to ensure that AWS CloudFormation successfully received them. All events triggered by a given stack operation are assigned the same client request token, which you can use to track operations. For example, if you execute a CreateStack operation with the token token1, then all the StackEvents generated by that operation will have ClientRequestToken set as token1. In the console, stack operations display the client request token on the Events tab. Stack operations that are initiated from the console use the token format Console-StackOperation-ID, which helps you easily identify the stack operation . For example, if you create a stack using the console, each stack event would be assigned the same token in the following format: Console-CreateStack-7f59c3cf-00d2-40c7-b2ff-e75db0987002.
public let clientRequestToken: String?
/// Amazon Simple Notification Service topic Amazon Resource Names (ARNs) that AWS CloudFormation associates with the stack. Specify an empty list to remove all notification topics.
@OptionalCustomCoding<StandardArrayCoder>
public var notificationARNs: [String]?
/// A list of Parameter structures that specify input parameters for the stack. For more information, see the Parameter data type.
@OptionalCustomCoding<StandardArrayCoder>
public var parameters: [Parameter]?
/// The template resource types that you have permissions to work with for this update stack action, such as AWS::EC2::Instance, AWS::EC2::*, or Custom::MyCustomInstance. If the list of resource types doesn't include a resource that you're updating, the stack update fails. By default, AWS CloudFormation grants permissions to all resource types. AWS Identity and Access Management (IAM) uses this parameter for AWS CloudFormation-specific condition keys in IAM policies. For more information, see Controlling Access with AWS Identity and Access Management.
@OptionalCustomCoding<StandardArrayCoder>
public var resourceTypes: [String]?
/// The Amazon Resource Name (ARN) of an AWS Identity and Access Management (IAM) role that AWS CloudFormation assumes to update the stack. AWS CloudFormation uses the role's credentials to make calls on your behalf. AWS CloudFormation always uses this role for all future operations on the stack. As long as users have permission to operate on the stack, AWS CloudFormation uses this role even if the users don't have permission to pass it. Ensure that the role grants least privilege. If you don't specify a value, AWS CloudFormation uses the role that was previously associated with the stack. If no role is available, AWS CloudFormation uses a temporary session that is generated from your user credentials.
public let roleARN: String?
/// The rollback triggers for AWS CloudFormation to monitor during stack creation and updating operations, and for the specified monitoring period afterwards.
public let rollbackConfiguration: RollbackConfiguration?
/// The name or unique stack ID of the stack to update.
public let stackName: String
/// Structure containing a new stack policy body. You can specify either the StackPolicyBody or the StackPolicyURL parameter, but not both. You might update the stack policy, for example, in order to protect a new resource that you created during a stack update. If you do not specify a stack policy, the current policy that is associated with the stack is unchanged.
public let stackPolicyBody: String?
/// Structure containing the temporary overriding stack policy body. You can specify either the StackPolicyDuringUpdateBody or the StackPolicyDuringUpdateURL parameter, but not both. If you want to update protected resources, specify a temporary overriding stack policy during this update. If you do not specify a stack policy, the current policy that is associated with the stack will be used.
public let stackPolicyDuringUpdateBody: String?
/// Location of a file containing the temporary overriding stack policy. The URL must point to a policy (max size: 16KB) located in an S3 bucket in the same Region as the stack. You can specify either the StackPolicyDuringUpdateBody or the StackPolicyDuringUpdateURL parameter, but not both. If you want to update protected resources, specify a temporary overriding stack policy during this update. If you do not specify a stack policy, the current policy that is associated with the stack will be used.
public let stackPolicyDuringUpdateURL: String?
/// Location of a file containing the updated stack policy. The URL must point to a policy (max size: 16KB) located in an S3 bucket in the same Region as the stack. You can specify either the StackPolicyBody or the StackPolicyURL parameter, but not both. You might update the stack policy, for example, in order to protect a new resource that you created during a stack update. If you do not specify a stack policy, the current policy that is associated with the stack is unchanged.
public let stackPolicyURL: String?
/// Key-value pairs to associate with this stack. AWS CloudFormation also propagates these tags to supported resources in the stack. You can specify a maximum number of 50 tags. If you don't specify this parameter, AWS CloudFormation doesn't modify the stack's tags. If you specify an empty value, AWS CloudFormation removes all associated tags.
@OptionalCustomCoding<StandardArrayCoder>
public var tags: [Tag]?
/// Structure containing the template body with a minimum length of 1 byte and a maximum length of 51,200 bytes. (For more information, go to Template Anatomy in the AWS CloudFormation User Guide.) Conditional: You must specify only one of the following parameters: TemplateBody, TemplateURL, or set the UsePreviousTemplate to true.
public let templateBody: String?
/// Location of file containing the template body. The URL must point to a template that is located in an Amazon S3 bucket or a Systems Manager document. For more information, go to Template Anatomy in the AWS CloudFormation User Guide. Conditional: You must specify only one of the following parameters: TemplateBody, TemplateURL, or set the UsePreviousTemplate to true.
public let templateURL: String?
/// Reuse the existing template that is associated with the stack that you are updating. Conditional: You must specify only one of the following parameters: TemplateBody, TemplateURL, or set the UsePreviousTemplate to true.
public let usePreviousTemplate: Bool?
public init(capabilities: [Capability]? = nil, clientRequestToken: String? = nil, notificationARNs: [String]? = nil, parameters: [Parameter]? = nil, resourceTypes: [String]? = nil, roleARN: String? = nil, rollbackConfiguration: RollbackConfiguration? = nil, stackName: String, stackPolicyBody: String? = nil, stackPolicyDuringUpdateBody: String? = nil, stackPolicyDuringUpdateURL: String? = nil, stackPolicyURL: String? = nil, tags: [Tag]? = nil, templateBody: String? = nil, templateURL: String? = nil, usePreviousTemplate: Bool? = nil) {
self.capabilities = capabilities
self.clientRequestToken = clientRequestToken
self.notificationARNs = notificationARNs
self.parameters = parameters
self.resourceTypes = resourceTypes
self.roleARN = roleARN
self.rollbackConfiguration = rollbackConfiguration
self.stackName = stackName
self.stackPolicyBody = stackPolicyBody
self.stackPolicyDuringUpdateBody = stackPolicyDuringUpdateBody
self.stackPolicyDuringUpdateURL = stackPolicyDuringUpdateURL
self.stackPolicyURL = stackPolicyURL
self.tags = tags
self.templateBody = templateBody
self.templateURL = templateURL
self.usePreviousTemplate = usePreviousTemplate
}
public func validate(name: String) throws {
try self.validate(self.clientRequestToken, name: "clientRequestToken", parent: name, max: 128)
try self.validate(self.clientRequestToken, name: "clientRequestToken", parent: name, min: 1)
try self.validate(self.clientRequestToken, name: "clientRequestToken", parent: name, pattern: "[a-zA-Z0-9][-a-zA-Z0-9]*")
try self.validate(self.notificationARNs, name: "notificationARNs", parent: name, max: 5)
try self.resourceTypes?.forEach {
try validate($0, name: "resourceTypes[]", parent: name, max: 256)
try validate($0, name: "resourceTypes[]", parent: name, min: 1)
}
try self.validate(self.roleARN, name: "roleARN", parent: name, max: 2048)
try self.validate(self.roleARN, name: "roleARN", parent: name, min: 20)
try self.rollbackConfiguration?.validate(name: "\(name).rollbackConfiguration")
try self.validate(self.stackPolicyBody, name: "stackPolicyBody", parent: name, max: 16384)
try self.validate(self.stackPolicyBody, name: "stackPolicyBody", parent: name, min: 1)
try self.validate(self.stackPolicyDuringUpdateBody, name: "stackPolicyDuringUpdateBody", parent: name, max: 16384)
try self.validate(self.stackPolicyDuringUpdateBody, name: "stackPolicyDuringUpdateBody", parent: name, min: 1)
try self.validate(self.stackPolicyDuringUpdateURL, name: "stackPolicyDuringUpdateURL", parent: name, max: 1350)
try self.validate(self.stackPolicyDuringUpdateURL, name: "stackPolicyDuringUpdateURL", parent: name, min: 1)
try self.validate(self.stackPolicyURL, name: "stackPolicyURL", parent: name, max: 1350)
try self.validate(self.stackPolicyURL, name: "stackPolicyURL", parent: name, min: 1)
try self.tags?.forEach {
try $0.validate(name: "\(name).tags[]")
}
try self.validate(self.tags, name: "tags", parent: name, max: 50)
try self.validate(self.templateBody, name: "templateBody", parent: name, min: 1)
try self.validate(self.templateURL, name: "templateURL", parent: name, max: 1024)
try self.validate(self.templateURL, name: "templateURL", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case capabilities = "Capabilities"
case clientRequestToken = "ClientRequestToken"
case notificationARNs = "NotificationARNs"
case parameters = "Parameters"
case resourceTypes = "ResourceTypes"
case roleARN = "RoleARN"
case rollbackConfiguration = "RollbackConfiguration"
case stackName = "StackName"
case stackPolicyBody = "StackPolicyBody"
case stackPolicyDuringUpdateBody = "StackPolicyDuringUpdateBody"
case stackPolicyDuringUpdateURL = "StackPolicyDuringUpdateURL"
case stackPolicyURL = "StackPolicyURL"
case tags = "Tags"
case templateBody = "TemplateBody"
case templateURL = "TemplateURL"
case usePreviousTemplate = "UsePreviousTemplate"
}
}
public struct UpdateStackInstancesInput: AWSEncodableShape {
/// [Self-managed permissions] The names of one or more AWS accounts for which you want to update parameter values for stack instances. The overridden parameter values will be applied to all stack instances in the specified accounts and Regions. You can specify Accounts or DeploymentTargets, but not both.
@OptionalCustomCoding<StandardArrayCoder>
public var accounts: [String]?
/// [Service-managed permissions] Specifies whether you are acting as an account administrator in the organization's management account or as a delegated administrator in a member account. By default, SELF is specified. Use SELF for stack sets with self-managed permissions. If you are signed in to the management account, specify SELF. If you are signed in to a delegated administrator account, specify DELEGATED_ADMIN. Your AWS account must be registered as a delegated administrator in the management account. For more information, see Register a delegated administrator in the AWS CloudFormation User Guide.
public let callAs: CallAs?
/// [Service-managed permissions] The AWS Organizations accounts for which you want to update parameter values for stack instances. If your update targets OUs, the overridden parameter values only apply to the accounts that are currently in the target OUs and their child OUs. Accounts added to the target OUs and their child OUs in the future won't use the overridden values. You can specify Accounts or DeploymentTargets, but not both.
public let deploymentTargets: DeploymentTargets?
/// The unique identifier for this stack set operation. The operation ID also functions as an idempotency token, to ensure that AWS CloudFormation performs the stack set operation only once, even if you retry the request multiple times. You might retry stack set operation requests to ensure that AWS CloudFormation successfully received them. If you don't specify an operation ID, the SDK generates one automatically.
public let operationId: String?
/// Preferences for how AWS CloudFormation performs this stack set operation.
public let operationPreferences: StackSetOperationPreferences?
/// A list of input parameters whose values you want to update for the specified stack instances. Any overridden parameter values will be applied to all stack instances in the specified accounts and Regions. When specifying parameters and their values, be aware of how AWS CloudFormation sets parameter values during stack instance update operations: To override the current value for a parameter, include the parameter and specify its value. To leave a parameter set to its present value, you can do one of the following: Do not include the parameter in the list. Include the parameter and specify UsePreviousValue as true. (You cannot specify both a value and set UsePreviousValue to true.) To set all overridden parameter back to the values specified in the stack set, specify a parameter list but do not include any parameters. To leave all parameters set to their present values, do not specify this property at all. During stack set updates, any parameter values overridden for a stack instance are not updated, but retain their overridden value. You can only override the parameter values that are specified in the stack set; to add or delete a parameter itself, use UpdateStackSet to update the stack set template. If you add a parameter to a template, before you can override the parameter value specified in the stack set you must first use UpdateStackSet to update all stack instances with the updated template and parameter value specified in the stack set. Once a stack instance has been updated with the new parameter, you can then override the parameter value using UpdateStackInstances.
@OptionalCustomCoding<StandardArrayCoder>
public var parameterOverrides: [Parameter]?
/// The names of one or more Regions in which you want to update parameter values for stack instances. The overridden parameter values will be applied to all stack instances in the specified accounts and Regions.
@CustomCoding<StandardArrayCoder>
public var regions: [String]
/// The name or unique ID of the stack set associated with the stack instances.
public let stackSetName: String
public init(accounts: [String]? = nil, callAs: CallAs? = nil, deploymentTargets: DeploymentTargets? = nil, operationId: String? = UpdateStackInstancesInput.idempotencyToken(), operationPreferences: StackSetOperationPreferences? = nil, parameterOverrides: [Parameter]? = nil, regions: [String], stackSetName: String) {
self.accounts = accounts
self.callAs = callAs
self.deploymentTargets = deploymentTargets
self.operationId = operationId
self.operationPreferences = operationPreferences
self.parameterOverrides = parameterOverrides
self.regions = regions
self.stackSetName = stackSetName
}
public func validate(name: String) throws {
try self.accounts?.forEach {
try validate($0, name: "accounts[]", parent: name, pattern: "^[0-9]{12}$")
}
try self.deploymentTargets?.validate(name: "\(name).deploymentTargets")
try self.validate(self.operationId, name: "operationId", parent: name, max: 128)
try self.validate(self.operationId, name: "operationId", parent: name, min: 1)
try self.validate(self.operationId, name: "operationId", parent: name, pattern: "[a-zA-Z0-9][-a-zA-Z0-9]*")
try self.operationPreferences?.validate(name: "\(name).operationPreferences")
try self.regions.forEach {
try validate($0, name: "regions[]", parent: name, pattern: "^[a-zA-Z0-9-]{1,128}$")
}
try self.validate(self.stackSetName, name: "stackSetName", parent: name, pattern: "[a-zA-Z][-a-zA-Z0-9]*(?::[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12})?")
}
private enum CodingKeys: String, CodingKey {
case accounts = "Accounts"
case callAs = "CallAs"
case deploymentTargets = "DeploymentTargets"
case operationId = "OperationId"
case operationPreferences = "OperationPreferences"
case parameterOverrides = "ParameterOverrides"
case regions = "Regions"
case stackSetName = "StackSetName"
}
}
public struct UpdateStackInstancesOutput: AWSDecodableShape {
/// The unique identifier for this stack set operation.
public let operationId: String?
public init(operationId: String? = nil) {
self.operationId = operationId
}
private enum CodingKeys: String, CodingKey {
case operationId = "OperationId"
}
}
public struct UpdateStackOutput: AWSDecodableShape {
/// Unique identifier of the stack.
public let stackId: String?
public init(stackId: String? = nil) {
self.stackId = stackId
}
private enum CodingKeys: String, CodingKey {
case stackId = "StackId"
}
}
public struct UpdateStackSetInput: AWSEncodableShape {
/// [Self-managed permissions] The accounts in which to update associated stack instances. If you specify accounts, you must also specify the Regions in which to update stack set instances. To update all the stack instances associated with this stack set, do not specify the Accounts or Regions properties. If the stack set update includes changes to the template (that is, if the TemplateBody or TemplateURL properties are specified), or the Parameters property, AWS CloudFormation marks all stack instances with a status of OUTDATED prior to updating the stack instances in the specified accounts and Regions. If the stack set update does not include changes to the template or parameters, AWS CloudFormation updates the stack instances in the specified accounts and Regions, while leaving all other stack instances with their existing stack instance status.
@OptionalCustomCoding<StandardArrayCoder>
public var accounts: [String]?
/// The Amazon Resource Number (ARN) of the IAM role to use to update this stack set. Specify an IAM role only if you are using customized administrator roles to control which users or groups can manage specific stack sets within the same administrator account. For more information, see Granting Permissions for Stack Set Operations in the AWS CloudFormation User Guide. If you specified a customized administrator role when you created the stack set, you must specify a customized administrator role, even if it is the same customized administrator role used with this stack set previously.
public let administrationRoleARN: String?
/// [Service-managed permissions] Describes whether StackSets automatically deploys to AWS Organizations accounts that are added to a target organization or organizational unit (OU). If you specify AutoDeployment, do not specify DeploymentTargets or Regions.
public let autoDeployment: AutoDeployment?
/// [Service-managed permissions] Specifies whether you are acting as an account administrator in the organization's management account or as a delegated administrator in a member account. By default, SELF is specified. Use SELF for stack sets with self-managed permissions. If you are signed in to the management account, specify SELF. If you are signed in to a delegated administrator account, specify DELEGATED_ADMIN. Your AWS account must be registered as a delegated administrator in the management account. For more information, see Register a delegated administrator in the AWS CloudFormation User Guide.
public let callAs: CallAs?
/// In some cases, you must explicitly acknowledge that your stack template contains certain capabilities in order for AWS CloudFormation to update the stack set and its associated stack instances. CAPABILITY_IAM and CAPABILITY_NAMED_IAM Some stack templates might include resources that can affect permissions in your AWS account; for example, by creating new AWS Identity and Access Management (IAM) users. For those stacks sets, you must explicitly acknowledge this by specifying one of these capabilities. The following IAM resources require you to specify either the CAPABILITY_IAM or CAPABILITY_NAMED_IAM capability. If you have IAM resources, you can specify either capability. If you have IAM resources with custom names, you must specify CAPABILITY_NAMED_IAM. If you don't specify either of these capabilities, AWS CloudFormation returns an InsufficientCapabilities error. If your stack template contains these resources, we recommend that you review all permissions associated with them and edit their permissions if necessary. AWS::IAM::AccessKey AWS::IAM::Group AWS::IAM::InstanceProfile AWS::IAM::Policy AWS::IAM::Role AWS::IAM::User AWS::IAM::UserToGroupAddition For more information, see Acknowledging IAM Resources in AWS CloudFormation Templates. CAPABILITY_AUTO_EXPAND Some templates reference macros. If your stack set template references one or more macros, you must update the stack set directly from the processed template, without first reviewing the resulting changes in a change set. To update the stack set directly, you must acknowledge this capability. For more information, see Using AWS CloudFormation Macros to Perform Custom Processing on Templates. Stack sets with service-managed permissions do not currently support the use of macros in templates. (This includes the AWS::Include and AWS::Serverless transforms, which are macros hosted by AWS CloudFormation.) Even if you specify this capability for a stack set with service-managed permissions, if you reference a macro in your template the stack set operation will fail.
@OptionalCustomCoding<StandardArrayCoder>
public var capabilities: [Capability]?
/// [Service-managed permissions] The AWS Organizations accounts in which to update associated stack instances. To update all the stack instances associated with this stack set, do not specify DeploymentTargets or Regions. If the stack set update includes changes to the template (that is, if TemplateBody or TemplateURL is specified), or the Parameters, AWS CloudFormation marks all stack instances with a status of OUTDATED prior to updating the stack instances in the specified accounts and Regions. If the stack set update does not include changes to the template or parameters, AWS CloudFormation updates the stack instances in the specified accounts and Regions, while leaving all other stack instances with their existing stack instance status.
public let deploymentTargets: DeploymentTargets?
/// A brief description of updates that you are making.
public let description: String?
/// The name of the IAM execution role to use to update the stack set. If you do not specify an execution role, AWS CloudFormation uses the AWSCloudFormationStackSetExecutionRole role for the stack set operation. Specify an IAM role only if you are using customized execution roles to control which stack resources users and groups can include in their stack sets. If you specify a customized execution role, AWS CloudFormation uses that role to update the stack. If you do not specify a customized execution role, AWS CloudFormation performs the update using the role previously associated with the stack set, so long as you have permissions to perform operations on the stack set.
public let executionRoleName: String?
/// The unique ID for this stack set operation. The operation ID also functions as an idempotency token, to ensure that AWS CloudFormation performs the stack set operation only once, even if you retry the request multiple times. You might retry stack set operation requests to ensure that AWS CloudFormation successfully received them. If you don't specify an operation ID, AWS CloudFormation generates one automatically. Repeating this stack set operation with a new operation ID retries all stack instances whose status is OUTDATED.
public let operationId: String?
/// Preferences for how AWS CloudFormation performs this stack set operation.
public let operationPreferences: StackSetOperationPreferences?
/// A list of input parameters for the stack set template.
@OptionalCustomCoding<StandardArrayCoder>
public var parameters: [Parameter]?
/// Describes how the IAM roles required for stack set operations are created. You cannot modify PermissionModel if there are stack instances associated with your stack set. With self-managed permissions, you must create the administrator and execution roles required to deploy to target accounts. For more information, see Grant Self-Managed Stack Set Permissions. With service-managed permissions, StackSets automatically creates the IAM roles required to deploy to accounts managed by AWS Organizations. For more information, see Grant Service-Managed Stack Set Permissions.
public let permissionModel: PermissionModels?
/// The Regions in which to update associated stack instances. If you specify Regions, you must also specify accounts in which to update stack set instances. To update all the stack instances associated with this stack set, do not specify the Accounts or Regions properties. If the stack set update includes changes to the template (that is, if the TemplateBody or TemplateURL properties are specified), or the Parameters property, AWS CloudFormation marks all stack instances with a status of OUTDATED prior to updating the stack instances in the specified accounts and Regions. If the stack set update does not include changes to the template or parameters, AWS CloudFormation updates the stack instances in the specified accounts and Regions, while leaving all other stack instances with their existing stack instance status.
@OptionalCustomCoding<StandardArrayCoder>
public var regions: [String]?
/// The name or unique ID of the stack set that you want to update.
public let stackSetName: String
/// The key-value pairs to associate with this stack set and the stacks created from it. AWS CloudFormation also propagates these tags to supported resources that are created in the stacks. You can specify a maximum number of 50 tags. If you specify tags for this parameter, those tags replace any list of tags that are currently associated with this stack set. This means: If you don't specify this parameter, AWS CloudFormation doesn't modify the stack's tags. If you specify any tags using this parameter, you must specify all the tags that you want associated with this stack set, even tags you've specifed before (for example, when creating the stack set or during a previous update of the stack set.). Any tags that you don't include in the updated list of tags are removed from the stack set, and therefore from the stacks and resources as well. If you specify an empty value, AWS CloudFormation removes all currently associated tags. If you specify new tags as part of an UpdateStackSet action, AWS CloudFormation checks to see if you have the required IAM permission to tag resources. If you omit tags that are currently associated with the stack set from the list of tags you specify, AWS CloudFormation assumes that you want to remove those tags from the stack set, and checks to see if you have permission to untag resources. If you don't have the necessary permission(s), the entire UpdateStackSet action fails with an access denied error, and the stack set is not updated.
@OptionalCustomCoding<StandardArrayCoder>
public var tags: [Tag]?
/// The structure that contains the template body, with a minimum length of 1 byte and a maximum length of 51,200 bytes. For more information, see Template Anatomy in the AWS CloudFormation User Guide. Conditional: You must specify only one of the following parameters: TemplateBody or TemplateURL—or set UsePreviousTemplate to true.
public let templateBody: String?
/// The location of the file that contains the template body. The URL must point to a template (maximum size: 460,800 bytes) that is located in an Amazon S3 bucket or a Systems Manager document. For more information, see Template Anatomy in the AWS CloudFormation User Guide. Conditional: You must specify only one of the following parameters: TemplateBody or TemplateURL—or set UsePreviousTemplate to true.
public let templateURL: String?
/// Use the existing template that's associated with the stack set that you're updating. Conditional: You must specify only one of the following parameters: TemplateBody or TemplateURL—or set UsePreviousTemplate to true.
public let usePreviousTemplate: Bool?
public init(accounts: [String]? = nil, administrationRoleARN: String? = nil, autoDeployment: AutoDeployment? = nil, callAs: CallAs? = nil, capabilities: [Capability]? = nil, deploymentTargets: DeploymentTargets? = nil, description: String? = nil, executionRoleName: String? = nil, operationId: String? = UpdateStackSetInput.idempotencyToken(), operationPreferences: StackSetOperationPreferences? = nil, parameters: [Parameter]? = nil, permissionModel: PermissionModels? = nil, regions: [String]? = nil, stackSetName: String, tags: [Tag]? = nil, templateBody: String? = nil, templateURL: String? = nil, usePreviousTemplate: Bool? = nil) {
self.accounts = accounts
self.administrationRoleARN = administrationRoleARN
self.autoDeployment = autoDeployment
self.callAs = callAs
self.capabilities = capabilities
self.deploymentTargets = deploymentTargets
self.description = description
self.executionRoleName = executionRoleName
self.operationId = operationId
self.operationPreferences = operationPreferences
self.parameters = parameters
self.permissionModel = permissionModel
self.regions = regions
self.stackSetName = stackSetName
self.tags = tags
self.templateBody = templateBody
self.templateURL = templateURL
self.usePreviousTemplate = usePreviousTemplate
}
public func validate(name: String) throws {
try self.accounts?.forEach {
try validate($0, name: "accounts[]", parent: name, pattern: "^[0-9]{12}$")
}
try self.validate(self.administrationRoleARN, name: "administrationRoleARN", parent: name, max: 2048)
try self.validate(self.administrationRoleARN, name: "administrationRoleARN", parent: name, min: 20)
try self.deploymentTargets?.validate(name: "\(name).deploymentTargets")
try self.validate(self.description, name: "description", parent: name, max: 1024)
try self.validate(self.description, name: "description", parent: name, min: 1)
try self.validate(self.executionRoleName, name: "executionRoleName", parent: name, max: 64)
try self.validate(self.executionRoleName, name: "executionRoleName", parent: name, min: 1)
try self.validate(self.executionRoleName, name: "executionRoleName", parent: name, pattern: "[a-zA-Z_0-9+=,.@-]+")
try self.validate(self.operationId, name: "operationId", parent: name, max: 128)
try self.validate(self.operationId, name: "operationId", parent: name, min: 1)
try self.validate(self.operationId, name: "operationId", parent: name, pattern: "[a-zA-Z0-9][-a-zA-Z0-9]*")
try self.operationPreferences?.validate(name: "\(name).operationPreferences")
try self.regions?.forEach {
try validate($0, name: "regions[]", parent: name, pattern: "^[a-zA-Z0-9-]{1,128}$")
}
try self.tags?.forEach {
try $0.validate(name: "\(name).tags[]")
}
try self.validate(self.tags, name: "tags", parent: name, max: 50)
try self.validate(self.templateBody, name: "templateBody", parent: name, min: 1)
try self.validate(self.templateURL, name: "templateURL", parent: name, max: 1024)
try self.validate(self.templateURL, name: "templateURL", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case accounts = "Accounts"
case administrationRoleARN = "AdministrationRoleARN"
case autoDeployment = "AutoDeployment"
case callAs = "CallAs"
case capabilities = "Capabilities"
case deploymentTargets = "DeploymentTargets"
case description = "Description"
case executionRoleName = "ExecutionRoleName"
case operationId = "OperationId"
case operationPreferences = "OperationPreferences"
case parameters = "Parameters"
case permissionModel = "PermissionModel"
case regions = "Regions"
case stackSetName = "StackSetName"
case tags = "Tags"
case templateBody = "TemplateBody"
case templateURL = "TemplateURL"
case usePreviousTemplate = "UsePreviousTemplate"
}
}
public struct UpdateStackSetOutput: AWSDecodableShape {
/// The unique ID for this stack set operation.
public let operationId: String?
public init(operationId: String? = nil) {
self.operationId = operationId
}
private enum CodingKeys: String, CodingKey {
case operationId = "OperationId"
}
}
public struct UpdateTerminationProtectionInput: AWSEncodableShape {
/// Whether to enable termination protection on the specified stack.
public let enableTerminationProtection: Bool
/// The name or unique ID of the stack for which you want to set termination protection.
public let stackName: String
public init(enableTerminationProtection: Bool, stackName: String) {
self.enableTerminationProtection = enableTerminationProtection
self.stackName = stackName
}
public func validate(name: String) throws {
try self.validate(self.stackName, name: "stackName", parent: name, min: 1)
try self.validate(self.stackName, name: "stackName", parent: name, pattern: "([a-zA-Z][-a-zA-Z0-9]*)|(arn:\\b(aws|aws-us-gov|aws-cn)\\b:[-a-zA-Z0-9:/._+]*)")
}
private enum CodingKeys: String, CodingKey {
case enableTerminationProtection = "EnableTerminationProtection"
case stackName = "StackName"
}
}
public struct UpdateTerminationProtectionOutput: AWSDecodableShape {
/// The unique ID of the stack.
public let stackId: String?
public init(stackId: String? = nil) {
self.stackId = stackId
}
private enum CodingKeys: String, CodingKey {
case stackId = "StackId"
}
}
public struct ValidateTemplateInput: AWSEncodableShape {
/// Structure containing the template body with a minimum length of 1 byte and a maximum length of 51,200 bytes. For more information, go to Template Anatomy in the AWS CloudFormation User Guide. Conditional: You must pass TemplateURL or TemplateBody. If both are passed, only TemplateBody is used.
public let templateBody: String?
/// Location of file containing the template body. The URL must point to a template (max size: 460,800 bytes) that is located in an Amazon S3 bucket or a Systems Manager document. For more information, go to Template Anatomy in the AWS CloudFormation User Guide. Conditional: You must pass TemplateURL or TemplateBody. If both are passed, only TemplateBody is used.
public let templateURL: String?
public init(templateBody: String? = nil, templateURL: String? = nil) {
self.templateBody = templateBody
self.templateURL = templateURL
}
public func validate(name: String) throws {
try self.validate(self.templateBody, name: "templateBody", parent: name, min: 1)
try self.validate(self.templateURL, name: "templateURL", parent: name, max: 1024)
try self.validate(self.templateURL, name: "templateURL", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case templateBody = "TemplateBody"
case templateURL = "TemplateURL"
}
}
public struct ValidateTemplateOutput: AWSDecodableShape {
/// The capabilities found within the template. If your template contains IAM resources, you must specify the CAPABILITY_IAM or CAPABILITY_NAMED_IAM value for this parameter when you use the CreateStack or UpdateStack actions with your template; otherwise, those actions return an InsufficientCapabilities error. For more information, see Acknowledging IAM Resources in AWS CloudFormation Templates.
@OptionalCustomCoding<StandardArrayCoder>
public var capabilities: [Capability]?
/// The list of resources that generated the values in the Capabilities response element.
public let capabilitiesReason: String?
/// A list of the transforms that are declared in the template.
@OptionalCustomCoding<StandardArrayCoder>
public var declaredTransforms: [String]?
/// The description found within the template.
public let description: String?
/// A list of TemplateParameter structures.
@OptionalCustomCoding<StandardArrayCoder>
public var parameters: [TemplateParameter]?
public init(capabilities: [Capability]? = nil, capabilitiesReason: String? = nil, declaredTransforms: [String]? = nil, description: String? = nil, parameters: [TemplateParameter]? = nil) {
self.capabilities = capabilities
self.capabilitiesReason = capabilitiesReason
self.declaredTransforms = declaredTransforms
self.description = description
self.parameters = parameters
}
private enum CodingKeys: String, CodingKey {
case capabilities = "Capabilities"
case capabilitiesReason = "CapabilitiesReason"
case declaredTransforms = "DeclaredTransforms"
case description = "Description"
case parameters = "Parameters"
}
}
}
|
[
-1
] |
831c972216796f00910ef5b532c32e8f01bc9642
|
83116e267f56cb66a535a9e80a57c7247879b2c6
|
/Stepic/Sources/Modules/Quizzes/UnsupportedQuiz/UnsupportedQuizDataFlow.swift
|
b6fff74879b6a662964d04e373a0d1f00c019541
|
[] |
no_license
|
opensourceios/stepik-ios
|
ca085c09a8bad62e1671f659f6d93361926a1270
|
a9809c1d7ee6948c3124238919ecb7f697f5bb03
|
refs/heads/master
| 2022-07-01T17:25:38.586698 | 2020-05-14T07:51:22 | 2020-05-14T07:51:22 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 291 |
swift
|
import Foundation
enum UnsupportedQuiz {
// Show step web version
enum UnsupportedQuizPresentation {
struct Request {}
struct Response {
let stepURLPath: String
}
struct ViewModel {
let stepURLPath: String
}
}
}
|
[
-1
] |
7e80cec783b407c9387b2a10f92a963a917fcfca
|
976ec36783b38013d9e8feb4d9f318f0fb88fbc0
|
/Todoey/AppDelegate.swift
|
cbd629d0ab5dfd63918c3e9a99717064ef978c01
|
[] |
no_license
|
markbentivegna/Todoey
|
773c8331f85760fc0c608a86c96a80e7c9f8812b
|
97c70717542a24d686bcbf2e5e094a50aacd4ab9
|
refs/heads/master
| 2020-03-14T10:52:29.903964 | 2018-05-02T11:59:44 | 2018-05-02T11:59:44 | 131,578,035 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 2,440 |
swift
|
//
// AppDelegate.swift
// Todoey
//
// Created by Mark Bentivegna on 4/30/18.
// Copyright © 2018 Mark Bentivegna. All rights reserved.
//
import UIKit
import CoreData
import RealmSwift
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
print(Realm.Configuration.defaultConfiguration.fileURL)
do {
_ = try Realm()
} catch {
print("Error initializing new realm, \(error)")
}
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.
}
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.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
|
[
229380,
229383,
229385,
229388,
294924,
229391,
327695,
229394,
229397,
229399,
229402,
229405,
229408,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
229426,
237618,
229428,
286774,
229432,
286776,
286778,
319544,
286791,
237640,
278605,
237646,
311375,
163920,
196692,
311383,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
327814,
131209,
303241,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
295110,
286922,
286924,
286926,
319694,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
287032,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
287054,
319822,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
279003,
279006,
188895,
172512,
279010,
287202,
279015,
172520,
319978,
279020,
172526,
279023,
311791,
172529,
279027,
319989,
164343,
180727,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
287238,
172552,
303623,
320007,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172612,
377413,
172614,
172618,
303690,
33357,
287309,
279124,
172634,
262752,
172644,
311911,
189034,
295533,
172655,
172656,
189039,
295538,
189040,
172660,
189044,
287349,
352880,
287355,
287360,
295553,
287365,
311942,
303751,
352905,
279178,
287371,
311946,
311951,
287377,
287381,
311957,
221850,
287386,
164509,
303773,
172702,
230045,
287390,
287394,
172707,
303780,
172705,
287398,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
279231,
287427,
312005,
312006,
172748,
287436,
107212,
172751,
295633,
172755,
303827,
279255,
172760,
279258,
303835,
213724,
189149,
303838,
287450,
279267,
312035,
295654,
279272,
230128,
312048,
312050,
230131,
205564,
303871,
230146,
295685,
328453,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
303914,
279340,
205613,
279353,
230202,
312124,
222018,
295755,
377676,
148302,
287569,
230237,
279390,
230241,
279394,
303976,
336744,
303985,
328563,
303987,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
213895,
320391,
304007,
304009,
304011,
230284,
304013,
279438,
295822,
189329,
304019,
189331,
58262,
304023,
279452,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
304063,
304065,
213954,
189378,
156612,
295873,
213963,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
295949,
230413,
197645,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
279661,
205934,
164973,
312432,
279669,
337018,
189562,
279679,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
238766,
165038,
230576,
238770,
304311,
230592,
279750,
312518,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
296189,
320771,
312585,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
173350,
312622,
296243,
312630,
222522,
222525,
296253,
312639,
296255,
230718,
296259,
378181,
296262,
230727,
238919,
320840,
296264,
296267,
296271,
222545,
230739,
312663,
337244,
222556,
230752,
312676,
230760,
173418,
410987,
230763,
148843,
230768,
296305,
312692,
230773,
304505,
304506,
181631,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
337306,
288154,
288160,
288162,
288164,
279975,
304555,
370092,
279983,
288176,
173488,
312755,
296373,
279991,
312759,
288185,
337335,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
288212,
148946,
222676,
280021,
239064,
288217,
329177,
280027,
288220,
288214,
239070,
288218,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
370146,
320998,
288234,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
402942,
296446,
148990,
206336,
296450,
321022,
230916,
230919,
214535,
304651,
370187,
304653,
230923,
230940,
222752,
108066,
296486,
296488,
157229,
239152,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
181854,
370272,
239202,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
190118,
321195,
296622,
321200,
337585,
296634,
296637,
313027,
280260,
206536,
280264,
206539,
206541,
206543,
280276,
313044,
321239,
280283,
313052,
288478,
313055,
321252,
313066,
280302,
288494,
280304,
313073,
321266,
288499,
419570,
288502,
280314,
288510,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
337732,
304968,
280393,
280402,
173907,
313176,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
10170,
296890,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
239586,
313320,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
321560,
305176,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288859,
280669,
313438,
280671,
149599,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
313458,
280691,
149618,
215154,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
280755,
288947,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
280823,
280825,
280827,
280830,
280831,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
289087,
280897,
280900,
239944,
305480,
280906,
239947,
305485,
305489,
379218,
280919,
354653,
354656,
313700,
280937,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
305594,
289210,
281024,
289218,
289221,
289227,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
240132,
223749,
281095,
338440,
150025,
223752,
330244,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
150066,
158262,
158266,
289342,
281154,
322115,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
158317,
19053,
313973,
281210,
297594,
158347,
182926,
133776,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
183172,
158596,
240519,
322440,
338823,
314249,
142226,
289687,
240535,
297883,
289694,
289696,
289700,
289724,
52163,
183260,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
207937,
314433,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
306354,
142531,
199877,
289991,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
298306,
380226,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
306555,
290174,
298365,
224641,
281987,
298372,
314756,
281990,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
282025,
314793,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
192008,
323084,
257550,
290321,
282130,
323090,
282133,
290325,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
282186,
224849,
282195,
282199,
282201,
306778,
159330,
314979,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
324757,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
196133,
282295,
282300,
323260,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
241450,
282410,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
307009,
241475,
307012,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
282481,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
44948,
298901,
241556,
282520,
241560,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241640,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
282639,
290835,
282645,
241693,
282654,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
192596,
176213,
307287,
315482,
217179,
315483,
192605,
233567,
200801,
299105,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
307338,
233613,
241813,
307352,
299164,
184479,
184481,
315557,
184486,
307370,
184492,
307372,
307374,
307376,
299185,
323763,
176311,
299191,
307385,
307386,
258235,
176316,
307388,
307390,
184503,
299200,
184512,
307394,
307396,
299204,
184518,
307399,
323784,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
184579,
282893,
291089,
282906,
291104,
233766,
176435,
307508,
315701,
307510,
332086,
307512,
168245,
307515,
282942,
307518,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
315739,
323932,
299357,
242018,
242024,
315757,
299373,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
283033,
291226,
242075,
315801,
291231,
61855,
283042,
291238,
291241,
127403,
127405,
291247,
127407,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
176592,
127440,
315856,
315860,
176597,
127447,
299481,
127449,
176605,
242143,
127455,
291299,
340454,
127463,
242152,
291305,
176620,
127469,
127474,
291314,
291317,
135672,
127480,
291323,
233979,
127485,
291330,
283142,
127494,
135689,
233994,
127497,
127500,
291341,
233998,
234003,
234006,
152087,
127511,
234010,
242202,
135707,
242206,
135710,
242208,
291361,
242220,
291378,
234038,
152118,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
291456,
135808,
373383,
299655,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
135844,
299684,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
226005,
226008,
242396,
299740,
201444,
299750,
283368,
234219,
283372,
226037,
283382,
316151,
234231,
234236,
234239,
242431,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
234278,
299814,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
283452,
160572,
234302,
234307,
242499,
234309,
234313,
316233,
316235,
234316,
283468,
242511,
234319,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
234338,
242530,
349027,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
291711,
234368,
234370,
201603,
291714,
234373,
226182,
234375,
291716,
308105,
226185,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
234396,
291742,
226200,
234401,
291747,
291748,
234405,
291750,
234407,
324518,
324520,
234410,
324522,
226220,
291756,
291754,
324527,
291760,
234417,
201650,
324531,
234414,
226230,
234422,
275384,
324536,
234428,
291773,
234431,
242623,
324544,
324546,
234434,
324548,
226245,
234437,
234439,
226239,
234443,
291788,
234446,
275406,
193486,
234449,
316370,
193488,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234478,
316400,
234481,
316403,
234484,
234485,
324599,
234487,
234490,
234493,
234496,
316416,
234501,
308231,
234504,
234507,
234515,
300054,
234519,
316439,
234520,
234523,
234528,
300066,
234532,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
234549,
300085,
300088,
234556,
234558,
316479,
234561,
316483,
160835,
308291,
234563,
234568,
234570,
316491,
300108,
234572,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
300133,
234597,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
300148,
234614,
398455,
144506,
234618,
275579,
234620,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
226453,
275606,
234647,
275608,
308373,
234650,
308379,
234648,
234653,
324766,
119967,
300189,
324768,
283805,
234657,
242852,
234661,
283813,
300197,
234664,
275626,
234667,
316596,
234687,
300226,
226500,
234692,
300229,
308420,
308422,
283844,
283850,
300234,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
161003,
300267,
300270,
300272,
120053,
300278,
316663,
275703,
300284,
275710,
300287,
300289,
292097,
161027,
300292,
300294,
275719,
300299,
177419,
283917,
300301,
242957,
177424,
275725,
349464,
283939,
259367,
292143,
283951,
300344,
226617,
243003,
226628,
283973,
300357,
177482,
283983,
316758,
357722,
316766,
292192,
316768,
218464,
292197,
316774,
243046,
218473,
284010,
136562,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
226703,
300433,
234899,
226709,
357783,
316824,
316826,
144796,
300448,
144810,
144812,
144814,
144820,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
226802,
292338,
316917,
308727,
292343,
300537,
316947,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
284213,
194101,
194103,
284215,
284218,
226877,
284223,
284226,
243268,
292421,
226886,
284231,
128584,
284228,
284234,
276043,
317004,
366155,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
276053,
284247,
317015,
284249,
243290,
284251,
284253,
300638,
284255,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
276086,
284278,
292470,
292473,
284283,
276093,
284286,
292479,
284288,
292481,
284290,
325250,
284292,
325251,
292485,
276098,
284297,
317066,
284299,
317068,
276109,
284301,
284303,
276114,
284306,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
276137,
284329,
284331,
317098,
284333,
284335,
284337,
284339,
300726,
284343,
284346,
284350,
276160,
358080,
284354,
358083,
276166,
284358,
358089,
276170,
284362,
276175,
284368,
276177,
284370,
317138,
284372,
358098,
284377,
276187,
284379,
284381,
284384,
284386,
358114,
358116,
276197,
358119,
284392,
325353,
284394,
358122,
358126,
276206,
358128,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
325408,
300832,
300834,
317221,
227109,
358183,
186151,
276268,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
153417,
292681,
284499,
276308,
178006,
317271,
284502,
276315,
292700,
284511,
227175,
292715,
284529,
292721,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
284564,
358292,
350106,
284572,
276386,
284579,
276388,
358312,
284585,
317353,
292776,
276395,
292784,
276402,
358326,
161718,
276410,
276411,
358330,
276418,
276425,
301009,
301011,
301013,
292823,
301015,
301017,
358360,
292828,
276446,
153568,
276452,
276455,
292839,
292843,
292845,
276464,
227314,
325624,
317435,
276479,
276482,
276485,
317446,
276490,
292876,
276496,
317456,
317458,
243733,
317468,
243740,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
243779,
292934,
243785,
350293,
350295,
194649,
227418,
309337,
350302,
227423,
178273,
194657,
227426,
194660,
276579,
227430,
276583,
309346,
309348,
309350,
309352,
309354,
350308,
276590,
350313,
350316,
350321,
284786,
276595,
301163,
350325,
227440,
350328,
292985,
301178,
350332,
292989,
292993,
301185,
350339,
317570,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
276638,
350366,
284837,
153765,
350375,
350379,
350381,
350383,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
309450,
301258,
276685,
276689,
309462,
301272,
276699,
309468,
194780,
301283,
317672,
317674,
325867,
243948,
194801,
309494,
243960,
276735,
227583,
227587,
276739,
211204,
276742,
227593,
227596,
325910,
309530,
342298,
211232,
276775,
211241,
325937,
325943,
211260,
260421,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
276843,
293227,
276848,
293232,
186744,
211324,
285061,
317833,
178572,
285070,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
317951,
309764,
301575,
121352,
236043,
317963,
342541,
55822,
113167,
317971,
309779,
309781,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
129603,
318020,
301636,
301639,
301643,
277071,
285265,
309844,
277080,
309849,
285277,
285282,
326244,
277100,
121458,
277106,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
318092,
326285,
318094,
334476,
277136,
277139,
227992,
334488,
285340,
318108,
227998,
318110,
383658,
285357,
318128,
277170,
342707,
154292,
293555,
277173,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
137946,
113378,
203491,
228069,
277223,
342760,
56041,
285417,
56043,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
326430,
228135,
318248,
277291,
293677,
318253,
285489,
293685,
285494,
301880,
285499,
301884,
310080,
293696,
277317,
277322,
277329,
162643,
310100,
301911,
277337,
301921,
400236,
236397,
162671,
326514,
310134,
15224,
236408,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
293811,
293817,
293820,
203715,
326603,
276586,
293849,
293861,
228327,
228328,
228330,
318442,
277486,
326638,
318450,
293876,
293877,
285686,
302073,
285690,
293882,
244731,
121850,
302075,
293887,
277504,
277507,
277511,
277519,
293908,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
310344,
277577,
293960,
277583,
203857,
310355,
293971,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
285817,
367737,
285821,
302205,
392326,
285831,
294026,
285835,
302218,
384148,
162964,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
204026,
228606,
204031,
64768,
310531,
285958,
138505,
228617,
318742,
204067,
130345,
277801,
113964,
277804,
285997,
285999,
277807,
113969,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
277822,
417086,
286016,
294211,
302403,
384328,
277832,
277836,
326991,
294223,
277839,
277842,
277847,
277850,
179547,
277853,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
277892,
277894,
253320,
310665,
318858,
327046,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
64966,
245191,
163272,
302534,
310727,
277959,
292968,
277963,
277966,
302543,
310737,
277971,
228825,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
40448,
228864,
286214,
302603,
65038,
302614,
286233,
302617,
286240,
146977,
187939,
40484,
294435,
286246,
40486,
40488,
278057,
294439,
294440,
40491,
294443,
294445,
310831,
245288,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
40521,
286283,
40525,
40527,
212560,
228944,
400976,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286313,
40554,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
310925,
286354,
278163,
302740,
278168,
179870,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
343757,
212690,
278227,
286420,
319187,
229076,
286425,
319194,
278235,
278238,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
319243,
311053,
302862,
319251,
294682,
278306,
294701,
278320,
319280,
319290,
229192,
302925,
188247,
237409,
229233,
294776,
360317,
327554,
40840,
40851,
294803,
188312,
294811,
319390,
294817,
319394,
40865,
294821,
311209,
180142,
188340,
40886,
319419,
294844,
294847,
393177,
294876,
294879,
294883,
294890,
311279,
278513,
237555,
278516,
311283,
237562
] |
1782409cd3b9a1795f6717bc5c128b3271e22418
|
bc84e5a6a151cf19aabd18875d701a104335552d
|
/Week5_2/BaiduSSP/BaiduSSPTests/BaiduSSPTests.swift
|
c21d95357cf8cfc2eeb41c061744b6d70d074fb9
|
[] |
no_license
|
Jaykong/iOS_Training_Phase2
|
26e63328d0f3a7fc8f2359518a0dd509b38566e6
|
ed5983a2539b788456bdb1668c21607795f7c9c9
|
refs/heads/master
| 2021-01-10T16:36:09.279101 | 2016-02-24T11:23:55 | 2016-02-24T11:23:55 | 48,992,366 | 3 | 9 | null | 2016-01-09T00:27:37 | 2016-01-04T11:14:38 |
Objective-C
|
UTF-8
|
Swift
| false | false | 978 |
swift
|
//
// BaiduSSPTests.swift
// BaiduSSPTests
//
// Created by kongyunpeng on 2/19/16.
// Copyright © 2016 kongyunpeng. All rights reserved.
//
import XCTest
@testable import BaiduSSP
class BaiduSSPTests: XCTestCase {
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()
}
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measureBlock {
// Put the code you want to measure the time of here.
}
}
}
|
[
98333,
16419,
229413,
204840,
278570,
344107,
155694,
253999,
229424,
229430,
319542,
180280,
286788,
352326,
254027,
311372,
196691,
278615,
180311,
180312,
237663,
131178,
278634,
278638,
319598,
352368,
131191,
237689,
131198,
278655,
311438,
278677,
278685,
311458,
278691,
49316,
32941,
278704,
278708,
131256,
278714,
295098,
254170,
229597,
311519,
286958,
327929,
180493,
254226,
319763,
278816,
98610,
278842,
287041,
287043,
139589,
319813,
319821,
254286,
344401,
311636,
155990,
106847,
246127,
139640,
246136,
246137,
311681,
246178,
377264,
278970,
319930,
336317,
278978,
188871,
278989,
278993,
278999,
328152,
369116,
188894,
287198,
279008,
279013,
279018,
279029,
279032,
279039,
287241,
279050,
303636,
279065,
180771,
377386,
279094,
352829,
115270,
377418,
295519,
66150,
344680,
279146,
295536,
287346,
287352,
279164,
189057,
311941,
279177,
369289,
344715,
311949,
352917,
230040,
271000,
295576,
303771,
221852,
279206,
295590,
287404,
295599,
205487,
303793,
164533,
287417,
303803,
287422,
66242,
287433,
287439,
279252,
287452,
295652,
230125,
279280,
230134,
221948,
205568,
295682,
295697,
336671,
344865,
262951,
279336,
262954,
295724,
312108,
353069,
164656,
303920,
262962,
328499,
353078,
230199,
353079,
336702,
295746,
353094,
353095,
353109,
230234,
295776,
279392,
303972,
230248,
246641,
295798,
246648,
279417,
361337,
254850,
287622,
295824,
189348,
279464,
353195,
140204,
353197,
304051,
189374,
353216,
213960,
279498,
50143,
123881,
304110,
320494,
287731,
295927,
304122,
312314,
320507,
328700,
328706,
320516,
230410,
320527,
418837,
140310,
320536,
197657,
336929,
189474,
345132,
238639,
238651,
238664,
296019,
353367,
156764,
156765,
304222,
230499,
279660,
312434,
353397,
279685,
222343,
296086,
238743,
296092,
238765,
279728,
238769,
279747,
353479,
353481,
353482,
279760,
189652,
279765,
296153,
279774,
304351,
304356,
279785,
279792,
353523,
279814,
312587,
328971,
173334,
320796,
345396,
116026,
222524,
279875,
230729,
222541,
296270,
238927,
296273,
222559,
230756,
230765,
296303,
279920,
312689,
296307,
116084,
148867,
378244,
296335,
9619,
279974,
173491,
279989,
361927,
296392,
280010,
370123,
148940,
280013,
312782,
222675,
329173,
353750,
280032,
280041,
361963,
296433,
321009,
280055,
288249,
296448,
230913,
230921,
329225,
296461,
304656,
329232,
230943,
230959,
288309,
288318,
280130,
124485,
288326,
288327,
280147,
239198,
157281,
222832,
247416,
337535,
239237,
288392,
239250,
345752,
255649,
321207,
296632,
280251,
280257,
321219,
280267,
9936,
280278,
280280,
18138,
67292,
321247,
288491,
280300,
239341,
313081,
124669,
288512,
288516,
280327,
280329,
321295,
321302,
116505,
321310,
247590,
296755,
321337,
280380,
345919,
280392,
345929,
304977,
18262,
280410,
370522,
345951,
362337,
345955,
296806,
288619,
288620,
280430,
296814,
362352,
313203,
124798,
182144,
305026,
67463,
329622,
124824,
214937,
214938,
354212,
124852,
288697,
214977,
280514,
280519,
247757,
280541,
329695,
337895,
247785,
296941,
362480,
313339,
313357,
182296,
239650,
354345,
223274,
124975,
346162,
124984,
288828,
288833,
288834,
354385,
223316,
280661,
329814,
338007,
354393,
280675,
280677,
329829,
313447,
288879,
223350,
280694,
288889,
215164,
313469,
215166,
280712,
215178,
346271,
239793,
125109,
182456,
280762,
223419,
379071,
338119,
280778,
321745,
280795,
338150,
321772,
125169,
338164,
125183,
125188,
313608,
125193,
125198,
125203,
125208,
305440,
125217,
125235,
280887,
125240,
280902,
182598,
289110,
272729,
379225,
321894,
280939,
313713,
354676,
199029,
362881,
248194,
395659,
395661,
240016,
190871,
289189,
289194,
108972,
281037,
281040,
281072,
289304,
182817,
289332,
338490,
322120,
281166,
281171,
354911,
436832,
191082,
313966,
281199,
330379,
330387,
330388,
117397,
289434,
338613,
166582,
289462,
314040,
158394,
363211,
289502,
363230,
338662,
346858,
330474,
289518,
199414,
35583,
363263,
322313,
322319,
166676,
207640,
289576,
281408,
420677,
281427,
281433,
330609,
207732,
240518,
289698,
289703,
289722,
289727,
363458,
338899,
248797,
207838,
314342,
52200,
289774,
183279,
240630,
314362,
322570,
330763,
281626,
248872,
322612,
314448,
281697,
314467,
281700,
322663,
281706,
207979,
363644,
150657,
248961,
330888,
339102,
330913,
306338,
339130,
208058,
322749,
290000,
298208,
298212,
290022,
330984,
298221,
298228,
216315,
208124,
363771,
388349,
322824,
126237,
339234,
298291,
224586,
372043,
314709,
314720,
281957,
134506,
306542,
314739,
290173,
306559,
298374,
314758,
314760,
142729,
388487,
314766,
306579,
282007,
290207,
314783,
314789,
282022,
282024,
241066,
380357,
306631,
191981,
306673,
306677,
191990,
290300,
290301,
282114,
306692,
306693,
323080,
323087,
282129,
282136,
282141,
282146,
306723,
290358,
282183,
290390,
306776,
282213,
323178,
314998,
175741,
224901,
282245,
282246,
290443,
323217,
282259,
282271,
282273,
323236,
282276,
298661,
290471,
282280,
298667,
306874,
282303,
306890,
282318,
241361,
241365,
282327,
298712,
282339,
12010,
282348,
323316,
282358,
282369,
175873,
323331,
323332,
216839,
282378,
282391,
249626,
282400,
241441,
339745,
257830,
282409,
282417,
200498,
282427,
315202,
307011,
282434,
282438,
323406,
307025,
413521,
216918,
307031,
282474,
282480,
241528,
241540,
282504,
110480,
184208,
282518,
282519,
298909,
118685,
298920,
282549,
290746,
298980,
282612,
282633,
241692,
102437,
233517,
282672,
315476,
307289,
200794,
315487,
45153,
307299,
315498,
299121,
233589,
233590,
241808,
323729,
233636,
299174,
233642,
323762,
299187,
184505,
299198,
299203,
282831,
356576,
176362,
184570,
184575,
282909,
299293,
282913,
233762,
217380,
151847,
282919,
332085,
332089,
315706,
282939,
307517,
241986,
332101,
323916,
348492,
282960,
250192,
323920,
348500,
168281,
323935,
242029,
242033,
291192,
225670,
291224,
283038,
61857,
61859,
340398,
299441,
61873,
61880,
283064,
127427,
127428,
291267,
283075,
324039,
373197,
176601,
242139,
160225,
242148,
291311,
233978,
291333,
340490,
283153,
291358,
283182,
283184,
234036,
315960,
348742,
348749,
111208,
348806,
152203,
184973,
299699,
299700,
242386,
234217,
299770,
299776,
242433,
291585,
291604,
234277,
283430,
152365,
242485,
299849,
283467,
201551,
242529,
275303,
177001,
201577,
308076,
242541,
209783,
209785,
177019,
291712,
308107,
308112,
234386,
209817,
324506,
324507,
324517,
283558,
349121,
316364,
340955,
340961,
324586,
340974,
316405,
201720,
234500,
324625,
234514,
316437,
201755,
300068,
357414,
300084,
324666,
308287,
21569,
300111,
234577,
341073,
234587,
250981,
300135,
300136,
316520,
316526,
357486,
144496,
300151,
291959,
160891,
341115,
300158,
349316,
349318,
169104,
177296,
308372,
185493,
283802,
119962,
300187,
300188,
300201,
300202,
283840,
259268,
283847,
62665,
283852,
283853,
316627,
357595,
234733,
234742,
292091,
316669,
234755,
242954,
292107,
251153,
300343,
333117,
193859,
300359,
234827,
177484,
251213,
234831,
120148,
283991,
357719,
234850,
292195,
333160,
284014,
243056,
112017,
112018,
234898,
357786,
333220,
316842,
210358,
284089,
292283,
415171,
292292,
300487,
300489,
366037,
210390,
210391,
210393,
144867,
316902,
54765,
251378,
333300,
300535,
300536,
333303,
210433,
366083,
316946,
308756,
398869,
308764,
349726,
333343,
349741,
169518,
194110,
235070,
349763,
218696,
292425,
243274,
128587,
333388,
333393,
300630,
128599,
235095,
333408,
300644,
374372,
317032,
54893,
366203,
325245,
218819,
333517,
333520,
333521,
333523,
153319,
284401,
325371,
194303,
194304,
300811,
284429,
284431,
366360,
284442,
325404,
325410,
341796,
333610,
317232,
325439,
341836,
325457,
284507,
300894,
284512,
284514,
276327,
292712,
325484,
292720,
325492,
300918,
317304,
194429,
325503,
333701,
243591,
325515,
243597,
325518,
300963,
292771,
333735,
284587,
292782,
243637,
284619,
301008,
153554,
194515,
219101,
292836,
292837,
317415,
325619,
333817,
292858,
333828,
317467,
292902,
227370,
309295,
358456,
309345,
227428,
194666,
284788,
333940,
292988,
292992,
194691,
227460,
333955,
235662,
325776,
317587,
284826,
333991,
333992,
284842,
153776,
227513,
301251,
309444,
227524,
227548,
301279,
317664,
227578,
243962,
309503,
375051,
325905,
325912,
309529,
227616,
211235,
211238,
260418,
227654,
6481,
366929,
366930,
6489,
391520,
416104,
285040,
227725,
178582,
293274,
317852,
285090,
375207,
293306,
293310,
317901,
326100,
285150,
342498,
195045,
309744,
301571,
342536,
342553,
375333,
293419,
244269,
236081,
23092,
301638,
293448,
55881,
244310,
301689,
227990,
342682,
285361,
342706,
342713,
285371,
285372,
285373,
285374,
154316,
96984,
318173,
285415,
342762,
154359,
228088,
162561,
285444,
285458,
326429,
326433,
318250,
318252,
285487,
301871,
285497,
293693,
318278,
293711,
301918,
293730,
351077,
342887,
400239,
269178,
359298,
113542,
228233,
228234,
56208,
293781,
318364,
310176,
310178,
310182,
293800,
236461,
293806,
130016,
64485,
326635,
203757,
293886,
277509,
146448,
277524,
293910,
252980,
359478,
302139,
359495,
277597,
302177,
285798,
228458,
15471,
187506,
285814,
285820,
187521,
285828,
302213,
285830,
302216,
228491,
228493,
285838,
162961,
326804,
187544,
302240,
343203,
253099,
367799,
294074,
64700,
228542,
302274,
343234,
367810,
244940,
228563,
310497,
228588,
253167,
302325,
228600,
228609,
245019,
130338,
130343,
351537,
286018,
113987,
294218,
318805,
294243,
327024,
327025,
327031,
294275,
179587,
368011,
318875,
310692,
310701,
286129,
228795,
302529,
302531,
163268,
310732,
64975,
327121,
228827,
286172,
310757,
187878,
343542,
343543,
286202,
286205,
302590,
294400,
228867,
253452,
146964,
286244,
245287,
245292,
286254,
56902,
228943,
286288,
196187,
343647,
286306,
138863,
294529,
286343,
229001,
310923,
188048,
229020,
302754,
245412,
229029,
40613,
40614,
40615,
286388,
286391,
319162,
286399,
302797,
212685,
212688,
245457,
302802,
286423,
278233,
278234,
294622,
278240,
212716,
212717,
229113,
286459,
278272,
319233,
278291,
278293,
294678,
286494,
294700,
360252,
188251,
237408,
253829,
294807,
294809,
294814,
311199,
319392,
294823,
294843,
98239,
294850,
163781,
344013,
212946,
24532,
294886,
253929,
327661,
278512,
311282
] |
d4fd76288d48affa326958a2490db60eba405fc7
|
c7565e5d0ebe6f4dcfb616e3d6394ab208021045
|
/Puzly/Model/ImageTileState.swift
|
180d8c6268b257217eaaa1d208adf6b5aed505a9
|
[] |
no_license
|
JonathanTennant/puzly-medium-example
|
a5a82aecc07a591c30a07a0426f37eefb1177874
|
614a36e00289703a0d745f6b78111178d32d28d0
|
refs/heads/main
| 2023-02-12T11:12:23.551133 | 2021-01-09T15:02:21 | 2021-01-09T15:02:21 | 328,178,604 | 1 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 251 |
swift
|
//
// imageTileState.swift
// Puzly
//
// Created by John on 27/11/2020.
//
import Foundation
import UIKit
struct imageTile {
let tag:Int
let image:UIImage
var positionIsCorrect:Bool = false
var successSoundPlayed:Bool = false
}
|
[
-1
] |
e48d784269deaeeeb6bfdeabb90f37bbb6763825
|
d7aafb063615668dc1c8a98fea8beff9821decab
|
/SocialTeqDemo/Data Layers/Network Layer/NetworkService.swift
|
5271f07d64976929d4dd5f522e8cb867c8c5bc46
|
[] |
no_license
|
farshadmb/SocialTeqDemo
|
29cba629d58b1c218ccffab171b97e31a4c0ce14
|
3b28034b4ac700f2be4f8d6ca625c0804aae750c
|
refs/heads/master
| 2023-02-21T08:37:41.043492 | 2021-01-25T23:34:10 | 2021-01-25T23:34:10 | 332,022,029 | 0 | 0 | null | 2021-01-25T23:34:11 | 2021-01-22T17:52:45 |
Swift
|
UTF-8
|
Swift
| false | false | 1,942 |
swift
|
//
// NetworkService.swift
// SocialTeqDemo
//
// Created by Farshad Mousalou on 1/16/21.
//
import Foundation
//Abstract
protocol NetworkService {
typealias ResultCompletion<T> = (_ result: Result<T,Error>) -> ()
typealias NetworkTask = URLSessionTask
/// <#Description#>
/// - Parameters:
/// - request: <#request description#>
/// - decoder: <#decoder description#>
/// - completion: <#completion description#>
@discardableResult
func send<T: Decodable>(request: NetworkRequestConvertiable, decoder: DataDecoder, completion: @escaping ResultCompletion<T>) -> NetworkTask?
/// <#Description#>
/// - Parameters:
/// - request: <#request description#>
/// - completion: <#completion description#>
@discardableResult
func download(request: NetworkRequestConvertiable, completion: @escaping ResultCompletion<Data>) -> NetworkTask?
}
//Abstract
protocol NetworkServiceInterceptorable: NetworkService {
/// <#Description#>
/// - Parameters:
/// - request: <#request description#>
/// - decoder: <#decoder description#>
/// - interceptor: <#interceptor description#>
/// - completion: <#completion description#>
@discardableResult
func send<T: Decodable>(request: NetworkRequestConvertiable,
decoder: DataDecoder,
interceptor: NetworkIntercaptor,
completion: @escaping ResultCompletion<T>) -> NetworkTask?
/// <#Description#>
/// - Parameters:
/// - request: <#request description#>
/// - interceptor: <#interceptor description#>
/// - completion: <#completion description#>
@discardableResult
func download(request: NetworkRequestConvertiable,
interceptor: NetworkIntercaptor,
completion: @escaping ResultCompletion<Data>) -> NetworkTask?
}
|
[
-1
] |
87fdbed86892b225def922e37cbc890d325130c7
|
4f285002acc5be5c677c5beb8b0d933b090494c2
|
/TechnicalTest/TechnicalTest/Modules/Equipements/View/EquipementsViewController.swift
|
e3601bd28f1a9f773c9239f64a547018f60d3239
|
[] |
no_license
|
MNadjib/Beeldi
|
3aadf71e1714207e44c6c621b93b80eb0c862099
|
8d94d4e436c9d187e844c8854245b4720a8445fc
|
refs/heads/master
| 2020-11-26T02:15:42.810964 | 2019-12-24T08:05:06 | 2019-12-24T08:05:06 | 228,934,240 | 1 | 0 | null | 2019-12-24T08:05:07 | 2019-12-18T22:49:26 |
Swift
|
UTF-8
|
Swift
| false | false | 2,210 |
swift
|
//
// EquipementsViewController.swift
// TechnicalTest
//
// Created by nbellouni on 15/12/2019.
// Copyright © 2019 nbellouni. All rights reserved.
//
import UIKit
import RxSwift
import RxCocoa
class EquipementsViewController: UIViewController {
var viewModel: EquipementsViewModelProtocol?
@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var searchBar: UISearchBar!
private let disposeBag = DisposeBag()
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
// Do any additional setup after loading the view.
}
private func setupUI() {
self.title = localize("equipements")
tableView.register(UINib(nibName: "EquipementTableViewCell", bundle: nil), forCellReuseIdentifier: "EquipementTableViewCellIdentifier")
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
self.tableView.delegate = nil
self.tableView.dataSource = nil
setupBindings()
}
private func setupBindings () {
guard let viewModel = viewModel else {
log("Error: view model null")
return
}
//seach bar text
searchBar.rx.text.orEmpty
.bind(to: viewModel.searchText)
.disposed(by: disposeBag)
// table view cell select
tableView.rx.itemSelected
.map({$0.row})
.bind(to: viewModel.selectCell)
.disposed(by: disposeBag)
//keyboard close
tableView.rx.contentOffset
.subscribe(onNext: { [unowned self] _ in
if self.searchBar.isFirstResponder {
self.searchBar.resignFirstResponder()
}
}).disposed(by: disposeBag)
//TableView load
viewModel.fetchedDatas
.bind(to: tableView.rx
.items(cellIdentifier: "EquipementTableViewCellIdentifier", cellType: EquipementTableViewCell.self)) { [unowned self]
i, equipement, cell in
cell.equipement = equipement
cell.searchedText = self.searchBar.text ?? ""
}.disposed(by: disposeBag)
}
}
|
[
-1
] |
5a2d7976fe87495ab118738e6a472ec631d624e9
|
1cfc23e2689296c5afe204e40dff6f40e03695cb
|
/TestFoundation/TestNSArray.swift
|
b37aea9aa4b17fc636b764a810df6a7176899644
|
[
"Apache-2.0",
"Swift-exception"
] |
permissive
|
zihejia/swift-corelibs-foundation
|
5fa5105b01b0f02524742da20b7148731aff82d4
|
64fb44abcfff1804963adb5eff086fbbc335ee6a
|
refs/heads/master
| 2020-03-27T01:12:22.326421 | 2018-08-22T08:41:03 | 2018-08-22T08:41:03 | 145,690,950 | 1 | 0 |
Apache-2.0
| 2018-08-22T10:02:43 | 2018-08-22T10:02:43 | null |
UTF-8
|
Swift
| false | false | 39,294 |
swift
|
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2016 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 the list of Swift project authors
//
class TestNSArray : XCTestCase {
static var allTests: [(String, (TestNSArray) -> () throws -> Void)] {
return [
("test_BasicConstruction", test_BasicConstruction),
("test_constructors", test_constructors),
("test_constructorWithCopyItems", test_constructorWithCopyItems),
("test_enumeration", test_enumeration),
("test_enumerationUsingBlock", test_enumerationUsingBlock),
("test_sequenceType", test_sequenceType),
("test_objectAtIndex", test_objectAtIndex),
("test_binarySearch", test_binarySearch),
("test_binarySearchFringeCases", test_binarySearchFringeCases),
("test_replaceObjectsInRange_withObjectsFrom", test_replaceObjectsInRange_withObjectsFrom),
("test_replaceObjectsInRange_withObjectsFrom_range", test_replaceObjectsInRange_withObjectsFrom_range),
("test_replaceObjectAtIndex", test_replaceObjectAtIndex),
("test_removeObjectsInArray", test_removeObjectsInArray),
("test_sortedArrayUsingComparator", test_sortedArrayUsingComparator),
("test_sortedArrayWithOptionsUsingComparator", test_sortedArrayWithOptionsUsingComparator),
("test_arrayReplacement", test_arrayReplacement),
("test_arrayReplaceObjectsInRangeFromRange", test_arrayReplaceObjectsInRangeFromRange),
("test_sortUsingFunction", test_sortUsingFunction),
("test_sortUsingComparator", test_sortUsingComparator),
("test_equality", test_equality),
("test_copying", test_copying),
("test_mutableCopying", test_mutableCopying),
("test_writeToFile", test_writeToFile),
("test_initWithContentsOfFile", test_initWithContentsOfFile),
("test_initMutableWithContentsOfFile", test_initMutableWithContentsOfFile),
("test_initMutableWithContentsOfURL", test_initMutableWithContentsOfURL),
("test_readWriteURL", test_readWriteURL),
("test_insertObjectAtIndex", test_insertObjectAtIndex),
("test_insertObjectsAtIndexes", test_insertObjectsAtIndexes),
("test_replaceObjectsAtIndexesWithObjects", test_replaceObjectsAtIndexesWithObjects),
("test_pathsMatchingExtensions", test_pathsMatchingExtensions),
]
}
func test_BasicConstruction() {
let array = NSArray()
let array2 : NSArray = ["foo", "bar"]
XCTAssertEqual(array.count, 0)
XCTAssertEqual(array2.count, 2)
}
func test_constructors() {
let arrayNil = NSArray(objects: nil, count: 0)
XCTAssertEqual(arrayNil.count, 0)
let array1 = NSArray(object: "foo")
XCTAssertEqual(array1.count, 1)
let testStrings: [AnyObject] = [NSString(string:"foo"), NSString(string: "bar")]
testStrings.withUnsafeBufferPointer { ptr in
let array2 = NSArray(objects: ptr.baseAddress, count: 1)
XCTAssertEqual(array1, array2)
}
let array3 = NSArray(objects: "foo" as NSString, "bar" as NSString, "baz" as NSString)
XCTAssertEqual(array3.count, 3)
let array4 = NSArray(array: ["foo", "bar", "baz"])
XCTAssertEqual(array4.count, 3)
let array5 = NSArray(arrayLiteral: "foo", "bar", "baz")
XCTAssertEqual(array5.count, 3)
XCTAssertEqual(array3, array4)
XCTAssertEqual(array3, array5)
XCTAssertEqual(array4, array5)
}
func test_constructorWithCopyItems() {
let foo = "foo" as NSMutableString
let array1 = NSArray(array: [foo], copyItems: false)
let array2 = NSArray(array: [foo], copyItems: true)
XCTAssertEqual(array1[0] as! String, "foo")
XCTAssertEqual(array2[0] as! String, "foo")
foo.append("1")
XCTAssertEqual(array1[0] as! String, "foo1")
XCTAssertEqual(array2[0] as! String, "foo")
}
func test_enumeration() {
let array : NSArray = ["foo", "bar", "baz"]
let e = array.objectEnumerator()
XCTAssertEqual((e.nextObject() as! String), "foo")
XCTAssertEqual((e.nextObject() as! String), "bar")
XCTAssertEqual((e.nextObject() as! String), "baz")
XCTAssertNil(e.nextObject())
XCTAssertNil(e.nextObject())
let r = array.reverseObjectEnumerator()
XCTAssertEqual((r.nextObject() as! String), "baz")
XCTAssertEqual((r.nextObject() as! String), "bar")
XCTAssertEqual((r.nextObject() as! String), "foo")
XCTAssertNil(r.nextObject())
XCTAssertNil(r.nextObject())
let empty = NSArray().objectEnumerator()
XCTAssertNil(empty.nextObject())
XCTAssertNil(empty.nextObject())
let reverseEmpty = NSArray().reverseObjectEnumerator()
XCTAssertNil(reverseEmpty.nextObject())
XCTAssertNil(reverseEmpty.nextObject())
}
func test_enumerationUsingBlock() {
let array : NSArray = NSArray(array: Array(0..<100))
let createIndexesArrayHavingSeen = { (havingSeen: IndexSet) in
return (0 ..< array.count).map { havingSeen.contains($0) }
}
let noIndexes = IndexSet()
let allIndexes = IndexSet(integersIn: 0 ..< array.count)
let firstHalfOfIndexes = IndexSet(integersIn: 0 ..< array.count / 2)
let lastHalfOfIndexes = IndexSet(integersIn: array.count / 2 ..< array.count)
let evenIndexes : IndexSet = {
var indexes = IndexSet()
for index in allIndexes.filter({ $0 % 2 == 0 }) {
indexes.insert(index)
}
return indexes
}()
let testExpectingToSee = { (expectation: IndexSet, block: (inout UnsafeMutableBufferPointer<Bool>) -> Void) in
var indexesSeen = createIndexesArrayHavingSeen(noIndexes)
indexesSeen.withUnsafeMutableBufferPointer(block)
XCTAssertEqual(indexesSeen, createIndexesArrayHavingSeen(expectation))
}
// Test enumerateObjects(_:), allowing it to run to completion...
testExpectingToSee(allIndexes) { (indexesSeen) in
array.enumerateObjects { (value, index, stop) in
XCTAssertEqual(value as! NSNumber, array[index] as! NSNumber)
indexesSeen[index] = true
}
}
// ... and stopping after the first half:
testExpectingToSee(firstHalfOfIndexes) { (indexesSeen) in
array.enumerateObjects { (value, index, stop) in
XCTAssertEqual(value as! NSNumber, array[index] as! NSNumber)
if firstHalfOfIndexes.contains(index) {
indexesSeen[index] = true
} else {
stop.pointee = true
}
}
}
// -----
// Test enumerateObjects(options:using) and enumerateObjects(at:options:using:):
// Test each of these options combinations:
let optionsToTest : [NSEnumerationOptions] = [
[],
[.concurrent],
[.reverse],
[.concurrent, .reverse],
]
for options in optionsToTest {
// Run to completion,
testExpectingToSee(allIndexes) { (indexesSeen) in
array.enumerateObjects(options: options, using: { (value, index, stop) in
XCTAssertEqual(value as! NSNumber, array[index] as! NSNumber)
indexesSeen[index] = true
})
}
// run it only for half the indexes (use the right half depending on where we start),
let indexesForHalfEnumeration = options.contains(.reverse) ? lastHalfOfIndexes : firstHalfOfIndexes
testExpectingToSee(indexesForHalfEnumeration) { (indexesSeen) in
array.enumerateObjects(options: options, using: { (value, index, stop) in
XCTAssertEqual(value as! NSNumber, array[index] as! NSNumber)
if indexesForHalfEnumeration.contains(index) {
indexesSeen[index] = true
} else {
stop.pointee = true
}
})
}
// run only for a specific index set to test the at:… variant,
testExpectingToSee(evenIndexes) { (indexesSeen) in
array.enumerateObjects(at: evenIndexes, options: options, using: { (value, index, stop) in
XCTAssertEqual(value as! NSNumber, array[index] as! NSNumber)
indexesSeen[index] = true
})
}
// and run for some indexes only to test stopping.
var indexesForStaggeredEnumeration = indexesForHalfEnumeration
indexesForStaggeredEnumeration.formIntersection(evenIndexes)
let finalCount = indexesForStaggeredEnumeration.count
let lockForSeenCount = NSLock()
var seenCount = 0
testExpectingToSee(indexesForStaggeredEnumeration) { (indexesSeen) in
array.enumerateObjects(at: evenIndexes, options: options, using: { (value, index, stop) in
XCTAssertEqual(value as! NSNumber, array[index] as! NSNumber)
if (indexesForStaggeredEnumeration.contains(index)) {
indexesSeen[index] = true
lockForSeenCount.lock()
seenCount += 1
let currentCount = seenCount
lockForSeenCount.unlock()
if currentCount == finalCount {
stop.pointee = true
}
}
})
}
}
}
func test_sequenceType() {
let array : NSArray = ["foo", "bar", "baz"]
var res = [String]()
for obj in array {
res.append((obj as! String))
}
XCTAssertEqual(res, ["foo", "bar", "baz"])
}
// func test_getObjects() {
// let array : NSArray = ["foo", "bar", "baz", "foo1", "bar2", "baz3",].bridge()
// var objects = [AnyObject]()
// array.getObjects(&objects, range: NSRange(location: 1, length: 3))
// XCTAssertEqual(objects.count, 3)
// let fetched = [
// (objects[0] as! NSString).bridge(),
// (objects[1] as! NSString).bridge(),
// (objects[2] as! NSString).bridge(),
// ]
// XCTAssertEqual(fetched, ["bar", "baz", "foo1"])
// }
func test_objectAtIndex() {
let array : NSArray = ["foo", "bar"]
let foo = array.object(at: 0) as! String
XCTAssertEqual(foo, "foo")
let bar = array.object(at: 1) as! String
XCTAssertEqual(bar, "bar")
}
func test_binarySearch() {
let numbers: [AnyObject] = [
NSNumber(value: 0 as Int), NSNumber(value: 1 as Int), NSNumber(value: 2 as Int), NSNumber(value: 2 as Int), NSNumber(value: 3 as Int),
NSNumber(value: 4 as Int), NSNumber(value: 4 as Int), NSNumber(value: 6 as Int), NSNumber(value: 7 as Int), NSNumber(value: 7 as Int),
NSNumber(value: 7 as Int), NSNumber(value: 8 as Int), NSNumber(value: 9 as Int), NSNumber(value: 9 as Int)]
let array = NSArray(array: numbers)
// Not sure how to test fatal errors.
// NSArray throws NSInvalidArgument if range exceeds bounds of the array.
// let rangeOutOfArray = NSRange(location: 5, length: 15)
// let _ = array.indexOfObject(NSNumber(value: 9 as Int), inSortedRange: rangeOutOfArray, options: [.insertionIndex, .firstEqual], usingComparator: compareIntNSNumber)
// NSArray throws NSInvalidArgument if both .firstEqual and .lastEqual are specified
// let searchForBoth: NSBinarySearchingOptions = [.firstEqual, .lastEqual]
// let _ = objectIndexInArray(array, value: 9, startingFrom: 0, length: 13, options: searchForBoth)
let notFound = objectIndexInArray(array, value: 11, startingFrom: 0, length: 13)
XCTAssertEqual(notFound, NSNotFound, "NSArray return NSNotFound if object is not found.")
let notFoundInRange = objectIndexInArray(array, value: 7, startingFrom: 0, length: 5)
XCTAssertEqual(notFoundInRange, NSNotFound, "NSArray return NSNotFound if object is not found.")
let indexOfAnySeven = objectIndexInArray(array, value: 7, startingFrom: 0, length: 13)
XCTAssertTrue(Set([8, 9, 10]).contains(indexOfAnySeven), "If no options provided NSArray returns an arbitrary matching object's index.")
let indexOfFirstNine = objectIndexInArray(array, value: 9, startingFrom: 7, length: 6, options: [.firstEqual])
XCTAssertTrue(indexOfFirstNine == 12, "If .FirstEqual is set NSArray returns the lowest index of equal objects.")
let indexOfLastTwo = objectIndexInArray(array, value: 2, startingFrom: 1, length: 7, options: [.lastEqual])
XCTAssertTrue(indexOfLastTwo == 3, "If .LastEqual is set NSArray returns the highest index of equal objects.")
let anyIndexToInsertNine = objectIndexInArray(array, value: 9, startingFrom: 0, length: 13, options: [.insertionIndex])
XCTAssertTrue(Set([12, 13, 14]).contains(anyIndexToInsertNine), "If .InsertionIndex is specified and no other options provided NSArray returns any equal or one larger index than any matching object’s index.")
let lowestIndexToInsertTwo = objectIndexInArray(array, value: 2, startingFrom: 0, length: 5, options: [.insertionIndex, .firstEqual])
XCTAssertTrue(lowestIndexToInsertTwo == 2, "If both .InsertionIndex and .FirstEqual are specified NSArray returns the lowest index of equal objects.")
let highestIndexToInsertNine = objectIndexInArray(array, value: 9, startingFrom: 7, length: 6, options: [.insertionIndex, .lastEqual])
XCTAssertTrue(highestIndexToInsertNine == 13, "If both .InsertionIndex and .LastEqual are specified NSArray returns the index of the least greater object...")
let indexOfLeastGreaterObjectThanFive = objectIndexInArray(array, value: 5, startingFrom: 0, length: 10, options: [.insertionIndex, .lastEqual])
XCTAssertTrue(indexOfLeastGreaterObjectThanFive == 7, "If both .InsertionIndex and .LastEqual are specified NSArray returns the index of the least greater object...")
let rangeStart = 0
let rangeLength = 13
let endOfArray = objectIndexInArray(array, value: 10, startingFrom: rangeStart, length: rangeLength, options: [.insertionIndex, .lastEqual])
XCTAssertTrue(endOfArray == (rangeStart + rangeLength), "...or the index at the end of the array if the object is larger than all other elements.")
let arrayOfTwo = NSArray(array: [NSNumber(value: 0 as Int), NSNumber(value: 2 as Int)])
let indexInMiddle = objectIndexInArray(arrayOfTwo, value: 1, startingFrom: 0, length: 2, options: [.insertionIndex, .firstEqual])
XCTAssertEqual(indexInMiddle, 1, "If no match found item should be inserted before least greater object")
let indexInMiddle2 = objectIndexInArray(arrayOfTwo, value: 1, startingFrom: 0, length: 2, options: [.insertionIndex, .lastEqual])
XCTAssertEqual(indexInMiddle2, 1, "If no match found item should be inserted before least greater object")
let indexInMiddle3 = objectIndexInArray(arrayOfTwo, value: 1, startingFrom: 0, length: 2, options: [.insertionIndex])
XCTAssertEqual(indexInMiddle3, 1, "If no match found item should be inserted before least greater object")
}
func test_arrayReplacement() {
let numbers: [AnyObject] = [
NSNumber(value: 0 as Int), NSNumber(value: 1 as Int), NSNumber(value: 2 as Int), NSNumber(value: 3 as Int),
NSNumber(value: 4 as Int), NSNumber(value: 5 as Int), NSNumber(value: 7 as Int)]
let array = NSMutableArray(array: numbers)
array.replaceObjects(in: NSRange(location: 0, length: 2), withObjectsFrom: [NSNumber(value: 8 as Int), NSNumber(value: 9 as Int)])
XCTAssertTrue((array[0] as! NSNumber).intValue == 8)
XCTAssertTrue((array[1] as! NSNumber).intValue == 9)
XCTAssertTrue((array[2] as! NSNumber).intValue == 2)
}
func test_arrayReplaceObjectsInRangeFromRange() {
let numbers: [AnyObject] = [
NSNumber(value: 0 as Int), NSNumber(value: 1 as Int), NSNumber(value: 2 as Int), NSNumber(value: 3 as Int),
NSNumber(value: 4 as Int), NSNumber(value: 5 as Int), NSNumber(value: 7 as Int)]
let array = NSMutableArray(array: numbers)
array.replaceObjects(in: NSRange(location: 0, length: 2), withObjectsFrom: [NSNumber(value: 8 as Int), NSNumber(value: 9 as Int), NSNumber(value: 10 as Int)], range: NSRange(location: 1, length: 2))
XCTAssertTrue((array[0] as! NSNumber).intValue == 9)
XCTAssertTrue((array[1] as! NSNumber).intValue == 10)
XCTAssertTrue((array[2] as! NSNumber).intValue == 2)
}
func test_replaceObjectAtIndex() {
let numbers: [AnyObject] = [
NSNumber(value: 0 as Int), NSNumber(value: 1 as Int), NSNumber(value: 2 as Int), NSNumber(value: 3 as Int),
NSNumber(value: 4 as Int), NSNumber(value: 5 as Int), NSNumber(value: 7 as Int)]
let array = NSMutableArray(array: numbers)
// 1. Check replacement in the middle of the array
array.replaceObject(at: 3, with: NSNumber(value: 8 as Int))
XCTAssertEqual(array.count, 7)
XCTAssertEqual((array[3] as! NSNumber).intValue, 8)
// 2. Check replacement of the first element
array.replaceObject(at: 0, with: NSNumber(value: 7 as Int))
XCTAssertEqual(array.count, 7)
XCTAssertEqual((array[0] as! NSNumber).intValue, 7)
// 3. Check replacement of the last element
array.replaceObject(at: 6, with: NSNumber(value: 6 as Int))
XCTAssertEqual(array.count, 7)
XCTAssertEqual((array[6] as! NSNumber).intValue, 6)
}
func test_removeObjectsInArray() {
let numbers: [AnyObject] = [
NSNumber(value: 0 as Int), NSNumber(value: 1 as Int), NSNumber(value: 2 as Int), NSNumber(value: 3 as Int),
NSNumber(value: 4 as Int), NSNumber(value: 5 as Int), NSNumber(value: 7 as Int)]
let array = NSMutableArray(array: numbers)
let objectsToRemove: Array<AnyObject> = [
NSNumber(value: 1 as Int), NSNumber(value: 22 as Int), NSNumber(value: 7 as Int), NSNumber(value: 5 as Int)]
array.removeObjects(in: objectsToRemove)
XCTAssertEqual(array.count, 4)
XCTAssertEqual((array[0] as! NSNumber).intValue, 0)
XCTAssertEqual((array[1] as! NSNumber).intValue, 2)
XCTAssertEqual((array[2] as! NSNumber).intValue, 3)
XCTAssertEqual((array[3] as! NSNumber).intValue, 4)
}
func test_binarySearchFringeCases() {
let numbers: [AnyObject] = [
NSNumber(value: 0 as Int), NSNumber(value: 1 as Int), NSNumber(value: 2 as Int), NSNumber(value: 2 as Int), NSNumber(value: 3 as Int),
NSNumber(value: 4 as Int), NSNumber(value: 4 as Int), NSNumber(value: 6 as Int), NSNumber(value: 7 as Int), NSNumber(value: 7 as Int),
NSNumber(value: 7 as Int), NSNumber(value: 8 as Int), NSNumber(value: 9 as Int), NSNumber(value: 9 as Int)]
let array = NSArray(array: numbers)
let emptyArray = NSArray()
// Same as for non empty NSArray but error message ends with 'bounds for empty array'.
// let _ = objectIndexInArray(emptyArray, value: 0, startingFrom: 0, length: 1)
let notFoundInEmptyArray = objectIndexInArray(emptyArray, value: 9, startingFrom: 0, length: 0)
XCTAssertEqual(notFoundInEmptyArray, NSNotFound, "Empty NSArray return NSNotFound for any valid arguments.")
let startIndex = objectIndexInArray(emptyArray, value: 7, startingFrom: 0, length: 0, options: [.insertionIndex])
XCTAssertTrue(startIndex == 0, "For Empty NSArray any objects should be inserted at start.")
let rangeStart = 0
let rangeLength = 13
let leastSearch = objectIndexInArray(array, value: -1, startingFrom: rangeStart, length: rangeLength)
XCTAssertTrue(leastSearch == NSNotFound, "If object is less than least object in the range then there is no change it could be found.")
let greatestSearch = objectIndexInArray(array, value: 15, startingFrom: rangeStart, length: rangeLength)
XCTAssertTrue(greatestSearch == NSNotFound, "If object is greater than greatest object in the range then there is no change it could be found.")
let leastInsert = objectIndexInArray(array, value: -1, startingFrom: rangeStart, length: rangeLength, options: .insertionIndex)
XCTAssertTrue(leastInsert == rangeStart, "If object is less than least object in the range it should be inserted at range' location.")
let greatestInsert = objectIndexInArray(array, value: 15, startingFrom: rangeStart, length: rangeLength, options: .insertionIndex)
XCTAssertTrue(greatestInsert == (rangeStart + rangeLength), "If object is greater than greatest object in the range it should be inserted at range' end.")
}
func objectIndexInArray(_ array: NSArray, value: Int, startingFrom: Int, length: Int, options: NSBinarySearchingOptions = []) -> Int {
return array.index(of: NSNumber(value: value), inSortedRange: NSRange(location: startingFrom, length: length), options: options, usingComparator: compareIntNSNumber)
}
func compareIntNSNumber(_ lhs: Any, rhs: Any) -> ComparisonResult {
let lhsInt = (lhs as! NSNumber).intValue
let rhsInt = (rhs as! NSNumber).intValue
if lhsInt == rhsInt {
return .orderedSame
}
if lhsInt < rhsInt {
return .orderedAscending
}
return .orderedDescending
}
func test_replaceObjectsInRange_withObjectsFrom() {
let array1 = NSMutableArray(array:[
"foo1",
"bar1",
"baz1"])
let array2: [Any] = [
"foo2",
"bar2",
"baz2"]
array1.replaceObjects(in: NSRange(location: 0, length: 2), withObjectsFrom: array2)
XCTAssertEqual(array1[0] as? String, "foo2", "Expected foo2 but was \(array1[0])")
XCTAssertEqual(array1[1] as? String, "bar2", "Expected bar2 but was \(array1[1])")
XCTAssertEqual(array1[2] as? String, "baz2", "Expected baz2 but was \(array1[2])")
XCTAssertEqual(array1[3] as? String, "baz1", "Expected baz1 but was \(array1[3])")
}
func test_replaceObjectsInRange_withObjectsFrom_range() {
let array1 = NSMutableArray(array:[
"foo1",
"bar1",
"baz1"])
let array2: [Any] = [
"foo2",
"bar2",
"baz2"]
array1.replaceObjects(in: NSRange(location: 1, length: 1), withObjectsFrom: array2, range: NSRange(location: 1, length: 2))
XCTAssertEqual(array1[0] as? String, "foo1", "Expected foo1 but was \(array1[0])")
XCTAssertEqual(array1[1] as? String, "bar2", "Expected bar2 but was \(array1[1])")
XCTAssertEqual(array1[2] as? String, "baz2", "Expected baz2 but was \(array1[2])")
XCTAssertEqual(array1[3] as? String, "baz1", "Expected baz1 but was \(array1[3])")
}
func test_sortedArrayUsingComparator() {
// sort with localized caseInsensitive compare
let input = ["this", "is", "a", "test", "of", "sort", "with", "strings"]
let expectedResult: Array<String> = input.sorted()
let result = NSArray(array: input).sortedArray(comparator:) { left, right -> ComparisonResult in
let l = left as! String
let r = right as! String
return l.localizedCaseInsensitiveCompare(r)
}
XCTAssertEqual(result.map { ($0 as! String)} , expectedResult)
// sort empty array
let emptyArray = NSArray().sortedArray(comparator:) { _,_ in .orderedSame }
XCTAssertTrue(emptyArray.isEmpty)
// sort numbers
let inputNumbers = [0, 10, 25, 100, 21, 22]
let expectedNumbers = inputNumbers.sorted()
let resultNumbers = NSArray(array: inputNumbers).sortedArray(comparator:) { left, right -> ComparisonResult in
let l = (left as! NSNumber).intValue
let r = (right as! NSNumber).intValue
return l < r ? .orderedAscending : (l == r ? .orderedSame : .orderedDescending)
}
XCTAssertEqual(resultNumbers.map { ($0 as! NSNumber).intValue}, expectedNumbers)
}
func test_sortedArrayWithOptionsUsingComparator() {
// check that sortedArrayWithOptions:comparator: works in the way sortedArrayUsingComparator does
let input = NSArray(array: ["this", "is", "a", "test", "of", "sort", "with", "strings"])
let comparator: (Any, Any) -> ComparisonResult = { left, right -> ComparisonResult in
let l = left as! String
let r = right as! String
return l.localizedCaseInsensitiveCompare(r)
}
let result1 = NSArray(array: input.sortedArray(comparator: comparator))
let result2 = input.sortedArray(options: [], usingComparator: comparator)
XCTAssertTrue(result1.isEqual(to: result2))
// sort empty array
let emptyArray = NSArray().sortedArray(options: []) { _,_ in .orderedSame }
XCTAssertTrue(emptyArray.isEmpty)
}
func test_sortUsingFunction() {
let inputNumbers = [11, 120, 215, 11, 1, -22, 35, -89, 65]
let mutableInput = NSArray(array: inputNumbers).mutableCopy() as! NSMutableArray
let expectedNumbers = inputNumbers.sorted()
func compare(_ left: Any, right:Any, context: UnsafeMutableRawPointer?) -> Int {
let l = (left as! NSNumber).intValue
let r = (right as! NSNumber).intValue
return l < r ? -1 : (l == r ? 0 : 1)
}
mutableInput.sort(compare, context: UnsafeMutableRawPointer(bitPattern: 0))
XCTAssertEqual(mutableInput.map { ($0 as! NSNumber).intValue}, expectedNumbers)
}
func test_sortUsingComparator() {
// check behaviour with Array's sort method
let inputNumbers = [11, 120, 215, 11, 1, -22, 35, -89, 65]
let mutableInput = NSMutableArray(array: inputNumbers)
let expectedNumbers = inputNumbers.sorted()
mutableInput.sort { left, right -> ComparisonResult in
let l = (left as! NSNumber).intValue
let r = (right as! NSNumber).intValue
return l < r ? .orderedAscending : (l == r ? .orderedSame : .orderedDescending)
}
XCTAssertEqual(mutableInput.map { ($0 as! NSNumber).intValue}, expectedNumbers)
// check that it works in the way self.sortWithOptions([], usingComparator: cmptr) does
let inputStrings = ["this", "is", "a", "test", "of", "sort", "with", "strings"]
let mutableStringsInput1 = NSMutableArray(array: inputStrings)
let mutableStringsInput2 = NSMutableArray(array: inputStrings)
let comparator: (Any, Any) -> ComparisonResult = { left, right -> ComparisonResult in
let l = left as! String
let r = right as! String
return l.localizedCaseInsensitiveCompare(r)
}
mutableStringsInput1.sort(comparator: comparator)
mutableStringsInput2.sort(options: [], usingComparator: comparator)
XCTAssertTrue(mutableStringsInput1.isEqual(to: Array(mutableStringsInput2)))
}
func test_equality() {
let array1 = NSArray(array: ["this", "is", "a", "test", "of", "equal", "with", "strings"])
let array2 = NSArray(array: ["this", "is", "a", "test", "of", "equal", "with", "strings"])
let array3 = NSArray(array: ["this", "is", "a", "test", "of", "equal", "with", "objects"])
XCTAssertTrue(array1 == array2)
XCTAssertTrue(array1.isEqual(array2))
XCTAssertTrue(array1.isEqual(to: Array(array2)))
// if 2 arrays are equal, hashes should be equal as well. But not vise versa
XCTAssertEqual(array1.hash, array2.hash)
XCTAssertEqual(array1.hashValue, array2.hashValue)
XCTAssertFalse(array1 == array3)
XCTAssertFalse(array1.isEqual(array3))
XCTAssertFalse(array1.isEqual(to: Array(array3)))
XCTAssertFalse(array1.isEqual(nil))
XCTAssertFalse(array1.isEqual(NSObject()))
let objectsArray1 = NSArray(array: [NSArray(array: [0])])
let objectsArray2 = NSArray(array: [NSArray(array: [1])])
XCTAssertFalse(objectsArray1 == objectsArray2)
XCTAssertFalse(objectsArray1.isEqual(objectsArray2))
XCTAssertFalse(objectsArray1.isEqual(to: Array(objectsArray2)))
}
/// - Note: value type conversion will destroy identity. So use index(of:) instead of indexOfObjectIdentical(to:)
func test_copying() {
let array = NSArray(array: ["this", "is", "a", "test", "of", "copy", "with", "strings"])
let arrayCopy1 = array.copy() as! NSArray
XCTAssertTrue(array === arrayCopy1)
let arrayMutableCopy = array.mutableCopy() as! NSMutableArray
let arrayCopy2 = arrayMutableCopy.copy() as! NSArray
XCTAssertTrue(type(of: arrayCopy2) === NSArray.self)
XCTAssertFalse(arrayMutableCopy === arrayCopy2)
for entry in arrayCopy2 {
XCTAssertTrue(array.index(of: entry) != NSNotFound)
}
}
func test_mutableCopying() {
let array = NSArray(array: ["this", "is", "a", "test", "of", "mutableCopy", "with", "strings"])
let arrayMutableCopy1 = array.mutableCopy() as! NSMutableArray
XCTAssertTrue(type(of: arrayMutableCopy1) === NSMutableArray.self)
XCTAssertFalse(array === arrayMutableCopy1)
for entry in arrayMutableCopy1 {
XCTAssertTrue(array.index(of: entry) != NSNotFound)
}
let arrayMutableCopy2 = arrayMutableCopy1.mutableCopy() as! NSMutableArray
XCTAssertTrue(type(of: arrayMutableCopy2) === NSMutableArray.self)
XCTAssertFalse(arrayMutableCopy2 === arrayMutableCopy1)
for entry in arrayMutableCopy2 {
XCTAssertTrue(arrayMutableCopy1.index(of: entry) != NSNotFound)
}
}
func test_initWithContentsOfFile() {
let testFilePath = createTestFile("TestFileOut.txt", _contents: Data(capacity: 234))
if let _ = testFilePath {
let a1: NSArray = ["foo", "bar"]
let isWritten = a1.write(toFile: testFilePath!, atomically: true)
if isWritten {
let array = NSArray.init(contentsOfFile: testFilePath!)
XCTAssert(array == a1)
} else {
XCTFail("Write to file failed")
}
removeTestFile(testFilePath!)
} else {
XCTFail("Temporary file creation failed")
}
}
func test_initMutableWithContentsOfFile() {
if let testFilePath = createTestFile("TestFileOut.txt", _contents: Data(capacity: 234)) {
let a1: NSArray = ["foo", "bar"]
let isWritten = a1.write(toFile: testFilePath, atomically: true)
if isWritten {
let array = NSMutableArray.init(contentsOfFile: testFilePath)
XCTAssert(array == a1)
XCTAssertEqual(array?.count, 2)
array?.removeAllObjects()
XCTAssertEqual(array?.count, 0)
} else {
XCTFail("Write to file failed")
}
removeTestFile(testFilePath)
} else {
XCTFail("Temporary file creation failed")
}
}
func test_initMutableWithContentsOfURL() {
if let testFilePath = createTestFile("TestFileOut.txt", _contents: Data(capacity: 234)) {
let a1: NSArray = ["foo", "bar"]
let isWritten = a1.write(toFile: testFilePath, atomically: true)
if isWritten {
let url = URL(fileURLWithPath: testFilePath, isDirectory: false)
let array = NSMutableArray.init(contentsOf: url)
XCTAssert(array == a1)
XCTAssertEqual(array?.count, 2)
array?.removeAllObjects()
XCTAssertEqual(array?.count, 0)
} else {
XCTFail("Write to file failed")
}
removeTestFile(testFilePath)
} else {
XCTFail("Temporary file creation failed")
}
}
func test_writeToFile() {
let testFilePath = createTestFile("TestFileOut.txt", _contents: Data(capacity: 234))
if let _ = testFilePath {
let d1: NSArray = ["foo", "bar"]
let isWritten = d1.write(toFile: testFilePath!, atomically: true)
if isWritten {
do {
let plistDoc = try XMLDocument(contentsOf: URL(fileURLWithPath: testFilePath!, isDirectory: false), options: [])
XCTAssert(plistDoc.rootElement()?.name == "plist")
let plist = try PropertyListSerialization.propertyList(from: plistDoc.xmlData, options: [], format: nil) as! [Any]
XCTAssert((plist[0] as? String) == d1[0] as? String)
XCTAssert((plist[1] as? String) == d1[1] as? String)
} catch {
XCTFail("Failed to read and parse XMLDocument")
}
} else {
XCTFail("Write to file failed")
}
removeTestFile(testFilePath!)
} else {
XCTFail("Temporary file creation failed")
}
}
func test_readWriteURL() {
let data = NSArray(arrayLiteral: "one", "two", "three", "four", "five")
do {
let tempDir = NSTemporaryDirectory() + "TestFoundation_Playground_" + NSUUID().uuidString
try FileManager.default.createDirectory(atPath: tempDir, withIntermediateDirectories: false, attributes: nil)
let testFile = tempDir + "/readWriteURL.txt"
let url = URL(fileURLWithPath: testFile)
let data2: NSArray
#if DARWIN_COMPATIBILITY_TESTS
if #available(macOS 10.13, *) {
try data.write(to: url)
data2 = try NSArray(contentsOf: url, error: ())
} else {
guard data.write(toFile: testFile, atomically: true) else {
throw NSError(domain: NSCocoaErrorDomain, code: CocoaError.fileWriteUnknown.rawValue)
}
data2 = NSArray(contentsOfFile: testFile)!
}
#else
try data.write(to: url)
data2 = try NSArray(contentsOf: url, error: ())
#endif
XCTAssertEqual(data, data2)
removeTestFile(testFile)
} catch let e {
XCTFail("Failed to write to file: \(e)")
}
}
func test_insertObjectAtIndex() {
let a1 = NSMutableArray(arrayLiteral: "one", "two", "three", "four")
a1.insert("a", at: 0)
XCTAssertEqual(a1, ["a", "one", "two", "three", "four"])
let a2 = NSMutableArray(arrayLiteral: "one", "two", "three", "four")
a2.insert("a", at: 4)
XCTAssertEqual(a2, ["one", "two", "three", "four", "a"])
let a3 = NSMutableArray()
a3.insert("a", at: 0)
XCTAssertEqual(a3, ["a"])
}
func test_insertObjectsAtIndexes() {
let a1 = NSMutableArray(arrayLiteral: "one", "two", "three", "four")
a1.insert(["a", "b"], at: [0, 1])
XCTAssertEqual(a1, ["a", "b", "one", "two", "three", "four"])
let a2 = NSMutableArray(arrayLiteral: "one", "two", "three", "four")
a2.insert(["a", "b"], at: [1, 3])
XCTAssertEqual(a2, ["one", "a", "two", "b", "three", "four"])
let a3 = NSMutableArray(arrayLiteral: "one", "two", "three", "four")
a3.insert(["a", "b"], at: [5, 4])
XCTAssertEqual(a3, ["one", "two", "three", "four", "a", "b"])
let a4 = NSMutableArray()
a4.insert(["a", "b"], at: [0, 1])
XCTAssertEqual(a4, ["a", "b"])
}
func test_replaceObjectsAtIndexesWithObjects() {
let a1 = NSMutableArray(arrayLiteral: "one", "two", "three", "four")
a1.replaceObjects(at: [0], with: ["a"])
XCTAssertEqual(a1, ["a", "two", "three", "four"])
let a2 = NSMutableArray(arrayLiteral: "one", "two", "three", "four")
a2.replaceObjects(at: [1, 2], with: ["a", "b"])
XCTAssertEqual(a2, ["one", "a", "b", "four"])
let a3 = NSMutableArray(arrayLiteral: "one", "two", "three", "four")
a3.replaceObjects(at: [3, 2, 1, 0], with: ["a", "b", "c", "d"])
XCTAssertEqual(a3, ["a", "b", "c", "d"])
}
func test_pathsMatchingExtensions() {
let paths = NSArray(arrayLiteral: "file1.txt", "/tmp/file2.txt", "file3.jpg", "file3.png", "/file4.png", "txt", ".txt")
let match1 = paths.pathsMatchingExtensions(["txt"])
XCTAssertEqual(match1, ["file1.txt", "/tmp/file2.txt"])
let match2 = paths.pathsMatchingExtensions([])
XCTAssertEqual(match2, [])
let match3 = paths.pathsMatchingExtensions([".txt", "png"])
XCTAssertEqual(match3, ["file3.png", "/file4.png"])
let match4 = paths.pathsMatchingExtensions(["", ".tx", "tx"])
XCTAssertEqual(match4, [])
let match5 = paths.pathsMatchingExtensions(["..txt"])
XCTAssertEqual(match5, [])
}
private func createTestFile(_ path: String, _contents: Data) -> String? {
let tempDir = NSTemporaryDirectory() + "TestFoundation_Playground_" + NSUUID().uuidString + "/"
do {
try FileManager.default.createDirectory(atPath: tempDir, withIntermediateDirectories: false, attributes: nil)
if FileManager.default.createFile(atPath: tempDir + "/" + path, contents: _contents, attributes: nil) {
return tempDir + path
} else {
return nil
}
} catch _ {
return nil
}
}
private func removeTestFile(_ location: String) {
do {
try FileManager.default.removeItem(atPath: location)
} catch _ {
}
}
}
|
[
-1
] |
380674ba606e1228964788625df41ef8d34b63f2
|
629d44497bcfc44010f1c5bdef13a8cd5d456daf
|
/BlogReader/DetailViewController.swift
|
ae8ef609f1cbd6d220f289a8e98ec9da6d39530b
|
[] |
no_license
|
MikeReining/BlogReaderFinal
|
53f38bf12c4f1ced6a0bb305e07c5cb7a8b3809f
|
b83ac4deecc42bd1445f91ed901200130e5c3b81
|
refs/heads/master
| 2021-01-01T05:48:50.013871 | 2015-01-04T17:17:58 | 2015-01-04T17:17:58 | 28,722,141 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 874 |
swift
|
//
// DetailViewController.swift
// BlogReader
//
// Created by Michael Reining on 1/2/15.
// Copyright (c) 2015 Mike Reining. All rights reserved.
//
import UIKit
class DetailViewController: UIViewController {
var blogPostTitle: String?
var blogPostUrl: NSURL = NSURL()
@IBOutlet weak var webView: UIWebView!
func configureView() {
// Update the user interface for the detail item.
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
self.navigationItem.title = blogPostTitle
webView?.loadRequest(NSURLRequest(URL: blogPostUrl))
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
|
[
-1
] |
e249241af05ca727e027614d6f5f184276bedff6
|
6de4ea0b881c5e7dd0efcacdeeb91dc7a6e1a67c
|
/TestingEkbana/Module/ArticleDetail/User Interface/Wireframe/ArticleDetailWireframe.swift
|
be835c150f148063379fa106492a491cc3c7a335
|
[] |
no_license
|
rmanjil/VIPERUpateExample
|
e4049ff60aa4e56c4f45ae081e2aead62514a1df
|
f9ae7146952bcaf9977b10abb4bf2edac79a8a7c
|
refs/heads/master
| 2023-07-14T03:01:40.899467 | 2021-08-19T04:04:31 | 2021-08-19T04:04:31 | 388,741,143 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,084 |
swift
|
//
// ArticleDetailWireframe.swift
// TestingEkbana
//
// Created by manjil on 23/07/2021.
//
//
import UIKit
import BaseDesignFramework
class ArticleDetailWireframe {
weak var view: UIViewController!
}
extension ArticleDetailWireframe: ArticleDetailWireframeInput {
var storyboardName: String {
""
}
// var storyboardName: String {return "ArticleDetail"}
func getMainView() -> UIViewController {
let service = ArticleDetailService()
let interactor = ArticleDetailInteractor(service: service)
let presenter = ArticleDetailPresenter()
let viewController = ArticleDetailController(baseView: ArticleDetailScreen(), basePresenter: presenter) //viewControllerFromStoryboard(of: ArticleDetailViewController.self)
// viewController.presenter = presenter
interactor.output = presenter
presenter.interactor = interactor
presenter.wireframe = self
// presenter.view = viewController
self.view = viewController
return viewController
}
}
|
[
-1
] |
7d9ae7e53aa07de1b5fb7d23796bd0271629eba8
|
8faf9125e14da1e653f28d3fb40ee983f33c9033
|
/X1/Source/Controller/ViewResponse/ViewResponseViewController.swift
|
75cfe45ed4da3d5977e61a5bc9cf04582c2c66e0
|
[] |
no_license
|
astraqube/X1_iOS
|
5a36268275775f4a99d4cc38f2c69046e4abea05
|
a86db2a4083043bb218a549c924ab438d413af03
|
refs/heads/master
| 2021-04-18T21:27:03.892180 | 2018-06-06T11:29:50 | 2018-06-06T11:29:50 | 126,799,883 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 791 |
swift
|
//
// ViewResponseViewController.swift
// Solviant
//
// Created by Rohit Kumar on 05/06/2018.
// Copyright © 2018 AstraQube. All rights reserved.
//
import UIKit
class ViewResponseViewController: UIViewController {
// MARK: - IB Outlet
// MARK: - Life Cycle
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.
}
// MARK: - IB Action
// MARK: - Navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
}
}
|
[
-1
] |
dc97d1cd7ad9f4c6541417ca78be2bc84c40c899
|
949f0f5f22e24ceef4d56f894d66b3067a42bf28
|
/Navigation-2-2/Navigation/NavigationElements/CreateModuleFactory.swift
|
f8bf4539b8ae570e097852819f13f7825e17c906
|
[] |
no_license
|
Fa1zer/GCD
|
6cfe70f020be0ace2c2e4ba61188ffbab33a9f1d
|
d0377f8ed1372b61fa91dd06d2de634eca734bba
|
refs/heads/feature/task-1/initial
| 2023-08-31T09:54:52.514282 | 2021-10-04T17:54:34 | 2021-10-04T17:54:34 | 413,527,600 | 0 | 0 | null | 2021-10-04T17:58:42 | 2021-10-04T17:49:53 |
Swift
|
UTF-8
|
Swift
| false | false | 493 |
swift
|
//
// CreateModuleFactory.swift
// Navigation
//
// Created by Artemiy Zuzin on 23.09.2021.
// Copyright © 2021 Artem Novichkov. All rights reserved.
//
import Foundation
class CreateModuleFactory {
func createModule(navigatinController: FirstNavigationController) {
let viewModel = FeedViewModel()
let viewController = FeedViewController(viewModel: viewModel)
navigatinController.pushViewController(viewController, animated: true)
}
}
|
[
-1
] |
789d0fb883567399bcba89fc316178b5dd607dc9
|
2381881858a3894bd3c3b517fc5ca58c9dedbd85
|
/Pizzaria/Cardapio/SearchFooter.swift
|
8dc924a837c4bfe91dcf1f922939aeb4bd2059a9
|
[] |
no_license
|
Krihgnus/Aplicativo-Pizzaria
|
498b7814bbb757b4300b595adb8294279f0cff12
|
4dda0edb17bf4e1b6ada1ddcc7774443b9b394ca
|
refs/heads/master
| 2021-04-03T09:21:25.854120 | 2018-03-19T21:28:33 | 2018-03-19T21:28:33 | 124,438,854 | 2 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 100 |
swift
|
import UIKit
import Foundation
class SearchFooter {
@IBOutlet weak var searchFooter: UIView!
}
|
[
-1
] |
6a70f8aed34c3f4836e4519041eb94fd8a359c68
|
e836abea21bf4f903fd74e38ea31a06ce8a7fe0a
|
/SocialApp/SignInVC.swift
|
f3b0f1472063151034807de6c351813f89d4d323
|
[] |
no_license
|
dahuggin/SocialApp
|
afee53d74859bf82d25257155e790ac7395cc68d
|
f24c54410c9f99c47aef4309efa4eaa049efaa29
|
refs/heads/master
| 2021-01-19T13:45:51.299270 | 2017-05-07T19:21:34 | 2017-05-07T19:21:34 | 88,106,564 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 3,645 |
swift
|
//
// ViewController.swift
// SocialApp
//
// Created by Daniel Huggins on 4/12/17.
// Copyright © 2017 Daniel Huggins. All rights reserved.
//
import UIKit
import FBSDKCoreKit
import FBSDKLoginKit
import Firebase
import SwiftKeychainWrapper
class SignInVC: UIViewController {
@IBOutlet weak var emailField: FancyField!
@IBOutlet weak var passField: FancyField!
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewDidAppear(_ animated: Bool) {
if let _ = KeychainWrapper.standard.string(forKey: KEY_UID) {
performSegue(withIdentifier: "goToFeed", sender: nil)
}
}
@IBAction func facebookBtnTapped(_ sender: Any) {
let facebookLogin = FBSDKLoginManager()
facebookLogin.logIn(withReadPermissions: ["email"], from: self) { (result, error) in
if error != nil {
print("DH: Unable to authenticate with Facebook - \(String(describing: error))")
} else if result?.isCancelled == true {
print("DH: User cancelled facebook authentication")
} else {
print("DH: Successfully authenticated with Facebook")
let credential = FIRFacebookAuthProvider.credential(withAccessToken: FBSDKAccessToken.current().tokenString)
self.firebaseAuth(credential)
}
}
}
func firebaseAuth(_ credential: FIRAuthCredential) {
FIRAuth.auth()?.signIn(with: credential, completion: { (user, error) in
if error != nil {
print("DH: Unable to authenticate with Firebase - \(String(describing: error))")
} else {
print("DH: Successfully authenticated with Firebase")
if let user = user {
let userData = ["provider": credential.provider]
self.completeSignIn(id: user.uid, userData: userData)
}
}
})
}
@IBAction func signInTapped(_ sender: Any) {
if let email = emailField.text, let pwd = passField.text {
FIRAuth.auth()?.signIn(withEmail: email, password: pwd, completion: { (user, error) in
if error == nil {
print("DH: Email user authenticated with Firebase")
if let user = user {
let userData = ["provider": user.providerID]
self.completeSignIn(id: user.uid, userData: userData)
}
} else {
FIRAuth.auth()?.createUser(withEmail: email, password: pwd, completion: { (user, error) in
if error != nil {
print("DH: Unable to authenticate with firebase using email")
} else {
print("DH: Successfully authenticated email with Firebase")
if let user = user {
let userData = ["provider": user.providerID]
self.completeSignIn(id: user.uid, userData: userData)
}
}
})
}
})
}
}
func completeSignIn(id: String, userData: Dictionary<String, String>) {
DataService.ds.createFirebaseDBUser(uid: id, userData: userData)
let keychainResult = KeychainWrapper.standard.set(id, forKey: KEY_UID)
print("DH: Sign in completed - \(keychainResult)")
performSegue(withIdentifier: "goToFeed", sender: nil)
}
}
|
[
-1
] |
35acc276577ad466a24058b4446f4a1c79e983bb
|
46f9a87b643b22057a721059ce8e1f9d4e6acad2
|
/SwiftUISamplesTests/SwiftUISamplesTests.swift
|
c8542e9bef6e77b48a2fa5e0abe91ea28eb6c3ac
|
[
"MIT"
] |
permissive
|
fhasni/DemoSwiftUI
|
bc2a837e5186c1fb4d31c0ca3fcb1fbd006105b3
|
794d1083d2c5604c82f91f582a0c0936fe04d8f7
|
refs/heads/master
| 2023-01-31T04:23:47.078257 | 2020-12-17T14:40:34 | 2020-12-17T14:40:34 | 315,123,609 | 1 | 0 | null | 2020-12-06T17:16:53 | 2020-11-22T20:14:36 |
Swift
|
UTF-8
|
Swift
| false | false | 916 |
swift
|
//
// SwiftUISamplesTests.swift
// SwiftUISamplesTests
//
// Created by fhasni on 11/21/20.
//
import XCTest
@testable import SwiftUISamples
class SwiftUISamplesTests: XCTestCase {
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
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 {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() throws {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}
|
[
333828,
43014,
358410,
354316,
313357,
360462,
399373,
182296,
317467,
145435,
16419,
223268,
229413,
204840,
315432,
325674,
344107,
102445,
155694,
253999,
176175,
233517,
346162,
129076,
241716,
229430,
243767,
163896,
180280,
358456,
352315,
288828,
436285,
376894,
288833,
288834,
436292,
403525,
352326,
225351,
315465,
436301,
338001,
196691,
338003,
280661,
329814,
307289,
385116,
237663,
254048,
315487,
356447,
280675,
280677,
43110,
319591,
321637,
436329,
194666,
221290,
438377,
260207,
352368,
432240,
204916,
233589,
266357,
131191,
215164,
215166,
422019,
280712,
415881,
104587,
235662,
241808,
381073,
196760,
284826,
426138,
346271,
436383,
362659,
49316,
299174,
333991,
258214,
333992,
32941,
239793,
377009,
405687,
182456,
295098,
258239,
379071,
389313,
299203,
149703,
299209,
346314,
372941,
266449,
321745,
139479,
254170,
229597,
194782,
301279,
311519,
317664,
280802,
379106,
387296,
346346,
205035,
307435,
321772,
438511,
381172,
436470,
327929,
243962,
344313,
184575,
149760,
375039,
411906,
147717,
368905,
325905,
254226,
272658,
368916,
262421,
272660,
325912,
381208,
377114,
151839,
237856,
237857,
233762,
211235,
217380,
432421,
211238,
338218,
251213,
311597,
358703,
321840,
98610,
332083,
379186,
332085,
358709,
180535,
336183,
332089,
321860,
332101,
438596,
323913,
348492,
383311,
323920,
344401,
366930,
377169,
348500,
368981,
155990,
289110,
368984,
168281,
215385,
332123,
363163,
272729,
332127,
98657,
383332,
242023,
383336,
270701,
160110,
242033,
270706,
354676,
139640,
291192,
211326,
436608,
362881,
240002,
436611,
311685,
225670,
317831,
106888,
340357,
242058,
385417,
373134,
385422,
108944,
252308,
190871,
213403,
149916,
121245,
242078,
420253,
141728,
39324,
315810,
315811,
381347,
289189,
108972,
272813,
340398,
385454,
377264,
342450,
338356,
436661,
293303,
311738,
33211,
293310,
336320,
311745,
378244,
127427,
342466,
416197,
254406,
188871,
324039,
129483,
342476,
373197,
289232,
328152,
256477,
287198,
160225,
342498,
358882,
334309,
340453,
391655,
432618,
375276,
319981,
291311,
254456,
377338,
377343,
174593,
254465,
291333,
340490,
139792,
420369,
303636,
258581,
393751,
416286,
377376,
207393,
375333,
377386,
244269,
197167,
375343,
385588,
289332,
234036,
375351,
174648,
338489,
338490,
244281,
315960,
352829,
242237,
348732,
70209,
348742,
115270,
70215,
293448,
55881,
301638,
309830,
348749,
381517,
385615,
426576,
340558,
369235,
416341,
297560,
332378,
201308,
354911,
416351,
139872,
436832,
436834,
268899,
111208,
344680,
39530,
184940,
373358,
420463,
346737,
389745,
313971,
139892,
346740,
420471,
287352,
344696,
209530,
244347,
373375,
152195,
311941,
336518,
348806,
311945,
369289,
330379,
344715,
311949,
287374,
326287,
375440,
316049,
311954,
334481,
117396,
111253,
316053,
346772,
230040,
264856,
111258,
111259,
271000,
289434,
303771,
205471,
318106,
318107,
342682,
139939,
344738,
377500,
176808,
352937,
205487,
303793,
318130,
299699,
293556,
336564,
383667,
314040,
287417,
342713,
39614,
287422,
377539,
422596,
422599,
291530,
225995,
363211,
164560,
242386,
385747,
361176,
418520,
422617,
287452,
363230,
264928,
422626,
375526,
234217,
346858,
330474,
342762,
293612,
342763,
289518,
299759,
369385,
377489,
312052,
154359,
172792,
348920,
344827,
221948,
432893,
363263,
205568,
162561,
291585,
295682,
430849,
35583,
291592,
197386,
383754,
62220,
117517,
434957,
322319,
422673,
377497,
430865,
166676,
291604,
310036,
197399,
207640,
422680,
426774,
426775,
326429,
293664,
344865,
326433,
197411,
342820,
400166,
289576,
293672,
295724,
152365,
197422,
353070,
164656,
295729,
422703,
191283,
189228,
422709,
152374,
197431,
273207,
375609,
355130,
160571,
353078,
289598,
160575,
336702,
430910,
160580,
252741,
420677,
381773,
201551,
293711,
353109,
377686,
244568,
230234,
189275,
244570,
435039,
295776,
242529,
349026,
357218,
303972,
385893,
342887,
355178,
308076,
242541,
207727,
330609,
246643,
207732,
295798,
361337,
177019,
185211,
308092,
398206,
400252,
291712,
158593,
254850,
359298,
260996,
359299,
113542,
369538,
381829,
316298,
392074,
349067,
295824,
224145,
349072,
355217,
256922,
289690,
318364,
390045,
310176,
185250,
310178,
420773,
185254,
256935,
289703,
293800,
140204,
236461,
363438,
347055,
377772,
252847,
304051,
326581,
373687,
326587,
230332,
377790,
289727,
273344,
349121,
330689,
353215,
363458,
379844,
213957,
19399,
359364,
326601,
345033,
373706,
316364,
359381,
386006,
418776,
433115,
248796,
343005,
340955,
50143,
347103,
130016,
64485,
123881,
326635,
187374,
383983,
347123,
240630,
271350,
201720,
127992,
295927,
349175,
328700,
318461,
293886,
320507,
257024,
328706,
330754,
320516,
293893,
295942,
357379,
386056,
410627,
353290,
330763,
377869,
433165,
384016,
238610,
308243,
418837,
140310,
433174,
252958,
369701,
357414,
248872,
238639,
357423,
252980,
300084,
359478,
312373,
203830,
238651,
308287,
248901,
377926,
359495,
218186,
250954,
314448,
341073,
339030,
439384,
304222,
392290,
253029,
257125,
300135,
316520,
273515,
173166,
357486,
144496,
351344,
404593,
187506,
377972,
285814,
291959,
300150,
300151,
363641,
160891,
363644,
341115,
300158,
377983,
392318,
150657,
248961,
384131,
349316,
402565,
349318,
302216,
330888,
386189,
373903,
169104,
177296,
326804,
363669,
238743,
119962,
300187,
300188,
339100,
351390,
199839,
380061,
429214,
343203,
265379,
300201,
249002,
253099,
253100,
238765,
3246,
300202,
306346,
238769,
318639,
402613,
367799,
421048,
373945,
113850,
294074,
302274,
367810,
259268,
265412,
353479,
402634,
283852,
259280,
290000,
316627,
333011,
189653,
419029,
351446,
148696,
296153,
357595,
134366,
304351,
195808,
298208,
310497,
359647,
298212,
298213,
222440,
330984,
328940,
298221,
253167,
298228,
302325,
234742,
386294,
351476,
351478,
128251,
363771,
386301,
261377,
320770,
386306,
437505,
322824,
439562,
292107,
328971,
369930,
414990,
353551,
251153,
177428,
349462,
257305,
250192,
320796,
222494,
253216,
339234,
372009,
412971,
353584,
261425,
351537,
382258,
345396,
300343,
386359,
116026,
378172,
286013,
306494,
382269,
216386,
312648,
337225,
304456,
230729,
146762,
224586,
177484,
294218,
259406,
234831,
238927,
294219,
331090,
353616,
406861,
318805,
314710,
372054,
425304,
159066,
374109,
314720,
378209,
163175,
333160,
386412,
380271,
327024,
296307,
116084,
208244,
249204,
316787,
290173,
306559,
314751,
318848,
337281,
148867,
357762,
253317,
298374,
314758,
314760,
142729,
296329,
368011,
384393,
388487,
314766,
296335,
318864,
112017,
234898,
9619,
259475,
275859,
318868,
370071,
357786,
290207,
314783,
251298,
310692,
314789,
333220,
314791,
396711,
245161,
396712,
374191,
286129,
380337,
173491,
286132,
150965,
304564,
353719,
380338,
210358,
228795,
425405,
302531,
380357,
339398,
361927,
300489,
425418,
306639,
413137,
353750,
23092,
210390,
210391,
210393,
210392,
286172,
144867,
271843,
429542,
361963,
296433,
251378,
308723,
300536,
286202,
359930,
302590,
210433,
372227,
366083,
323080,
329225,
253451,
296461,
359950,
259599,
304656,
329232,
146964,
308756,
370197,
253463,
175639,
374296,
388632,
374299,
308764,
396827,
134686,
349726,
431649,
355876,
286244,
245287,
402985,
394794,
245292,
349741,
347694,
169518,
431663,
288309,
312889,
194110,
349763,
196164,
265798,
288327,
218696,
292425,
128587,
265804,
333388,
396882,
128599,
179801,
44635,
239198,
343647,
333408,
396895,
99938,
300644,
323172,
310889,
415338,
243307,
312940,
54893,
204397,
138863,
188016,
222832,
325231,
224883,
120427,
314998,
370296,
396922,
366203,
323196,
325245,
337534,
337535,
339584,
263809,
294529,
194180,
224901,
288392,
229001,
415375,
188048,
239250,
419478,
345752,
425626,
255649,
302754,
153251,
298661,
40614,
300714,
210603,
224946,
337591,
384695,
110268,
415420,
224958,
327358,
333503,
274115,
259781,
306890,
403148,
212685,
333517,
9936,
9937,
241361,
302802,
333520,
272085,
345814,
370388,
384720,
224984,
345821,
321247,
298720,
321249,
325346,
153319,
325352,
345833,
345834,
212716,
212717,
372460,
360177,
67315,
173814,
325371,
288512,
319233,
175873,
339715,
288516,
360195,
339720,
243472,
372496,
323346,
321302,
345879,
366360,
398869,
249626,
325404,
286494,
321310,
255776,
339745,
341796,
257830,
421672,
362283,
378668,
399147,
431916,
300848,
409394,
296755,
259899,
319292,
360252,
325439,
345919,
436031,
403267,
153415,
360264,
345929,
341836,
415567,
325457,
317269,
18262,
362327,
216918,
241495,
341847,
255829,
350044,
346779,
128862,
245599,
345951,
362337,
376669,
345955,
425825,
296806,
292712,
425833,
423789,
214895,
313199,
362352,
325492,
276341,
417654,
341879,
241528,
317304,
333688,
112509,
55167,
182144,
325503,
305026,
339841,
188292,
333701,
253829,
243591,
315273,
315274,
350093,
325518,
372626,
380821,
329622,
294807,
337815,
333722,
376732,
118685,
298909,
311199,
319392,
350109,
253856,
292771,
354212,
436131,
294823,
415655,
436137,
327596,
362417,
323507,
243637,
290745,
294843,
188348,
362431,
237504,
294850,
274371,
384964,
214984,
151497,
362443,
344013,
212942,
301008,
153554,
212946,
24532,
346067,
219101,
372701,
329695,
436191,
360417,
292836,
292837,
298980,
337895,
313319,
317415,
253929,
380908,
436205,
327661,
247791,
362480,
311281,
311282,
325619,
432116,
292858,
415741,
352917
] |
cac02a19d25d4c5ce949ab413a20bafbd266ba89
|
02313d1130e427ced701f7537a148ea1f2faa368
|
/SocietyFund/Modules/Menu/MenuControllers/Profile/ChangePassword/ChangePasswordViewController.swift
|
a59d62e3c4920fef2be7c47197d30fcd1d6232d5
|
[] |
no_license
|
ramesh9842/SocietyFund
|
1630ba67487fd44f11eace76318272df689be22a
|
06644ba1979a851ac783ddc31245cf1cee225074
|
refs/heads/master
| 2022-12-11T10:23:17.790249 | 2020-09-14T15:39:55 | 2020-09-14T15:39:55 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,450 |
swift
|
//
// ChangePasswordViewController.swift
// SocietyFund
//
// Created by sanish on 8/31/20.
// Copyright © 2020 AahamSolutions. All rights reserved.
//
import UIKit
class ChangePasswordViewController: UIViewController {
@IBOutlet weak var tfOldPassword: UITextField!
@IBOutlet weak var tfNewPassword: UITextField!
@IBOutlet weak var tfConfirmPassword: UITextField!
var validator: ChangePasswordValidator!
var vmChangePassword: ChangePasswordViewModel!
@IBAction func changePasswordPressed(_ : UIButton) {
validator.validate(tfOldPassword: tfOldPassword, tfNewPassword: tfNewPassword, tfConfirmPassword: tfConfirmPassword)
}
override func viewDidLoad() {
super.viewDidLoad()
customizeTextFields()
vmChangePassword = ChangePasswordViewModel()
validator = ChangePasswordValidator(vm: vmChangePassword)
vmChangePassword.delegate = self
validator.delegate = self
}
func customizeTextFields() {
tfOldPassword.customTextField()
tfNewPassword.customTextField()
tfConfirmPassword.customTextField()
}
}
// MARK: - ChangePasswordDelegate
extension ChangePasswordViewController: ChangePasswordDelegate {
func onSuccess(_ response: ChangePasswordResponse) {
Log.debug(msg: response)
}
func onFailure(msg: String, title: String) {
alert(message: msg, title: title)
}
}
|
[
-1
] |
05161fa59005255797fecfbfb5ce8368af138ce8
|
b2bf575808c2683e515ac8d07b1ccbea09e815de
|
/01_swift_tour.swift
|
b9d50183552b1ab0805eb4e4acbb4f292771886f
|
[] |
no_license
|
luuvish/swift-example-xcode-6.1
|
1b64976ee6c9999966fe3c17557146b220a86104
|
4c34e9879d5a0a6c4402a6ae1e8462b311fa7fa1
|
refs/heads/master
| 2021-03-12T22:33:18.454380 | 2014-10-26T17:45:27 | 2014-10-26T17:45:27 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 9,931 |
swift
|
#!/usr/bin/env xcrun swift
println("Hello, world")
// Simple Values
var myVariable = 42
myVariable = 50
let myConstant = 42
let implicitInteger = 70
let implicitDouble = 70.0
let explicitDouble: Double = 70
let label = "The width is "
let width = 94
let widthLabel = label + String(width)
let apples = 3
let oranges = 5
let appleSummary = "I have \(apples) apples."
let fruitSummary = "I have \(apples + oranges) pieces of fruit."
var shoppingList = ["catfish", "water", "tulips", "blue paint"]
shoppingList[1] = "bottle of water"
var occupations = [
"Malcolm": "Captain",
"Kaylee": "Mechanic",
]
occupations["Jayne"] = "Public Relations"
let emptyArray = [String]()
let emptyDictionary = [String: Float]()
shoppingList = []
occupations = [:]
// Control Flow
let individualScores = [75, 43, 103, 87, 12]
var teamScore = 0
for score in individualScores {
if score > 50 {
teamScore += 3
} else {
teamScore += 1
}
}
println("teamScore \(teamScore)")
var optionalString: String? = "Hello"
optionalString == nil
var optionalName: String? = "John Appleseed"
var greeting = "Hello!"
if let name = optionalName {
greeting = "Hello, \(name)"
}
let vegetable = "red pepper"
switch vegetable {
case "celery":
let vegetableComment = "Add some raisins and make ants on a log."
case "cucumber", "watercress":
let vegetableComment = "That would make a good tea sandwich."
case let x where x.hasSuffix("pepper"):
let vegetableComment = "Is it a spicy \(x)?"
default:
let vegetableComment = "Everything tastes good in soup."
}
let interestingNumbers = [
"Prime": [2, 3, 5, 7, 11, 13],
"Fibonacci": [1, 1, 2, 3, 5, 8],
"Square": [1, 4, 9, 16, 25],
]
var largest = 0
for (kind, numbers) in interestingNumbers {
for number in numbers {
if number > largest {
largest = number
}
}
}
println("largest \(largest)")
var n = 2
while n < 100 {
n = n * 2
}
println("n \(n)")
var m = 2
do {
m = m * 2
} while m < 100
println("m \(m)")
var firstForLoop = 0
for i in 0..<4 {
firstForLoop += i
}
println("firstForLoop \(firstForLoop)")
var secondForLoop = 0
for var i = 0; i < 4; ++i {
secondForLoop += 1
}
println("secondForLoop \(secondForLoop)")
// Functions and Closures
func greet(name: String, day: String) -> String {
return "Hello \(name), today is \(day)."
}
println(greet("Bob", "Tuesday"))
func calculateStatistics(scores: [Int]) -> (min: Int, max: Int, sum: Int) {
var min = scores[0]
var max = scores[0]
var sum = 0
for score in scores {
if score > max {
max = score
} else if score < min {
min = score
}
sum += score
}
return (min, max, sum)
}
let statistics = calculateStatistics([5, 3, 100, 3, 9])
println("staticstics.sum \(statistics.sum)")
println("staticstics.2 \(statistics.2)")
func sumOf(numbers: Int...) -> Int {
var sum = 0
for number in numbers {
sum += number
}
return sum
}
println(sumOf())
println(sumOf(42, 597, 12))
func returnFifteen() -> Int {
var y = 10
func add() {
y += 5
}
add()
return y
}
println(returnFifteen())
func makeIncrementer() -> (Int -> Int) {
func addOne(number: Int) -> Int {
return 1 + number
}
return addOne
}
var increment = makeIncrementer()
println(increment(7))
func hasAnyMatches(list: [Int], condition: Int -> Bool) -> Bool {
for item in list {
if condition(item) {
return true
}
}
return false
}
func lessThanTen(number: Int) -> Bool {
return number < 10
}
var numbers = [20, 19, 7, 12]
println(hasAnyMatches(numbers, lessThanTen))
numbers.map({
(number: Int) -> Int in
let result = 3 * number
return result
})
let mappedNumbers = numbers.map({ number in 3 * number })
println("mappedNumbers \(mappedNumbers)")
let sortedNumbers = sorted(numbers) { $0 > $1 }
println("sortedNumbers \(sortedNumbers)")
// Objects and Classes
class Shape {
var numberOfSides = 0
func simpleDescription() -> String {
return "A shape with \(numberOfSides) sides."
}
}
var shape = Shape()
shape.numberOfSides = 7
var shapeDescription = shape.simpleDescription()
println("shapeDescription \(shapeDescription)")
class NamedShape {
var numberOfSides: Int = 0
var name: String
init(name: String) {
self.name = name
}
func simpleDescription() -> String {
return "A shape with \(numberOfSides) sides."
}
}
class Square: NamedShape {
var sideLength: Double
init(sideLength: Double, name: String) {
self.sideLength = sideLength
super.init(name: name)
numberOfSides = 4
}
func area() -> Double {
return sideLength * sideLength
}
override func simpleDescription() -> String {
return "A square with sides of length \(sideLength)."
}
}
let test = Square(sideLength: 5.2, name: "my test square")
println(test.area())
println(test.simpleDescription())
class EquilateralTriangle: NamedShape {
var sideLength: Double = 0.0
init(sideLength: Double, name: String) {
self.sideLength = sideLength
super.init(name: name)
numberOfSides = 3
}
var perimeter: Double {
get {
return 3.0 * sideLength
}
set {
sideLength = newValue / 3.0
}
}
override func simpleDescription() -> String {
return "An Equilateral triangle with sides of length \(sideLength)."
}
}
var triangle = EquilateralTriangle(sideLength: 3.1, name: "a triangle")
println(triangle.perimeter)
triangle.perimeter = 9.9
println(triangle.sideLength)
class TriangleAndSquare {
var triangle: EquilateralTriangle {
willSet {
square.sideLength = newValue.sideLength
}
}
var square: Square {
willSet {
triangle.sideLength = newValue.sideLength
}
}
init(size: Double, name: String) {
square = Square(sideLength: size, name: name)
triangle = EquilateralTriangle(sideLength: size, name: name)
}
}
var triangleAndSquare = TriangleAndSquare(size: 10, name: "another test shape")
println(triangleAndSquare.square.sideLength)
println(triangleAndSquare.triangle.sideLength)
triangleAndSquare.square = Square(sideLength: 50, name: "larger square")
println(triangleAndSquare.triangle.sideLength)
class Counter {
var count: Int = 0
func incrementBy(amount: Int, numberOfTimes times: Int) {
count += amount * times
}
}
var counter = Counter()
counter.incrementBy(2, numberOfTimes: 7)
println(counter.count)
let optionalSquare: Square? = Square(sideLength: 2.5, name: "optional square")
let sideLength = optionalSquare?.sideLength
println("sideLength \(sideLength)")
// Enumerations and Structures
enum Rank: Int {
case Ace = 1
case Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten
case Jack, Queen, King
func simpleDescription() -> String {
switch self {
case .Ace:
return "ace"
case .Jack:
return "jack"
case .Queen:
return "queen"
case .King:
return "king"
default:
return String(self.rawValue)
}
}
}
let ace = Rank.Ace
let aceRawValue = ace.rawValue
println("ace \(ace) \(aceRawValue)")
if let convertedRank = Rank(rawValue: 3) {
let threeDescription = convertedRank.simpleDescription()
}
enum Suit {
case Spades, Hearts, Diamonds, Clubs
func simpleDescription() -> String {
switch self {
case .Spades:
return "spades"
case .Hearts:
return "hearts"
case .Diamonds:
return "diamonds"
case .Clubs:
return "clubs"
}
}
}
let hearts = Suit.Hearts
let heartsDescription = hearts.simpleDescription()
println("hearts \(hearts) \(heartsDescription)")
struct Card {
var rank: Rank
var suit: Suit
func simpleDescription() -> String {
return "The \(rank.simpleDescription()) of \(suit.simpleDescription())"
}
}
let threeOfSpades = Card(rank: .Three, suit: .Spades)
let threeOfSpadesDescription = threeOfSpades.simpleDescription();
println("threeOfSpades \(threeOfSpades) \(threeOfSpadesDescription)")
enum ServerResponse {
case Result(String, String)
case Error(String)
}
let success = ServerResponse.Result("6:00 am", "8:09 pm")
let failure = ServerResponse.Error("Out of cheese.")
switch success {
case let .Result(sunrise, sunset):
let serverResponse = "Sunrise is at \(sunrise) and sunset is at \(sunset)."
case let .Error(error):
let serverResponse = "Failure... \(error)"
}
// Protocols and Extensions
protocol ExampleProtocol {
var simpleDescription: String { get }
mutating func adjust()
}
class SimpleClass: ExampleProtocol {
var simpleDescription: String = "A very simple class."
var anotherProperty: Int = 69105
func adjust() {
simpleDescription += " Now 100% adjusted."
}
}
var a = SimpleClass()
a.adjust()
let aDescription = a.simpleDescription
println(aDescription)
struct SimpleStructure: ExampleProtocol {
var simpleDescription: String = "A simple structure"
mutating func adjust() {
simpleDescription += " (adjusted)"
}
}
var b = SimpleStructure()
b.adjust()
let bDescription = b.simpleDescription
println(bDescription)
extension Int: ExampleProtocol {
var simpleDescription: String {
return "The number \(self)"
}
mutating func adjust() {
self += 42
}
}
println(7.simpleDescription)
let protocolValue: ExampleProtocol = a
println(protocolValue.simpleDescription)
// Generics
func repeat<Item>(item: Item, times: Int) -> [Item] {
var result = [Item]()
for i in 0..<times {
result.append(item)
}
return result
}
println(repeat("knock", 4))
enum OptionValue<T> {
case None
case Some(T)
}
var possibleInteger: OptionValue<Int> = .None
possibleInteger = .Some(100)
func anyCommonElements <T, U where T: SequenceType, U: SequenceType,
T.Generator.Element: Equatable,
T.Generator.Element == U.Generator.Element> (lhs: T, rhs: U) -> Bool {
for lhsItem in lhs {
for rhsItem in rhs {
if lhsItem == rhsItem {
return true
}
}
}
return false
}
println(anyCommonElements([1, 2, 3], [3]))
|
[
-1
] |
0419d03762e6560bf2b85e38e422493da6ee3b78
|
5314e1b122306de859b7375b7eecff5b69207043
|
/Tests/AppTests/AcronymTests.swift
|
38b884497fcd627083f19fb84fb3d25288385ad1
|
[
"MIT"
] |
permissive
|
paultiarks/TILApp
|
d7d3e638af6a99125620086f377ea37eae632661
|
808252b0ef7fae12d3fd444c44f2ee3de7a4f27d
|
refs/heads/master
| 2020-03-26T04:44:18.136384 | 2018-09-01T15:06:16 | 2018-09-01T15:06:16 | 144,520,126 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 7,632 |
swift
|
@testable import App
import Vapor
import XCTest
import FluentPostgreSQL
final class AcronymTests: XCTestCase {
let acronymsURI = "/api/acronyms/"
let acronymShort = "OMG"
let acronymLong = "Oh My God"
var app: Application!
var conn: PostgreSQLConnection!
override func setUp() {
try! Application.reset()
app = try! Application.testable()
conn = try! app.newConnection(to: .psql).wait()
}
override func tearDown() {
conn.close()
}
func testAcronymsCanBeRetrievedFromAPI() throws {
let acronym1 = try Acronym.create(short: acronymShort, long: acronymLong, on: conn)
_ = try Acronym.create(on: conn)
let acronyms = try app.getResponse(to: acronymsURI, decodeTo: [Acronym].self)
XCTAssertEqual(acronyms.count, 2)
XCTAssertEqual(acronyms[0].short, acronymShort)
XCTAssertEqual(acronyms[0].long, acronymLong)
XCTAssertEqual(acronyms[0].id, acronym1.id)
}
func testAcronymCanBeSavedWithAPI() throws {
let user = try User.create(on: conn)
let acronym = Acronym(short: acronymShort, long: acronymLong, userID: user.id!)
let receivedAcronym = try app.getResponse(to: acronymsURI, method: .POST, headers: ["Content-Type": "application/json"], data: acronym, decodeTo: Acronym.self, loggedInRequest: true)
XCTAssertEqual(receivedAcronym.short, acronymShort)
XCTAssertEqual(receivedAcronym.long, acronymLong)
XCTAssertNotNil(receivedAcronym.id)
let acronyms = try app.getResponse(to: acronymsURI, decodeTo: [Acronym].self)
XCTAssertEqual(acronyms.count, 1)
XCTAssertEqual(acronyms[0].short, acronymShort)
XCTAssertEqual(acronyms[0].long, acronymLong)
XCTAssertEqual(acronyms[0].id, receivedAcronym.id)
}
func testGettingASingleAcronymFromTheAPI() throws {
let acronym = try Acronym.create(short: acronymShort, long: acronymLong, on: conn)
let returnedAcronym = try app.getResponse(to: "\(acronymsURI)\(acronym.id!)", decodeTo: Acronym.self)
XCTAssertEqual(returnedAcronym.short, acronymShort)
XCTAssertEqual(returnedAcronym.long, acronymLong)
XCTAssertEqual(returnedAcronym.id, acronym.id)
}
func testUpdatingAnAcronym() throws {
let acronym = try Acronym.create(short: acronymShort, long: acronymLong, on: conn)
let newUser = try User.create(on: conn)
let newLong = "Oh My Gosh"
let updatedAcronym = Acronym(short: acronymShort, long: newLong, userID: newUser.id!)
try app.sendRequest(to: "\(acronymsURI)\(acronym.id!)", method: .PUT, headers: ["Content-Type": "application/json"], data: updatedAcronym, loggedInUser: newUser)
let returnedAcronym = try app.getResponse(to: "\(acronymsURI)\(acronym.id!)", decodeTo: Acronym.self)
XCTAssertEqual(returnedAcronym.short, acronymShort)
XCTAssertEqual(returnedAcronym.long, newLong)
XCTAssertEqual(returnedAcronym.userID, newUser.id)
}
func testDeletingAnAcronym() throws {
let acronym = try Acronym.create(on: conn)
var acronyms = try app.getResponse(to: acronymsURI, decodeTo: [Acronym].self)
XCTAssertEqual(acronyms.count, 1)
_ = try app.sendRequest(to: "\(acronymsURI)\(acronym.id!)", method: .DELETE, loggedInRequest: true)
acronyms = try app.getResponse(to: acronymsURI, decodeTo: [Acronym].self)
XCTAssertEqual(acronyms.count, 0)
}
func testSearchAcronymShort() throws {
let acronym = try Acronym.create(short: acronymShort, long: acronymLong, on: conn)
let acronyms = try app.getResponse(to: "\(acronymsURI)?term=OMG", decodeTo: [Acronym].self)
XCTAssertEqual(acronyms.count, 1)
XCTAssertEqual(acronyms[0].id, acronym.id)
XCTAssertEqual(acronyms[0].short, acronymShort)
XCTAssertEqual(acronyms[0].long, acronymLong)
}
func testSearchAcronymLong() throws {
let acronym = try Acronym.create(short: acronymShort, long: acronymLong, on: conn)
let acronyms = try app.getResponse(to: "\(acronymsURI)?term=Oh+My+God", decodeTo: [Acronym].self)
XCTAssertEqual(acronyms.count, 1)
XCTAssertEqual(acronyms[0].id, acronym.id)
XCTAssertEqual(acronyms[0].short, acronymShort)
XCTAssertEqual(acronyms[0].long, acronymLong)
}
func testGetFirstAcronym() throws {
let acronym = try Acronym.create(short: acronymShort, long: acronymLong, on: conn)
_ = try Acronym.create(on: conn)
_ = try Acronym.create(on: conn)
let firstAcronym = try app.getResponse(to: "\(acronymsURI)first", decodeTo: Acronym.self)
XCTAssertEqual(firstAcronym.id, acronym.id)
XCTAssertEqual(firstAcronym.short, acronymShort)
XCTAssertEqual(firstAcronym.long, acronymLong)
}
func testSortingAcronyms() throws {
let short2 = "LOL"
let long2 = "Laugh Out Loud"
let acronym1 = try Acronym.create(short: acronymShort, long: acronymLong, on: conn)
let acronym2 = try Acronym.create(short: short2, long: long2, on: conn)
let sortedAcronyms = try app.getResponse(to: "\(acronymsURI)sorted", decodeTo: [Acronym].self)
XCTAssertEqual(sortedAcronyms[0].id, acronym2.id)
XCTAssertEqual(sortedAcronyms[1].id, acronym1.id)
}
func testGettingAnAcronymsUser() throws {
let user = try User.create(on: conn)
let acronym = try Acronym.create(user: user, on: conn)
let acronymsUser = try app.getResponse(to: "\(acronymsURI)\(acronym.id!)/user", decodeTo: User.Public.self)
XCTAssertEqual(acronymsUser.id, user.id)
XCTAssertEqual(acronymsUser.name, user.name)
XCTAssertEqual(acronymsUser.username, user.username)
}
func testAcronymsCategories() throws {
let category = try Category.create(on: conn)
let category2 = try Category.create(name: "Funny", on: conn)
let acronym = try Acronym.create(on: conn)
let request1URL =
"\(acronymsURI)\(acronym.id!)/categories/\(category.id!)"
_ = try app.sendRequest(
to: request1URL,
method: .POST,
loggedInRequest: true)
let request2URL =
"\(acronymsURI)\(acronym.id!)/categories/\(category2.id!)"
_ = try app.sendRequest(
to: request2URL,
method: .POST,
loggedInRequest: true)
let categories = try app.getResponse(to: "\(acronymsURI)\(acronym.id!)/categories", decodeTo: [App.Category].self)
XCTAssertEqual(categories.count, 2)
XCTAssertEqual(categories[0].id, category.id)
XCTAssertEqual(categories[0].name, category.name)
XCTAssertEqual(categories[1].id, category2.id)
XCTAssertEqual(categories[1].name, category2.name)
let request3URL =
"\(acronymsURI)\(acronym.id!)/categories/\(category.id!)"
_ = try app.sendRequest(
to: request3URL,
method: .DELETE,
loggedInRequest: true)
let newCategories = try app.getResponse(to: "\(acronymsURI)\(acronym.id!)/categories", decodeTo: [App.Category].self)
XCTAssertEqual(newCategories.count, 1)
}
static let allTests = [
("testAcronymsCanBeRetrievedFromAPI", testAcronymsCanBeRetrievedFromAPI),
("testAcronymCanBeSavedWithAPI", testAcronymCanBeSavedWithAPI),
("testGettingASingleAcronymFromTheAPI", testGettingASingleAcronymFromTheAPI),
("testUpdatingAnAcronym", testUpdatingAnAcronym),
("testDeletingAnAcronym", testDeletingAnAcronym),
("testSearchAcronymShort", testSearchAcronymShort),
("testSearchAcronymLong", testSearchAcronymLong),
("testGetFirstAcronym", testGetFirstAcronym),
("testSortingAcronyms", testSortingAcronyms),
("testGettingAnAcronymsUser", testGettingAnAcronymsUser),
("testAcronymsCategories", testAcronymsCategories),
]
}
|
[
-1
] |
8124f6ba65c2a7d6677560ac467fd05ce4f234be
|
9aa6ed7cc74b74ef271562d2de46465b1019c38f
|
/Sources/PrintableObject/PrintableObject.swift
|
3a71762ab7e7afc71ab8dd3e44f9f712cc5221b3
|
[] |
no_license
|
Darkkrye/PrintableObject
|
1b32e0eef1dbfc698e46a9f297208aaab4a9bb22
|
2bdc0fbbc0a2a5027b189fb1cef20602225c0aa1
|
refs/heads/master
| 2021-06-20T00:05:30.181492 | 2021-02-25T18:46:00 | 2021-02-25T18:46:00 | 191,029,868 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 179 |
swift
|
//
// PrintableObjectExtension
//
//
// Created by Pierre on 09/06/2019.
//
import Foundation
public protocol PrintableObject {
func fullPrint()
func partialPrint()
}
|
[
-1
] |
31634319471f61cf2f572645764c69936dba775b
|
cbce8e63b8eaff25c1ae38a2f025b061f24a172d
|
/src/ios/ios/Controllers/TotalStaticRootTVC.swift
|
a127a8fd8db1fc19b506669639400bfaf3522a58
|
[] |
no_license
|
sd-s/Statistics
|
f80daaebe9852e7ccf459d90fc431faabf939eec
|
2ceca0fdad85141b18cbdc456264a593c6309b2c
|
refs/heads/master
| 2020-12-03T02:17:09.739633 | 2017-06-30T19:31:16 | 2017-06-30T19:31:16 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,697 |
swift
|
//
// TotalStaticRootTVC.swift
// ios
//
// Created by Dmytro Shcherbachenko on 25.06.17.
// Copyright © 2017 GB. All rights reserved.
//
import UIKit
class TotalStaticRootTVC: UITableViewController, DataManagerProtocol {
var dm = DataManager.initWithNetworkManager()
var data = SiteDataArray()
func didCompliteRequestOnRange(data: SiteDataArray, dateBegin: Date, dateEnd: Date) {
}
func didCompliteRequestTotal(data: SiteDataArray){
self.data = data
tableView.reloadData()
}
override func viewDidLoad() {
super.viewDidLoad()
dm.delegat = self
dm.getTotalData()
}
override func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return data.sites.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "TotalStaticCell", for: indexPath) as! TotalStaticRootTVCell
cell.nameLabel.text = data.sites[indexPath.row].name
cell.countLabel.text = String(data.sites[indexPath.row].count)
return cell
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "statDV" {
let destenationVC = segue.destination as! TotalSiteStaticTVC
if let selectedItem = tableView.indexPathForSelectedRow{
destenationVC.siteDataArray = data.filterBySite(siteName: data.sites[selectedItem.row].name)
}
}
}
}
|
[
-1
] |
94eeefb0d03767e0aa235d62b7c16789592cdaab
|
7b210a6494b8912aeaa4157094dc7ecbdf13dd17
|
/PokeFinder/PokeFinder/PokeAnnotation.swift
|
13aaca2a7a18b86a3e4e5b93989959c10d391276
|
[] |
no_license
|
bromodachi/OtherSwiftSimpleApps
|
7806fd97db21edc2dc13f4698ce67b4f435cb080
|
ac6b78f34c56ebe4fde2c1f3f4ba84b070615f51
|
refs/heads/master
| 2020-12-24T12:30:20.328519 | 2016-11-16T13:56:53 | 2016-11-16T13:56:53 | 72,990,045 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 2,967 |
swift
|
//
// PokeAnnotation.swift
// PokeFinder
//
// Created by c.uraga on 2016/10/02.
// Copyright © 2016年 c.uraga. All rights reserved.
//
import Foundation
import MapKit
let pokemon = [
"bulbasaur",
"ivysaur",
"venusaur",
"charmander",
"charmeleon",
"charizard",
"squirtle",
"wartortle",
"blastoise",
"caterpie",
"metapod",
"butterfree",
"weedle",
"kakuna",
"beedrill",
"pidgey",
"pidgeotto",
"pidgeot",
"rattata",
"raticate",
"spearow",
"fearow",
"ekans",
"arbok",
"pikachu",
"raichu",
"sandshrew",
"sandslash",
"nidoran-f",
"nidorina",
"nidoqueen",
"nidoran-m",
"nidorino",
"nidoking",
"clefairy",
"clefable",
"vulpix",
"ninetales",
"jigglypuff",
"wigglytuff",
"zubat",
"golbat",
"oddish",
"gloom",
"vileplume",
"paras",
"parasect",
"venonat",
"venomoth",
"diglett",
"dugtrio",
"meowth",
"persian",
"psyduck",
"golduck",
"mankey",
"primeape",
"growlithe",
"arcanine",
"poliwag",
"poliwhirl",
"poliwrath",
"abra",
"kadabra",
"alakazam",
"machop",
"machoke",
"machamp",
"bellsprout",
"weepinbell",
"victreebel",
"tentacool",
"tentacruel",
"geodude",
"graveler",
"golem",
"ponyta",
"rapidash",
"slowpoke",
"slowbro",
"magnemite",
"magneton",
"farfetchd",
"doduo",
"dodrio",
"seel",
"dewgong",
"grimer",
"muk",
"shellder",
"cloyster",
"gastly",
"haunter",
"gengar",
"onix",
"drowzee",
"hypno",
"krabby",
"kingler",
"voltorb",
"electrode",
"exeggcute",
"exeggutor",
"cubone",
"marowak",
"hitmonlee",
"hitmonchan",
"lickitung",
"koffing",
"weezing",
"rhyhorn",
"rhydon",
"chansey",
"tangela",
"kangaskhan",
"horsea",
"seadra",
"goldeen",
"seaking",
"staryu",
"starmie",
"mr-mime",
"scyther",
"jynx",
"electabuzz",
"magmar",
"pinsir",
"tauros",
"magikarp",
"gyarados",
"lapras",
"ditto",
"eevee",
"vaporeon",
"jolteon",
"flareon",
"porygon",
"omanyte",
"omastar",
"kabuto",
"kabutops",
"aerodactyl",
"snorlax",
"articuno",
"zapdos",
"moltres",
"dratini",
"dragonair",
"dragonite",
"mewtwo",
"mew"]
class PokeAnnotation: NSObject, MKAnnotation {
var coordinate = CLLocationCoordinate2D()
var pokemonNumber:Int
var pokemonName: String
var title: String?
init(coordinate: CLLocationCoordinate2D, pokemonNumber: Int) {
self.coordinate = coordinate
self.pokemonNumber = pokemonNumber
self.pokemonName = pokemon[pokemonNumber - 1].capitalized
self.title = self.pokemonName
}
}
|
[
286168,
286779
] |
f702f0a9fb2f6c3f9e142ecf27f73a91d3eea6a9
|
c8997dfc154c1f2eec894bb3fad7036fce59e9a2
|
/IKEAFinder_V9/IKEAFinder/IKEADataStore.swift
|
3bf4508fb76b7a539c146cf2b8cfd8efd771fa8b
|
[] |
no_license
|
dwillis-iu/cit-411-master
|
ab6357d42e60bc81fb5236c1b715a96aa4a7295c
|
02e5d381957f541b20fdfe0ed5bf5ce647c134b7
|
refs/heads/main
| 2023-05-05T20:59:04.680658 | 2021-05-29T04:49:01 | 2021-05-29T04:49:01 | 371,882,068 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 17,779 |
swift
|
//
// IKEADataStore.swift
// IKEAFinder
//
// Created by Willis, David James on 9/26/18.
// Copyright © 2018 Willis, David James. All rights reserved.
//
import Foundation
import UIKit
//final means it can never be inherited from - end of the line
final class IKEADataStore {
static let sharedInstance = IKEADataStore()
var allIKEAs = [IKEA]()
init() {
let aalborg = IKEA(storeName: "Aalborg",
storeNumber: 5,
storeImage: "Aalborg",
address: "Krebsen 40",
city: "Åalborg",
zipCode: "9200",
country: "Denmark",
telephone: "4572299300",
size: 31861,
roomSettings: 52,
realLifeHomes: 3,
cashLanes: 28,
restaurantSeating: 361,
smaland: true,
webpage: "http://www.ikea.com/dk/da/store/aalborg",
latitude: 56.99516952,
longitude: 9.8662433)
let aarhus = IKEA(storeName: "Aarhus",
storeNumber: 298,
storeImage: "Aarhus",
address: "Graham Bells Vej 9-11",
city: "Aarhus",
zipCode: "8200",
country: "Denmark",
telephone: "4541214488",
size: 0,
roomSettings: 0,
realLifeHomes: 0,
cashLanes: 0,
restaurantSeating: 0,
smaland: true,
webpage: "http://www.ikea.com/dk/da/store/aarhus",
latitude: 56.203934,
longitude: 10.181035)
let abudhabi = IKEA(storeName: "Abu Dhabi",
storeNumber: 55,
storeImage: "Abu Dhabi",
address: "Dubai Festival City",
city: "Dubai",
zipCode: "50618",
country: "United Arab Emirates",
telephone: "97126812228",
size: 24176,
roomSettings: 53,
realLifeHomes: 3,
cashLanes: 22,
restaurantSeating: 822,
smaland: true,
webpage: "http://www.ikea.com/ae/en/store/abu_dhabi",
latitude: 24.292597,
longitude: 54.364765)
let adelaide = IKEA(storeName: "Adelaide",
storeNumber: 192,
storeImage: "Adelaide",
address: "Sir Donald Bradman Drive 397",
city: "Adelaide",
zipCode: "5950",
country: "Australia",
telephone: "61881544532",
size: 23500,
roomSettings: 51,
realLifeHomes: 3,
cashLanes: 0,
restaurantSeating: 0,
smaland: true,
webpage: "http://www.ikea.com/aa/en/store/adelaide",
latitude: -34.9343127,
longitude: 138.5384295)
let adygea = IKEA(storeName: "Adygea (Adygea-Kuban)",
storeNumber: 480,
storeImage: "Adygea (Adygea-Kuban)",
address: "Takhtamukaiskiy Region",
city: "Adigeya",
zipCode: "385112",
country: "Russia",
telephone: "",
size: 26650,
roomSettings: 59,
realLifeHomes: 2,
cashLanes: 20,
restaurantSeating: 620,
smaland: true,
webpage: "http://www.ikea.com/ru/ru/",
latitude: 45.010937,
longitude: 38.926809)
let almhult = IKEA(storeName: "Älmhult",
storeNumber: 268,
storeImage: "Älmhult",
address: "Handelsvägen 4",
city: "Älmhult",
zipCode: "34333",
country: "Sweden",
telephone: "4647681600",
size: 25391,
roomSettings: 28,
realLifeHomes: 2,
cashLanes: 12,
restaurantSeating: 550,
smaland: true,
webpage: "http://www.ikea.com/se/sv/store/almhult",
latitude: 56.5524461,
longitude: 14.1374047)
let amersfoort = IKEA(storeName: "Amersfoort",
storeNumber: 415,
storeImage: "Amersfoort",
address: "Euroweg 101",
city: "Amersfoort",
zipCode: "3825HB",
country: "Netherlands",
telephone: "31334543546",
size: 30967,
roomSettings: 72,
realLifeHomes: 3,
cashLanes: 29,
restaurantSeating: 541,
smaland: true,
webpage: "http://www.ikea.com/nl/nl/store/amersfoort",
latitude: 52.187064,
longitude: 5.415384)
let amman = IKEA(storeName: "Amman",
storeNumber: 237,
storeImage: "Amman",
address: "Airport Road - Madaba Bridge",
city: "Amman",
zipCode: "11821",
country: "Jordan",
telephone: "96265508030",
size: 35250,
roomSettings: 0,
realLifeHomes: 0,
cashLanes: 14,
restaurantSeating: 470,
smaland: true,
webpage: "",
latitude: 31.826244,
longitude: 35.901653)
let amsterdam = IKEA(storeName: "Amsterdam",
storeNumber: 88,
storeImage: "Amsterdam",
address: "Hullenbergweg 2",
city: "Amsterdam",
zipCode: "1101 BL",
country: "Netherlands",
telephone: "31205648888",
size: 32709,
roomSettings: 72,
realLifeHomes: 3,
cashLanes: 37,
restaurantSeating: 612,
smaland: true,
webpage: "http://www.ikea.com/nl/nl/store/amsterdam",
latitude: 52.3025445,
longitude: 4.949478)
let ancona = IKEA(storeName: "Ancona (Camerano)",
storeNumber: 457,
storeImage: "Ancona (Camerano)",
address: "Via Terme Dell'aspio Ex Farfisa",
city: "Camerano",
zipCode: "60021",
country: "Italy",
telephone: "",
size: 24083,
roomSettings: 54,
realLifeHomes: 3,
cashLanes: 28,
restaurantSeating: 424,
smaland: true,
webpage: "",
latitude: 43.5298062,
longitude: 13.5195018)
let ankara = IKEA(storeName: "Ankara",
storeNumber: 127,
storeImage: "Ankara",
address: "IKEA Anatolium ADA Parcel",
city: "Ankara",
zipCode: "39658",
country: "Turkey",
telephone: "+90 216 5280555/2017",
size: 39167,
roomSettings: 50,
realLifeHomes: 3,
cashLanes: 25,
restaurantSeating: 700,
smaland: true,
webpage: "http://www.ikea.com.tr/Magaza/Genel/5.aspx",
latitude: 39.888453,
longitude: 32.932642)
let antwerp = IKEA(storeName: "Antwerp (Wilrijk)",
storeNumber: 179,
storeImage: "Antwerp (Wilrijk)",
address: "",
city: "",
zipCode: "",
country: "Belgium",
telephone: "",
size: 32194,
roomSettings: 53,
realLifeHomes: 3,
cashLanes: 40,
restaurantSeating: 670,
smaland: true,
webpage: "",
latitude: 51.157466,
longitude: 4.385166)
let arlon = IKEA(storeName: "Arlon (Sterpenich)",
storeNumber: 483,
storeImage: "Arlon (Sterpenich)",
address: "Rue De Grasse 100",
city: "Arlon",
zipCode: "6700",
country: "Belgium",
telephone: "3263214811",
size: 25429,
roomSettings: 46,
realLifeHomes: 3,
cashLanes: 28,
restaurantSeating: 460,
smaland: true,
webpage: "http://www.ikea.com/be/nl/store/arlon",
latitude: 49.637277,
longitude: 5.890919)
let asturias = IKEA(storeName: "Asturias",
storeNumber: 428,
storeImage: "Asturias",
address: "Parque Principado Concejo De Siero",
city: "Pola De Siero",
zipCode: "33510",
country: "Spain",
telephone: "34985989725",
size: 26147,
roomSettings: 42,
realLifeHomes: 3,
cashLanes: 21,
restaurantSeating: 375,
smaland: true,
webpage: "http://www.ikea.com/es/es/store/asturias",
latitude: 43.3878841,
longitude: -5.8057548)
let athens = IKEA(storeName: "Athens (Airport)",
storeNumber: 364,
storeImage: "Athens (Airport)",
address: "Bldg 501 Athens International Airport Commercial Park",
city: "Athens",
zipCode: "19019",
country: "Greece",
telephone: "302103543411",
size: 26195,
roomSettings: 46,
realLifeHomes: 3,
cashLanes: 22,
restaurantSeating: 478,
smaland: true,
webpage: "http://www.ikea.gr/default.aspx?page=home",
latitude: 37.9250333,
longitude: 23.9316834)
let athens2 = IKEA(storeName: "Athens (Kifisou)",
storeNumber: 365,
storeImage: "Athens (Kifisou)",
address: "Kifisou Avenue 96",
city: "Aigaleo",
zipCode: "12241",
country: "Greece",
telephone: "302105400430",
size: 25040,
roomSettings: 52,
realLifeHomes: 3,
cashLanes: 23,
restaurantSeating: 426,
smaland: true,
webpage: "",
latitude: 37.9815857,
longitude: 23.6793935)
let atlanta = IKEA(storeName: "Atlanta (Midtown)",
storeNumber: 257,
storeImage: "Atlanta (Midtown)",
address: "16th Street 441",
city: "Atlanta",
zipCode: "30363",
country: "USA",
telephone: "",
size: 31600,
roomSettings: 45,
realLifeHomes: 3,
cashLanes: 25,
restaurantSeating: 398,
smaland: true,
webpage: "http://www.ikea.com/us/en/store/atlanta",
latitude: 33.7886038,
longitude: -84.4050641)
let augsburg = IKEA(storeName: "Augsburg",
storeNumber: 66,
storeImage: "Augsburg",
address: "Otto Hanh Strasse 99",
city: "Gersthofen",
zipCode: "86368",
country: "Germany",
telephone: "",
size: 29525,
roomSettings: 52,
realLifeHomes: 3,
cashLanes: 30,
restaurantSeating: 452,
smaland: true,
webpage: "http://www.ikea.com/de/de/store/augsburg",
latitude: 48.403923,
longitude: 10.871747)
let austin = IKEA(storeName: "Austin (Round Rock)",
storeNumber: 27,
storeImage: "Austin (Round Rock)",
address: "Ikea Way 1",
city: "Round Rock",
zipCode: "78664",
country: "USA",
telephone: "15123108027",
size: 28292,
roomSettings: 40,
realLifeHomes: 3,
cashLanes: 20,
restaurantSeating: 250,
smaland: true,
webpage: "http://www.ikea.com/us/en/store/round_rock",
latitude: 30.5572378,
longitude: -97.6900849)
let avignon = IKEA(storeName: "Avignon (Vedène)",
storeNumber: 18,
storeImage: "Avignon (Vedène)",
address: "100 Chemin Du Pont Blanc",
city: "Vedene",
zipCode: "84270",
country: "France",
telephone: "33490338116",
size: 27004,
roomSettings: 52,
realLifeHomes: 3,
cashLanes: 28,
restaurantSeating: 528,
smaland: true,
webpage: "http://www.ikea.com/fr/fr/store/avignon",
latitude: 43.9789766,
longitude: 4.8895785)
allIKEAs += [aalborg, aarhus, abudhabi, adelaide, adygea, almhult, amersfoort, amman, amsterdam, ancona, ankara, antwerp, arlon, asturias, athens, athens2, atlanta, augsburg, austin, avignon]
print(allIKEAs.count)
}
}
|
[
-1
] |
96418adfaeeabb8c671ea7a0c870cb149803828b
|
82136c46b4d339e023eb995478526426fc626471
|
/software/app/Pods/TeslaSwift/Sources/VehicleState.swift
|
8ff8c739de380d0f9803c30b379746ded7997934
|
[
"MIT"
] |
permissive
|
MiniCodeMonkey/tesla-key
|
da35498016f57b52e82f7a35d363833def510713
|
1ad166107e83217c4775a61bcef735b47e555b7c
|
refs/heads/master
| 2021-01-12T15:40:20.750502 | 2016-12-10T22:20:27 | 2016-12-10T22:20:27 | 71,844,880 | 1 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,496 |
swift
|
//
// VehicleState.swift
// TeslaSwift
//
// Created by Joao Nunes on 20/03/16.
// Copyright © 2016 Joao Nunes. All rights reserved.
//
import Foundation
import ObjectMapper
open class VehicleState: Mappable {
open var driverDoorOpen: Bool?
open var driverRearDoorOpen: Bool?
open var passengerDoorOpen: Bool?
open var passengerRearDoorOpen: Bool?
open var frontTrunkOpen: Bool?
open var rearTrunkOpen: Bool?
open var firmwareVersion: String?
open var locked: Bool?
open var sunRoofInstalled: Bool?
open var sunRoofState: String?
open var sunRoofPercentageOpen: Int? // null if not installed
open var darkRims: Bool?
open var wheelType: String?
open var hasSpoiler: Bool?
open var roofColor: String? // "None" for panoramic roof
open var perfConfig: String?
// MARK: Mappable protocol
required public init?(map: Map) {
}
open func mapping(map: Map) {
driverDoorOpen <- map["df"]
driverRearDoorOpen <- map["dr"]
passengerDoorOpen <- map["pf"]
passengerRearDoorOpen <- map["pr"]
frontTrunkOpen <- map["ft"]
rearTrunkOpen <- map["rt"]
firmwareVersion <- map["car_version"]
locked <- map["locked"]
sunRoofInstalled <- map["sun_roof_installed"]
sunRoofState <- map["sun_roof_state"]
sunRoofPercentageOpen <- map["sun_roof_percent_open"]
darkRims <- map["dark_rims"]
wheelType <- map["wheel_type"]
hasSpoiler <- map["has_spoiler"]
roofColor <- map["roof_color"]
perfConfig <- map["perf_config"]
}
}
|
[
-1
] |
6e20f92c1cdbd23123fbb751ff5322b37383ff7e
|
083ee575a69739df4ab2e34e7bda59333be4d18a
|
/Flo/Flo/CounterView.swift
|
a32536795221b01983465faf4f95a2af7ec6d964
|
[] |
no_license
|
JaeRyu/iOS
|
e3990a2628699578359eb716692690027a3c50dd
|
9c396cddac1f964b3c07fab5b91a2b0a36e8bcea
|
refs/heads/master
| 2021-01-25T01:04:45.190417 | 2017-06-19T01:42:22 | 2017-06-19T01:42:22 | 94,724,996 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,975 |
swift
|
//
// CounterView.swift
// Flo
//
// Created by kpugame on 2017. 5. 31..
// Copyright © 2017년 Jae Won Yoo. All rights reserved.
//
import UIKit
let NoOfGlasses = 8
let Pi:CGFloat = CGFloat(M_PI)
@IBDesignable
class CounterView: UIView {
@IBInspectable var counter: Int = 5{
didSet{
if counter <= NoOfGlasses{
setNeedsDisplay()
}
}
}
@IBInspectable var outlineColor : UIColor = UIColor.blue
@IBInspectable var counterColor: UIColor = UIColor.orange
// Only override draw() if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
override func draw(_ rect: CGRect) {
let center = CGPoint(x: bounds.width/2 , y: bounds.height/2)
let radius: CGFloat = max(bounds.width, bounds.height)
let arcWidth: CGFloat = 76
let startAngle: CGFloat = 3 * Pi / 4
let endAngle: CGFloat = Pi / 4
var path = UIBezierPath(arcCenter: center, radius: radius/2 - arcWidth/2, startAngle: startAngle, endAngle: endAngle, clockwise: true)
path.lineWidth = arcWidth
counterColor.setStroke()
path.stroke()
let angleDifference: CGFloat = 2 * Pi - startAngle + endAngle
let arcLengthPerGlass = angleDifference / CGFloat(NoOfGlasses)
let outlineEndAngle = arcLengthPerGlass * CGFloat(counter) + startAngle
var outlinePath = UIBezierPath(arcCenter: center, radius: bounds.width/2 - 2.5, startAngle: startAngle, endAngle: outlineEndAngle, clockwise: true)
outlinePath.addArc(withCenter: center, radius: bounds.width/2 - arcWidth + 2.5, startAngle: outlineEndAngle, endAngle: startAngle, clockwise: false)
outlinePath.close()
outlineColor.setStroke()
outlinePath.lineWidth = 5.0
outlinePath.stroke()
}
}
|
[
-1
] |
1fcc0c4cff21b9aa9e17546f94010f742e8ad7c1
|
369012ef453051b5937e7b7733bc2305ee24deac
|
/StructuresAndAlgorithms/QuickSort.swift
|
80d02b93dc7c14befe6c99b5c1613d4679aa3d06
|
[] |
no_license
|
neddoz/StructuresAndAlgorithms
|
ea3df6229c28552f3cd2850dbc3c69f603b2762d
|
e74bf177555f1ce4c3cb9c0cc8adcab57270acb6
|
refs/heads/master
| 2021-06-22T13:00:13.672391 | 2021-01-01T14:53:57 | 2021-01-01T14:54:54 | 175,190,944 | 0 | 0 | null | 2019-09-16T03:57:27 | 2019-03-12T10:49:56 |
Swift
|
UTF-8
|
Swift
| false | false | 581 |
swift
|
//
// QuickSort.swift
// StructuresAndAlgorithms
//
// Created by kayeli dennis on 28/11/2018.
// Copyright © 2018 kayeli dennis. All rights reserved.
//
import Foundation
extension Array {
func quickSort<Element: Comparable>(_ array: [Element])-> [Element] {
guard array.count > 1 else {return array}
let pivot = array[array.count/2]
let less = array.filter { $0 < pivot }
let equal = array.filter { $0 == pivot }
let greater = array.filter { $0 > pivot }
return quickSort(less) + equal + quickSort(greater)
}
}
|
[
-1
] |
d178e4e6e78b81763c24eda852505acaea71913a
|
07fd1c7646449264672947cf811f68a2735d2051
|
/Tests/CiNiiKitTests/CiNiiKitTests.swift
|
7b6507b85b4d78f9b4b4043552a68e02aef7cc4d
|
[
"MIT"
] |
permissive
|
YutoMizutani/CiNiiKit
|
b2ce22ff1de4a7eb8f68addd089f673ea01547d2
|
44e67570bb8ce7cf4a6e085232fa38f62c8e2b55
|
refs/heads/master
| 2020-03-27T08:56:04.564766 | 2018-10-07T07:42:11 | 2018-10-07T07:42:11 | 146,299,249 | 1 | 0 |
MIT
| 2018-10-07T07:42:12 | 2018-08-27T13:11:22 |
Swift
|
UTF-8
|
Swift
| false | false | 530 |
swift
|
import XCTest
@testable import CiNiiKit
final class CiNiiKitTests: XCTestCase {
var cinii: CiNiiKit!
var helper: TestHelper!
var decoder: JSONDecoder!
override func setUp() {
super.setUp()
self.cinii = CiNiiKit.shared
self.helper = TestHelper.shared
self.decoder = JSONDecoder()
}
static var allTests = [
("testDecodeArticle", testDecodeArticle),
("testDecodeBooks", testDecodeBooks),
("testDecodeDissertations", testDecodeDissertations)
]
}
|
[
-1
] |
8b07431631f8e01a9f81c7667c449f164733d83b
|
688382dfaf14672637b1ad868a2f2152ce364ec6
|
/to-do-list/to-do-list/AppDelegate.swift
|
3041e82b1a6608bbdc4d24cfc329bcbac8f4f631
|
[] |
no_license
|
iciwim3/ToDoList
|
41b0371356c6e502beae073b7696d501acbc6aaa
|
1ae45616e028d02685b4227c3f02b72afecf586a
|
refs/heads/master
| 2021-09-01T22:14:15.951861 | 2017-12-24T15:25:07 | 2017-12-24T15:25:07 | 115,270,103 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 2,184 |
swift
|
//
// AppDelegate.swift
// to-do-list
//
// Created by Sain-R Edwards Jr. on 12/24/17.
// Copyright © 2017 Appybuildmore. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
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.
}
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.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
|
[
229380,
229383,
229385,
278539,
294924,
229388,
278542,
229391,
327695,
229394,
278548,
229397,
229399,
229402,
352284,
229405,
278556,
278559,
229408,
294950,
229415,
229417,
327722,
237613,
229422,
229426,
237618,
229428,
311349,
286774,
286776,
319544,
286778,
229432,
204856,
352318,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
237693,
303230,
327814,
303241,
131209,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
286916,
295110,
286922,
286924,
286926,
319694,
286928,
131281,
131278,
278743,
278747,
295133,
131299,
319716,
237807,
303345,
286962,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
311601,
295220,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
278983,
319945,
278986,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
172534,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
172552,
320007,
287238,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
311850,
279082,
279084,
172591,
172598,
172607,
172609,
172612,
377413,
172614,
172618,
303690,
33357,
303696,
279124,
172634,
262752,
254563,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
295538,
189040,
172660,
287349,
189044,
189039,
287355,
287360,
295553,
172675,
295557,
287365,
311942,
303751,
352905,
311946,
287371,
279178,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
287390,
303773,
172705,
287394,
172707,
303780,
164509,
287398,
205479,
287400,
279208,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
328381,
287423,
328384,
172737,
279231,
287427,
312005,
312006,
107208,
172748,
287436,
172751,
287440,
295633,
172755,
303827,
279255,
287450,
303835,
279258,
189149,
303838,
213724,
312035,
279267,
295654,
279272,
230128,
312048,
312050,
230131,
189169,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
303976,
336744,
303985,
303987,
328563,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
304007,
304009,
213895,
304011,
304013,
295822,
189325,
213902,
189329,
295825,
304019,
279438,
58262,
304023,
304027,
279452,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
230334,
304063,
238528,
304065,
213954,
189378,
156612,
197580,
312272,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
295945,
230413,
197645,
295949,
320528,
140312,
295961,
238620,
304164,
304170,
304175,
238641,
238652,
238655,
230465,
238658,
336964,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
296044,
164973,
205934,
312432,
337018,
189562,
279679,
304258,
279683,
66690,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
238766,
165038,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
304348,
304354,
296163,
320740,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
230679,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
230718,
296259,
296262,
230727,
238919,
296264,
320840,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
148843,
410987,
230763,
230768,
296305,
312692,
230773,
304505,
304506,
181626,
279929,
181631,
148865,
312711,
296331,
288140,
288144,
230800,
337306,
288154,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
279991,
288185,
337335,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
148946,
370130,
222676,
288210,
288212,
288214,
280021,
329177,
288217,
288218,
280027,
288220,
239070,
239064,
288224,
370146,
280034,
288226,
288229,
280036,
280038,
288232,
288230,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
148990,
296450,
206336,
230916,
230919,
230923,
304651,
304653,
370187,
402969,
230940,
222752,
108066,
296486,
296488,
157229,
239152,
230961,
157236,
288320,
288325,
124489,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
239202,
370279,
312938,
280183,
280191,
116354,
280194,
280208,
280211,
288408,
280222,
419489,
190118,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
419522,
280260,
419525,
206536,
280264,
206539,
206541,
206543,
263888,
313044,
280276,
321239,
280283,
313052,
288478,
313055,
419555,
321252,
313066,
288494,
280302,
321266,
288499,
419570,
288502,
280314,
288510,
124671,
280324,
198405,
288519,
280331,
198416,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
337732,
280388,
304968,
280402,
173907,
313171,
313176,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
354265,
354270,
239586,
313320,
354281,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
280681,
313451,
223341,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
288895,
321670,
215175,
141455,
275606,
280725,
313498,
100520,
280747,
288940,
288947,
280755,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
280811,
280817,
125171,
280819,
157940,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
305464,
280888,
280891,
289087,
108865,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
280919,
248153,
215387,
354653,
354656,
313700,
280937,
313705,
190832,
280946,
223606,
313720,
280956,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
240021,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
289227,
436684,
281047,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
240132,
330244,
223752,
150025,
338440,
281095,
223757,
281102,
223763,
223765,
322074,
281116,
182819,
289317,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
338528,
338532,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
264845,
182926,
133776,
182929,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
314045,
314047,
314051,
199364,
297671,
158409,
256716,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
174955,
224110,
207733,
207737,
158596,
183172,
338823,
322440,
314249,
183184,
142226,
289687,
224151,
240535,
289694,
289696,
289700,
289712,
281529,
289724,
183260,
420829,
289762,
322534,
297961,
183277,
322550,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
216376,
380226,
298306,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
298365,
290174,
306555,
224641,
281987,
298372,
314756,
281990,
224647,
298377,
314763,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
290305,
306694,
192008,
323084,
257550,
282127,
290321,
282130,
290325,
282133,
241175,
290328,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
282186,
224849,
282195,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282255,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
196133,
282295,
323260,
282300,
323266,
282310,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
118593,
307009,
413506,
307012,
241475,
315211,
307027,
315221,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
315253,
315255,
339838,
315267,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
44948,
298901,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
241581,
241583,
323504,
241586,
290739,
241588,
282547,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
299003,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
307211,
282639,
290835,
282645,
241693,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
307287,
307290,
217179,
315482,
192605,
315483,
233567,
299105,
200801,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
307338,
233613,
241813,
307352,
299164,
241821,
299167,
315552,
184479,
184481,
184486,
307370,
307372,
307374,
307376,
299185,
323763,
184503,
299191,
307385,
176311,
258235,
307388,
176316,
307390,
299200,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
299225,
233701,
307432,
282881,
184586,
282893,
291089,
282906,
291104,
233766,
299304,
295583,
307508,
315701,
332086,
307510,
307512,
307515,
307518,
282942,
282947,
323917,
282957,
233808,
323921,
315733,
323926,
233815,
315739,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
291226,
242075,
283033,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
291254,
283062,
127417,
291260,
127421,
127424,
299457,
127429,
127431,
127434,
315856,
127440,
176592,
315860,
176597,
127447,
283095,
299481,
127449,
176605,
242143,
127455,
127457,
291299,
127460,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
127490,
127494,
283142,
127497,
233994,
135689,
127500,
233998,
127506,
234003,
127509,
234006,
127511,
152087,
283161,
242202,
135707,
234010,
135710,
242206,
242208,
291361,
242220,
291378,
234038,
152118,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
299706,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
299740,
201444,
299750,
283368,
234219,
283372,
185074,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
234246,
226056,
291593,
234248,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
292433,
316233,
234313,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
242530,
349027,
234338,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
291711,
234368,
291714,
234370,
291716,
234373,
226182,
234375,
201603,
226185,
308105,
234379,
324490,
234384,
234390,
226200,
234393,
209818,
308123,
234396,
324504,
291742,
324508,
234398,
234401,
291747,
291748,
234405,
291750,
324518,
324520,
234407,
324522,
234410,
291756,
291754,
226220,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
324536,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
226239,
226245,
234437,
234439,
234443,
291788,
193486,
234446,
193488,
234449,
275406,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
324599,
234490,
234493,
316416,
234496,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
234546,
275508,
300085,
234549,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
234585,
275545,
242777,
234590,
234593,
234595,
234597,
300133,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
324757,
234647,
234648,
226453,
234650,
308379,
275608,
300189,
324766,
119967,
234653,
324768,
283805,
234657,
242852,
300197,
234661,
283813,
234664,
177318,
275626,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
283844,
300234,
283850,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
349451,
177424,
275725,
283917,
349464,
415009,
283939,
259367,
292143,
283951,
300344,
243003,
283963,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
292192,
316768,
218464,
292197,
316774,
218473,
136562,
324978,
333178,
275834,
275840,
316803,
316806,
316811,
316814,
226703,
300433,
234899,
300436,
226709,
357783,
316824,
316826,
300448,
144807,
144810,
144812,
284076,
144814,
227426,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
316917,
292343,
308727,
300537,
316933,
316947,
308757,
308762,
284191,
316959,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
292414,
284223,
284226,
284228,
292421,
243268,
284231,
226886,
128584,
284234,
276043,
317004,
366155,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
276052,
284247,
276053,
235097,
243290,
284249,
284251,
317015,
300638,
284253,
284255,
284258,
292452,
292454,
284263,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
292479,
284288,
292481,
284290,
325250,
284292,
292485,
325251,
276095,
276098,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
284354,
358083,
284358,
276166,
358089,
284362,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
284379,
284381,
284384,
358114,
284386,
358116,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
284399,
358128,
276206,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
366406,
276295,
292681,
153417,
358224,
276308,
284502,
317271,
276315,
292700,
317279,
284511,
292715,
300912,
292721,
284529,
300915,
292729,
317306,
284540,
292734,
325512,
317332,
358292,
399252,
284564,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
292776,
284585,
276395,
292784,
358326,
161718,
358330,
276411,
276418,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276448,
292839,
276455,
350186,
292843,
276460,
292845,
178161,
227314,
276466,
325624,
350200,
276472,
317435,
276476,
276479,
350210,
276482,
178181,
317446,
276485,
350218,
276490,
292876,
350222,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
178224,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
243779,
325700,
284739,
292934,
243785,
276553,
350293,
350295,
309337,
227418,
350299,
194649,
350302,
194654,
350304,
178273,
309346,
227423,
194660,
350308,
309350,
309348,
292968,
309352,
350313,
309354,
350316,
227430,
276583,
301167,
276590,
350321,
284786,
276595,
301163,
350325,
252022,
227440,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
153765,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
309450,
276685,
309455,
276689,
309462,
301272,
194780,
309468,
309471,
301283,
317672,
317674,
325867,
227571,
309491,
309494,
243960,
227583,
276735,
227587,
276739,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
235858,
276829,
276833,
391523,
276836,
293227,
293232,
276848,
186744,
211324,
227709,
285061,
366983,
317833,
178572,
285070,
285077,
227738,
317853,
276896,
317858,
342434,
317864,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
129486,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
293346,
227810,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
293387,
236043,
342541,
113167,
309779,
317971,
309781,
277011,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
23094,
277054,
219714,
129603,
301636,
318020,
301639,
301643,
285265,
399955,
309844,
277080,
309849,
285282,
326244,
318055,
277100,
309871,
121458,
170619,
309885,
309888,
277122,
277128,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
334488,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
293555,
342707,
154292,
277173,
318132,
277177,
277181,
318144,
277187,
277194,
277196,
277201,
342745,
137946,
342747,
342749,
113378,
228069,
277223,
342760,
285417,
56043,
56045,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
301884,
293696,
310080,
277317,
277322,
162643,
310100,
301911,
301913,
277337,
301921,
236397,
162671,
326514,
310134,
236408,
277368,
416639,
416640,
113538,
310147,
416648,
277385,
39817,
187274,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
293811,
276579,
293817,
293820,
203715,
342994,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
351217,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
244731,
285690,
293887,
277504,
277507,
277511,
293899,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
293956,
277573,
228422,
293960,
310344,
277577,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
285821,
392326,
285831,
253064,
294026,
302218,
285835,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
310486,
302296,
384222,
310498,
285927,
318698,
302315,
228592,
294132,
138485,
228601,
204026,
228606,
64768,
310531,
138505,
228617,
318742,
277798,
130345,
113964,
285997,
384302,
285999,
113969,
318773,
318776,
286010,
417086,
286016,
302403,
294211,
384328,
294221,
146765,
294223,
326991,
179547,
146784,
302436,
294246,
327015,
310632,
327017,
351594,
351607,
310648,
310651,
310657,
351619,
294276,
310659,
327046,
253320,
310665,
318858,
310672,
351633,
310689,
130468,
228776,
277932,
310703,
310710,
130486,
310712,
310715,
302526,
228799,
302534,
310727,
245191,
64966,
302541,
302543,
310737,
228825,
163290,
310749,
310755,
187880,
310764,
286188,
310772,
40440,
212472,
40443,
286203,
40448,
228864,
286214,
228871,
302603,
302614,
302617,
286233,
302621,
286240,
187936,
146977,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
245288,
310831,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286312,
40554,
286313,
310892,
40557,
40560,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
302764,
278188,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
286420,
278227,
229076,
286425,
319194,
278235,
229086,
278238,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
188252,
237409,
229233,
294776,
294785,
327554,
360322,
294803,
40851,
294811,
237470,
319390,
40865,
319394,
294817,
294821,
311209,
343983,
294831,
188340,
40886,
319419,
294844,
294847,
393177,
294876,
294879,
294883,
393190,
311279,
278513,
237555,
311283,
278519,
237562
] |
ffdd99ab3e60d278bf87f2bc495cc6dd35aacff9
|
e456023f87cfc8f085a8f631353f95184240d3d7
|
/GoJekContact/GoJekContact/Resources/ObservableExtention.swift
|
6599abf75eda1923f5ebb4ae71325e3e72bcae11
|
[] |
no_license
|
sachinpatra/GoJek
|
37508127653766dce108cd2e91ee091d26b7df37
|
9174fbe8717f3205584e4a9c56ea114a78a23483
|
refs/heads/master
| 2020-04-24T11:14:31.646701 | 2019-02-27T14:10:53 | 2019-02-27T14:10:53 | 171,918,924 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 907 |
swift
|
//
// ObservableExtention.swift
// GoJekContact
//
// Created by Sachin Kumar Patra on 2/22/19.
// Copyright © 2019 Sachin Kumar Patra. All rights reserved.
//
import RxSwift
import RxCocoa
extension ObservableType where E == Bool {
/// Boolean not operator
public func not() -> Observable<Bool> {
return self.map(!)
}
}
//extension SharedSequenceConvertibleType {
// func mapToVoid() -> SharedSequence<SharingStrategy, Void> {
// return map { _ in }
// }
//}
extension ObservableType {
func catchErrorJustComplete() -> Observable<E> {
return catchError { _ in
return Observable.empty()
}
}
func asDriverOnErrorJustComplete() -> Driver<E> {
return asDriver { error in
return Driver.empty()
}
}
func mapToVoid() -> Observable<Void> {
return map { _ in }
}
}
|
[
-1
] |
d8b049a0954b7aa0a3b9223a3192a0b184ea1d66
|
1980bf76d2ef4984ed805e131ca19a6a5e63d496
|
/Example/Koloda/KolodaCustom/CustomKolodaView.swift
|
73dd5b194122ec15b3aad848f42c4f96c67026ff
|
[
"MIT"
] |
permissive
|
hackath2on/iosApp
|
a053d0e9d2da91dfff9cbe4bb6fc152f8761e518
|
335f8149223621ead7c4681e96660581ca432f1a
|
refs/heads/master
| 2020-12-30T13:20:29.924125 | 2017-05-14T11:50:15 | 2017-05-14T11:50:15 | 91,202,419 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,304 |
swift
|
//
// CustomKolodaView.swift
// Koloda
//
// Created by Eugene Andreyev on 7/11/15.
// Copyright (c) 2015 CocoaPods. All rights reserved.
//
import UIKit
import Koloda
let defaultTopOffset: CGFloat = 20
let defaultHorizontalOffset: CGFloat = 10
let defaultHeightRatio: CGFloat = 1.25
let backgroundCardHorizontalMarginMultiplier: CGFloat = 0.25
let backgroundCardScalePercent: CGFloat = 0.1
class CustomKolodaView: KolodaView {
override func frameForCard(at index: Int) -> CGRect {
if index == 0 {
let topOffset: CGFloat = defaultTopOffset
let xOffset: CGFloat = defaultHorizontalOffset
let width = (self.frame).width - 2 * defaultHorizontalOffset
let height = width * defaultHeightRatio
let yOffset: CGFloat = topOffset
let frame = CGRect(x: xOffset, y: yOffset, width: width, height: height)
return frame
} else if index == 1 {
let horizontalMargin = -self.bounds.width * backgroundCardHorizontalMarginMultiplier
let width = self.bounds.width * backgroundCardScalePercent
let height = width * defaultHeightRatio
return CGRect(x: horizontalMargin, y: 0, width: width, height: height)
}
return CGRect.zero
}
}
|
[
-1
] |
f4cf221ba8fed0a6e84964d76c41a97b586936f9
|
697fd889fa5a10f977a78e3b8e534d803ababeb9
|
/XZStructDemo/Url/API+StockCommonInfo.swift
|
683c75b8bfe7a85a4c6a500a7ecd572f0d2d451f
|
[] |
no_license
|
CoderXAndZ/XZStructDemo
|
a22cf82beb5e616c187f10979356ad3f02b5bd39
|
33ad67950f70a4267007dd983217decaaae60437
|
refs/heads/master
| 2022-12-31T06:03:07.516996 | 2020-10-22T07:51:24 | 2020-10-22T07:51:24 | 303,706,117 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 714 |
swift
|
//
// API+StockCommonInfo.swift
// iClickKabu
//
// Created by Cho on 2020/09/30.
//
import Foundation
import RxSwift
extension API {
// 銘柄情報共通
final class StockCommonInfo: ApiTelegram {
var path: String { "iclickkabu/stockCommonInfo.do" }
var method: Method { .post }
var errorHandler: API.ErrorHandler? { .telegram }
struct Parameter: Encodable {
var skc: String // 証券コード
var sjt: String // 市場コード
}
static func excute(_ parameter: Parameter) -> Observable<API.Telegram> {
return observable(parameter: parameter)
}
}
}
|
[
-1
] |
6b57d56d19748bbfef942f97a2eb36d1ffb970ef
|
d503d785b9b3fb384449f78062f2cbe3d564974d
|
/AdyenUIHost/Configuration.swift
|
e387804b16a3ea0ca9fb4e828d26a1e15fe27a61
|
[
"MIT"
] |
permissive
|
rvandijke/adyen-ios
|
a47525c0b19a772cf409d9f73b5d97d8c641fa8e
|
0e8c64bcb148756c9a8c9c1236b0f3c5089288a1
|
refs/heads/master
| 2020-03-23T15:11:34.201511 | 2018-05-30T07:55:21 | 2018-05-30T07:55:21 | 141,729,344 | 0 | 0 |
MIT
| 2018-07-20T15:34:25 | 2018-07-20T15:34:24 | null |
UTF-8
|
Swift
| false | false | 740 |
swift
|
//
// Copyright (c) 2018 Adyen B.V.
//
// This file is open source and available under the MIT license. See the LICENSE file for more info.
//
import Foundation
// Fill in your app identifier and secret key here.
struct Configuration {
static var appSecretKey = ""
static var isFilledIn: Bool {
return appSecretKey.isEmpty == false
}
// Checks if SecretKey was defined in compile time via SECRET_KEY user defined build setting.
static func readApiKeyFromUserDefinedBuildSettings() {
if let apiKey = Bundle.init(for: AppDelegate.self).object(forInfoDictionaryKey: "SecretKey") as? String,
apiKey.isEmpty == false {
Configuration.appSecretKey = apiKey
}
}
}
|
[
-1
] |
54154bf86d8b537eb78048032de93a37de86ad3b
|
5ad2e9cc4f51172fbaf02230a12c68bcff00b7ad
|
/Sources/ObjcParser/NodeContext.swift
|
44d956cd8173bb1d82ade39061da3a894ea620ba
|
[
"LicenseRef-scancode-warranty-disclaimer",
"MIT",
"BSD-3-Clause",
"BSD-2-Clause"
] |
permissive
|
kinpowoo/SwiftRewriter
|
938d5c3b77c390734118cce76bfce0ee40d0fb6d
|
87bb08aabe16429ea70d631ed466a593b1a78880
|
refs/heads/master
| 2023-08-14T04:54:40.399209 | 2021-09-22T18:34:52 | 2021-09-22T18:35:38 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 2,307 |
swift
|
import GrammarModels
/// A class used to nest up hierarchic node creations
public class NodeCreationContext {
/// Current top-most node
public var topmostNode: ASTNode? {
_nodeStack.last
}
public var autoUpdatesSourceRange = true
private var _nodeStack: [ASTNode] = []
public var isInNonnullContext: Bool = false
/// Pushes a new node context
@discardableResult
public func pushContext<T: InitializableNode>(nodeType type: T.Type = T.self) -> T {
let node = T.init(isInNonnullContext: isInNonnullContext)
pushContext(node: node)
return node
}
/// Searches for a context node with a given node type.
/// Returns nil, if no nodes along the context stack are of type `T`.
///
/// Searchs from most recently added to least recently added nodes.
public func findContextNode<T: ASTNode>(as node: T.Type = T.self) -> T? {
for node in _nodeStack.reversed() {
if let node = node as? T {
return node
}
}
return nil
}
/// Gets the current context node as a given node type.
/// Returns nil, if `topmostNode` is nil or if it is not castable to `T`.
public func currentContextNode<T: ASTNode>(as node: T.Type = T.self) -> T? {
topmostNode as? T
}
/// Pushes a new node context using a given node
public func pushContext(node: ASTNode) {
topmostNode?.addChild(node)
_nodeStack.append(node)
}
/// Adds a given child node to the top-most context.
/// - precondition: `topmostNode != nil`
public func addChildNode(_ node: ASTNode) {
guard let topmostNode = topmostNode else {
fatalError("Expected topmostNode to not be nil")
}
topmostNode.addChild(node)
}
/// Pops the current top-most node
/// - precondition: `topmostNode != nil`
@discardableResult
public func popContext() -> ASTNode? {
guard let top = _nodeStack.popLast() else {
return nil
}
if autoUpdatesSourceRange {
if top.location == .invalid {
top.updateSourceRange()
}
}
return top
}
}
|
[
-1
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.