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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ec2a930171d243f49049e69c00ab7cba1a990310 | 49bd984d457fa847abb64cf816dd02cdc0555b4b | /Barabaragame/GameViewController.swift | dda2b6ead217de724a92aad1c006bce0b981abbc | [] | no_license | YukiIG/Barabaragame | be07eaa4b18c4fe3c40c960ded435a4cf53c693f | 08e1c4aa7546d08b4f04df5886e84a5377a25a3f | refs/heads/master | 2021-01-10T14:38:52.180519 | 2016-02-11T15:06:13 | 2016-02-11T15:06:13 | 51,522,325 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,142 | swift | //
// GameViewController.swift
// Barabaragame
//
// Created by yuki ishiguro on 2016/02/11.
// Copyright © 2016年 yk1209. All rights reserved.
//
import UIKit
class GameViewController: UIViewController {
@IBOutlet var imgView1: UIImageView!
@IBOutlet var imgView2: UIImageView!
@IBOutlet var imgView3: UIImageView!
@IBOutlet var resultLabel: UILabel!
var timer: NSTimer!
var score: Int = 1000
let defaults: NSUserDefaults = NSUserDefaults.standardUserDefaults()
let width: CGFloat = UIScreen.mainScreen().bounds.size.width
var positionX: [CGFloat] = [0.0,0.0,0.0]
var dx: [CGFloat] = [3.0,2,-5.0]
func start(){
resultLabel.hidden = true
timer = NSTimer.scheduledTimerWithTimeInterval(0.005,target: self, selector: "up", userInfo: nil, repeats: true)
timer.fire()
}
func up(){
for i in 0..<3{
if positionX[i]>width || positionX[i]<0 {
dx[i] = dx[i]*(-1)
}
positionX[i] += dx[i]
}
imgView1.center.x = positionX[0]
imgView2.center.x = positionX[1]
imgView3.center.x = positionX[2]
}
@IBAction func stop(){
if timer.valid == true {
timer.invalidate()
}
for i in 0..<3 {
score = score - abs(Int(width/2 - positionX[i]))*2
}
resultLabel.text = "Score: "+String(score)
resultLabel.hidden = false
var highScore1: Int = defaults.integerForKey("score1")
var highScore2: Int = defaults.integerForKey("score2")
var highScore3: Int = defaults.integerForKey("score3")
if score > highScore1{
defaults.setInteger(score, forKey: "score1")
defaults.setInteger(highScore1, forKey: "score2")
defaults.setInteger(highScore2, forKey: "score3")
} else if score > highScore2 {
defaults.setInteger(score, forKey: "score2")
defaults.setInteger(highScore2, forKey: "score3")
} else if score > highScore3 {
defaults.setInteger(score, forKey: "score3")
}
}
@IBAction func retry(){
score = 1000
positionX = [width/2, width/2, width/2]
self.start()
}
@IBAction func toTop(){
self.dismissViewControllerAnimated(true, completion: nil)
}
override func viewDidLoad() {
super.viewDidLoad()
positionX = [width/2,width/2,width/2]
self.start()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
| [
-1
] |
3958c57ff17a595f32fbe2f8a72919f4251e6b78 | 5122253d59dcdbc8bb057e76ba14e0a04204ac6b | /instagram/PhotoDetailsViewController.swift | e2e7f1c6a8560e0cd73a2556df13c1a64301fbfe | [
"Apache-2.0"
] | permissive | MiguelFletes/Instagram | 15105013d48a1b9f8b820f4c57b74ea069ecaa65 | da06f3798e579b0079c05f272f85667493467102 | refs/heads/master | 2021-01-24T03:37:50.639047 | 2018-03-04T04:07:48 | 2018-03-04T04:07:48 | 122,896,333 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,601 | swift | //
// PhotoDetailsViewController.swift
// instagram
//
// Created by Michael Fletes on 2/26/18.
// Copyright © 2018 Michael Fletes. All rights reserved.
//
import UIKit
class PhotoDetailsViewController: UIViewController {
@IBAction func backButton(_ sender: Any) {
NotificationCenter.default.post(name: NSNotification.Name("didBack"), object: nil)
}
@IBOutlet weak var authorLabel: UILabel!
@IBOutlet weak var timeStampLabel: UILabel!
@IBOutlet weak var photo: UIImageView!
@IBOutlet weak var captionLabel: UILabel!
@IBOutlet weak var likesLabel: UILabel!
var newPhoto: UIImage!
var newCaption: String = ""
var newLikes: String = ""
var newAuthor: String = ""
var newTimeStamp: String = ""
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
photo.image = newPhoto
authorLabel.text = newAuthor
timeStampLabel.text = newTimeStamp
captionLabel.text = newCaption
likesLabel.text = newLikes
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// 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
] |
0cfe2adb3c337d2c5f20d99dcdc71955ed580ff2 | 0f2d9bb709a310c325190a7cda5ddeed739d0a65 | /SnowblindFramework/SnowblindFrameworkTests/OAuth/OAuthRequestorTest.swift | 9e970ad6cfe31ee53e47ea899190fa1f732dcd16 | [] | no_license | lancelot-koh/myDemo | 9a0c899af0ad0a1ae69d156c09d4616578bfe01a | 715cd7b627779a5740862fc6f5fb08ca3d274f64 | refs/heads/master | 2021-07-22T19:05:25.025351 | 2017-10-25T02:37:18 | 2017-10-25T02:37:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,613 | swift | //
// OAuthRequestorTest.swift
// SAPMDCFramework
//
// Created by Wonderley, Lucas on 3/27/17.
// Copyright © 2017 SAP. All rights reserved.
//
import Foundation
import XCTest
import SAPFoundation
import SAPCommon
@testable import SAPMDC
class OAuthRequestorTests: XCTestCase {
override func setUp() {
super.setUp()
}
override func tearDown() {
super.tearDown()
}
func testInitialize() {
let params: NSDictionary = [
"ApplicationID": "AID",
"AuthorizationEndpointURL": "AEURL",
"ClientID": "CID",
"RedirectURL": "RURL",
"TokenEndpointURL": "TEURL"
]
let requestor = OAuthRequestor()
XCTAssertNil(requestor.authenticator)
XCTAssertNil(requestor.cpmsObserver)
XCTAssertNil(requestor.oauthObserver)
requestor.initialize(params: params)
XCTAssertNotNil(requestor.authenticator)
XCTAssertNotNil(requestor.cpmsObserver)
XCTAssertNotNil(requestor.oauthObserver)
XCTAssert(requestor.urlSession.isRegistered(requestor.cpmsObserver!))
XCTAssert(requestor.urlSession.isRegistered(requestor.oauthObserver!))
XCTAssertEqual(requestor.cpmsObserver!.applicationID, "AID")
}
func testSendRequestFailsIfNotInitialized() {
let requestor = OAuthRequestor()
var failed = false
requestor.sendRequest(urlString: "url", success: { (_: HTTPURLResponse, _: Data) in
XCTFail()
}, failure: { (_: String?, _: String?, _: NSError?) in
failed = true
})
XCTAssert(failed)
}
// Can't test the sending of the request because there
// doesn't seem to be any way to mock SAPURLSession.
}
| [
-1
] |
1a898d7bb9cb8843fff12adfe9fc51b477bd9205 | 4fa280f5616e26050e75bbc77e1c705cf97a8556 | /data-collection/data-collection/View Controllers/Layer Contents View Controllers/LayerContentsTableViewController.swift | 4e846b4927f92a5b5f62e9bff035a88eb7b50eb2 | [
"Apache-2.0",
"MIT",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | Tahminur/data-collection-ios | dbf88250550c87011179c2e668a8843a4ebe6bb3 | 437f6f58ab6c04109351a7a534136cb4a0cbed72 | refs/heads/main | 2023-04-12T11:42:54.829710 | 2021-05-07T22:26:35 | 2021-05-07T22:26:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 10,333 | swift | //
// Copyright 2020 Esri.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import UIKit
import ArcGIS
private let indentationConstant: CGFloat = 10.0
/// The protocol you implement to respond to user accordion and visibility changes.
internal protocol LayerCellDelegate: AnyObject {
/// Tells the delegate that the user has changed the accordion state.
func accordionChanged(_ layerCell: LayerCell)
func visibilityChanged(_ layerCell: LayerCell)
}
/// LegendInfoCell - cell representing a LegendInfo.
class LegendInfoCell: UITableViewCell {
var symbolImage: UIImage? {
didSet {
legendImageView.image = symbolImage
symbolImage != nil ? activityIndicatorView.stopAnimating() : activityIndicatorView.startAnimating()
}
}
var layerIndentationLevel: Int = 0 {
didSet {
// Set constraint constant; use +1 to account for initial indentation.
indentationConstraint.constant = CGFloat(layerIndentationLevel + 1) * indentationConstant
}
}
@IBOutlet var nameLabel: UILabel!
@IBOutlet var legendImageView: UIImageView!
@IBOutlet var activityIndicatorView: UIActivityIndicatorView!
@IBOutlet var indentationConstraint: NSLayoutConstraint!
}
/// LayerCell - cell representing either a Layer or LayerContent (i.e., a sublayer).
/// The difference is in which table view cell prototype is used for the cell.
class LayerCell: UITableViewCell {
var layerIndentationLevel: Int = 0 {
didSet {
// Set constraint constant; use +1 to account for initial indentation.
indentationConstraint.constant = CGFloat(layerIndentationLevel + 1) * indentationConstant
}
}
var showRowSeparator: Bool = true {
didSet {
separatorView.isHidden = !showRowSeparator
}
}
weak var delegate: LayerCellDelegate?
@IBOutlet var nameLabel: UILabel!
@IBOutlet var accordionButton: UIButton!
@IBOutlet var visibilitySwitch: UISwitch!
@IBOutlet var indentationConstraint: NSLayoutConstraint!
@IBOutlet var accordionButtonWidthConstraint: NSLayoutConstraint!
@IBOutlet var separatorView: UIView!
@IBAction func accordionAction(_ sender: UIButton) {
delegate?.accordionChanged(self)
}
@IBAction func visibilityChanged(_ sender: Any) {
delegate?.visibilityChanged(self)
}
static let labelColor: UIColor = .label
static let dimmedColor: UIColor = .secondaryLabel
}
class LayerContentsTableViewController: UITableViewController, LayerCellDelegate {
static let legendInfoCellReuseIdentifier = "LegendInfo"
static let layerCellReuseIdentifier = "LayerTitle"
static let sublayerCellReuseIdentifier = "SublayerTitle"
// This is the array of data to display. 'rowConfigurations' contains either:
// - layers of type AGSLayers,
// - sublayers which implement AGSLayerContent but are not AGSLayers,
// - legend infos of type AGSLegendInfo.
var rowConfigurations = [LayerContentsRowConfiguration]() {
didSet {
updateVisibleConfigurations()
}
}
var configuration: LayerContentsConfiguration = LayerContentsViewController.TableOfContents() {
didSet {
tableView.separatorStyle = .none
title = configuration.title
tableView.reloadData()
}
}
// NSCache of symbol swatches (images); keys are the symbol used to create the swatch.
private var symbolSwatchesCache = NSCache<AGSSymbol, UIImage>()
var visibleConfigurations = [LayerContentsRowConfiguration]()
private func updateVisibleConfigurations() {
visibleConfigurations = rowConfigurations.filter({ (configuration) -> Bool in
// If any of content's parent's accordionDisplay is `.collapsed`, don't show it.
!configuration.parents.contains { $0.accordion == .collapsed }
})
if isViewLoaded {
tableView.reloadData()
}
}
// MARK: - Table view data source
override func numberOfSections(in tableView: UITableView) -> Int {
1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return visibleConfigurations.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
// Create and configure the cell...
let cell: UITableViewCell
let rowItem: LayerContentsRowConfiguration = visibleConfigurations[indexPath.row]
switch rowItem.kind {
case .layer:
// rowItem is a layer or a sublayer which implements AGSLayerContent
let layerCell = (tableView.dequeueReusableCell(withIdentifier: LayerContentsTableViewController.layerCellReuseIdentifier) as! LayerCell)
cell = layerCell
setupLayerCell(layerCell, indexPath, rowItem)
case .sublayer:
// rowItem is a layer or a sublayer which implements AGSLayerContent
let layerCell = (tableView.dequeueReusableCell(withIdentifier: LayerContentsTableViewController.sublayerCellReuseIdentifier) as! LayerCell)
cell = layerCell
setupLayerCell(layerCell, indexPath, rowItem)
case .legendInfo(let legendInfo):
// rowItem is a legendInfo.
let legendInfoCell = tableView.dequeueReusableCell(withIdentifier: LayerContentsTableViewController.legendInfoCellReuseIdentifier) as! LegendInfoCell
cell = legendInfoCell
legendInfoCell.nameLabel.text = rowItem.name
legendInfoCell.layerIndentationLevel = rowItem.indentationLevel
if let symbol = legendInfo.symbol {
if let swatch = symbolSwatchesCache.object(forKey: symbol) {
// We have a swatch, so set it into the imageView.
legendInfoCell.symbolImage = swatch
} else {
legendInfoCell.symbolImage = nil
// We don't have a swatch for the given symbol, so create the swatch.
symbol.createSwatch(completion: { [weak self] (swatch, _) -> Void in
guard let self = self,
let swatch = swatch else { return }
// Set the swatch into our dictionary and reload the row
self.symbolSwatchesCache.setObject(swatch, forKey: symbol)
// Make sure our cell is still displayed and update the symbolImage.
if let indexPath = self.indexPath(for: rowItem),
let cell = self.tableView.cellForRow(at: indexPath) as? LegendInfoCell {
cell.symbolImage = swatch
}
})
}
}
}
return cell
}
private func indexPath(for configuration: LayerContentsRowConfiguration) -> IndexPath? {
visibleConfigurations
.firstIndex(where: { $0.kind == configuration.kind })
.map { IndexPath(row: $0, section: 0) }
}
fileprivate func setupLayerCell(_ layerCell: (LayerCell), _ indexPath: IndexPath, _ rowItem: LayerContentsRowConfiguration) {
layerCell.delegate = self
layerCell.showRowSeparator = (indexPath.row > 0) && configuration.showRowSeparator
layerCell.nameLabel.text = rowItem.name
let enabled = rowItem.isVisibilityToggleOn && (rowItem.isVisibleAtScale)
layerCell.nameLabel.textColor = enabled ? LayerCell.labelColor : LayerCell.dimmedColor
layerCell.accordionButton.isHidden = rowItem.accordion == .none
layerCell.accordionButtonWidthConstraint.constant = !layerCell.accordionButton.isHidden ? layerCell.accordionButton.frame.height : 0.0
layerCell.accordionButton.setImage(rowItem.accordion.image, for: .normal)
layerCell.visibilitySwitch.isHidden = !rowItem.allowToggleVisibility
layerCell.visibilitySwitch.isOn = rowItem.isVisibilityToggleOn
layerCell.layerIndentationLevel = rowItem.indentationLevel
}
}
extension LayerContentsRowConfiguration.AccordionDisplay {
var image: UIImage? {
let name = self == .expanded ? "chevron-down" : "chevron-right"
return UIImage(named: name)
}
}
extension LayerContentsTableViewController {
func accordionChanged(_ layerCell: LayerCell) {
guard let indexPath = tableView.indexPath(for: layerCell) else { return }
let configuration = visibleConfigurations[indexPath.row]
guard configuration.accordion != .none else { return }
let newAccordian: LayerContentsRowConfiguration.AccordionDisplay = (configuration.accordion == .expanded) ? .collapsed : .expanded
configuration.accordion = newAccordian
layerCell.accordionButton.setImage(newAccordian.image, for: .normal)
updateVisibleConfigurations()
}
func visibilityChanged(_ layerCell: LayerCell) {
guard let indexPath = tableView.indexPath(for: layerCell) else { return }
let configuration = visibleConfigurations[indexPath.row]
switch configuration.kind {
case .layer(let layer):
layer.isVisible = layerCell.visibilitySwitch.isOn
case .sublayer(let sublayer):
sublayer.isVisible = layerCell.visibilitySwitch.isOn
case .legendInfo(_):
break
}
configuration.isVisibilityToggleOn = layerCell.visibilitySwitch.isOn
layerCell.nameLabel.textColor = configuration.isVisibilityToggleOn ? LayerCell.labelColor : LayerCell.dimmedColor
}
}
| [
-1
] |
e0a484736bc07a69e6ea86833c2c450fe6faf1bd | 5bb1e16f9f9954fbc69b52b3ed714f9d9151c244 | /ios/LPKTutorialOne-Swift/MovieDetailViewController.swift | d81dd5eead0806166ec20fae88e256f6d8ab3d4d | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | LiquidAnalytics/ld-api-examples | c2443fdf66698de3257f672f4ddaafbaf822b20f | 82a3c6c3c0948fc7e134f65a3db86ee2014ec3c2 | refs/heads/master | 2021-01-18T23:26:14.964471 | 2018-08-15T17:42:19 | 2018-08-15T17:42:19 | 25,589,860 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,411 | swift | //
// MovieDetailViewController.swift
// LPKTutorialOne-Swift
//
// Created by CARSON LI on 2016-07-01.
// Copyright © 2016 Liquid Analytics. All rights reserved.
//
import LiquidPlatformKit
import BlocksKit
class MovieDetailViewController: UIViewController{
@IBOutlet weak var categoryLabel: UILabel!
@IBOutlet weak var nameField: UITextField!
@IBOutlet weak var descriptionTextView: UITextView!
@IBOutlet weak var ratingTextField: UITextField!
@IBOutlet weak var changeButton: UIButton!
@IBOutlet weak var horizontalViewStack: UIStackView!
internal var movie : LDMItem!
internal var myRating : LDMItem!
internal var currentCategory : LDMEnumeration!
override func viewDidLoad() {
super.viewDidLoad()
if let theCategory = self.movie.valueForKey("movieCategory") as? LDMEnumeration{
self.currentCategory = theCategory
}
LDMEnumeration.enumerationsNamed("movieCategory") { (results: [AnyObject]!) in
if let enumResults = results as? Array<LDMEnumeration> {
for category in enumResults{
let button = UIButton()
button.setTitle(category.display, forState: .Normal)
button.setTitleColor(UIColor.whiteColor(), forState: .Normal)
button.backgroundColor = UIColor.blueColor()
button.bk_addEventHandler({ (sender: AnyObject! ) in
self.currentCategory = category
self.refreshUI()
}, forControlEvents: .TouchUpInside)
self.horizontalViewStack.addArrangedSubview(button)
}
}
}
self.refreshUI()
}
func refreshUI(){
self.nameField.text = self.movie.valueForKey("name") as? String
self.descriptionTextView.text = self.movie.valueForKey("description") as? String
if let category = self.currentCategory {
self.categoryLabel.text = category.stringValue
}
else{
self.categoryLabel.text = ""
}
if let rating = self.myRating{
if let ratingValue = rating.valueForKey("value") as? NSNumber{
self.ratingTextField.text = "\(ratingValue)"
}
}
}
@IBAction func saveButtonPressed(){
self.movie.setValue(self.nameField.text, forKey: "name")
self.movie.setValue(self.descriptionTextView.text, forKey: "description")
if let category = self.currentCategory{
self.movie.setValue(category, forKey: "movieCategory")
}
if let ratingText = self.ratingTextField.text{
if let rating = self.myRating{
rating.setValue(ratingText, forKey: "value")
LDMDataManager.sharedInstance().transactCreateOrUpdateWithItem(rating, withCompletionHandler: nil)
}
else{
if let newRating = LDMDataManager.sharedInstance().itemInstanceForTypeName("Rating"){
let user = LDMDataManager.sharedInstance().getUser()
newRating.setValue(LDMItem.generateId(), forKey: "ratingId")
newRating.setValue(user.valueForKey("userId"), forKey: "userId")
newRating.setValue(self.movie.valueForKey("movieId"), forKey: "movieId")
newRating.setValue(ratingText, forKey: "value")
LDMDataManager.sharedInstance().transactCreateOrUpdateWithItem(newRating, withCompletionHandler: nil)
}
}
}
LDMDataManager.sharedInstance().transactCreateOrUpdateWithItem(self.movie) { (success:Bool) in
self.navigationController?.popViewControllerAnimated(true)
}
}
@IBAction func deleteButtonPressed(){
var items = Array<LDMItem>()
if let rating = self.myRating{
items.append(rating)
}
if let movie = self.movie{
items.append(movie)
}
LDMDataManager.sharedInstance().transactDeleteWithItems(items) { (success:(Bool)) in
self.navigationController?.popViewControllerAnimated(true)
}
}
}
| [
-1
] |
a4e244f9fc4b7b98fe0c1ad9366d323d6c2a2b57 | bb9298d1ebab5712b2faefb4b8c1d2c58acdf65c | /Sources/AWSSDKSwift/Services/CodePipeline/CodePipeline_Shapes.swift | 4e288e75b2d5da93ffbfa044eaa7d517fcbafd19 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | alak/aws-sdk-swift | d0323507c34d54c99a3731a5c09519c9b26c6449 | 22da4164a6785c8b37b52fb2595d84c439043f57 | refs/heads/master | 2022-01-19T09:59:04.639930 | 2019-07-05T19:21:47 | 2019-07-05T19:21:47 | 195,456,098 | 0 | 0 | Apache-2.0 | 2019-07-05T19:06:28 | 2019-07-05T19:06:27 | null | UTF-8 | Swift | false | false | 149,304 | swift | // THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/noppoMan/aws-sdk-swift/blob/master/Sources/CodeGenerator/main.swift. DO NOT EDIT.
import Foundation
import AWSSDKSwiftCore
extension CodePipeline {
public struct AWSSessionCredentials: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "accessKeyId", required: true, type: .string),
AWSShapeMember(label: "secretAccessKey", required: true, type: .string),
AWSShapeMember(label: "sessionToken", required: true, type: .string)
]
/// The access key for the session.
public let accessKeyId: String
/// The secret access key for the session.
public let secretAccessKey: String
/// The token for the session.
public let sessionToken: String
public init(accessKeyId: String, secretAccessKey: String, sessionToken: String) {
self.accessKeyId = accessKeyId
self.secretAccessKey = secretAccessKey
self.sessionToken = sessionToken
}
private enum CodingKeys: String, CodingKey {
case accessKeyId = "accessKeyId"
case secretAccessKey = "secretAccessKey"
case sessionToken = "sessionToken"
}
}
public struct AcknowledgeJobInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "jobId", required: true, type: .string),
AWSShapeMember(label: "nonce", required: true, type: .string)
]
/// The unique system-generated ID of the job for which you want to confirm receipt.
public let jobId: String
/// A system-generated random number that AWS CodePipeline uses to ensure that the job is being worked on by only one job worker. Get this number from the response of the PollForJobs request that returned this job.
public let nonce: String
public init(jobId: String, nonce: String) {
self.jobId = jobId
self.nonce = nonce
}
private enum CodingKeys: String, CodingKey {
case jobId = "jobId"
case nonce = "nonce"
}
}
public struct AcknowledgeJobOutput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "status", required: false, type: .enum)
]
/// Whether the job worker has received the specified job.
public let status: JobStatus?
public init(status: JobStatus? = nil) {
self.status = status
}
private enum CodingKeys: String, CodingKey {
case status = "status"
}
}
public struct AcknowledgeThirdPartyJobInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "clientToken", required: true, type: .string),
AWSShapeMember(label: "jobId", required: true, type: .string),
AWSShapeMember(label: "nonce", required: true, type: .string)
]
/// The clientToken portion of the clientId and clientToken pair used to verify that the calling entity is allowed access to the job and its details.
public let clientToken: String
/// The unique system-generated ID of the job.
public let jobId: String
/// A system-generated random number that AWS CodePipeline uses to ensure that the job is being worked on by only one job worker. Get this number from the response to a GetThirdPartyJobDetails request.
public let nonce: String
public init(clientToken: String, jobId: String, nonce: String) {
self.clientToken = clientToken
self.jobId = jobId
self.nonce = nonce
}
private enum CodingKeys: String, CodingKey {
case clientToken = "clientToken"
case jobId = "jobId"
case nonce = "nonce"
}
}
public struct AcknowledgeThirdPartyJobOutput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "status", required: false, type: .enum)
]
/// The status information for the third party job, if any.
public let status: JobStatus?
public init(status: JobStatus? = nil) {
self.status = status
}
private enum CodingKeys: String, CodingKey {
case status = "status"
}
}
public enum ActionCategory: String, CustomStringConvertible, Codable {
case source = "Source"
case build = "Build"
case deploy = "Deploy"
case test = "Test"
case invoke = "Invoke"
case approval = "Approval"
public var description: String { return self.rawValue }
}
public struct ActionConfiguration: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "configuration", required: false, type: .map)
]
/// The configuration data for the action.
public let configuration: [String: String]?
public init(configuration: [String: String]? = nil) {
self.configuration = configuration
}
private enum CodingKeys: String, CodingKey {
case configuration = "configuration"
}
}
public struct ActionConfigurationProperty: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "description", required: false, type: .string),
AWSShapeMember(label: "key", required: true, type: .boolean),
AWSShapeMember(label: "name", required: true, type: .string),
AWSShapeMember(label: "queryable", required: false, type: .boolean),
AWSShapeMember(label: "required", required: true, type: .boolean),
AWSShapeMember(label: "secret", required: true, type: .boolean),
AWSShapeMember(label: "type", required: false, type: .enum)
]
/// The description of the action configuration property that will be displayed to users.
public let description: String?
/// Whether the configuration property is a key.
public let key: Bool
/// The name of the action configuration property.
public let name: String
/// Indicates that the property will be used in conjunction with PollForJobs. When creating a custom action, an action can have up to one queryable property. If it has one, that property must be both required and not secret. If you create a pipeline with a custom action type, and that custom action contains a queryable property, the value for that configuration property is subject to additional restrictions. The value must be less than or equal to twenty (20) characters. The value can contain only alphanumeric characters, underscores, and hyphens.
public let queryable: Bool?
/// Whether the configuration property is a required value.
public let required: Bool
/// Whether the configuration property is secret. Secrets are hidden from all calls except for GetJobDetails, GetThirdPartyJobDetails, PollForJobs, and PollForThirdPartyJobs. When updating a pipeline, passing * * * * * without changing any other values of the action will preserve the prior value of the secret.
public let secret: Bool
/// The type of the configuration property.
public let `type`: ActionConfigurationPropertyType?
public init(description: String? = nil, key: Bool, name: String, queryable: Bool? = nil, required: Bool, secret: Bool, type: ActionConfigurationPropertyType? = nil) {
self.description = description
self.key = key
self.name = name
self.queryable = queryable
self.required = required
self.secret = secret
self.`type` = `type`
}
private enum CodingKeys: String, CodingKey {
case description = "description"
case key = "key"
case name = "name"
case queryable = "queryable"
case required = "required"
case secret = "secret"
case `type` = "type"
}
}
public enum ActionConfigurationPropertyType: String, CustomStringConvertible, Codable {
case string = "String"
case number = "Number"
case boolean = "Boolean"
public var description: String { return self.rawValue }
}
public struct ActionContext: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "actionExecutionId", required: false, type: .string),
AWSShapeMember(label: "name", required: false, type: .string)
]
/// The system-generated unique ID that corresponds to an action's execution.
public let actionExecutionId: String?
/// The name of the action within the context of a job.
public let name: String?
public init(actionExecutionId: String? = nil, name: String? = nil) {
self.actionExecutionId = actionExecutionId
self.name = name
}
private enum CodingKeys: String, CodingKey {
case actionExecutionId = "actionExecutionId"
case name = "name"
}
}
public struct ActionDeclaration: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "actionTypeId", required: true, type: .structure),
AWSShapeMember(label: "configuration", required: false, type: .map),
AWSShapeMember(label: "inputArtifacts", required: false, type: .list),
AWSShapeMember(label: "name", required: true, type: .string),
AWSShapeMember(label: "outputArtifacts", required: false, type: .list),
AWSShapeMember(label: "region", required: false, type: .string),
AWSShapeMember(label: "roleArn", required: false, type: .string),
AWSShapeMember(label: "runOrder", required: false, type: .integer)
]
/// The configuration information for the action type.
public let actionTypeId: ActionTypeId
/// The action declaration's configuration.
public let configuration: [String: String]?
/// The name or ID of the artifact consumed by the action, such as a test or build artifact.
public let inputArtifacts: [InputArtifact]?
/// The action declaration's name.
public let name: String
/// The name or ID of the result of the action declaration, such as a test or build artifact.
public let outputArtifacts: [OutputArtifact]?
/// The action declaration's AWS Region, such as us-east-1.
public let region: String?
/// The ARN of the IAM service role that will perform the declared action. This is assumed through the roleArn for the pipeline.
public let roleArn: String?
/// The order in which actions are run.
public let runOrder: Int32?
public init(actionTypeId: ActionTypeId, configuration: [String: String]? = nil, inputArtifacts: [InputArtifact]? = nil, name: String, outputArtifacts: [OutputArtifact]? = nil, region: String? = nil, roleArn: String? = nil, runOrder: Int32? = nil) {
self.actionTypeId = actionTypeId
self.configuration = configuration
self.inputArtifacts = inputArtifacts
self.name = name
self.outputArtifacts = outputArtifacts
self.region = region
self.roleArn = roleArn
self.runOrder = runOrder
}
private enum CodingKeys: String, CodingKey {
case actionTypeId = "actionTypeId"
case configuration = "configuration"
case inputArtifacts = "inputArtifacts"
case name = "name"
case outputArtifacts = "outputArtifacts"
case region = "region"
case roleArn = "roleArn"
case runOrder = "runOrder"
}
}
public struct ActionExecution: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "errorDetails", required: false, type: .structure),
AWSShapeMember(label: "externalExecutionId", required: false, type: .string),
AWSShapeMember(label: "externalExecutionUrl", required: false, type: .string),
AWSShapeMember(label: "lastStatusChange", required: false, type: .timestamp),
AWSShapeMember(label: "lastUpdatedBy", required: false, type: .string),
AWSShapeMember(label: "percentComplete", required: false, type: .integer),
AWSShapeMember(label: "status", required: false, type: .enum),
AWSShapeMember(label: "summary", required: false, type: .string),
AWSShapeMember(label: "token", required: false, type: .string)
]
/// The details of an error returned by a URL external to AWS.
public let errorDetails: ErrorDetails?
/// The external ID of the run of the action.
public let externalExecutionId: String?
/// The URL of a resource external to AWS that will be used when running the action, for example an external repository URL.
public let externalExecutionUrl: String?
/// The last status change of the action.
public let lastStatusChange: TimeStamp?
/// The ARN of the user who last changed the pipeline.
public let lastUpdatedBy: String?
/// A percentage of completeness of the action as it runs.
public let percentComplete: Int32?
/// The status of the action, or for a completed action, the last status of the action.
public let status: ActionExecutionStatus?
/// A summary of the run of the action.
public let summary: String?
/// The system-generated token used to identify a unique approval request. The token for each open approval request can be obtained using the GetPipelineState command and is used to validate that the approval request corresponding to this token is still valid.
public let token: String?
public init(errorDetails: ErrorDetails? = nil, externalExecutionId: String? = nil, externalExecutionUrl: String? = nil, lastStatusChange: TimeStamp? = nil, lastUpdatedBy: String? = nil, percentComplete: Int32? = nil, status: ActionExecutionStatus? = nil, summary: String? = nil, token: String? = nil) {
self.errorDetails = errorDetails
self.externalExecutionId = externalExecutionId
self.externalExecutionUrl = externalExecutionUrl
self.lastStatusChange = lastStatusChange
self.lastUpdatedBy = lastUpdatedBy
self.percentComplete = percentComplete
self.status = status
self.summary = summary
self.token = token
}
private enum CodingKeys: String, CodingKey {
case errorDetails = "errorDetails"
case externalExecutionId = "externalExecutionId"
case externalExecutionUrl = "externalExecutionUrl"
case lastStatusChange = "lastStatusChange"
case lastUpdatedBy = "lastUpdatedBy"
case percentComplete = "percentComplete"
case status = "status"
case summary = "summary"
case token = "token"
}
}
public struct ActionExecutionDetail: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "actionExecutionId", required: false, type: .string),
AWSShapeMember(label: "actionName", required: false, type: .string),
AWSShapeMember(label: "input", required: false, type: .structure),
AWSShapeMember(label: "lastUpdateTime", required: false, type: .timestamp),
AWSShapeMember(label: "output", required: false, type: .structure),
AWSShapeMember(label: "pipelineExecutionId", required: false, type: .string),
AWSShapeMember(label: "pipelineVersion", required: false, type: .integer),
AWSShapeMember(label: "stageName", required: false, type: .string),
AWSShapeMember(label: "startTime", required: false, type: .timestamp),
AWSShapeMember(label: "status", required: false, type: .enum)
]
/// The action execution ID.
public let actionExecutionId: String?
/// The name of the action.
public let actionName: String?
/// Input details for the action execution, such as role ARN, Region, and input artifacts.
public let input: ActionExecutionInput?
/// The last update time of the action execution.
public let lastUpdateTime: TimeStamp?
/// Output details for the action execution, such as the action execution result.
public let output: ActionExecutionOutput?
/// The pipeline execution ID for the action execution.
public let pipelineExecutionId: String?
/// The version of the pipeline where the action was run.
public let pipelineVersion: Int32?
/// The name of the stage that contains the action.
public let stageName: String?
/// The start time of the action execution.
public let startTime: TimeStamp?
/// The status of the action execution. Status categories are InProgress, Succeeded, and Failed.
public let status: ActionExecutionStatus?
public init(actionExecutionId: String? = nil, actionName: String? = nil, input: ActionExecutionInput? = nil, lastUpdateTime: TimeStamp? = nil, output: ActionExecutionOutput? = nil, pipelineExecutionId: String? = nil, pipelineVersion: Int32? = nil, stageName: String? = nil, startTime: TimeStamp? = nil, status: ActionExecutionStatus? = nil) {
self.actionExecutionId = actionExecutionId
self.actionName = actionName
self.input = input
self.lastUpdateTime = lastUpdateTime
self.output = output
self.pipelineExecutionId = pipelineExecutionId
self.pipelineVersion = pipelineVersion
self.stageName = stageName
self.startTime = startTime
self.status = status
}
private enum CodingKeys: String, CodingKey {
case actionExecutionId = "actionExecutionId"
case actionName = "actionName"
case input = "input"
case lastUpdateTime = "lastUpdateTime"
case output = "output"
case pipelineExecutionId = "pipelineExecutionId"
case pipelineVersion = "pipelineVersion"
case stageName = "stageName"
case startTime = "startTime"
case status = "status"
}
}
public struct ActionExecutionFilter: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "pipelineExecutionId", required: false, type: .string)
]
/// The pipeline execution ID used to filter action execution history.
public let pipelineExecutionId: String?
public init(pipelineExecutionId: String? = nil) {
self.pipelineExecutionId = pipelineExecutionId
}
private enum CodingKeys: String, CodingKey {
case pipelineExecutionId = "pipelineExecutionId"
}
}
public struct ActionExecutionInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "actionTypeId", required: false, type: .structure),
AWSShapeMember(label: "configuration", required: false, type: .map),
AWSShapeMember(label: "inputArtifacts", required: false, type: .list),
AWSShapeMember(label: "region", required: false, type: .string),
AWSShapeMember(label: "roleArn", required: false, type: .string)
]
public let actionTypeId: ActionTypeId?
/// Configuration data for an action execution.
public let configuration: [String: String]?
/// Details of input artifacts of the action that correspond to the action execution.
public let inputArtifacts: [ArtifactDetail]?
/// The AWS Region for the action, such as us-east-1.
public let region: String?
/// The ARN of the IAM service role that performs the declared action. This is assumed through the roleArn for the pipeline.
public let roleArn: String?
public init(actionTypeId: ActionTypeId? = nil, configuration: [String: String]? = nil, inputArtifacts: [ArtifactDetail]? = nil, region: String? = nil, roleArn: String? = nil) {
self.actionTypeId = actionTypeId
self.configuration = configuration
self.inputArtifacts = inputArtifacts
self.region = region
self.roleArn = roleArn
}
private enum CodingKeys: String, CodingKey {
case actionTypeId = "actionTypeId"
case configuration = "configuration"
case inputArtifacts = "inputArtifacts"
case region = "region"
case roleArn = "roleArn"
}
}
public struct ActionExecutionOutput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "executionResult", required: false, type: .structure),
AWSShapeMember(label: "outputArtifacts", required: false, type: .list)
]
/// Execution result information listed in the output details for an action execution.
public let executionResult: ActionExecutionResult?
/// Details of output artifacts of the action that correspond to the action execution.
public let outputArtifacts: [ArtifactDetail]?
public init(executionResult: ActionExecutionResult? = nil, outputArtifacts: [ArtifactDetail]? = nil) {
self.executionResult = executionResult
self.outputArtifacts = outputArtifacts
}
private enum CodingKeys: String, CodingKey {
case executionResult = "executionResult"
case outputArtifacts = "outputArtifacts"
}
}
public struct ActionExecutionResult: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "externalExecutionId", required: false, type: .string),
AWSShapeMember(label: "externalExecutionSummary", required: false, type: .string),
AWSShapeMember(label: "externalExecutionUrl", required: false, type: .string)
]
/// The action provider's external ID for the action execution.
public let externalExecutionId: String?
/// The action provider's summary for the action execution.
public let externalExecutionSummary: String?
/// The deepest external link to the external resource (for example, a repository URL or deployment endpoint) that is used when running the action.
public let externalExecutionUrl: String?
public init(externalExecutionId: String? = nil, externalExecutionSummary: String? = nil, externalExecutionUrl: String? = nil) {
self.externalExecutionId = externalExecutionId
self.externalExecutionSummary = externalExecutionSummary
self.externalExecutionUrl = externalExecutionUrl
}
private enum CodingKeys: String, CodingKey {
case externalExecutionId = "externalExecutionId"
case externalExecutionSummary = "externalExecutionSummary"
case externalExecutionUrl = "externalExecutionUrl"
}
}
public enum ActionExecutionStatus: String, CustomStringConvertible, Codable {
case inprogress = "InProgress"
case succeeded = "Succeeded"
case failed = "Failed"
public var description: String { return self.rawValue }
}
public enum ActionOwner: String, CustomStringConvertible, Codable {
case aws = "AWS"
case thirdparty = "ThirdParty"
case custom = "Custom"
public var description: String { return self.rawValue }
}
public struct ActionRevision: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "created", required: true, type: .timestamp),
AWSShapeMember(label: "revisionChangeId", required: true, type: .string),
AWSShapeMember(label: "revisionId", required: true, type: .string)
]
/// The date and time when the most recent version of the action was created, in timestamp format.
public let created: TimeStamp
/// The unique identifier of the change that set the state to this revision, for example a deployment ID or timestamp.
public let revisionChangeId: String
/// The system-generated unique ID that identifies the revision number of the action.
public let revisionId: String
public init(created: TimeStamp, revisionChangeId: String, revisionId: String) {
self.created = created
self.revisionChangeId = revisionChangeId
self.revisionId = revisionId
}
private enum CodingKeys: String, CodingKey {
case created = "created"
case revisionChangeId = "revisionChangeId"
case revisionId = "revisionId"
}
}
public struct ActionState: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "actionName", required: false, type: .string),
AWSShapeMember(label: "currentRevision", required: false, type: .structure),
AWSShapeMember(label: "entityUrl", required: false, type: .string),
AWSShapeMember(label: "latestExecution", required: false, type: .structure),
AWSShapeMember(label: "revisionUrl", required: false, type: .string)
]
/// The name of the action.
public let actionName: String?
/// Represents information about the version (or revision) of an action.
public let currentRevision: ActionRevision?
/// A URL link for more information about the state of the action, such as a deployment group details page.
public let entityUrl: String?
/// Represents information about the run of an action.
public let latestExecution: ActionExecution?
/// A URL link for more information about the revision, such as a commit details page.
public let revisionUrl: String?
public init(actionName: String? = nil, currentRevision: ActionRevision? = nil, entityUrl: String? = nil, latestExecution: ActionExecution? = nil, revisionUrl: String? = nil) {
self.actionName = actionName
self.currentRevision = currentRevision
self.entityUrl = entityUrl
self.latestExecution = latestExecution
self.revisionUrl = revisionUrl
}
private enum CodingKeys: String, CodingKey {
case actionName = "actionName"
case currentRevision = "currentRevision"
case entityUrl = "entityUrl"
case latestExecution = "latestExecution"
case revisionUrl = "revisionUrl"
}
}
public struct ActionType: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "actionConfigurationProperties", required: false, type: .list),
AWSShapeMember(label: "id", required: true, type: .structure),
AWSShapeMember(label: "inputArtifactDetails", required: true, type: .structure),
AWSShapeMember(label: "outputArtifactDetails", required: true, type: .structure),
AWSShapeMember(label: "settings", required: false, type: .structure)
]
/// The configuration properties for the action type.
public let actionConfigurationProperties: [ActionConfigurationProperty]?
/// Represents information about an action type.
public let id: ActionTypeId
/// The details of the input artifact for the action, such as its commit ID.
public let inputArtifactDetails: ArtifactDetails
/// The details of the output artifact of the action, such as its commit ID.
public let outputArtifactDetails: ArtifactDetails
/// The settings for the action type.
public let settings: ActionTypeSettings?
public init(actionConfigurationProperties: [ActionConfigurationProperty]? = nil, id: ActionTypeId, inputArtifactDetails: ArtifactDetails, outputArtifactDetails: ArtifactDetails, settings: ActionTypeSettings? = nil) {
self.actionConfigurationProperties = actionConfigurationProperties
self.id = id
self.inputArtifactDetails = inputArtifactDetails
self.outputArtifactDetails = outputArtifactDetails
self.settings = settings
}
private enum CodingKeys: String, CodingKey {
case actionConfigurationProperties = "actionConfigurationProperties"
case id = "id"
case inputArtifactDetails = "inputArtifactDetails"
case outputArtifactDetails = "outputArtifactDetails"
case settings = "settings"
}
}
public struct ActionTypeId: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "category", required: true, type: .enum),
AWSShapeMember(label: "owner", required: true, type: .enum),
AWSShapeMember(label: "provider", required: true, type: .string),
AWSShapeMember(label: "version", required: true, type: .string)
]
/// A category defines what kind of action can be taken in the stage, and constrains the provider type for the action. Valid categories are limited to one of the values below.
public let category: ActionCategory
/// The creator of the action being called.
public let owner: ActionOwner
/// The provider of the service being called by the action. Valid providers are determined by the action category. For example, an action in the Deploy category type might have a provider of AWS CodeDeploy, which would be specified as CodeDeploy. To reference a list of action providers by action type, see Valid Action Types and Providers in CodePipeline.
public let provider: String
/// A string that describes the action version.
public let version: String
public init(category: ActionCategory, owner: ActionOwner, provider: String, version: String) {
self.category = category
self.owner = owner
self.provider = provider
self.version = version
}
private enum CodingKeys: String, CodingKey {
case category = "category"
case owner = "owner"
case provider = "provider"
case version = "version"
}
}
public struct ActionTypeSettings: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "entityUrlTemplate", required: false, type: .string),
AWSShapeMember(label: "executionUrlTemplate", required: false, type: .string),
AWSShapeMember(label: "revisionUrlTemplate", required: false, type: .string),
AWSShapeMember(label: "thirdPartyConfigurationUrl", required: false, type: .string)
]
/// The URL returned to the AWS CodePipeline console that provides a deep link to the resources of the external system, such as the configuration page for an AWS CodeDeploy deployment group. This link is provided as part of the action display within the pipeline.
public let entityUrlTemplate: String?
/// The URL returned to the AWS CodePipeline console that contains a link to the top-level landing page for the external system, such as console page for AWS CodeDeploy. This link is shown on the pipeline view page in the AWS CodePipeline console and provides a link to the execution entity of the external action.
public let executionUrlTemplate: String?
/// The URL returned to the AWS CodePipeline console that contains a link to the page where customers can update or change the configuration of the external action.
public let revisionUrlTemplate: String?
/// The URL of a sign-up page where users can sign up for an external service and perform initial configuration of the action provided by that service.
public let thirdPartyConfigurationUrl: String?
public init(entityUrlTemplate: String? = nil, executionUrlTemplate: String? = nil, revisionUrlTemplate: String? = nil, thirdPartyConfigurationUrl: String? = nil) {
self.entityUrlTemplate = entityUrlTemplate
self.executionUrlTemplate = executionUrlTemplate
self.revisionUrlTemplate = revisionUrlTemplate
self.thirdPartyConfigurationUrl = thirdPartyConfigurationUrl
}
private enum CodingKeys: String, CodingKey {
case entityUrlTemplate = "entityUrlTemplate"
case executionUrlTemplate = "executionUrlTemplate"
case revisionUrlTemplate = "revisionUrlTemplate"
case thirdPartyConfigurationUrl = "thirdPartyConfigurationUrl"
}
}
public struct ApprovalResult: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "status", required: true, type: .enum),
AWSShapeMember(label: "summary", required: true, type: .string)
]
/// The response submitted by a reviewer assigned to an approval action request.
public let status: ApprovalStatus
/// The summary of the current status of the approval request.
public let summary: String
public init(status: ApprovalStatus, summary: String) {
self.status = status
self.summary = summary
}
private enum CodingKeys: String, CodingKey {
case status = "status"
case summary = "summary"
}
}
public enum ApprovalStatus: String, CustomStringConvertible, Codable {
case approved = "Approved"
case rejected = "Rejected"
public var description: String { return self.rawValue }
}
public struct Artifact: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "location", required: false, type: .structure),
AWSShapeMember(label: "name", required: false, type: .string),
AWSShapeMember(label: "revision", required: false, type: .string)
]
/// The location of an artifact.
public let location: ArtifactLocation?
/// The artifact's name.
public let name: String?
/// The artifact's revision ID. Depending on the type of object, this could be a commit ID (GitHub) or a revision ID (Amazon S3).
public let revision: String?
public init(location: ArtifactLocation? = nil, name: String? = nil, revision: String? = nil) {
self.location = location
self.name = name
self.revision = revision
}
private enum CodingKeys: String, CodingKey {
case location = "location"
case name = "name"
case revision = "revision"
}
}
public struct ArtifactDetail: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "name", required: false, type: .string),
AWSShapeMember(label: "s3location", required: false, type: .structure)
]
/// The artifact object name for the action execution.
public let name: String?
/// The Amazon S3 artifact location for the action execution.
public let s3location: S3Location?
public init(name: String? = nil, s3location: S3Location? = nil) {
self.name = name
self.s3location = s3location
}
private enum CodingKeys: String, CodingKey {
case name = "name"
case s3location = "s3location"
}
}
public struct ArtifactDetails: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "maximumCount", required: true, type: .integer),
AWSShapeMember(label: "minimumCount", required: true, type: .integer)
]
/// The maximum number of artifacts allowed for the action type.
public let maximumCount: Int32
/// The minimum number of artifacts allowed for the action type.
public let minimumCount: Int32
public init(maximumCount: Int32, minimumCount: Int32) {
self.maximumCount = maximumCount
self.minimumCount = minimumCount
}
private enum CodingKeys: String, CodingKey {
case maximumCount = "maximumCount"
case minimumCount = "minimumCount"
}
}
public struct ArtifactLocation: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "s3Location", required: false, type: .structure),
AWSShapeMember(label: "type", required: false, type: .enum)
]
/// The Amazon S3 bucket that contains the artifact.
public let s3Location: S3ArtifactLocation?
/// The type of artifact in the location.
public let `type`: ArtifactLocationType?
public init(s3Location: S3ArtifactLocation? = nil, type: ArtifactLocationType? = nil) {
self.s3Location = s3Location
self.`type` = `type`
}
private enum CodingKeys: String, CodingKey {
case s3Location = "s3Location"
case `type` = "type"
}
}
public enum ArtifactLocationType: String, CustomStringConvertible, Codable {
case s3 = "S3"
public var description: String { return self.rawValue }
}
public struct ArtifactRevision: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "created", required: false, type: .timestamp),
AWSShapeMember(label: "name", required: false, type: .string),
AWSShapeMember(label: "revisionChangeIdentifier", required: false, type: .string),
AWSShapeMember(label: "revisionId", required: false, type: .string),
AWSShapeMember(label: "revisionSummary", required: false, type: .string),
AWSShapeMember(label: "revisionUrl", required: false, type: .string)
]
/// The date and time when the most recent revision of the artifact was created, in timestamp format.
public let created: TimeStamp?
/// The name of an artifact. This name might be system-generated, such as "MyApp", or might be defined by the user when an action is created.
public let name: String?
/// An additional identifier for a revision, such as a commit date or, for artifacts stored in Amazon S3 buckets, the ETag value.
public let revisionChangeIdentifier: String?
/// The revision ID of the artifact.
public let revisionId: String?
/// Summary information about the most recent revision of the artifact. For GitHub and AWS CodeCommit repositories, the commit message. For Amazon S3 buckets or actions, the user-provided content of a codepipeline-artifact-revision-summary key specified in the object metadata.
public let revisionSummary: String?
/// The commit ID for the artifact revision. For artifacts stored in GitHub or AWS CodeCommit repositories, the commit ID is linked to a commit details page.
public let revisionUrl: String?
public init(created: TimeStamp? = nil, name: String? = nil, revisionChangeIdentifier: String? = nil, revisionId: String? = nil, revisionSummary: String? = nil, revisionUrl: String? = nil) {
self.created = created
self.name = name
self.revisionChangeIdentifier = revisionChangeIdentifier
self.revisionId = revisionId
self.revisionSummary = revisionSummary
self.revisionUrl = revisionUrl
}
private enum CodingKeys: String, CodingKey {
case created = "created"
case name = "name"
case revisionChangeIdentifier = "revisionChangeIdentifier"
case revisionId = "revisionId"
case revisionSummary = "revisionSummary"
case revisionUrl = "revisionUrl"
}
}
public struct ArtifactStore: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "encryptionKey", required: false, type: .structure),
AWSShapeMember(label: "location", required: true, type: .string),
AWSShapeMember(label: "type", required: true, type: .enum)
]
/// The encryption key used to encrypt the data in the artifact store, such as an AWS Key Management Service (AWS KMS) key. If this is undefined, the default key for Amazon S3 is used.
public let encryptionKey: EncryptionKey?
/// The Amazon S3 bucket used for storing the artifacts for a pipeline. You can specify the name of an S3 bucket but not a folder within the bucket. A folder to contain the pipeline artifacts is created for you based on the name of the pipeline. You can use any Amazon S3 bucket in the same AWS Region as the pipeline to store your pipeline artifacts.
public let location: String
/// The type of the artifact store, such as S3.
public let `type`: ArtifactStoreType
public init(encryptionKey: EncryptionKey? = nil, location: String, type: ArtifactStoreType) {
self.encryptionKey = encryptionKey
self.location = location
self.`type` = `type`
}
private enum CodingKeys: String, CodingKey {
case encryptionKey = "encryptionKey"
case location = "location"
case `type` = "type"
}
}
public enum ArtifactStoreType: String, CustomStringConvertible, Codable {
case s3 = "S3"
public var description: String { return self.rawValue }
}
public struct BlockerDeclaration: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "name", required: true, type: .string),
AWSShapeMember(label: "type", required: true, type: .enum)
]
/// Reserved for future use.
public let name: String
/// Reserved for future use.
public let `type`: BlockerType
public init(name: String, type: BlockerType) {
self.name = name
self.`type` = `type`
}
private enum CodingKeys: String, CodingKey {
case name = "name"
case `type` = "type"
}
}
public enum BlockerType: String, CustomStringConvertible, Codable {
case schedule = "Schedule"
public var description: String { return self.rawValue }
}
public struct CreateCustomActionTypeInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "category", required: true, type: .enum),
AWSShapeMember(label: "configurationProperties", required: false, type: .list),
AWSShapeMember(label: "inputArtifactDetails", required: true, type: .structure),
AWSShapeMember(label: "outputArtifactDetails", required: true, type: .structure),
AWSShapeMember(label: "provider", required: true, type: .string),
AWSShapeMember(label: "settings", required: false, type: .structure),
AWSShapeMember(label: "tags", required: false, type: .list),
AWSShapeMember(label: "version", required: true, type: .string)
]
/// The category of the custom action, such as a build action or a test action. Although Source and Approval are listed as valid values, they are not currently functional. These values are reserved for future use.
public let category: ActionCategory
/// The configuration properties for the custom action. You can refer to a name in the configuration properties of the custom action within the URL templates by following the format of {Config:name}, as long as the configuration property is both required and not secret. For more information, see Create a Custom Action for a Pipeline.
public let configurationProperties: [ActionConfigurationProperty]?
/// The details of the input artifact for the action, such as its commit ID.
public let inputArtifactDetails: ArtifactDetails
/// The details of the output artifact of the action, such as its commit ID.
public let outputArtifactDetails: ArtifactDetails
/// The provider of the service used in the custom action, such as AWS CodeDeploy.
public let provider: String
/// URLs that provide users information about this custom action.
public let settings: ActionTypeSettings?
/// The tags for the custom action.
public let tags: [Tag]?
/// The version identifier of the custom action.
public let version: String
public init(category: ActionCategory, configurationProperties: [ActionConfigurationProperty]? = nil, inputArtifactDetails: ArtifactDetails, outputArtifactDetails: ArtifactDetails, provider: String, settings: ActionTypeSettings? = nil, tags: [Tag]? = nil, version: String) {
self.category = category
self.configurationProperties = configurationProperties
self.inputArtifactDetails = inputArtifactDetails
self.outputArtifactDetails = outputArtifactDetails
self.provider = provider
self.settings = settings
self.tags = tags
self.version = version
}
private enum CodingKeys: String, CodingKey {
case category = "category"
case configurationProperties = "configurationProperties"
case inputArtifactDetails = "inputArtifactDetails"
case outputArtifactDetails = "outputArtifactDetails"
case provider = "provider"
case settings = "settings"
case tags = "tags"
case version = "version"
}
}
public struct CreateCustomActionTypeOutput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "actionType", required: true, type: .structure),
AWSShapeMember(label: "tags", required: false, type: .list)
]
/// Returns information about the details of an action type.
public let actionType: ActionType
/// Specifies the tags applied to the custom action.
public let tags: [Tag]?
public init(actionType: ActionType, tags: [Tag]? = nil) {
self.actionType = actionType
self.tags = tags
}
private enum CodingKeys: String, CodingKey {
case actionType = "actionType"
case tags = "tags"
}
}
public struct CreatePipelineInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "pipeline", required: true, type: .structure),
AWSShapeMember(label: "tags", required: false, type: .list)
]
/// Represents the structure of actions and stages to be performed in the pipeline.
public let pipeline: PipelineDeclaration
/// The tags for the pipeline.
public let tags: [Tag]?
public init(pipeline: PipelineDeclaration, tags: [Tag]? = nil) {
self.pipeline = pipeline
self.tags = tags
}
private enum CodingKeys: String, CodingKey {
case pipeline = "pipeline"
case tags = "tags"
}
}
public struct CreatePipelineOutput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "pipeline", required: false, type: .structure),
AWSShapeMember(label: "tags", required: false, type: .list)
]
/// Represents the structure of actions and stages to be performed in the pipeline.
public let pipeline: PipelineDeclaration?
/// Specifies the tags applied to the pipeline.
public let tags: [Tag]?
public init(pipeline: PipelineDeclaration? = nil, tags: [Tag]? = nil) {
self.pipeline = pipeline
self.tags = tags
}
private enum CodingKeys: String, CodingKey {
case pipeline = "pipeline"
case tags = "tags"
}
}
public struct CurrentRevision: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "changeIdentifier", required: true, type: .string),
AWSShapeMember(label: "created", required: false, type: .timestamp),
AWSShapeMember(label: "revision", required: true, type: .string),
AWSShapeMember(label: "revisionSummary", required: false, type: .string)
]
/// The change identifier for the current revision.
public let changeIdentifier: String
/// The date and time when the most recent revision of the artifact was created, in timestamp format.
public let created: TimeStamp?
/// The revision ID of the current version of an artifact.
public let revision: String
/// The summary of the most recent revision of the artifact.
public let revisionSummary: String?
public init(changeIdentifier: String, created: TimeStamp? = nil, revision: String, revisionSummary: String? = nil) {
self.changeIdentifier = changeIdentifier
self.created = created
self.revision = revision
self.revisionSummary = revisionSummary
}
private enum CodingKeys: String, CodingKey {
case changeIdentifier = "changeIdentifier"
case created = "created"
case revision = "revision"
case revisionSummary = "revisionSummary"
}
}
public struct DeleteCustomActionTypeInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "category", required: true, type: .enum),
AWSShapeMember(label: "provider", required: true, type: .string),
AWSShapeMember(label: "version", required: true, type: .string)
]
/// The category of the custom action that you want to delete, such as source or deploy.
public let category: ActionCategory
/// The provider of the service used in the custom action, such as AWS CodeDeploy.
public let provider: String
/// The version of the custom action to delete.
public let version: String
public init(category: ActionCategory, provider: String, version: String) {
self.category = category
self.provider = provider
self.version = version
}
private enum CodingKeys: String, CodingKey {
case category = "category"
case provider = "provider"
case version = "version"
}
}
public struct DeletePipelineInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "name", required: true, type: .string)
]
/// The name of the pipeline to be deleted.
public let name: String
public init(name: String) {
self.name = name
}
private enum CodingKeys: String, CodingKey {
case name = "name"
}
}
public struct DeleteWebhookInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "name", required: true, type: .string)
]
/// The name of the webhook you want to delete.
public let name: String
public init(name: String) {
self.name = name
}
private enum CodingKeys: String, CodingKey {
case name = "name"
}
}
public struct DeleteWebhookOutput: AWSShape {
public init() {
}
}
public struct DeregisterWebhookWithThirdPartyInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "webhookName", required: false, type: .string)
]
/// The name of the webhook you want to deregister.
public let webhookName: String?
public init(webhookName: String? = nil) {
self.webhookName = webhookName
}
private enum CodingKeys: String, CodingKey {
case webhookName = "webhookName"
}
}
public struct DeregisterWebhookWithThirdPartyOutput: AWSShape {
public init() {
}
}
public struct DisableStageTransitionInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "pipelineName", required: true, type: .string),
AWSShapeMember(label: "reason", required: true, type: .string),
AWSShapeMember(label: "stageName", required: true, type: .string),
AWSShapeMember(label: "transitionType", required: true, type: .enum)
]
/// The name of the pipeline in which you want to disable the flow of artifacts from one stage to another.
public let pipelineName: String
/// The reason given to the user why a stage is disabled, such as waiting for manual approval or manual tests. This message is displayed in the pipeline console UI.
public let reason: String
/// The name of the stage where you want to disable the inbound or outbound transition of artifacts.
public let stageName: String
/// Specifies whether artifacts will be prevented from transitioning into the stage and being processed by the actions in that stage (inbound), or prevented from transitioning from the stage after they have been processed by the actions in that stage (outbound).
public let transitionType: StageTransitionType
public init(pipelineName: String, reason: String, stageName: String, transitionType: StageTransitionType) {
self.pipelineName = pipelineName
self.reason = reason
self.stageName = stageName
self.transitionType = transitionType
}
private enum CodingKeys: String, CodingKey {
case pipelineName = "pipelineName"
case reason = "reason"
case stageName = "stageName"
case transitionType = "transitionType"
}
}
public struct EnableStageTransitionInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "pipelineName", required: true, type: .string),
AWSShapeMember(label: "stageName", required: true, type: .string),
AWSShapeMember(label: "transitionType", required: true, type: .enum)
]
/// The name of the pipeline in which you want to enable the flow of artifacts from one stage to another.
public let pipelineName: String
/// The name of the stage where you want to enable the transition of artifacts, either into the stage (inbound) or from that stage to the next stage (outbound).
public let stageName: String
/// Specifies whether artifacts will be allowed to enter the stage and be processed by the actions in that stage (inbound) or whether already-processed artifacts will be allowed to transition to the next stage (outbound).
public let transitionType: StageTransitionType
public init(pipelineName: String, stageName: String, transitionType: StageTransitionType) {
self.pipelineName = pipelineName
self.stageName = stageName
self.transitionType = transitionType
}
private enum CodingKeys: String, CodingKey {
case pipelineName = "pipelineName"
case stageName = "stageName"
case transitionType = "transitionType"
}
}
public struct EncryptionKey: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "id", required: true, type: .string),
AWSShapeMember(label: "type", required: true, type: .enum)
]
/// The ID used to identify the key. For an AWS KMS key, this is the key ID or key ARN.
public let id: String
/// The type of encryption key, such as an AWS Key Management Service (AWS KMS) key. When creating or updating a pipeline, the value must be set to 'KMS'.
public let `type`: EncryptionKeyType
public init(id: String, type: EncryptionKeyType) {
self.id = id
self.`type` = `type`
}
private enum CodingKeys: String, CodingKey {
case id = "id"
case `type` = "type"
}
}
public enum EncryptionKeyType: String, CustomStringConvertible, Codable {
case kms = "KMS"
public var description: String { return self.rawValue }
}
public struct ErrorDetails: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "code", required: false, type: .string),
AWSShapeMember(label: "message", required: false, type: .string)
]
/// The system ID or error number code of the error.
public let code: String?
/// The text of the error message.
public let message: String?
public init(code: String? = nil, message: String? = nil) {
self.code = code
self.message = message
}
private enum CodingKeys: String, CodingKey {
case code = "code"
case message = "message"
}
}
public struct ExecutionDetails: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "externalExecutionId", required: false, type: .string),
AWSShapeMember(label: "percentComplete", required: false, type: .integer),
AWSShapeMember(label: "summary", required: false, type: .string)
]
/// The system-generated unique ID of this action used to identify this job worker in any external systems, such as AWS CodeDeploy.
public let externalExecutionId: String?
/// The percentage of work completed on the action, represented on a scale of zero to one hundred percent.
public let percentComplete: Int32?
/// The summary of the current status of the actions.
public let summary: String?
public init(externalExecutionId: String? = nil, percentComplete: Int32? = nil, summary: String? = nil) {
self.externalExecutionId = externalExecutionId
self.percentComplete = percentComplete
self.summary = summary
}
private enum CodingKeys: String, CodingKey {
case externalExecutionId = "externalExecutionId"
case percentComplete = "percentComplete"
case summary = "summary"
}
}
public struct FailureDetails: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "externalExecutionId", required: false, type: .string),
AWSShapeMember(label: "message", required: true, type: .string),
AWSShapeMember(label: "type", required: true, type: .enum)
]
/// The external ID of the run of the action that failed.
public let externalExecutionId: String?
/// The message about the failure.
public let message: String
/// The type of the failure.
public let `type`: FailureType
public init(externalExecutionId: String? = nil, message: String, type: FailureType) {
self.externalExecutionId = externalExecutionId
self.message = message
self.`type` = `type`
}
private enum CodingKeys: String, CodingKey {
case externalExecutionId = "externalExecutionId"
case message = "message"
case `type` = "type"
}
}
public enum FailureType: String, CustomStringConvertible, Codable {
case jobfailed = "JobFailed"
case configurationerror = "ConfigurationError"
case permissionerror = "PermissionError"
case revisionoutofsync = "RevisionOutOfSync"
case revisionunavailable = "RevisionUnavailable"
case systemunavailable = "SystemUnavailable"
public var description: String { return self.rawValue }
}
public struct GetJobDetailsInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "jobId", required: true, type: .string)
]
/// The unique system-generated ID for the job.
public let jobId: String
public init(jobId: String) {
self.jobId = jobId
}
private enum CodingKeys: String, CodingKey {
case jobId = "jobId"
}
}
public struct GetJobDetailsOutput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "jobDetails", required: false, type: .structure)
]
/// The details of the job. If AWSSessionCredentials is used, a long-running job can call GetJobDetails again to obtain new credentials.
public let jobDetails: JobDetails?
public init(jobDetails: JobDetails? = nil) {
self.jobDetails = jobDetails
}
private enum CodingKeys: String, CodingKey {
case jobDetails = "jobDetails"
}
}
public struct GetPipelineExecutionInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "pipelineExecutionId", required: true, type: .string),
AWSShapeMember(label: "pipelineName", required: true, type: .string)
]
/// The ID of the pipeline execution about which you want to get execution details.
public let pipelineExecutionId: String
/// The name of the pipeline about which you want to get execution details.
public let pipelineName: String
public init(pipelineExecutionId: String, pipelineName: String) {
self.pipelineExecutionId = pipelineExecutionId
self.pipelineName = pipelineName
}
private enum CodingKeys: String, CodingKey {
case pipelineExecutionId = "pipelineExecutionId"
case pipelineName = "pipelineName"
}
}
public struct GetPipelineExecutionOutput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "pipelineExecution", required: false, type: .structure)
]
/// Represents information about the execution of a pipeline.
public let pipelineExecution: PipelineExecution?
public init(pipelineExecution: PipelineExecution? = nil) {
self.pipelineExecution = pipelineExecution
}
private enum CodingKeys: String, CodingKey {
case pipelineExecution = "pipelineExecution"
}
}
public struct GetPipelineInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "name", required: true, type: .string),
AWSShapeMember(label: "version", required: false, type: .integer)
]
/// The name of the pipeline for which you want to get information. Pipeline names must be unique under an Amazon Web Services (AWS) user account.
public let name: String
/// The version number of the pipeline. If you do not specify a version, defaults to the most current version.
public let version: Int32?
public init(name: String, version: Int32? = nil) {
self.name = name
self.version = version
}
private enum CodingKeys: String, CodingKey {
case name = "name"
case version = "version"
}
}
public struct GetPipelineOutput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "metadata", required: false, type: .structure),
AWSShapeMember(label: "pipeline", required: false, type: .structure)
]
/// Represents the pipeline metadata information returned as part of the output of a GetPipeline action.
public let metadata: PipelineMetadata?
/// Represents the structure of actions and stages to be performed in the pipeline.
public let pipeline: PipelineDeclaration?
public init(metadata: PipelineMetadata? = nil, pipeline: PipelineDeclaration? = nil) {
self.metadata = metadata
self.pipeline = pipeline
}
private enum CodingKeys: String, CodingKey {
case metadata = "metadata"
case pipeline = "pipeline"
}
}
public struct GetPipelineStateInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "name", required: true, type: .string)
]
/// The name of the pipeline about which you want to get information.
public let name: String
public init(name: String) {
self.name = name
}
private enum CodingKeys: String, CodingKey {
case name = "name"
}
}
public struct GetPipelineStateOutput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "created", required: false, type: .timestamp),
AWSShapeMember(label: "pipelineName", required: false, type: .string),
AWSShapeMember(label: "pipelineVersion", required: false, type: .integer),
AWSShapeMember(label: "stageStates", required: false, type: .list),
AWSShapeMember(label: "updated", required: false, type: .timestamp)
]
/// The date and time the pipeline was created, in timestamp format.
public let created: TimeStamp?
/// The name of the pipeline for which you want to get the state.
public let pipelineName: String?
/// The version number of the pipeline. A newly-created pipeline is always assigned a version number of 1.
public let pipelineVersion: Int32?
/// A list of the pipeline stage output information, including stage name, state, most recent run details, whether the stage is disabled, and other data.
public let stageStates: [StageState]?
/// The date and time the pipeline was last updated, in timestamp format.
public let updated: TimeStamp?
public init(created: TimeStamp? = nil, pipelineName: String? = nil, pipelineVersion: Int32? = nil, stageStates: [StageState]? = nil, updated: TimeStamp? = nil) {
self.created = created
self.pipelineName = pipelineName
self.pipelineVersion = pipelineVersion
self.stageStates = stageStates
self.updated = updated
}
private enum CodingKeys: String, CodingKey {
case created = "created"
case pipelineName = "pipelineName"
case pipelineVersion = "pipelineVersion"
case stageStates = "stageStates"
case updated = "updated"
}
}
public struct GetThirdPartyJobDetailsInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "clientToken", required: true, type: .string),
AWSShapeMember(label: "jobId", required: true, type: .string)
]
/// The clientToken portion of the clientId and clientToken pair used to verify that the calling entity is allowed access to the job and its details.
public let clientToken: String
/// The unique system-generated ID used for identifying the job.
public let jobId: String
public init(clientToken: String, jobId: String) {
self.clientToken = clientToken
self.jobId = jobId
}
private enum CodingKeys: String, CodingKey {
case clientToken = "clientToken"
case jobId = "jobId"
}
}
public struct GetThirdPartyJobDetailsOutput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "jobDetails", required: false, type: .structure)
]
/// The details of the job, including any protected values defined for the job.
public let jobDetails: ThirdPartyJobDetails?
public init(jobDetails: ThirdPartyJobDetails? = nil) {
self.jobDetails = jobDetails
}
private enum CodingKeys: String, CodingKey {
case jobDetails = "jobDetails"
}
}
public struct InputArtifact: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "name", required: true, type: .string)
]
/// The name of the artifact to be worked on, for example, "My App". The input artifact of an action must exactly match the output artifact declared in a preceding action, but the input artifact does not have to be the next action in strict sequence from the action that provided the output artifact. Actions in parallel can declare different output artifacts, which are in turn consumed by different following actions.
public let name: String
public init(name: String) {
self.name = name
}
private enum CodingKeys: String, CodingKey {
case name = "name"
}
}
public struct Job: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "accountId", required: false, type: .string),
AWSShapeMember(label: "data", required: false, type: .structure),
AWSShapeMember(label: "id", required: false, type: .string),
AWSShapeMember(label: "nonce", required: false, type: .string)
]
/// The ID of the AWS account to use when performing the job.
public let accountId: String?
/// Additional data about a job.
public let data: JobData?
/// The unique system-generated ID of the job.
public let id: String?
/// A system-generated random number that AWS CodePipeline uses to ensure that the job is being worked on by only one job worker. Use this number in an AcknowledgeJob request.
public let nonce: String?
public init(accountId: String? = nil, data: JobData? = nil, id: String? = nil, nonce: String? = nil) {
self.accountId = accountId
self.data = data
self.id = id
self.nonce = nonce
}
private enum CodingKeys: String, CodingKey {
case accountId = "accountId"
case data = "data"
case id = "id"
case nonce = "nonce"
}
}
public struct JobData: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "actionConfiguration", required: false, type: .structure),
AWSShapeMember(label: "actionTypeId", required: false, type: .structure),
AWSShapeMember(label: "artifactCredentials", required: false, type: .structure),
AWSShapeMember(label: "continuationToken", required: false, type: .string),
AWSShapeMember(label: "encryptionKey", required: false, type: .structure),
AWSShapeMember(label: "inputArtifacts", required: false, type: .list),
AWSShapeMember(label: "outputArtifacts", required: false, type: .list),
AWSShapeMember(label: "pipelineContext", required: false, type: .structure)
]
/// Represents information about an action configuration.
public let actionConfiguration: ActionConfiguration?
/// Represents information about an action type.
public let actionTypeId: ActionTypeId?
/// Represents an AWS session credentials object. These credentials are temporary credentials that are issued by AWS Secure Token Service (STS). They can be used to access input and output artifacts in the Amazon S3 bucket used to store artifacts for the pipeline in AWS CodePipeline.
public let artifactCredentials: AWSSessionCredentials?
/// A system-generated token, such as a AWS CodeDeploy deployment ID, that a job requires in order to continue the job asynchronously.
public let continuationToken: String?
/// Represents information about the key used to encrypt data in the artifact store, such as an AWS Key Management Service (AWS KMS) key.
public let encryptionKey: EncryptionKey?
/// The artifact supplied to the job.
public let inputArtifacts: [Artifact]?
/// The output of the job.
public let outputArtifacts: [Artifact]?
/// Represents information about a pipeline to a job worker. Includes pipelineArn and pipelineExecutionId for Custom jobs.
public let pipelineContext: PipelineContext?
public init(actionConfiguration: ActionConfiguration? = nil, actionTypeId: ActionTypeId? = nil, artifactCredentials: AWSSessionCredentials? = nil, continuationToken: String? = nil, encryptionKey: EncryptionKey? = nil, inputArtifacts: [Artifact]? = nil, outputArtifacts: [Artifact]? = nil, pipelineContext: PipelineContext? = nil) {
self.actionConfiguration = actionConfiguration
self.actionTypeId = actionTypeId
self.artifactCredentials = artifactCredentials
self.continuationToken = continuationToken
self.encryptionKey = encryptionKey
self.inputArtifacts = inputArtifacts
self.outputArtifacts = outputArtifacts
self.pipelineContext = pipelineContext
}
private enum CodingKeys: String, CodingKey {
case actionConfiguration = "actionConfiguration"
case actionTypeId = "actionTypeId"
case artifactCredentials = "artifactCredentials"
case continuationToken = "continuationToken"
case encryptionKey = "encryptionKey"
case inputArtifacts = "inputArtifacts"
case outputArtifacts = "outputArtifacts"
case pipelineContext = "pipelineContext"
}
}
public struct JobDetails: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "accountId", required: false, type: .string),
AWSShapeMember(label: "data", required: false, type: .structure),
AWSShapeMember(label: "id", required: false, type: .string)
]
/// The AWS account ID associated with the job.
public let accountId: String?
/// Represents additional information about a job required for a job worker to complete the job.
public let data: JobData?
/// The unique system-generated ID of the job.
public let id: String?
public init(accountId: String? = nil, data: JobData? = nil, id: String? = nil) {
self.accountId = accountId
self.data = data
self.id = id
}
private enum CodingKeys: String, CodingKey {
case accountId = "accountId"
case data = "data"
case id = "id"
}
}
public enum JobStatus: String, CustomStringConvertible, Codable {
case created = "Created"
case queued = "Queued"
case dispatched = "Dispatched"
case inprogress = "InProgress"
case timedout = "TimedOut"
case succeeded = "Succeeded"
case failed = "Failed"
public var description: String { return self.rawValue }
}
public struct ListActionExecutionsInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "filter", required: false, type: .structure),
AWSShapeMember(label: "maxResults", required: false, type: .integer),
AWSShapeMember(label: "nextToken", required: false, type: .string),
AWSShapeMember(label: "pipelineName", required: true, type: .string)
]
/// Input information used to filter action execution history.
public let filter: ActionExecutionFilter?
/// The maximum number of results to return in a single call. To retrieve the remaining results, make another call with the returned nextToken value. Action execution history is retained for up to 12 months, based on action execution start times. Default value is 100. Detailed execution history is available for executions run on or after February 21, 2019.
public let maxResults: Int32?
/// The token that was returned from the previous ListActionExecutions call, which can be used to return the next set of action executions in the list.
public let nextToken: String?
/// The name of the pipeline for which you want to list action execution history.
public let pipelineName: String
public init(filter: ActionExecutionFilter? = nil, maxResults: Int32? = nil, nextToken: String? = nil, pipelineName: String) {
self.filter = filter
self.maxResults = maxResults
self.nextToken = nextToken
self.pipelineName = pipelineName
}
private enum CodingKeys: String, CodingKey {
case filter = "filter"
case maxResults = "maxResults"
case nextToken = "nextToken"
case pipelineName = "pipelineName"
}
}
public struct ListActionExecutionsOutput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "actionExecutionDetails", required: false, type: .list),
AWSShapeMember(label: "nextToken", required: false, type: .string)
]
/// The details for a list of recent executions, such as action execution ID.
public let actionExecutionDetails: [ActionExecutionDetail]?
/// If the amount of returned information is significantly large, an identifier is also returned and can be used in a subsequent ListActionExecutions call to return the next set of action executions in the list.
public let nextToken: String?
public init(actionExecutionDetails: [ActionExecutionDetail]? = nil, nextToken: String? = nil) {
self.actionExecutionDetails = actionExecutionDetails
self.nextToken = nextToken
}
private enum CodingKeys: String, CodingKey {
case actionExecutionDetails = "actionExecutionDetails"
case nextToken = "nextToken"
}
}
public struct ListActionTypesInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "actionOwnerFilter", required: false, type: .enum),
AWSShapeMember(label: "nextToken", required: false, type: .string)
]
/// Filters the list of action types to those created by a specified entity.
public let actionOwnerFilter: ActionOwner?
/// An identifier that was returned from the previous list action types call, which can be used to return the next set of action types in the list.
public let nextToken: String?
public init(actionOwnerFilter: ActionOwner? = nil, nextToken: String? = nil) {
self.actionOwnerFilter = actionOwnerFilter
self.nextToken = nextToken
}
private enum CodingKeys: String, CodingKey {
case actionOwnerFilter = "actionOwnerFilter"
case nextToken = "nextToken"
}
}
public struct ListActionTypesOutput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "actionTypes", required: true, type: .list),
AWSShapeMember(label: "nextToken", required: false, type: .string)
]
/// Provides details of the action types.
public let actionTypes: [ActionType]
/// If the amount of returned information is significantly large, an identifier is also returned which can be used in a subsequent list action types call to return the next set of action types in the list.
public let nextToken: String?
public init(actionTypes: [ActionType], nextToken: String? = nil) {
self.actionTypes = actionTypes
self.nextToken = nextToken
}
private enum CodingKeys: String, CodingKey {
case actionTypes = "actionTypes"
case nextToken = "nextToken"
}
}
public struct ListPipelineExecutionsInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "maxResults", required: false, type: .integer),
AWSShapeMember(label: "nextToken", required: false, type: .string),
AWSShapeMember(label: "pipelineName", required: true, type: .string)
]
/// The maximum number of results to return in a single call. To retrieve the remaining results, make another call with the returned nextToken value. Pipeline history is limited to the most recent 12 months, based on pipeline execution start times. Default value is 100.
public let maxResults: Int32?
/// The token that was returned from the previous ListPipelineExecutions call, which can be used to return the next set of pipeline executions in the list.
public let nextToken: String?
/// The name of the pipeline for which you want to get execution summary information.
public let pipelineName: String
public init(maxResults: Int32? = nil, nextToken: String? = nil, pipelineName: String) {
self.maxResults = maxResults
self.nextToken = nextToken
self.pipelineName = pipelineName
}
private enum CodingKeys: String, CodingKey {
case maxResults = "maxResults"
case nextToken = "nextToken"
case pipelineName = "pipelineName"
}
}
public struct ListPipelineExecutionsOutput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "nextToken", required: false, type: .string),
AWSShapeMember(label: "pipelineExecutionSummaries", required: false, type: .list)
]
/// A token that can be used in the next ListPipelineExecutions call. To view all items in the list, continue to call this operation with each subsequent token until no more nextToken values are returned.
public let nextToken: String?
/// A list of executions in the history of a pipeline.
public let pipelineExecutionSummaries: [PipelineExecutionSummary]?
public init(nextToken: String? = nil, pipelineExecutionSummaries: [PipelineExecutionSummary]? = nil) {
self.nextToken = nextToken
self.pipelineExecutionSummaries = pipelineExecutionSummaries
}
private enum CodingKeys: String, CodingKey {
case nextToken = "nextToken"
case pipelineExecutionSummaries = "pipelineExecutionSummaries"
}
}
public struct ListPipelinesInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "nextToken", required: false, type: .string)
]
/// An identifier that was returned from the previous list pipelines call, which can be used to return the next set of pipelines in the list.
public let nextToken: String?
public init(nextToken: String? = nil) {
self.nextToken = nextToken
}
private enum CodingKeys: String, CodingKey {
case nextToken = "nextToken"
}
}
public struct ListPipelinesOutput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "nextToken", required: false, type: .string),
AWSShapeMember(label: "pipelines", required: false, type: .list)
]
/// If the amount of returned information is significantly large, an identifier is also returned which can be used in a subsequent list pipelines call to return the next set of pipelines in the list.
public let nextToken: String?
/// The list of pipelines.
public let pipelines: [PipelineSummary]?
public init(nextToken: String? = nil, pipelines: [PipelineSummary]? = nil) {
self.nextToken = nextToken
self.pipelines = pipelines
}
private enum CodingKeys: String, CodingKey {
case nextToken = "nextToken"
case pipelines = "pipelines"
}
}
public struct ListTagsForResourceInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "maxResults", required: false, type: .integer),
AWSShapeMember(label: "nextToken", required: false, type: .string),
AWSShapeMember(label: "resourceArn", required: true, type: .string)
]
/// The maximum number of results to return in a single call.
public let maxResults: Int32?
/// The token that was returned from the previous API call, which would be used to return the next page of the list. However, the ListTagsforResource call lists all available tags in one call and does not use pagination.
public let nextToken: String?
/// The Amazon Resource Name (ARN) of the resource to get tags for.
public let resourceArn: String
public init(maxResults: Int32? = nil, nextToken: String? = nil, resourceArn: String) {
self.maxResults = maxResults
self.nextToken = nextToken
self.resourceArn = resourceArn
}
private enum CodingKeys: String, CodingKey {
case maxResults = "maxResults"
case nextToken = "nextToken"
case resourceArn = "resourceArn"
}
}
public struct ListTagsForResourceOutput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "nextToken", required: false, type: .string),
AWSShapeMember(label: "tags", required: false, type: .list)
]
/// If the amount of returned information is significantly large, an identifier is also returned and can be used in a subsequent API call to return the next page of the list. However, the ListTagsforResource call lists all available tags in one call and does not use pagination.
public let nextToken: String?
/// The tags for the resource.
public let tags: [Tag]?
public init(nextToken: String? = nil, tags: [Tag]? = nil) {
self.nextToken = nextToken
self.tags = tags
}
private enum CodingKeys: String, CodingKey {
case nextToken = "nextToken"
case tags = "tags"
}
}
public struct ListWebhookItem: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "arn", required: false, type: .string),
AWSShapeMember(label: "definition", required: true, type: .structure),
AWSShapeMember(label: "errorCode", required: false, type: .string),
AWSShapeMember(label: "errorMessage", required: false, type: .string),
AWSShapeMember(label: "lastTriggered", required: false, type: .timestamp),
AWSShapeMember(label: "tags", required: false, type: .list),
AWSShapeMember(label: "url", required: true, type: .string)
]
/// The Amazon Resource Name (ARN) of the webhook.
public let arn: String?
/// The detail returned for each webhook, such as the webhook authentication type and filter rules.
public let definition: WebhookDefinition
/// The number code of the error.
public let errorCode: String?
/// The text of the error message about the webhook.
public let errorMessage: String?
/// The date and time a webhook was last successfully triggered, in timestamp format.
public let lastTriggered: TimeStamp?
/// Specifies the tags applied to the webhook.
public let tags: [Tag]?
/// A unique URL generated by CodePipeline. When a POST request is made to this URL, the defined pipeline is started as long as the body of the post request satisfies the defined authentication and filtering conditions. Deleting and re-creating a webhook will make the old URL invalid and generate a new URL.
public let url: String
public init(arn: String? = nil, definition: WebhookDefinition, errorCode: String? = nil, errorMessage: String? = nil, lastTriggered: TimeStamp? = nil, tags: [Tag]? = nil, url: String) {
self.arn = arn
self.definition = definition
self.errorCode = errorCode
self.errorMessage = errorMessage
self.lastTriggered = lastTriggered
self.tags = tags
self.url = url
}
private enum CodingKeys: String, CodingKey {
case arn = "arn"
case definition = "definition"
case errorCode = "errorCode"
case errorMessage = "errorMessage"
case lastTriggered = "lastTriggered"
case tags = "tags"
case url = "url"
}
}
public struct ListWebhooksInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "MaxResults", required: false, type: .integer),
AWSShapeMember(label: "NextToken", required: false, type: .string)
]
/// The maximum number of results to return in a single call. To retrieve the remaining results, make another call with the returned nextToken value.
public let maxResults: Int32?
/// The token that was returned from the previous ListWebhooks call, which can be used to return the next set of webhooks in the list.
public let nextToken: String?
public init(maxResults: Int32? = nil, nextToken: String? = nil) {
self.maxResults = maxResults
self.nextToken = nextToken
}
private enum CodingKeys: String, CodingKey {
case maxResults = "MaxResults"
case nextToken = "NextToken"
}
}
public struct ListWebhooksOutput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "NextToken", required: false, type: .string),
AWSShapeMember(label: "webhooks", required: false, type: .list)
]
/// If the amount of returned information is significantly large, an identifier is also returned and can be used in a subsequent ListWebhooks call to return the next set of webhooks in the list.
public let nextToken: String?
/// The JSON detail returned for each webhook in the list output for the ListWebhooks call.
public let webhooks: [ListWebhookItem]?
public init(nextToken: String? = nil, webhooks: [ListWebhookItem]? = nil) {
self.nextToken = nextToken
self.webhooks = webhooks
}
private enum CodingKeys: String, CodingKey {
case nextToken = "NextToken"
case webhooks = "webhooks"
}
}
public struct OutputArtifact: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "name", required: true, type: .string)
]
/// The name of the output of an artifact, such as "My App". The input artifact of an action must exactly match the output artifact declared in a preceding action, but the input artifact does not have to be the next action in strict sequence from the action that provided the output artifact. Actions in parallel can declare different output artifacts, which are in turn consumed by different following actions. Output artifact names must be unique within a pipeline.
public let name: String
public init(name: String) {
self.name = name
}
private enum CodingKeys: String, CodingKey {
case name = "name"
}
}
public struct PipelineContext: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "action", required: false, type: .structure),
AWSShapeMember(label: "pipelineArn", required: false, type: .string),
AWSShapeMember(label: "pipelineExecutionId", required: false, type: .string),
AWSShapeMember(label: "pipelineName", required: false, type: .string),
AWSShapeMember(label: "stage", required: false, type: .structure)
]
/// The context of an action to a job worker within the stage of a pipeline.
public let action: ActionContext?
/// The Amazon Resource Name (ARN) of the pipeline.
public let pipelineArn: String?
/// The execution ID of the pipeline.
public let pipelineExecutionId: String?
/// The name of the pipeline. This is a user-specified value. Pipeline names must be unique across all pipeline names under an Amazon Web Services account.
public let pipelineName: String?
/// The stage of the pipeline.
public let stage: StageContext?
public init(action: ActionContext? = nil, pipelineArn: String? = nil, pipelineExecutionId: String? = nil, pipelineName: String? = nil, stage: StageContext? = nil) {
self.action = action
self.pipelineArn = pipelineArn
self.pipelineExecutionId = pipelineExecutionId
self.pipelineName = pipelineName
self.stage = stage
}
private enum CodingKeys: String, CodingKey {
case action = "action"
case pipelineArn = "pipelineArn"
case pipelineExecutionId = "pipelineExecutionId"
case pipelineName = "pipelineName"
case stage = "stage"
}
}
public struct PipelineDeclaration: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "artifactStore", required: false, type: .structure),
AWSShapeMember(label: "artifactStores", required: false, type: .map),
AWSShapeMember(label: "name", required: true, type: .string),
AWSShapeMember(label: "roleArn", required: true, type: .string),
AWSShapeMember(label: "stages", required: true, type: .list),
AWSShapeMember(label: "version", required: false, type: .integer)
]
/// Represents information about the Amazon S3 bucket where artifacts are stored for the pipeline.
public let artifactStore: ArtifactStore?
/// A mapping of artifactStore objects and their corresponding regions. There must be an artifact store for the pipeline region and for each cross-region action within the pipeline. You can only use either artifactStore or artifactStores, not both. If you create a cross-region action in your pipeline, you must use artifactStores.
public let artifactStores: [String: ArtifactStore]?
/// The name of the action to be performed.
public let name: String
/// The Amazon Resource Name (ARN) for AWS CodePipeline to use to either perform actions with no actionRoleArn, or to use to assume roles for actions with an actionRoleArn.
public let roleArn: String
/// The stage in which to perform the action.
public let stages: [StageDeclaration]
/// The version number of the pipeline. A new pipeline always has a version number of 1. This number is automatically incremented when a pipeline is updated.
public let version: Int32?
public init(artifactStore: ArtifactStore? = nil, artifactStores: [String: ArtifactStore]? = nil, name: String, roleArn: String, stages: [StageDeclaration], version: Int32? = nil) {
self.artifactStore = artifactStore
self.artifactStores = artifactStores
self.name = name
self.roleArn = roleArn
self.stages = stages
self.version = version
}
private enum CodingKeys: String, CodingKey {
case artifactStore = "artifactStore"
case artifactStores = "artifactStores"
case name = "name"
case roleArn = "roleArn"
case stages = "stages"
case version = "version"
}
}
public struct PipelineExecution: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "artifactRevisions", required: false, type: .list),
AWSShapeMember(label: "pipelineExecutionId", required: false, type: .string),
AWSShapeMember(label: "pipelineName", required: false, type: .string),
AWSShapeMember(label: "pipelineVersion", required: false, type: .integer),
AWSShapeMember(label: "status", required: false, type: .enum)
]
/// A list of ArtifactRevision objects included in a pipeline execution.
public let artifactRevisions: [ArtifactRevision]?
/// The ID of the pipeline execution.
public let pipelineExecutionId: String?
/// The name of the pipeline that was executed.
public let pipelineName: String?
/// The version number of the pipeline that was executed.
public let pipelineVersion: Int32?
/// The status of the pipeline execution. InProgress: The pipeline execution is currently running. Succeeded: The pipeline execution was completed successfully. Superseded: While this pipeline execution was waiting for the next stage to be completed, a newer pipeline execution advanced and continued through the pipeline instead. Failed: The pipeline execution was not completed successfully.
public let status: PipelineExecutionStatus?
public init(artifactRevisions: [ArtifactRevision]? = nil, pipelineExecutionId: String? = nil, pipelineName: String? = nil, pipelineVersion: Int32? = nil, status: PipelineExecutionStatus? = nil) {
self.artifactRevisions = artifactRevisions
self.pipelineExecutionId = pipelineExecutionId
self.pipelineName = pipelineName
self.pipelineVersion = pipelineVersion
self.status = status
}
private enum CodingKeys: String, CodingKey {
case artifactRevisions = "artifactRevisions"
case pipelineExecutionId = "pipelineExecutionId"
case pipelineName = "pipelineName"
case pipelineVersion = "pipelineVersion"
case status = "status"
}
}
public enum PipelineExecutionStatus: String, CustomStringConvertible, Codable {
case inprogress = "InProgress"
case succeeded = "Succeeded"
case superseded = "Superseded"
case failed = "Failed"
public var description: String { return self.rawValue }
}
public struct PipelineExecutionSummary: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "lastUpdateTime", required: false, type: .timestamp),
AWSShapeMember(label: "pipelineExecutionId", required: false, type: .string),
AWSShapeMember(label: "sourceRevisions", required: false, type: .list),
AWSShapeMember(label: "startTime", required: false, type: .timestamp),
AWSShapeMember(label: "status", required: false, type: .enum)
]
/// The date and time of the last change to the pipeline execution, in timestamp format.
public let lastUpdateTime: TimeStamp?
/// The ID of the pipeline execution.
public let pipelineExecutionId: String?
/// A list of the source artifact revisions that initiated a pipeline execution.
public let sourceRevisions: [SourceRevision]?
/// The date and time when the pipeline execution began, in timestamp format.
public let startTime: TimeStamp?
/// The status of the pipeline execution. InProgress: The pipeline execution is currently running. Succeeded: The pipeline execution was completed successfully. Superseded: While this pipeline execution was waiting for the next stage to be completed, a newer pipeline execution advanced and continued through the pipeline instead. Failed: The pipeline execution was not completed successfully.
public let status: PipelineExecutionStatus?
public init(lastUpdateTime: TimeStamp? = nil, pipelineExecutionId: String? = nil, sourceRevisions: [SourceRevision]? = nil, startTime: TimeStamp? = nil, status: PipelineExecutionStatus? = nil) {
self.lastUpdateTime = lastUpdateTime
self.pipelineExecutionId = pipelineExecutionId
self.sourceRevisions = sourceRevisions
self.startTime = startTime
self.status = status
}
private enum CodingKeys: String, CodingKey {
case lastUpdateTime = "lastUpdateTime"
case pipelineExecutionId = "pipelineExecutionId"
case sourceRevisions = "sourceRevisions"
case startTime = "startTime"
case status = "status"
}
}
public struct PipelineMetadata: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "created", required: false, type: .timestamp),
AWSShapeMember(label: "pipelineArn", required: false, type: .string),
AWSShapeMember(label: "updated", required: false, type: .timestamp)
]
/// The date and time the pipeline was created, in timestamp format.
public let created: TimeStamp?
/// The Amazon Resource Name (ARN) of the pipeline.
public let pipelineArn: String?
/// The date and time the pipeline was last updated, in timestamp format.
public let updated: TimeStamp?
public init(created: TimeStamp? = nil, pipelineArn: String? = nil, updated: TimeStamp? = nil) {
self.created = created
self.pipelineArn = pipelineArn
self.updated = updated
}
private enum CodingKeys: String, CodingKey {
case created = "created"
case pipelineArn = "pipelineArn"
case updated = "updated"
}
}
public struct PipelineSummary: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "created", required: false, type: .timestamp),
AWSShapeMember(label: "name", required: false, type: .string),
AWSShapeMember(label: "updated", required: false, type: .timestamp),
AWSShapeMember(label: "version", required: false, type: .integer)
]
/// The date and time the pipeline was created, in timestamp format.
public let created: TimeStamp?
/// The name of the pipeline.
public let name: String?
/// The date and time of the last update to the pipeline, in timestamp format.
public let updated: TimeStamp?
/// The version number of the pipeline.
public let version: Int32?
public init(created: TimeStamp? = nil, name: String? = nil, updated: TimeStamp? = nil, version: Int32? = nil) {
self.created = created
self.name = name
self.updated = updated
self.version = version
}
private enum CodingKeys: String, CodingKey {
case created = "created"
case name = "name"
case updated = "updated"
case version = "version"
}
}
public struct PollForJobsInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "actionTypeId", required: true, type: .structure),
AWSShapeMember(label: "maxBatchSize", required: false, type: .integer),
AWSShapeMember(label: "queryParam", required: false, type: .map)
]
/// Represents information about an action type.
public let actionTypeId: ActionTypeId
/// The maximum number of jobs to return in a poll for jobs call.
public let maxBatchSize: Int32?
/// A map of property names and values. For an action type with no queryable properties, this value must be null or an empty map. For an action type with a queryable property, you must supply that property as a key in the map. Only jobs whose action configuration matches the mapped value will be returned.
public let queryParam: [String: String]?
public init(actionTypeId: ActionTypeId, maxBatchSize: Int32? = nil, queryParam: [String: String]? = nil) {
self.actionTypeId = actionTypeId
self.maxBatchSize = maxBatchSize
self.queryParam = queryParam
}
private enum CodingKeys: String, CodingKey {
case actionTypeId = "actionTypeId"
case maxBatchSize = "maxBatchSize"
case queryParam = "queryParam"
}
}
public struct PollForJobsOutput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "jobs", required: false, type: .list)
]
/// Information about the jobs to take action on.
public let jobs: [Job]?
public init(jobs: [Job]? = nil) {
self.jobs = jobs
}
private enum CodingKeys: String, CodingKey {
case jobs = "jobs"
}
}
public struct PollForThirdPartyJobsInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "actionTypeId", required: true, type: .structure),
AWSShapeMember(label: "maxBatchSize", required: false, type: .integer)
]
/// Represents information about an action type.
public let actionTypeId: ActionTypeId
/// The maximum number of jobs to return in a poll for jobs call.
public let maxBatchSize: Int32?
public init(actionTypeId: ActionTypeId, maxBatchSize: Int32? = nil) {
self.actionTypeId = actionTypeId
self.maxBatchSize = maxBatchSize
}
private enum CodingKeys: String, CodingKey {
case actionTypeId = "actionTypeId"
case maxBatchSize = "maxBatchSize"
}
}
public struct PollForThirdPartyJobsOutput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "jobs", required: false, type: .list)
]
/// Information about the jobs to take action on.
public let jobs: [ThirdPartyJob]?
public init(jobs: [ThirdPartyJob]? = nil) {
self.jobs = jobs
}
private enum CodingKeys: String, CodingKey {
case jobs = "jobs"
}
}
public struct PutActionRevisionInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "actionName", required: true, type: .string),
AWSShapeMember(label: "actionRevision", required: true, type: .structure),
AWSShapeMember(label: "pipelineName", required: true, type: .string),
AWSShapeMember(label: "stageName", required: true, type: .string)
]
/// The name of the action that will process the revision.
public let actionName: String
/// Represents information about the version (or revision) of an action.
public let actionRevision: ActionRevision
/// The name of the pipeline that will start processing the revision to the source.
public let pipelineName: String
/// The name of the stage that contains the action that will act upon the revision.
public let stageName: String
public init(actionName: String, actionRevision: ActionRevision, pipelineName: String, stageName: String) {
self.actionName = actionName
self.actionRevision = actionRevision
self.pipelineName = pipelineName
self.stageName = stageName
}
private enum CodingKeys: String, CodingKey {
case actionName = "actionName"
case actionRevision = "actionRevision"
case pipelineName = "pipelineName"
case stageName = "stageName"
}
}
public struct PutActionRevisionOutput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "newRevision", required: false, type: .boolean),
AWSShapeMember(label: "pipelineExecutionId", required: false, type: .string)
]
/// Indicates whether the artifact revision was previously used in an execution of the specified pipeline.
public let newRevision: Bool?
/// The ID of the current workflow state of the pipeline.
public let pipelineExecutionId: String?
public init(newRevision: Bool? = nil, pipelineExecutionId: String? = nil) {
self.newRevision = newRevision
self.pipelineExecutionId = pipelineExecutionId
}
private enum CodingKeys: String, CodingKey {
case newRevision = "newRevision"
case pipelineExecutionId = "pipelineExecutionId"
}
}
public struct PutApprovalResultInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "actionName", required: true, type: .string),
AWSShapeMember(label: "pipelineName", required: true, type: .string),
AWSShapeMember(label: "result", required: true, type: .structure),
AWSShapeMember(label: "stageName", required: true, type: .string),
AWSShapeMember(label: "token", required: true, type: .string)
]
/// The name of the action for which approval is requested.
public let actionName: String
/// The name of the pipeline that contains the action.
public let pipelineName: String
/// Represents information about the result of the approval request.
public let result: ApprovalResult
/// The name of the stage that contains the action.
public let stageName: String
/// The system-generated token used to identify a unique approval request. The token for each open approval request can be obtained using the GetPipelineState action and is used to validate that the approval request corresponding to this token is still valid.
public let token: String
public init(actionName: String, pipelineName: String, result: ApprovalResult, stageName: String, token: String) {
self.actionName = actionName
self.pipelineName = pipelineName
self.result = result
self.stageName = stageName
self.token = token
}
private enum CodingKeys: String, CodingKey {
case actionName = "actionName"
case pipelineName = "pipelineName"
case result = "result"
case stageName = "stageName"
case token = "token"
}
}
public struct PutApprovalResultOutput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "approvedAt", required: false, type: .timestamp)
]
/// The timestamp showing when the approval or rejection was submitted.
public let approvedAt: TimeStamp?
public init(approvedAt: TimeStamp? = nil) {
self.approvedAt = approvedAt
}
private enum CodingKeys: String, CodingKey {
case approvedAt = "approvedAt"
}
}
public struct PutJobFailureResultInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "failureDetails", required: true, type: .structure),
AWSShapeMember(label: "jobId", required: true, type: .string)
]
/// The details about the failure of a job.
public let failureDetails: FailureDetails
/// The unique system-generated ID of the job that failed. This is the same ID returned from PollForJobs.
public let jobId: String
public init(failureDetails: FailureDetails, jobId: String) {
self.failureDetails = failureDetails
self.jobId = jobId
}
private enum CodingKeys: String, CodingKey {
case failureDetails = "failureDetails"
case jobId = "jobId"
}
}
public struct PutJobSuccessResultInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "continuationToken", required: false, type: .string),
AWSShapeMember(label: "currentRevision", required: false, type: .structure),
AWSShapeMember(label: "executionDetails", required: false, type: .structure),
AWSShapeMember(label: "jobId", required: true, type: .string)
]
/// A token generated by a job worker, such as an AWS CodeDeploy deployment ID, that a successful job provides to identify a custom action in progress. Future jobs will use this token in order to identify the running instance of the action. It can be reused to return additional information about the progress of the custom action. When the action is complete, no continuation token should be supplied.
public let continuationToken: String?
/// The ID of the current revision of the artifact successfully worked upon by the job.
public let currentRevision: CurrentRevision?
/// The execution details of the successful job, such as the actions taken by the job worker.
public let executionDetails: ExecutionDetails?
/// The unique system-generated ID of the job that succeeded. This is the same ID returned from PollForJobs.
public let jobId: String
public init(continuationToken: String? = nil, currentRevision: CurrentRevision? = nil, executionDetails: ExecutionDetails? = nil, jobId: String) {
self.continuationToken = continuationToken
self.currentRevision = currentRevision
self.executionDetails = executionDetails
self.jobId = jobId
}
private enum CodingKeys: String, CodingKey {
case continuationToken = "continuationToken"
case currentRevision = "currentRevision"
case executionDetails = "executionDetails"
case jobId = "jobId"
}
}
public struct PutThirdPartyJobFailureResultInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "clientToken", required: true, type: .string),
AWSShapeMember(label: "failureDetails", required: true, type: .structure),
AWSShapeMember(label: "jobId", required: true, type: .string)
]
/// The clientToken portion of the clientId and clientToken pair used to verify that the calling entity is allowed access to the job and its details.
public let clientToken: String
/// Represents information about failure details.
public let failureDetails: FailureDetails
/// The ID of the job that failed. This is the same ID returned from PollForThirdPartyJobs.
public let jobId: String
public init(clientToken: String, failureDetails: FailureDetails, jobId: String) {
self.clientToken = clientToken
self.failureDetails = failureDetails
self.jobId = jobId
}
private enum CodingKeys: String, CodingKey {
case clientToken = "clientToken"
case failureDetails = "failureDetails"
case jobId = "jobId"
}
}
public struct PutThirdPartyJobSuccessResultInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "clientToken", required: true, type: .string),
AWSShapeMember(label: "continuationToken", required: false, type: .string),
AWSShapeMember(label: "currentRevision", required: false, type: .structure),
AWSShapeMember(label: "executionDetails", required: false, type: .structure),
AWSShapeMember(label: "jobId", required: true, type: .string)
]
/// The clientToken portion of the clientId and clientToken pair used to verify that the calling entity is allowed access to the job and its details.
public let clientToken: String
/// A token generated by a job worker, such as an AWS CodeDeploy deployment ID, that a successful job provides to identify a partner action in progress. Future jobs will use this token in order to identify the running instance of the action. It can be reused to return additional information about the progress of the partner action. When the action is complete, no continuation token should be supplied.
public let continuationToken: String?
/// Represents information about a current revision.
public let currentRevision: CurrentRevision?
/// The details of the actions taken and results produced on an artifact as it passes through stages in the pipeline.
public let executionDetails: ExecutionDetails?
/// The ID of the job that successfully completed. This is the same ID returned from PollForThirdPartyJobs.
public let jobId: String
public init(clientToken: String, continuationToken: String? = nil, currentRevision: CurrentRevision? = nil, executionDetails: ExecutionDetails? = nil, jobId: String) {
self.clientToken = clientToken
self.continuationToken = continuationToken
self.currentRevision = currentRevision
self.executionDetails = executionDetails
self.jobId = jobId
}
private enum CodingKeys: String, CodingKey {
case clientToken = "clientToken"
case continuationToken = "continuationToken"
case currentRevision = "currentRevision"
case executionDetails = "executionDetails"
case jobId = "jobId"
}
}
public struct PutWebhookInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "tags", required: false, type: .list),
AWSShapeMember(label: "webhook", required: true, type: .structure)
]
/// The tags for the webhook.
public let tags: [Tag]?
/// The detail provided in an input file to create the webhook, such as the webhook name, the pipeline name, and the action name. Give the webhook a unique name which identifies the webhook being defined. You may choose to name the webhook after the pipeline and action it targets so that you can easily recognize what it's used for later.
public let webhook: WebhookDefinition
public init(tags: [Tag]? = nil, webhook: WebhookDefinition) {
self.tags = tags
self.webhook = webhook
}
private enum CodingKeys: String, CodingKey {
case tags = "tags"
case webhook = "webhook"
}
}
public struct PutWebhookOutput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "webhook", required: false, type: .structure)
]
/// The detail returned from creating the webhook, such as the webhook name, webhook URL, and webhook ARN.
public let webhook: ListWebhookItem?
public init(webhook: ListWebhookItem? = nil) {
self.webhook = webhook
}
private enum CodingKeys: String, CodingKey {
case webhook = "webhook"
}
}
public struct RegisterWebhookWithThirdPartyInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "webhookName", required: false, type: .string)
]
/// The name of an existing webhook created with PutWebhook to register with a supported third party.
public let webhookName: String?
public init(webhookName: String? = nil) {
self.webhookName = webhookName
}
private enum CodingKeys: String, CodingKey {
case webhookName = "webhookName"
}
}
public struct RegisterWebhookWithThirdPartyOutput: AWSShape {
public init() {
}
}
public struct RetryStageExecutionInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "pipelineExecutionId", required: true, type: .string),
AWSShapeMember(label: "pipelineName", required: true, type: .string),
AWSShapeMember(label: "retryMode", required: true, type: .enum),
AWSShapeMember(label: "stageName", required: true, type: .string)
]
/// The ID of the pipeline execution in the failed stage to be retried. Use the GetPipelineState action to retrieve the current pipelineExecutionId of the failed stage
public let pipelineExecutionId: String
/// The name of the pipeline that contains the failed stage.
public let pipelineName: String
/// The scope of the retry attempt. Currently, the only supported value is FAILED_ACTIONS.
public let retryMode: StageRetryMode
/// The name of the failed stage to be retried.
public let stageName: String
public init(pipelineExecutionId: String, pipelineName: String, retryMode: StageRetryMode, stageName: String) {
self.pipelineExecutionId = pipelineExecutionId
self.pipelineName = pipelineName
self.retryMode = retryMode
self.stageName = stageName
}
private enum CodingKeys: String, CodingKey {
case pipelineExecutionId = "pipelineExecutionId"
case pipelineName = "pipelineName"
case retryMode = "retryMode"
case stageName = "stageName"
}
}
public struct RetryStageExecutionOutput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "pipelineExecutionId", required: false, type: .string)
]
/// The ID of the current workflow execution in the failed stage.
public let pipelineExecutionId: String?
public init(pipelineExecutionId: String? = nil) {
self.pipelineExecutionId = pipelineExecutionId
}
private enum CodingKeys: String, CodingKey {
case pipelineExecutionId = "pipelineExecutionId"
}
}
public struct S3ArtifactLocation: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "bucketName", required: true, type: .string),
AWSShapeMember(label: "objectKey", required: true, type: .string)
]
/// The name of the Amazon S3 bucket.
public let bucketName: String
/// The key of the object in the Amazon S3 bucket, which uniquely identifies the object in the bucket.
public let objectKey: String
public init(bucketName: String, objectKey: String) {
self.bucketName = bucketName
self.objectKey = objectKey
}
private enum CodingKeys: String, CodingKey {
case bucketName = "bucketName"
case objectKey = "objectKey"
}
}
public struct S3Location: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "bucket", required: false, type: .string),
AWSShapeMember(label: "key", required: false, type: .string)
]
/// The Amazon S3 artifact bucket for an action's artifacts.
public let bucket: String?
/// The artifact name.
public let key: String?
public init(bucket: String? = nil, key: String? = nil) {
self.bucket = bucket
self.key = key
}
private enum CodingKeys: String, CodingKey {
case bucket = "bucket"
case key = "key"
}
}
public struct SourceRevision: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "actionName", required: true, type: .string),
AWSShapeMember(label: "revisionId", required: false, type: .string),
AWSShapeMember(label: "revisionSummary", required: false, type: .string),
AWSShapeMember(label: "revisionUrl", required: false, type: .string)
]
/// The name of the action that processed the revision to the source artifact.
public let actionName: String
/// The system-generated unique ID that identifies the revision number of the artifact.
public let revisionId: String?
/// Summary information about the most recent revision of the artifact. For GitHub and AWS CodeCommit repositories, the commit message. For Amazon S3 buckets or actions, the user-provided content of a codepipeline-artifact-revision-summary key specified in the object metadata.
public let revisionSummary: String?
/// The commit ID for the artifact revision. For artifacts stored in GitHub or AWS CodeCommit repositories, the commit ID is linked to a commit details page.
public let revisionUrl: String?
public init(actionName: String, revisionId: String? = nil, revisionSummary: String? = nil, revisionUrl: String? = nil) {
self.actionName = actionName
self.revisionId = revisionId
self.revisionSummary = revisionSummary
self.revisionUrl = revisionUrl
}
private enum CodingKeys: String, CodingKey {
case actionName = "actionName"
case revisionId = "revisionId"
case revisionSummary = "revisionSummary"
case revisionUrl = "revisionUrl"
}
}
public struct StageContext: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "name", required: false, type: .string)
]
/// The name of the stage.
public let name: String?
public init(name: String? = nil) {
self.name = name
}
private enum CodingKeys: String, CodingKey {
case name = "name"
}
}
public struct StageDeclaration: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "actions", required: true, type: .list),
AWSShapeMember(label: "blockers", required: false, type: .list),
AWSShapeMember(label: "name", required: true, type: .string)
]
/// The actions included in a stage.
public let actions: [ActionDeclaration]
/// Reserved for future use.
public let blockers: [BlockerDeclaration]?
/// The name of the stage.
public let name: String
public init(actions: [ActionDeclaration], blockers: [BlockerDeclaration]? = nil, name: String) {
self.actions = actions
self.blockers = blockers
self.name = name
}
private enum CodingKeys: String, CodingKey {
case actions = "actions"
case blockers = "blockers"
case name = "name"
}
}
public struct StageExecution: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "pipelineExecutionId", required: true, type: .string),
AWSShapeMember(label: "status", required: true, type: .enum)
]
/// The ID of the pipeline execution associated with the stage.
public let pipelineExecutionId: String
/// The status of the stage, or for a completed stage, the last status of the stage.
public let status: StageExecutionStatus
public init(pipelineExecutionId: String, status: StageExecutionStatus) {
self.pipelineExecutionId = pipelineExecutionId
self.status = status
}
private enum CodingKeys: String, CodingKey {
case pipelineExecutionId = "pipelineExecutionId"
case status = "status"
}
}
public enum StageExecutionStatus: String, CustomStringConvertible, Codable {
case inprogress = "InProgress"
case failed = "Failed"
case succeeded = "Succeeded"
public var description: String { return self.rawValue }
}
public enum StageRetryMode: String, CustomStringConvertible, Codable {
case failedActions = "FAILED_ACTIONS"
public var description: String { return self.rawValue }
}
public struct StageState: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "actionStates", required: false, type: .list),
AWSShapeMember(label: "inboundTransitionState", required: false, type: .structure),
AWSShapeMember(label: "latestExecution", required: false, type: .structure),
AWSShapeMember(label: "stageName", required: false, type: .string)
]
/// The state of the stage.
public let actionStates: [ActionState]?
/// The state of the inbound transition, which is either enabled or disabled.
public let inboundTransitionState: TransitionState?
/// Information about the latest execution in the stage, including its ID and status.
public let latestExecution: StageExecution?
/// The name of the stage.
public let stageName: String?
public init(actionStates: [ActionState]? = nil, inboundTransitionState: TransitionState? = nil, latestExecution: StageExecution? = nil, stageName: String? = nil) {
self.actionStates = actionStates
self.inboundTransitionState = inboundTransitionState
self.latestExecution = latestExecution
self.stageName = stageName
}
private enum CodingKeys: String, CodingKey {
case actionStates = "actionStates"
case inboundTransitionState = "inboundTransitionState"
case latestExecution = "latestExecution"
case stageName = "stageName"
}
}
public enum StageTransitionType: String, CustomStringConvertible, Codable {
case inbound = "Inbound"
case outbound = "Outbound"
public var description: String { return self.rawValue }
}
public struct StartPipelineExecutionInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "clientRequestToken", required: false, type: .string),
AWSShapeMember(label: "name", required: true, type: .string)
]
/// The system-generated unique ID used to identify a unique execution request.
public let clientRequestToken: String?
/// The name of the pipeline to start.
public let name: String
public init(clientRequestToken: String? = nil, name: String) {
self.clientRequestToken = clientRequestToken
self.name = name
}
private enum CodingKeys: String, CodingKey {
case clientRequestToken = "clientRequestToken"
case name = "name"
}
}
public struct StartPipelineExecutionOutput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "pipelineExecutionId", required: false, type: .string)
]
/// The unique system-generated ID of the pipeline execution that was started.
public let pipelineExecutionId: String?
public init(pipelineExecutionId: String? = nil) {
self.pipelineExecutionId = pipelineExecutionId
}
private enum CodingKeys: String, CodingKey {
case pipelineExecutionId = "pipelineExecutionId"
}
}
public struct Tag: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "key", required: true, type: .string),
AWSShapeMember(label: "value", required: true, type: .string)
]
/// The tag's key.
public let key: String
/// The tag's 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 TagResourceInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "resourceArn", required: true, type: .string),
AWSShapeMember(label: "tags", required: true, type: .list)
]
/// The Amazon Resource Name (ARN) of the resource you want to add tags to.
public let resourceArn: String
/// The tags you want to modify or add to the resource.
public let tags: [Tag]
public init(resourceArn: String, tags: [Tag]) {
self.resourceArn = resourceArn
self.tags = tags
}
private enum CodingKeys: String, CodingKey {
case resourceArn = "resourceArn"
case tags = "tags"
}
}
public struct TagResourceOutput: AWSShape {
public init() {
}
}
public struct ThirdPartyJob: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "clientId", required: false, type: .string),
AWSShapeMember(label: "jobId", required: false, type: .string)
]
/// The clientToken portion of the clientId and clientToken pair used to verify that the calling entity is allowed access to the job and its details.
public let clientId: String?
/// The identifier used to identify the job in AWS CodePipeline.
public let jobId: String?
public init(clientId: String? = nil, jobId: String? = nil) {
self.clientId = clientId
self.jobId = jobId
}
private enum CodingKeys: String, CodingKey {
case clientId = "clientId"
case jobId = "jobId"
}
}
public struct ThirdPartyJobData: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "actionConfiguration", required: false, type: .structure),
AWSShapeMember(label: "actionTypeId", required: false, type: .structure),
AWSShapeMember(label: "artifactCredentials", required: false, type: .structure),
AWSShapeMember(label: "continuationToken", required: false, type: .string),
AWSShapeMember(label: "encryptionKey", required: false, type: .structure),
AWSShapeMember(label: "inputArtifacts", required: false, type: .list),
AWSShapeMember(label: "outputArtifacts", required: false, type: .list),
AWSShapeMember(label: "pipelineContext", required: false, type: .structure)
]
/// Represents information about an action configuration.
public let actionConfiguration: ActionConfiguration?
/// Represents information about an action type.
public let actionTypeId: ActionTypeId?
/// Represents an AWS session credentials object. These credentials are temporary credentials that are issued by AWS Secure Token Service (STS). They can be used to access input and output artifacts in the Amazon S3 bucket used to store artifact for the pipeline in AWS CodePipeline.
public let artifactCredentials: AWSSessionCredentials?
/// A system-generated token, such as a AWS CodeDeploy deployment ID, that a job requires in order to continue the job asynchronously.
public let continuationToken: String?
/// The encryption key used to encrypt and decrypt data in the artifact store for the pipeline, such as an AWS Key Management Service (AWS KMS) key. This is optional and might not be present.
public let encryptionKey: EncryptionKey?
/// The name of the artifact that will be worked upon by the action, if any. This name might be system-generated, such as "MyApp", or might be defined by the user when the action is created. The input artifact name must match the name of an output artifact generated by an action in an earlier action or stage of the pipeline.
public let inputArtifacts: [Artifact]?
/// The name of the artifact that will be the result of the action, if any. This name might be system-generated, such as "MyBuiltApp", or might be defined by the user when the action is created.
public let outputArtifacts: [Artifact]?
/// Represents information about a pipeline to a job worker. Does not include pipelineArn and pipelineExecutionId for ThirdParty jobs.
public let pipelineContext: PipelineContext?
public init(actionConfiguration: ActionConfiguration? = nil, actionTypeId: ActionTypeId? = nil, artifactCredentials: AWSSessionCredentials? = nil, continuationToken: String? = nil, encryptionKey: EncryptionKey? = nil, inputArtifacts: [Artifact]? = nil, outputArtifacts: [Artifact]? = nil, pipelineContext: PipelineContext? = nil) {
self.actionConfiguration = actionConfiguration
self.actionTypeId = actionTypeId
self.artifactCredentials = artifactCredentials
self.continuationToken = continuationToken
self.encryptionKey = encryptionKey
self.inputArtifacts = inputArtifacts
self.outputArtifacts = outputArtifacts
self.pipelineContext = pipelineContext
}
private enum CodingKeys: String, CodingKey {
case actionConfiguration = "actionConfiguration"
case actionTypeId = "actionTypeId"
case artifactCredentials = "artifactCredentials"
case continuationToken = "continuationToken"
case encryptionKey = "encryptionKey"
case inputArtifacts = "inputArtifacts"
case outputArtifacts = "outputArtifacts"
case pipelineContext = "pipelineContext"
}
}
public struct ThirdPartyJobDetails: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "data", required: false, type: .structure),
AWSShapeMember(label: "id", required: false, type: .string),
AWSShapeMember(label: "nonce", required: false, type: .string)
]
/// The data to be returned by the third party job worker.
public let data: ThirdPartyJobData?
/// The identifier used to identify the job details in AWS CodePipeline.
public let id: String?
/// A system-generated random number that AWS CodePipeline uses to ensure that the job is being worked on by only one job worker. Use this number in an AcknowledgeThirdPartyJob request.
public let nonce: String?
public init(data: ThirdPartyJobData? = nil, id: String? = nil, nonce: String? = nil) {
self.data = data
self.id = id
self.nonce = nonce
}
private enum CodingKeys: String, CodingKey {
case data = "data"
case id = "id"
case nonce = "nonce"
}
}
public struct TransitionState: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "disabledReason", required: false, type: .string),
AWSShapeMember(label: "enabled", required: false, type: .boolean),
AWSShapeMember(label: "lastChangedAt", required: false, type: .timestamp),
AWSShapeMember(label: "lastChangedBy", required: false, type: .string)
]
/// The user-specified reason why the transition between two stages of a pipeline was disabled.
public let disabledReason: String?
/// Whether the transition between stages is enabled (true) or disabled (false).
public let enabled: Bool?
/// The timestamp when the transition state was last changed.
public let lastChangedAt: TimeStamp?
/// The ID of the user who last changed the transition state.
public let lastChangedBy: String?
public init(disabledReason: String? = nil, enabled: Bool? = nil, lastChangedAt: TimeStamp? = nil, lastChangedBy: String? = nil) {
self.disabledReason = disabledReason
self.enabled = enabled
self.lastChangedAt = lastChangedAt
self.lastChangedBy = lastChangedBy
}
private enum CodingKeys: String, CodingKey {
case disabledReason = "disabledReason"
case enabled = "enabled"
case lastChangedAt = "lastChangedAt"
case lastChangedBy = "lastChangedBy"
}
}
public struct UntagResourceInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "resourceArn", required: true, type: .string),
AWSShapeMember(label: "tagKeys", required: true, type: .list)
]
/// The Amazon Resource Name (ARN) of the resource to remove tags from.
public let resourceArn: String
/// The list of keys for the tags to be removed from the resource.
public let tagKeys: [String]
public init(resourceArn: String, tagKeys: [String]) {
self.resourceArn = resourceArn
self.tagKeys = tagKeys
}
private enum CodingKeys: String, CodingKey {
case resourceArn = "resourceArn"
case tagKeys = "tagKeys"
}
}
public struct UntagResourceOutput: AWSShape {
public init() {
}
}
public struct UpdatePipelineInput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "pipeline", required: true, type: .structure)
]
/// The name of the pipeline to be updated.
public let pipeline: PipelineDeclaration
public init(pipeline: PipelineDeclaration) {
self.pipeline = pipeline
}
private enum CodingKeys: String, CodingKey {
case pipeline = "pipeline"
}
}
public struct UpdatePipelineOutput: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "pipeline", required: false, type: .structure)
]
/// The structure of the updated pipeline.
public let pipeline: PipelineDeclaration?
public init(pipeline: PipelineDeclaration? = nil) {
self.pipeline = pipeline
}
private enum CodingKeys: String, CodingKey {
case pipeline = "pipeline"
}
}
public struct WebhookAuthConfiguration: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "AllowedIPRange", required: false, type: .string),
AWSShapeMember(label: "SecretToken", required: false, type: .string)
]
/// The property used to configure acceptance of webhooks within a specific IP range. For IP, only the AllowedIPRange property must be set, and this property must be set to a valid CIDR range.
public let allowedIPRange: String?
/// The property used to configure GitHub authentication. For GITHUB_HMAC, only the SecretToken property must be set.
public let secretToken: String?
public init(allowedIPRange: String? = nil, secretToken: String? = nil) {
self.allowedIPRange = allowedIPRange
self.secretToken = secretToken
}
private enum CodingKeys: String, CodingKey {
case allowedIPRange = "AllowedIPRange"
case secretToken = "SecretToken"
}
}
public enum WebhookAuthenticationType: String, CustomStringConvertible, Codable {
case githubHmac = "GITHUB_HMAC"
case ip = "IP"
case unauthenticated = "UNAUTHENTICATED"
public var description: String { return self.rawValue }
}
public struct WebhookDefinition: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "authentication", required: true, type: .enum),
AWSShapeMember(label: "authenticationConfiguration", required: true, type: .structure),
AWSShapeMember(label: "filters", required: true, type: .list),
AWSShapeMember(label: "name", required: true, type: .string),
AWSShapeMember(label: "targetAction", required: true, type: .string),
AWSShapeMember(label: "targetPipeline", required: true, type: .string)
]
/// Supported options are GITHUB_HMAC, IP and UNAUTHENTICATED. For information about the authentication scheme implemented by GITHUB_HMAC, see Securing your webhooks on the GitHub Developer website. IP will reject webhooks trigger requests unless they originate from an IP within the IP range whitelisted in the authentication configuration. UNAUTHENTICATED will accept all webhook trigger requests regardless of origin.
public let authentication: WebhookAuthenticationType
/// Properties that configure the authentication applied to incoming webhook trigger requests. The required properties depend on the authentication type. For GITHUB_HMAC, only the SecretToken property must be set. For IP, only the AllowedIPRange property must be set to a valid CIDR range. For UNAUTHENTICATED, no properties can be set.
public let authenticationConfiguration: WebhookAuthConfiguration
/// A list of rules applied to the body/payload sent in the POST request to a webhook URL. All defined rules must pass for the request to be accepted and the pipeline started.
public let filters: [WebhookFilterRule]
/// The name of the webhook.
public let name: String
/// The name of the action in a pipeline you want to connect to the webhook. The action must be from the source (first) stage of the pipeline.
public let targetAction: String
/// The name of the pipeline you want to connect to the webhook.
public let targetPipeline: String
public init(authentication: WebhookAuthenticationType, authenticationConfiguration: WebhookAuthConfiguration, filters: [WebhookFilterRule], name: String, targetAction: String, targetPipeline: String) {
self.authentication = authentication
self.authenticationConfiguration = authenticationConfiguration
self.filters = filters
self.name = name
self.targetAction = targetAction
self.targetPipeline = targetPipeline
}
private enum CodingKeys: String, CodingKey {
case authentication = "authentication"
case authenticationConfiguration = "authenticationConfiguration"
case filters = "filters"
case name = "name"
case targetAction = "targetAction"
case targetPipeline = "targetPipeline"
}
}
public struct WebhookFilterRule: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "jsonPath", required: true, type: .string),
AWSShapeMember(label: "matchEquals", required: false, type: .string)
]
/// A JsonPath expression that will be applied to the body/payload of the webhook. The value selected by the JsonPath expression must match the value specified in the MatchEquals field, otherwise the request will be ignored. For more information about JsonPath expressions, see Java JsonPath implementation in GitHub.
public let jsonPath: String
/// The value selected by the JsonPath expression must match what is supplied in the MatchEquals field, otherwise the request will be ignored. Properties from the target action configuration can be included as placeholders in this value by surrounding the action configuration key with curly braces. For example, if the value supplied here is "refs/heads/{Branch}" and the target action has an action configuration property called "Branch" with a value of "master", the MatchEquals value will be evaluated as "refs/heads/master". For a list of action configuration properties for built-in action types, see Pipeline Structure Reference Action Requirements.
public let matchEquals: String?
public init(jsonPath: String, matchEquals: String? = nil) {
self.jsonPath = jsonPath
self.matchEquals = matchEquals
}
private enum CodingKeys: String, CodingKey {
case jsonPath = "jsonPath"
case matchEquals = "matchEquals"
}
}
} | [
-1
] |
c14536f4fac7399410c3468b07c0c1f6784c309a | fa464b0c228b02caab7303f7a763240623fd0f11 | /Secret Swift/ViewController.swift | 3c8ffff7438e485693445d02ad644bc193e711b5 | [] | no_license | ArturAzarau/Secret-Swift | d4bfc7bd0638d52f9f2f31e8770673428d94d1eb | 8664f89011bcf671f6028262e3b4bdbb0495e9f4 | refs/heads/master | 2020-03-26T11:48:54.581130 | 2018-08-15T14:47:44 | 2018-08-15T14:47:44 | 144,861,063 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,879 | swift | //
// ViewController.swift
// Secret Swift
//
// Created by Артур Азаров on 15.08.2018.
// Copyright © 2018 Артур Азаров. All rights reserved.
//
import UIKit
import LocalAuthentication
class ViewController: UIViewController {
// MARK: - Properties
@IBOutlet var secret: UITextView!
// MARK: - Actions
@IBAction func authenticateTapped(_ sender: Any) {
let context = LAContext()
var error: NSError?
if context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) {
let reason = "Identify yourself!"
context.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: reason) { (success, error) in
DispatchQueue.main.async { [unowned self] in
if success {
self.unlockSecretMessage()
} else {
let ac = UIAlertController(title: "Authentication failed", message: "You could not be verified; please try again.", preferredStyle: .alert)
ac.addAction(UIAlertAction(title: "OK", style: .default))
self.present(ac, animated: true)
}
}
}
} else {
let ac = UIAlertController(title: "Biometry unavailable", message: "Your device is not configured for biometric authentication.", preferredStyle: .alert)
ac.addAction(UIAlertAction(title: "OK", style: .default))
self.present(ac, animated: true)
}
unlockSecretMessage()
}
// MARK: - View life cycle
override func viewDidLoad() {
super.viewDidLoad()
registerForKeyboardNotifications()
registerForAppWillResignActive()
}
// MARK: - Methods
private func registerForKeyboardNotifications() {
let notificationCenter = NotificationCenter.default
notificationCenter.addObserver(self, selector: #selector(adjustForKeyboard(notification:)), name: Notification.Name.UIKeyboardWillHide, object: nil)
notificationCenter.addObserver(self, selector: #selector(adjustForKeyboard(notification:)), name: Notification.Name.UIKeyboardWillChangeFrame, object: nil)
}
// MARK: -
@objc private func adjustForKeyboard(notification: Notification) {
let userInfo = notification.userInfo!
let keyboardScreenEndFrame = (userInfo[UIKeyboardFrameEndUserInfoKey] as! NSValue).cgRectValue
let keyboardViewEndFrame = view.convert(keyboardScreenEndFrame, to: view.window)
if notification.name == Notification.Name.UIKeyboardWillHide {
secret.contentInset = .zero
} else {
secret.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: keyboardViewEndFrame.height, right: 0)
}
secret.scrollIndicatorInsets = secret.contentInset
let selectedRange = secret.selectedRange
secret.scrollRangeToVisible(selectedRange)
}
// MARK: -
private func unlockSecretMessage() {
secret.isHidden = false
title = "Secret stuff!"
if let text = KeychainWrapper.standard.string(forKey: "Secret message") {
secret.text = text
}
}
// MARK: -
@objc private func saveSecretMessage() {
if !secret.isHidden {
_ = KeychainWrapper.standard.set(secret.text, forKey: "Secret message")
secret.resignFirstResponder()
secret.isHidden = true
title = "Nothing to see here"
}
}
// MARK: -
private func registerForAppWillResignActive() {
NotificationCenter.default.addObserver(self, selector: #selector(saveSecretMessage), name: Notification.Name.UIApplicationWillResignActive, object: nil)
}
}
| [
350294
] |
c8e8af7ee317cab4d0c5ba78ee4f0f6936650723 | 2a97e8f58658bd8dca2793679f50d32bb84fe515 | /Sources/Protocols/APIResult.swift | 997dc72f6e05213b8eb7a608a2cb1d24b41f4f32 | [
"MIT"
] | permissive | niksauer/NetworkKit | 22f14c265090edcfe0de1fa061e58733497c476d | c5803765e670101bac5b58e8b9514911603d789e | refs/heads/master | 2020-03-19T08:23:47.687110 | 2018-06-14T15:33:10 | 2018-06-14T15:33:10 | 136,200,217 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 236 | swift | //
// APIResult.swift
// NetworkKit
//
// Created by Niklas Sauer on 07.06.18.
// Copyright © 2018 SauerStudios. All rights reserved.
//
import Foundation
public enum APIResult {
case success(Data?)
case failure(Error)
}
| [
-1
] |
f42d7784a8bd9f16bfe4670461b8d90bbad463a9 | 640d4ff90a7bf30f9c86a9582ebdf7779ba488b3 | /Sources/TokamakUIKit/Components/Host/View.swift | 67d1d20638beb6da936e9f83784a038bf720bcc9 | [
"Apache-2.0"
] | permissive | Joannis/Tokamak | 06ba8cceb0ae7876875ff5e37b4e298079d73e72 | 156b775c4e71f980d686415704b25308a5260945 | refs/heads/master | 2021-06-13T23:58:40.092677 | 2019-03-19T12:40:03 | 2019-03-19T12:40:03 | 176,575,475 | 0 | 0 | Apache-2.0 | 2019-03-19T18:32:09 | 2019-03-19T18:32:08 | null | UTF-8 | Swift | false | false | 441 | swift | //
// View.swift
// TokamakUIKit
//
// Created by Max Desiatov on 31/12/2018.
//
import Tokamak
import UIKit
final class TokamakView: UIView, Default {
public static var defaultValue: TokamakView {
return TokamakView()
}
}
extension View: UIViewComponent {
public typealias RefTarget = UIView
static func update(view: ViewBox<TokamakView>,
_ props: View.Props,
_: [AnyNode]) {}
}
| [
-1
] |
611108a71a7e461353eca15948980ceca89b94b0 | 6947c9b12c020b3b6327a595779b4bc0caf520e7 | /Highlights/Common/Extensions/Reactive/Response+ObjectMapper.swift | 9e54ea4d57d9d789c7d138ea6b113365e63d85ce | [] | no_license | mingyeow/scrim-base | 606c12b8b04e5085f9eb669b4a49bb31e8acb7a6 | f81d5a7a825d07c13950be09e93b63d5338e74f4 | refs/heads/master | 2021-01-11T15:04:00.300549 | 2020-02-01T17:44:08 | 2020-02-01T17:44:08 | 80,289,787 | 6 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,136 | swift | import Foundation
import Moya
import ObjectMapper
public extension Response {
typealias JSONDictionary = [String: Any]
func mapObject<T: BaseMappable>(type: T.Type, keyPath: String) throws -> T {
guard let jsonDictionary = try mapJSON() as? JSONDictionary else {
throw MoyaError.jsonMapping(self)
}
guard let jsonDictionaryAtKeyPath = jsonDictionary[keyPath] as? JSONDictionary else {
throw MoyaError.jsonMapping(self)
}
guard let object = Mapper<T>().map(JSON: jsonDictionaryAtKeyPath) else {
throw MoyaError.jsonMapping(self)
}
return object
}
internal func mapArray<T: BaseMappable>(type: T.Type, keyPath: String) throws -> ([T], Pagination?) {
guard let jsonDictionary = try mapJSON() as? JSONDictionary else {
throw MoyaError.jsonMapping(self)
}
guard let jsonDictionaryAtKeyPath = jsonDictionary[keyPath] as? [JSONDictionary] else {
throw MoyaError.jsonMapping(self)
}
guard let objects = Mapper<T>().mapArray(JSONArray: jsonDictionaryAtKeyPath) else {
throw MoyaError.jsonMapping(self)
}
return (objects, nil)
}
}
| [
-1
] |
dc98661984fe5c58c44bdc5fe588ee2d48119fb7 | e41e90d9256132bcfb1bd8cccec02b01c2b6b23f | /PlaceDescription/PlaceDescriptionApp.swift | 865783bb11a4d8b26dc2c67c30bf1fdbfb57ad36 | [] | no_license | jolee211/PlaceDescriptionSwiftUI | 3a12e4998a9983c2a89c486f6e0f0ed558771613 | 221e5234912235f3d8faf1c3a07607849f3e2964 | refs/heads/main | 2023-03-09T20:57:27.465218 | 2021-02-09T22:36:25 | 2021-02-09T22:36:25 | 334,987,993 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 826 | swift | // Copyright 2021 David Lee
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @author David Lee mailto:[email protected]
* @version January 2021
*/
import SwiftUI
@main
struct PlaceDescriptionApp: App {
var body: some Scene {
WindowGroup {
ContentView(jsonStr: "")
}
}
}
| [
-1
] |
b74360181adc47c2b83b91150f3cee16f866b0f9 | f4071a80627c397a3cd4ab89988e55a8c190fc19 | /secure-ios-app/authentication/AuthenticationDetailsViewController.swift | 0007c2e89244729c96f2fd5a3dd97c6a623520e3 | [] | no_license | tomjackman/mobile-security-ios-template | 62cce590ef70d00306b6c034d828d8cb8cba5514 | 7ff1560b655fc6dceff28d92e5fdfca15802c207 | refs/heads/master | 2021-09-09T11:27:20.888754 | 2018-03-15T15:42:32 | 2018-03-15T15:42:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,101 | swift | //
// AuthenticationDetailsViewController.swift
// secure-ios-app
//
// Created by Wei Li on 20/11/2017.
// Copyright © 2017 Wei Li. All rights reserved.
//
import UIKit
class AuthenticationDetailsViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
@IBOutlet weak var userInfoView: UITableView!
var userIdentify: Identity = Identity() {
didSet {
if let tableView = self.userInfoView {
tableView.reloadData()
}
}
}
var navbarItem: UINavigationItem?
var authListener: AuthListener?
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
userInfoView.dataSource = self
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.showLogoutBtn()
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillAppear(animated)
self.removeLogoutBtn()
}
func displayUserDetails(from: UIViewController, identity: Identity) {
self.userIdentify = identity
ViewHelper.showChildViewController(parentViewController: from, childViewController: self)
ViewHelper.showSuccessBannerMessage(from: self, title: "Login Completed", message: "")
}
func showError(title: String, error: Error) {
ViewHelper.showErrorBannerMessage(from: self, title: title, message: error.localizedDescription)
}
func removeView() {
ViewHelper.removeViewController(viewController: self)
}
func showLogoutBtn() {
guard let rootViewController = self.parent?.parent else {
return
}
if rootViewController.isKind(of: RootViewController.self) {
self.navbarItem = rootViewController.navigationItem
self.navbarItem!.rightBarButtonItem = UIBarButtonItem(title: "Logout", style: .plain, target: self, action: #selector(logoutTapped))
}
}
func removeLogoutBtn() {
if self.navbarItem != nil {
self.navbarItem!.rightBarButtonItem = nil;
}
}
@IBAction func logoutTapped(_ sender: UIBarButtonItem) {
let alertView = UIAlertController(title: "Logout", message: "Are you sure to logout?", preferredStyle: UIAlertControllerStyle.alert)
alertView.addAction(UIAlertAction(title: "Yes", style: .default, handler: { action in
if let listener = self.authListener {
listener.logout()
}
}))
alertView.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: { action in
Logger.debug("logout cancelled")
}))
self.present(alertView, 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.
}
*/
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
switch section {
case 0:
return 2
case 1:
return self.userIdentify.reamlRoles.count
default:
return 0
}
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let sectionNum = indexPath.section
if (sectionNum == 0) {
let userInfoCell = tableView.dequeueReusableCell(withIdentifier: "userInfoCell")!
let fieldNameLabel = userInfoCell.contentView.viewWithTag(1) as! UILabel
let fieldValueLabel = userInfoCell.contentView.viewWithTag(2) as! UILabel
if (indexPath.row == 0) {
fieldNameLabel.text = "Name"
fieldValueLabel.text = self.userIdentify.fullName
} else {
fieldNameLabel.text = "Email"
fieldValueLabel.text = self.userIdentify.emailAddress
}
return userInfoCell
} else {
let roleNameCell = tableView.dequeueReusableCell(withIdentifier: "roleNameCell")!
let roleValueLabel = roleNameCell.contentView.viewWithTag(1) as! UILabel
roleValueLabel.text = self.userIdentify.reamlRoles[indexPath.row]
return roleNameCell
}
}
func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
switch section {
case 0:
return "User Details"
case 1:
return "Realm Roles"
default:
return ""
}
}
func numberOfSections(in tableView: UITableView) -> Int {
return 2;
}
}
| [
-1
] |
d7df6f5199e3a16aac4e5264b37df78291363d2a | af050966b9695aa4f125e75030bfa5f3bb884344 | /ModuloKit/Commands/InitCommand.swift | cc764705f3f8ed24a657ee11ded590bd2e0da8e4 | [] | no_license | peat/modulo | b7f0810508fa50471c179adb25cd9dc674c0166d | 068a3bf045bf39d54941200d3158e648ec5c89bf | refs/heads/master | 2020-06-10T20:21:29.393626 | 2016-11-04T18:27:39 | 2016-11-04T18:27:39 | 75,886,320 | 0 | 0 | null | 2016-12-08T00:06:11 | 2016-12-08T00:06:11 | null | UTF-8 | Swift | false | false | 2,013 | swift | //
// InitCommand.swift
// ModuloKit
//
// Created by Brandon Sneed on 6/16/16.
// Copyright © 2016 TheHolyGrail. All rights reserved.
//
import Foundation
#if NOFRAMEWORKS
#else
import ELCLI
#endif
open class InitCommand: NSObject, Command {
// Internal properties
open var isModule: Bool = true
// Protocol conformance
open var name: String { return "init" }
open var shortHelpDescription: String { return "Initialize modulo" }
open var longHelpDescription: String {
return "This command initializes modulo and creates a .modulo file\n" +
"containing module dependency information."
}
open var failOnUnrecognizedOptions: Bool { return true }
open var verbose: Bool = false
open var quiet: Bool = false
open func configureOptions() {
addOption(["--app"], usage: "init's the working path as an application") { (option, value) in
self.isModule = false
}
addOption(["--module"], usage: "init's the working path as a module (default)") { (option, value) in
self.isModule = true
}
}
open func execute(_ otherParams: Array<String>?) -> Int {
let scm = currentSCM()
if ModuleSpec.exists() {
exit(.alreadyInitialized)
}
if isModule == false {
let scmResult = scm.addModulesIgnore()
if scmResult != .success {
exit(scmResult.errorMessage())
}
}
let specPath = FileManager.workingPath().appendPathComponent(specFilename)
let spec = ModuleSpec(name: FileManager.directoryName(), module: isModule, sourcePath: nil, dependencies: [], path: specPath)
let success = spec.save()
if !success {
exit(ErrorCode.specNotWritable)
} else {
writeln(.stdout, "Modulo has been initialized.")
}
return ErrorCode.success.rawValue
}
}
| [
-1
] |
a5a66fa10a9f73ca52868e091eaf9591cf91c84d | e5b4fcda1266c43680054e2b9eae7459cb9ff995 | /Project 15 - Animation/Project 15 - Animation/ViewController.swift | 3faa2bc92d691ae8200c1542bc26f8834cd948ad | [] | no_license | CatalinDavid17/HackingSwift-book | 8cee46662ed11f451ad63611726d0b4285828121 | 767facdb3309752fa1d1aca7fc4afb53d85ed2d6 | refs/heads/master | 2020-04-12T06:35:34.520785 | 2016-11-02T10:11:13 | 2016-11-02T10:11:13 | 65,817,299 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,782 | swift | //
// ViewController.swift
// Project 15 - Animation
//
// Created by Catalin David on 26/08/16.
// Copyright © 2016 Catalin David. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
var imageView: UIImageView!
var currentAnimation = 0
override func viewDidLoad() {
super.viewDidLoad()
imageView = UIImageView(image: UIImage(named: "penguin"))
imageView.center = CGPoint(x: 512, y: 384)
view.addSubview(imageView)
}
@IBOutlet weak var tap: UIButton!
@IBAction func tapped(sender: UIButton) {
tap.hidden = true
UIView.animateWithDuration(1, delay: 0, usingSpringWithDamping: 0.5, initialSpringVelocity: 5, options: [],
animations: { [unowned self] in
switch self.currentAnimation {
case 0:
self.imageView.transform = CGAffineTransformMakeScale(2, 2)
case 1:
self.imageView.transform = CGAffineTransformIdentity
case 2:
self.imageView.transform = CGAffineTransformMakeTranslation(-256, -256)
case 3:
self.imageView.transform = CGAffineTransformIdentity
case 4:
self.imageView.transform = CGAffineTransformMakeRotation(CGFloat(M_PI))
case 5:
self.imageView.transform = CGAffineTransformIdentity
case 6:
self.imageView.alpha = 0.1
self.imageView.backgroundColor = UIColor.greenColor()
case 7:
self.imageView.alpha = 1
self.imageView.backgroundColor = UIColor.clearColor()
default:
break
}
}) { [unowned self] (finished: Bool) in
self.tap.hidden = false
}
currentAnimation = currentAnimation + 1
if currentAnimation > 7 {
currentAnimation = 0
}
}
}
| [
264649
] |
52e68aa3491dec1ade4fcc36060be1150cbb9de1 | e2033058486a9dbcea4c5e7f4a769f2d12037cc8 | /BookApp/HistoryBuyProductController.swift | ef464b946a6af129d277929fd6603c490d293669 | [] | no_license | CTVTRANS/Book | bf8c31f7b8e9f238d4ef34c79ed411bf8e964d9c | 5c9e566ab0a41a55fde84ecb28761249dbfa44f2 | refs/heads/master | 2021-09-06T13:53:37.132467 | 2017-12-06T09:37:41 | 2017-12-06T09:37:41 | 107,642,378 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,241 | swift | //
// HistoryBuyProductController.swift
// BookApp
//
// Created by kien le van on 9/13/17.
// Copyright © 2017 Le Cong. All rights reserved.
//
import UIKit
class HistoryBuyProductController: BaseViewController, UITableViewDelegate, UITableViewDataSource {
@IBOutlet weak var table: UITableView!
var listHistory: [HistoryBuy] = []
override func viewDidLoad() {
super.viewDidLoad()
table.tableFooterView = UIView()
table.estimatedRowHeight = 140
navigationItem.title = "购物记录"
getHistoryVip()
getHistoryBook()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationController?.isNavigationBarHidden = false
}
func getHistoryVip() {
let getData = GetHistoryBuyVipTask(idmember: (memberInstance?.idMember)!, token: tokenInstance!)
requestWithTask(task: getData, success: { (data) in
if let vip = data as? [HistoryBuy] {
self.listHistory += vip
self.table.reloadData()
}
}) { (_) in
}
}
func getHistoryBook() {
let getData = GetHIstoryBuyBookTask(idmember: (memberInstance?.idMember)!, token: (tokenInstance!))
requestWithTask(task: getData, success: { (data) in
if let book = data as? [HistoryBuy] {
self.listHistory += book
self.table.reloadData()
}
}) { (_) in
}
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return listHistory.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell1 = table.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as? HistoryMarkCell
let cell2 = table.dequeueReusableCell(withIdentifier: "bookCell", for: indexPath) as? HistoryCellBook
let product = listHistory[indexPath.row]
if product.producBook == nil {
cell1?.binData(history: product)
return cell1!
}
cell2?.binData(historyBook: product)
return cell2!
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableViewAutomaticDimension
}
}
class HistoryCellBook: UITableViewCell {
@IBOutlet weak var imageBook: UIImageView!
@IBOutlet weak var time: UILabel!
@IBOutlet weak var name: UILabel!
@IBOutlet weak var detail: UILabel!
func binData(historyBook: HistoryBuy) {
name.text = historyBook.producBook?.name
imageBook.sd_setImage(with: URL(string: (historyBook.producBook?.imageURL)!))
time.text = historyBook.time.components(separatedBy: " ")[0]
let arrayString = historyBook.producBook?.descriptionBook.components(separatedBy: "</p>")
let firstString = arrayString?.first
if firstString != nil {
if firstString!.count > 4 {
let index = firstString!.index(firstString!.startIndex, offsetBy: 3)
detail.text = String(firstString![..<index])
}
}
}
}
| [
-1
] |
d9dacf9e3bf6cba2be0937f58b9e5d909cb8826d | 984593d0bfb6c14a071f564741941107504c3ad3 | /Example/BWPageTab/ThirdViewController.swift | 518785309f86a023354a067db762284d677869b6 | [
"MIT"
] | permissive | bairdweng/BWPageTab | 2c8453e2390546cc217855338b508bd1a87035c3 | db59d9dae887cf909430f8a4eceae82ec91e0d12 | refs/heads/master | 2022-12-17T06:06:45.847767 | 2020-09-29T10:03:49 | 2020-09-29T10:03:49 | 297,648,021 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,550 | swift | //
// ThirdViewController.swift
// BWPageTab_Example
//
// Created by bairdweng on 2020/9/22.
// Copyright © 2020 CocoaPods. All rights reserved.
//
import UIKit
class ThirdViewController: UIViewController {
let cellId = "thirdvc_cell"
lazy var tableView:UITableView = {[weak self] in
let tableView = UITableView()
tableView.delegate = self
tableView.dataSource = self
if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never
} else {
self?.automaticallyAdjustsScrollViewInsets = false
// Fallback on earlier versions
}
tableView.register(UITableViewCell.self, forCellReuseIdentifier: cellId)
return tableView
}()
let dataSources:[Any] = {
var datas:[String] = []
for i in 1...20 {
datas.append("thirdvc_\(i)")
}
return datas
}()
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
print("ThirdViewController viewwillAppear")
}
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .green
self.view.addSubview(tableView)
tableView.frame = self.view.bounds
// Do any additional setup after loading the view.
}
/*
// MARK: - Navigation
/Users/bairdweng/Desktop/ios_open_source/BWPageTab/ViewControllers
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
}
extension ThirdViewController:UITableViewDelegate,UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return dataSources.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: cellId,for: indexPath)
cell.textLabel?.text = dataSources[indexPath.row] as? String ?? ""
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 80
}
}
| [
-1
] |
3a2f93986a73c6cc6ccef842f4cca046a240b5a5 | 1a70ea4ff3ad855c54f061e6bcdae8d7554be2ae | /Bear/SceneDelegate.swift | c2205c68449b11c7f0e861b530429b799b2ffdba | [] | no_license | n1a2v3z4/BeerBar | 2aa97b5e2562b1c08f622fce76afb14b1b6a3b1d | 8a0b708760abecb4282216fe72923c203f17f87a | refs/heads/main | 2023-07-01T04:51:40.517549 | 2021-08-07T09:47:57 | 2021-08-07T09:47:57 | 393,336,940 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,302 | swift | //
// SceneDelegate.swift
// Bear
//
// Created by Cергей Иванович on 3.08.21.
//
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,
254045,
180322,
376932,
286845,
286851,
417925,
262284,
360598,
377003,
377013,
164029,
327872,
180418,
377030,
377037,
377047,
418008,
418012,
377063,
327915,
205037,
393457,
393461,
393466,
418044,
385281,
262405,
180491,
336140,
164107,
262417,
368913,
262423,
377118,
377121,
262437,
254253,
336181,
262455,
393539,
262473,
344404,
213333,
418135,
418145,
262497,
262501,
213354,
246124,
262508,
262512,
213374,
385420,
393613,
262551,
262553,
385441,
385444,
262567,
385452,
262574,
393649,
385460,
262587,
344512,
262593,
360917,
369119,
328180,
328183,
328190,
254463,
328193,
328207,
410129,
393748,
262679,
377372,
188959,
385571,
197160,
377384,
33322,
352822,
270905,
197178,
418364,
188990,
369224,
270922,
385610,
352844,
385617,
352865,
262761,
352875,
344694,
352888,
336513,
377473,
385671,
148106,
213642,
377485,
352919,
98969,
344745,
361130,
336556,
385714,
434868,
164535,
164539,
328379,
328387,
352969,
344777,
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,
386004,
345046,
386012,
386019,
328690,
435188,
328703,
328710,
418822,
328715,
377867,
361490,
386070,
336922,
345119,
377888,
345134,
345139,
361525,
386102,
361537,
377931,
345172,
189525,
402523,
361568,
148580,
345200,
361591,
386168,
361594,
410746,
214150,
345224,
386187,
345247,
361645,
345268,
402615,
361657,
402636,
328925,
165086,
66783,
165092,
222438,
328942,
386286,
386292,
206084,
345377,
345380,
353572,
345383,
263464,
337207,
345400,
378170,
369979,
386366,
337230,
337235,
263509,
353634,
337252,
402792,
271731,
378232,
337278,
271746,
181639,
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,
370208,
419360,
394787,
419363,
370214,
419369,
394796,
419377,
419386,
214594,
419401,
419404,
353868,
419408,
214611,
419412,
403040,
345702,
370298,
353920,
403073,
403076,
345737,
198282,
403085,
403092,
345750,
419484,
345758,
345763,
419492,
419498,
419502,
370351,
419507,
337588,
419510,
419513,
403139,
337607,
419528,
419531,
272083,
394967,
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,
354143,
345965,
354157,
345968,
345971,
345975,
403321,
1914,
354173,
247692,
395148,
337809,
247701,
436127,
436133,
247720,
337834,
362414,
337845,
190393,
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,
256214,
411862,
411865,
411869,
411874,
379108,
411877,
387303,
346344,
395496,
338154,
387307,
346350,
338161,
387314,
436474,
379135,
411905,
411917,
379154,
395539,
387350,
387353,
338201,
338212,
395567,
248112,
362823,
436556,
321880,
362844,
379234,
354674,
321911,
420237,
379279,
354728,
338353,
338382,
272849,
248279,
256474,
182755,
338404,
338411,
330225,
248309,
248332,
330254,
199189,
420377,
330268,
191012,
330320,
199250,
191069,
346722,
248427,
338544,
346736,
191093,
346743,
346769,
150184,
174775,
248505,
174778,
363198,
223936,
355025,
273109,
355029,
264919,
264942,
363252,
338680,
264965,
338701,
256787,
363294,
396067,
346917,
396070,
215854,
355123,
355141,
355144,
338764,
355151,
330581,
387929,
330585,
355167,
265056,
265059,
355176,
355180,
412600,
207809,
379849,
347082,
396246,
330711,
248794,
248799,
347106,
437219,
257009,
265208,
199681,
338951,
330761,
330769,
330775,
248863,
396329,
347178,
404526,
396337,
330803,
396340,
339002,
388155,
339010,
248905,
330827,
248915,
183384,
339037,
412765,
257121,
265321,
248952,
420985,
330890,
347288,
248986,
44199,
380071,
339118,
339133,
330959,
330966,
265433,
265438,
388320,
363757,
388348,
339199,
396552,
175376,
175397,
273709,
372016,
437553,
347442,
199989,
175416,
396601,
208189,
437567,
175425,
437571,
437576,
437584,
437588,
396634,
175451,
437596,
429408,
175458,
175461,
175464,
265581,
331124,
175478,
249215,
175487,
249219,
175491,
249225,
249228,
249235,
175514,
175517,
396703,
396706,
175523,
355749,
396723,
388543,
380353,
216518,
380364,
339406,
372177,
339414,
413143,
249303,
339418,
339421,
249310,
249313,
339425,
339429,
339435,
249329,
69114,
372229,
208399,
175637,
405017,
134689,
265779,
421442,
413251,
265796,
265806,
224854,
224858,
339553,
257636,
224871,
372328,
257647,
372338,
224885,
224888,
224891,
224895,
372354,
126597,
421509,
224905,
11919,
224911,
224914,
126611,
224917,
224920,
126618,
224923,
208539,
224927,
224930,
224933,
257705,
224939,
224943,
257713,
257717,
224949,
257721,
224954,
257725,
224960,
257733,
224966,
224970,
257740,
224976,
257745,
257748,
224982,
257752,
224987,
257762,
224996,
225000,
225013,
257788,
225021,
257791,
339711,
225027,
257796,
257802,
339722,
257805,
225039,
257808,
249617,
225044,
167701,
372500,
257815,
225049,
257820,
225054,
184096,
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,
225128,
257897,
225138,
257909,
225142,
372598,
257914,
257917,
225150,
257922,
380803,
225156,
339845,
257927,
225166,
397201,
225171,
380823,
225176,
225183,
372698,
372704,
372707,
356336,
380919,
372739,
405534,
266295,
266298,
421961,
200786,
356440,
217180,
430181,
266351,
356467,
266365,
192640,
266375,
381069,
225425,
250003,
225430,
250008,
356507,
225439,
135328,
438434,
225442,
192674,
225445,
438438,
225448,
438441,
356521,
225451,
258223,
225456,
430257,
225459,
225462,
225468,
389309,
225472,
372931,
225476,
430275,
389322,
225485,
225488,
225491,
266454,
225494,
225497,
225500,
225503,
225506,
225511,
217319,
225515,
225519,
381177,
397572,
389381,
381212,
356638,
356641,
356644,
356647,
266537,
356650,
389417,
356656,
332081,
340276,
356662,
397623,
332091,
225599,
348489,
332107,
151884,
332118,
348503,
430422,
250201,
250211,
340328,
250217,
348523,
348528,
332153,
356734,
389503,
332158,
438657,
332162,
389507,
348548,
356741,
332175,
160152,
373146,
340380,
373149,
70048,
356783,
266688,
324032,
201158,
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,
381546,
340628,
184983,
373399,
258723,
332460,
389806,
332464,
332473,
381626,
332484,
332487,
332494,
357070,
357074,
332512,
340724,
332534,
155647,
348926,
389927,
348979,
348983,
398141,
357202,
389971,
357208,
389979,
357212,
430940,
357215,
439138,
349041,
340850,
381815,
430967,
324473,
398202,
340859,
324476,
430973,
119675,
340863,
324479,
324482,
373635,
324485,
324488,
381834,
185226,
324493,
324496,
324499,
430996,
324502,
324511,
422817,
324514,
201638,
398246,
373672,
324525,
5040,
111539,
324534,
5047,
324539,
324542,
398280,
349129,
340942,
209874,
340958,
431073,
398307,
340964,
209896,
209904,
201712,
349173,
381947,
201724,
349181,
431100,
431107,
349203,
209944,
209948,
357411,
250917,
169002,
357419,
209966,
209969,
209973,
209976,
209980,
209988,
209991,
209996,
431180,
349268,
177238,
250968,
210011,
373853,
341094,
210026,
210028,
210032,
349296,
210037,
210042,
210045,
349309,
152704,
349313,
160896,
210053,
210056,
373905,
259217,
210068,
210072,
210078,
210081,
210085,
210089,
210096,
210100,
324792,
210108,
357571,
210116,
210128,
210132,
333016,
210139,
210144,
218355,
218361,
275709,
275713,
242947,
275717,
275723,
349460,
349486,
349492,
415034,
210261,
365912,
259423,
374113,
251236,
374118,
390518,
357756,
374161,
112021,
349591,
333222,
259516,
415168,
415187,
366035,
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,
349762,
333396,
374359,
333400,
366173,
423529,
423533,
210547,
415354,
333440,
267910,
259789,
366301,
333535,
153311,
366308,
366312,
431852,
399086,
366319,
210673,
366322,
399092,
366326,
333566,
268042,
210700,
366349,
210707,
399129,
333595,
210720,
358192,
366384,
366388,
210740,
358201,
325441,
366403,
325447,
341831,
341839,
341844,
415574,
358235,
350046,
399200,
399208,
268144,
358256,
358260,
325494,
399222,
333690,
325505,
399244,
333709,
333725,
333737,
382891,
382898,
350153,
358348,
333777,
219094,
399318,
358372,
350190,
350194,
333819,
350204,
350207,
325633,
325637,
350214,
219144,
268299,
333838,
350225,
186388,
350232,
333851,
350238,
350241,
374819,
350245,
350249,
350252,
178221,
350257,
350260,
350272,
243782,
350281,
350286,
374865,
252021,
342134,
374904,
268435,
333998,
334012,
260299,
211161,
358645,
268553,
268560,
432406,
325920,
194854,
358701,
391469,
358705,
358714,
358717,
383307,
358738,
383331,
383334,
391531,
383342,
334204,
194942,
391564,
366991,
334224,
342431,
375209,
375220,
334263,
326087,
358857,
195041,
334312,
104940,
375279,
416255,
350724,
186898,
342546,
350740,
342551,
342555,
416294,
350762,
252463,
358962,
334397,
358973,
252483,
219719,
399957,
334425,
326240,
375401,
334466,
334469,
162446,
342680,
342685,
260767,
342711,
244410,
260798,
260802,
350918,
154318,
342737,
391895,
154329,
416476,
64231,
113389,
203508,
375541,
342777,
391938,
391949,
375569,
375572,
375575,
375580,
162592,
326444,
383794,
375613,
244542,
375616,
342857,
416599,
342875,
433001,
400238,
211826,
211832,
392061,
351102,
252801,
260993,
351105,
400260,
211846,
342921,
342931,
252823,
400279,
392092,
400286,
252838,
359335,
211885,
252846,
400307,
351169,
359362,
351172,
170950,
326599,
359367,
187335,
359383,
359389,
383968,
343018,
261109,
261112,
244728,
383999,
261130,
359452,
261148,
211999,
261155,
261160,
359471,
375868,
343132,
384099,
384102,
384108,
367724,
187503,
343155,
384115,
212095,
351366,
384136,
384140,
384144,
351382,
384152,
384158,
384161,
351399,
384169,
367795,
384182,
367801,
384189,
351424,
384192,
343232,
367817,
244938,
384202,
253132,
384209,
146644,
351450,
384225,
343272,
351467,
359660,
384247,
351480,
384250,
351483,
351492,
384270,
261391,
359695,
253202,
261395,
384276,
384284,
245021,
384290,
253218,
171304,
245032,
384299,
351535,
245042,
326970,
384324,
212296,
212304,
367966,
343394,
367981,
343410,
155000,
327035,
245121,
245128,
253321,
155021,
384398,
245137,
245143,
245146,
245149,
245152,
245155,
155045,
245158,
114093,
327090,
343478,
359867,
384444,
327108,
327112,
384457,
359887,
359891,
368093,
155103,
343535,
343540,
368120,
409092,
253445,
359948,
359951,
245295,
359984,
343610,
400977,
400982,
179803,
155255,
155274,
368289,
245410,
425652,
425663,
155328,
245463,
155352,
155356,
155364,
245477,
155372,
245487,
212723,
409336,
155394,
155404,
245528,
155423,
360224,
155439,
204592,
155444,
155448,
417596,
384829,
360262,
155463,
155477,
376665,
155484,
261982,
425823,
155488,
376672,
155492,
327532,
261997,
376686,
262000,
262003,
262006,
327542,
147319,
262009,
425846,
262012,
155517,
155523,
155526,
360327,
376715,
155532,
262028,
262031,
262034,
262037,
262040,
262043,
155550,
253854,
262046,
262049,
262052,
327590,
155560,
155563,
155566,
327613,
393152,
393170,
155604,
155620,
253924,
155622,
253927,
327655,
360432,
393204,
360439,
253944,
393209,
393215
] |
f13e3b4581e2ed8a1103d3ff794298591c3c21b9 | 51ebf2f30264c3596c42404ea482e8170e2bbf2e | /DoIt/CreateTaskViewController.swift | 461871011704bc182d2c33a99e260175d06ad8ed | [] | no_license | thomleiter/DoIt | b496e83742cf69285fdce75e5e0e5cb06b17ff25 | 20068318c57f06a1ef11a55e89375e0ebd07f9cc | refs/heads/master | 2021-01-17T10:16:15.157845 | 2017-03-07T05:18:05 | 2017-03-07T05:18:05 | 84,012,866 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,021 | swift | //
// CreateTaskViewController.swift
// DoIt
//
// Created by Leiter Family on 3/6/17.
// Copyright © 2017 40° Degrees Media, Ltd. All rights reserved.
//
import UIKit
class CreateTaskViewController: UIViewController {
@IBOutlet weak var importantSwitch: UISwitch!
@IBOutlet weak var taskNameTextField: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
@IBAction func addTapped(_ sender: Any) {
// Create a Task from the outlet information
let context = (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext
let task = Task(context: context)
task.name = taskNameTextField.text!
task.important = importantSwitch.isOn
(UIApplication.shared.delegate as! AppDelegate).saveContext()
// Pop back
navigationController!.popViewController(animated: true)
}
}
| [
230747
] |
0d09fb509b8b8be4eae8313b84fad42ffcba7ac1 | 64070be21d2a235dc850c2c5ce13e37b80d436b4 | /WashVes Native/SplashViewController.swift | 14ae0717ee67e02091ed2ae58ff3a20bf0ebaf9d | [] | no_license | brascene/WashMe-iOS | b327aed3fda0fc9efbbda3d303c8f0ec220fd67f | 6ef581771420aa745f41f91f54385b11d734e076 | refs/heads/master | 2021-01-02T23:02:11.586708 | 2017-08-13T16:16:02 | 2017-08-13T16:16:02 | 99,447,436 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,517 | swift | //
// ViewController.swift
// WashVes Native
//
// Created by Dino Pelic on 8/5/17.
// Copyright © 2017 Dino Pelic. All rights reserved.
//
import UIKit
class SplashViewController: UIViewController {
@IBOutlet weak var splashImage: UIImageView!
var timer: Timer?
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func viewWillAppear(_ animated: Bool) {
splashImage.transform = CGAffineTransform.init(scaleX: 0.05, y: 0.05)
UIView.animate(withDuration: 2.0, delay: 0, options: .curveEaseIn, animations: {
self.splashImage.transform = CGAffineTransform.identity
}, completion: {
success in
if success {
self.timer = Timer.scheduledTimer(timeInterval: 1.0, target: self, selector: #selector(self.showGetStartedScreen), userInfo: nil, repeats: false)
}
})
}
func showGetStartedScreen () {
let sb = UIStoryboard(name: "GetStarted", bundle: nil)
let getStartedVC = sb.instantiateViewController(withIdentifier: "getStarted") as! GetStartedViewController
//self.present(getStartedVC, animated: true)
self.navigationController?.pushViewController(getStartedVC, animated: false)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
| [
-1
] |
c1f49e951700924fdab06b5e38dfca29a46e86e5 | a180f0070456436d5fa4ecf4325d67ac97d034c9 | /day01/ex03/main.swift | 9910ef5a89722199b0fc25b6e4ea4107b0a199b6 | [] | no_license | cwindom/swift_piscine | 1bede6ca4de26352f4c212a514982162711eaec9 | 15ef34442bc96624df44f56b0a6e3983baad0af8 | refs/heads/master | 2023-08-11T08:19:09.714975 | 2021-09-25T20:17:05 | 2021-09-25T20:17:05 | 401,718,911 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 166 | swift | //
// main.swift
// ex00
//
// Created by OUT-Korogodova-MM on 22.09.2021.
//
import Foundation
var allCards = Deck.allCards
allCards.mixing()
print(allCards)
| [
-1
] |
3bd2eb271fca69b5bbe32350047387ee6a0283a0 | ab8b43c87be8f32050c0bdf1d0969fa9fe1ec4b1 | /WatchApp WatchKit Extension/Menu.swift | 4e31421d92030f4ef0ad8d4a540b618708f4a777 | [] | no_license | osmszk/WatchApp | 3140aed23c4eb917af7b240750fecb20f8f40c90 | 6af3466cede17c300dce03ec5218177425637fbc | refs/heads/master | 2020-04-23T09:06:10.532660 | 2019-02-16T22:14:40 | 2019-02-16T22:14:40 | 171,058,133 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,337 | swift | //
// Menu.swift
// WatchApp WatchKit Extension
//
// Created by 鈴木治 on 2019/02/17.
// Copyright © 2019年 Osamu Suzuki. All rights reserved.
//
import UIKit
class Menu {
let category: String
let contents: [String]
init(category: String, contents: [String]) {
self.category = category
self.contents = contents
}
convenience init(dictionary: [String: Any]) {
let category = dictionary["category"] as! String
var contents: [String] = []
if let menus = dictionary["menu"] as? [String] {
contents = menus
}
self.init(category: category, contents: contents)
}
class func allMenus() -> [Menu] {
var menus: [Menu] = []
guard let path = Bundle.main.path(forResource: "hotcook_menu", ofType: "json"),
let data = try? Data(contentsOf: URL(fileURLWithPath: path)) else {
return menus
}
do {
let json = try JSONSerialization.jsonObject(with: data, options: .allowFragments) as! [[String: Any]]
json.forEach({ (dict: [String: Any]) in
menus.append(Menu(dictionary: dict))
})
} catch let error as NSError {
print(error)
}
return menus
}
}
| [
-1
] |
c993cfb44989efa111c542c5c2d4bcf72034db35 | 27f37dc47af921abd4f75e69eed6903f2c4b9cff | /StarWarsUITests/StarWarsUITests.swift | da697abffe7c13fb9309acf440e0e95f0f683388 | [] | no_license | strannikac/starwarstest | 210ddfe3b96a7c27bb7f604124a307fec50788da | f603a2418eba110b7bb38e874e84a32e224ad1db | refs/heads/master | 2023-01-22T01:32:48.166797 | 2020-11-26T04:36:00 | 2020-11-26T04:36:00 | 315,996,833 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,422 | swift | //
// StarWarsUITests.swift
// StarWarsUITests
//
// Created by Dmitriy Roytman on 10/11/2020.
//
import XCTest
class StarWarsUITests: XCTestCase {
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() throws {
// UI tests must launch the application that they test.
let app = XCUIApplication()
app.launch()
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testLaunchPerformance() throws {
if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) {
// This measures how long it takes to launch your application.
measure(metrics: [XCTApplicationLaunchMetric()]) {
XCUIApplication().launch()
}
}
}
}
| [
360463,
155665,
376853,
344106,
253996,
163894,
385078,
180279,
352314,
213051,
376892,
32829,
286787,
352324,
237638,
352327,
385095,
163916,
368717,
311373,
196687,
278607,
311377,
254039,
426074,
368732,
180317,
32871,
352359,
221292,
278637,
385135,
319599,
376945,
131190,
385147,
131199,
426124,
196758,
49308,
65698,
311459,
49317,
377008,
377010,
180409,
295099,
377025,
377033,
164043,
417996,
254157,
368849,
368850,
139478,
229591,
385240,
254171,
147679,
147680,
311520,
205034,
254189,
286957,
254193,
344312,
336121,
262403,
147716,
385291,
368908,
180494,
262419,
254228,
368915,
319764,
278805,
377116,
254250,
311596,
131374,
418095,
336177,
368949,
180534,
155968,
287040,
311622,
270663,
368969,
254285,
180559,
377168,
344402,
229716,
368982,
270703,
139641,
385407,
385409,
106893,
270733,
385423,
385433,
213402,
385437,
254373,
156069,
385448,
385449,
115116,
385463,
319931,
278974,
336319,
336323,
188870,
278988,
278992,
262619,
377309,
377310,
369121,
369124,
279014,
270823,
279017,
311787,
213486,
360945,
139766,
393719,
279030,
377337,
279033,
254459,
410108,
410109,
262657,
377346,
279042,
279053,
410126,
393745,
385554,
303635,
279060,
279061,
262673,
254487,
410138,
279066,
188957,
377374,
385569,
385578,
377388,
197166,
393775,
418352,
33339,
352831,
33344,
385603,
377419,
385612,
303693,
426575,
385620,
369236,
115287,
189016,
270938,
287327,
279143,
279150,
287345,
352885,
352886,
344697,
189054,
287359,
369285,
385669,
311944,
344714,
311950,
377487,
311953,
287379,
336531,
426646,
180886,
352921,
377499,
221853,
344737,
295591,
352938,
295598,
418479,
279215,
279218,
164532,
336565,
287418,
377531,
303802,
377534,
377536,
66243,
385737,
287434,
385745,
279249,
303826,
369365,
369366,
385751,
230105,
361178,
352989,
352990,
418529,
295649,
385763,
295653,
369383,
230120,
361194,
312046,
418550,
344829,
279293,
205566,
197377,
434956,
312076,
295698,
418579,
426772,
197398,
426777,
221980,
344864,
197412,
336678,
262952,
189229,
262957,
164655,
197424,
328495,
197428,
336693,
230198,
377656,
426809,
197433,
222017,
295745,
377669,
197451,
369488,
279379,
385878,
385880,
295769,
197467,
435038,
230238,
279393,
303973,
279398,
385895,
197479,
385901,
197489,
295799,
164730,
336765,
254851,
369541,
172936,
320394,
426894,
377754,
140203,
172971,
377778,
304050,
189362,
189365,
377789,
189373,
345030,
345034,
279499,
418774,
386007,
418781,
386016,
123880,
418793,
320495,
435185,
222193,
271351,
214009,
312313,
435195,
328701,
312317,
386049,
328705,
418819,
410629,
377863,
189448,
230411,
361487,
435216,
386068,
254997,
336928,
336930,
410665,
345137,
361522,
312372,
238646,
238650,
320571,
386108,
410687,
336962,
238663,
377927,
361547,
205911,
156763,
361570,
214116,
230500,
214119,
402538,
279659,
173168,
230514,
238706,
279666,
312435,
377974,
66684,
377986,
279686,
402568,
222344,
140426,
337037,
386191,
410772,
222364,
418975,
124073,
402618,
148674,
402632,
148687,
402641,
189651,
419028,
279766,
189656,
304353,
279780,
222441,
279789,
386288,
66802,
271607,
386296,
369913,
419066,
369912,
386300,
279803,
386304,
369929,
419097,
320795,
115997,
222496,
320802,
304422,
369964,
353581,
116014,
66863,
312628,
345397,
345398,
386363,
222523,
345418,
337226,
337228,
353611,
353612,
230730,
296269,
353617,
222542,
238928,
296274,
378201,
230757,
296304,
312688,
337280,
296328,
263561,
296330,
353672,
370066,
9618,
411028,
279955,
370072,
148899,
148900,
361928,
337359,
329168,
312785,
329170,
222674,
353751,
280025,
239069,
361958,
271850,
280042,
280043,
271853,
329198,
411119,
337391,
116209,
296434,
386551,
288252,
271880,
198155,
329231,
304655,
370200,
222754,
157219,
157220,
394793,
312879,
288305,
288319,
288322,
280131,
288328,
353875,
312937,
271980,
206447,
403057,
42616,
337533,
280193,
370307,
419462,
149127,
149128,
419464,
288391,
214667,
411275,
239251,
345753,
198304,
255651,
337590,
370359,
280252,
280253,
321217,
239305,
296649,
403149,
313042,
345813,
370390,
272087,
345817,
337638,
345832,
181992,
345835,
288492,
141037,
313082,
288508,
288515,
173828,
395018,
395019,
116491,
395026,
116502,
435993,
345882,
411417,
255781,
362281,
378666,
403248,
378673,
345910,
182070,
182071,
436029,
345918,
337734,
280396,
272207,
272208,
337746,
395092,
345942,
362326,
345950,
370526,
362336,
255844,
296807,
214894,
362351,
214896,
313200,
313204,
182145,
280451,
67464,
305032,
337816,
329627,
239515,
354210,
436130,
436135,
10153,
313257,
362411,
370604,
362418,
411587,
280517,
362442,
346066,
231382,
354268,
436189,
403421,
329696,
354273,
403425,
354279,
436199,
174058,
354283,
247787,
329707,
247786,
337899,
296942,
436209,
239610,
346117,
182277,
354311,
403463,
354312,
43016,
354310,
313356,
436235,
419857,
305173,
436248,
223269,
346153,
354346,
313388,
272432,
403507,
378933,
378934,
436283,
288835,
403524,
436293,
313415,
239689,
436304,
329812,
223317,
411738,
272477,
280676,
313446,
395373,
288878,
346237,
215165,
436372,
329884,
378186,
362658,
436388,
215204,
133313,
395458,
338118,
436429,
346319,
379102,
387299,
18661,
379110,
338151,
149743,
379120,
436466,
411892,
395511,
436471,
313595,
436480,
272644,
338187,
338188,
395536,
338196,
272661,
379157,
157973,
338217,
321839,
362809,
379193,
395591,
289109,
272730,
436570,
215395,
239973,
280938,
321901,
354671,
362864,
354672,
272755,
354678,
199030,
223611,
436609,
395653,
436613,
395660,
264591,
272784,
420241,
240020,
190870,
190872,
289185,
436644,
289195,
272815,
436659,
338359,
436677,
289229,
281038,
281039,
256476,
420326,
166403,
420374,
322077,
289328,
330291,
322119,
191065,
436831,
420461,
346739,
346741,
420473,
297600,
166533,
346771,
363155,
264855,
363161,
289435,
436897,
248494,
166581,
355006,
363212,
363228,
436957,
322269,
436960,
264929,
338658,
289511,
330473,
346859,
330476,
289517,
215790,
199415,
289534,
322302,
35584,
133889,
322312,
346889,
166677,
207639,
363295,
355117,
191285,
355129,
273209,
273211,
355136,
355138,
420680,
355147,
355148,
355153,
281426,
387927,
363353,
363354,
281434,
420702,
363361,
363362,
412516,
355173,
355174,
281444,
207724,
355182,
207728,
420722,
314240,
158594,
330627,
240517,
265094,
387977,
396171,
355216,
224146,
224149,
256918,
256919,
256920,
240543,
256934,
289720,
273336,
289723,
273341,
330688,
379845,
363462,
19398,
273353,
191445,
207839,
347104,
314343,
134124,
412653,
257007,
248815,
347122,
437245,
257023,
125953,
396292,
330759,
347150,
330766,
412692,
330789,
248871,
281647,
412725,
257093,
404550,
207954,
339031,
257126,
404582,
265318,
322664,
396395,
265323,
404589,
273523,
363643,
248960,
363658,
404622,
224400,
347286,
265366,
429209,
339101,
429216,
265381,
380069,
3243,
208044,
322733,
421050,
339131,
265410,
183492,
273616,
339167,
298209,
421102,
363769,
52473,
208123,
52476,
412926,
437504,
322826,
388369,
380178,
429332,
126229,
412963,
257323,
273713,
298290,
208179,
159033,
347451,
372039,
257353,
257354,
109899,
437585,
331091,
150868,
314708,
372064,
429410,
437602,
281958,
388458,
265579,
306541,
421240,
224637,
388488,
298378,
306580,
282008,
396697,
282013,
290206,
396709,
298406,
241067,
314797,
380335,
355761,
421302,
134586,
380348,
380350,
216511,
216510,
306630,
200136,
273865,
306634,
339403,
372172,
413138,
437726,
429540,
3557,
3559,
191980,
282097,
265720,
216575,
290304,
372226,
437766,
323083,
208397,
323088,
413202,
388630,
413206,
175640,
216610,
372261,
347693,
323120,
396850,
200245,
323126,
290359,
134715,
323132,
421437,
396865,
282182,
413255,
265800,
273992,
421452,
265809,
396885,
290391,
265816,
396889,
306777,
388699,
396896,
388712,
388713,
314997,
290425,
339579,
396927,
282248,
224907,
396942,
405140,
274071,
323226,
208547,
208548,
405157,
388775,
282279,
364202,
421556,
224951,
224952,
306875,
282302,
323262,
241366,
224985,
282330,
159462,
372458,
397040,
12017,
323315,
274170,
200444,
175874,
249606,
282379,
216844,
372497,
397076,
421657,
339746,
216868,
257831,
167720,
241447,
421680,
282418,
421686,
274234,
339782,
315209,
159563,
339799,
307038,
274276,
282471,
274288,
372592,
274296,
339840,
372625,
282517,
298912,
118693,
438186,
126896,
151492,
380874,
372699,
323554,
380910,
380922,
380923,
274432,
372736,
241695,
430120,
102441,
315433,
430127,
405552,
282671,
241717,
249912,
225347,
307269,
421958,
233548,
176209,
315477,
53334,
381013,
200795,
356446,
323678,
438374,
176231,
438378,
233578,
422000,
249976,
266361,
422020,
381061,
168070,
168069,
381071,
241809,
430231,
200856,
422044,
192670,
192671,
299166,
258213,
299176,
323761,
184498,
430263,
266427,
356550,
299208,
372943,
266447,
258263,
356575,
307431,
438512,
372979,
389364,
381173,
135416,
356603,
184574,
266504,
217352,
61720,
381210,
282908,
389406,
282912,
233761,
438575,
315698,
266547,
332084,
397620,
438583,
127292,
438592,
332100,
323914,
201037,
397650,
348499,
250196,
348501,
389465,
332128,
110955,
242027,
242028,
160111,
250227,
315768,
291193,
438653,
291200,
266628,
340356,
242059,
225684,
373141,
373144,
291225,
389534,
397732,
373196,
176602,
242138,
184799,
291297,
201195,
324098,
233987,
340489,
397841,
283154,
258584,
397855,
291359,
348709,
348710,
397872,
283185,
234037,
340539,
266812,
438850,
348741,
381515,
348748,
430681,
332379,
242274,
184938,
373357,
184942,
176751,
389744,
356983,
356984,
209529,
356990,
291455,
422529,
373377,
152196,
201348,
356998,
348807,
356999,
316044,
275102,
340645,
176805,
422567,
176810,
160441,
422591,
291529,
225996,
135888,
242385,
234216,
373485,
373486,
21239,
275193,
348921,
234233,
242428,
299777,
430853,
430860,
62222,
430880,
234276,
234290,
152372,
160569,
430909,
160576,
348999,
283466,
439118,
234330,
275294,
381791,
127840,
357219,
439145,
177002,
308075,
381811,
201590,
177018,
398205,
340865,
291713,
349066,
316299,
349068,
234382,
308111,
381840,
308113,
390034,
373653,
430999,
209820,
381856,
185252,
398244,
422825,
381872,
177074,
398268,
349122,
398275,
373705,
127945,
340960,
398305,
340967,
398313,
234476,
127990,
349176,
201721,
349179,
234499,
357380,
398370,
357413,
357420,
300087,
21567,
308288,
398405,
349254,
218187,
250955,
300109,
234578,
250965,
439391,
250982,
398444,
62574,
357487,
300147,
119925,
349304,
234626,
349315,
349317,
234635,
373902,
234655,
234662,
373937,
373939,
324790,
300215,
218301,
283841,
283846,
259275,
316628,
259285,
357594,
414956,
251124,
316661,
292092,
439550,
439563,
242955,
414989,
349458,
259346,
382243,
382246,
382257,
292145,
382264,
333115,
193853,
193858,
251212,
406862,
234830,
259408,
283990,
357720,
300378,
300379,
374110,
234864,
382329,
259449,
357758,
243073,
357763,
112019,
398740,
234902,
333224,
374189,
251314,
284086,
259513,
54719,
292291,
300490,
300526,
259569,
251379,
300539,
398844,
210429,
366081,
316951,
374297,
153115,
431646,
349727,
431662,
374327,
210489,
235069,
349764,
292424,
292426,
128589,
333389,
333394,
349780,
128600,
235096,
300643,
300645,
415334,
54895,
366198,
210558,
210559,
415360,
325246,
415369,
431754,
210569,
267916,
415376,
259741,
153252,
399014,
210601,
202413,
415419,
259780,
333508,
267978,
333522,
325345,
333543,
325357,
431861,
284410,
161539,
284425,
300812,
284430,
366358,
169751,
431901,
341791,
186148,
186149,
284460,
399148,
431918,
202541,
153392,
431935,
415555,
325444,
153416,
325449,
341837,
415566,
431955,
325460,
341846,
300893,
259937,
382820,
276326,
415592,
292713,
292719,
325491,
341878,
276343,
333687,
350072,
112510,
325508,
333700,
243590,
325514,
350091,
350092,
350102,
350108,
333727,
219046,
284584,
292783,
300983,
128955,
219102,
292835,
6116,
317416,
432114,
325620,
415740,
268286,
415744,
243720,
399372,
153618,
358418,
178215,
325675,
243763,
358455,
399433,
333902,
104534,
194667,
260206,
432241,
284789,
374913,
374914,
415883,
333968,
153752,
333990,
104633,
260285,
227517,
268479,
374984,
301270,
301271,
334049,
325857,
268515,
383208,
317676,
260337,
260338,
432373,
375040,
309504,
432387,
260355,
375052,
194832,
325904,
391448,
268570,
178459,
186660,
268581,
334121,
358698,
317738,
260396,
325930,
358707,
432435,
178485,
358710,
14654,
268609,
227655,
383309,
383327,
391521,
366948,
416101,
416103,
383338,
432503,
432511,
211327,
227721,
285074,
252309,
39323,
285083,
317851,
285089,
375211,
334259,
129461,
342454,
358844,
293309,
317889,
326083,
416201,
129484,
154061,
416206,
326093,
432608,
285152,
391654,
432616,
334315,
375281,
293368,
317949,
334345,
432650,
309770,
342537,
342549,
416288,
342560,
350758,
350759,
358951,
358952,
293420,
219694,
219695,
432694,
244279,
309831,
375369,
375373,
416334,
301647,
416340,
244311,
416353,
260705,
375396,
268901,
244345,
334473,
375438,
326288,
285348,
293552,
342705,
285362,
383668,
342714,
39616,
383708,
342757,
269036,
432883,
342775,
203511,
383740,
416509,
359166,
162559,
375552,
432894,
228099,
285443,
285450,
383755,
326413,
285467,
326428,
318247,
342827,
391980,
318251,
375610,
301883,
342846,
416577,
416591,
244569,
375644,
252766,
293729,
351078,
342888,
392057,
211835,
392065,
260995,
400262,
392071,
424842,
236427,
252812,
400271,
392080,
400282,
7070,
211871,
359332,
359333,
293801,
326571,
252848,
326580,
261045,
261046,
326586,
359365,
211913,
326602,
342990,
252878,
433104,
56270,
359380,
433112,
433116,
359391,
187372,
343020,
383980,
203758,
383994,
171009,
384004,
433166,
384015,
433173,
293911,
326684,
252959,
384031,
375848,
318515,
203829,
261191,
375902,
375903,
392288,
253028,
351343,
187505,
138354,
187508,
384120,
302202,
285819,
392317,
343166,
384127,
392320,
285823,
285833,
285834,
318602,
228492,
253074,
326803,
187539,
359574,
285850,
351389,
302239,
253098,
302251,
367791,
367792,
367798,
64699,
294075,
228541,
343230,
367809,
253124,
113863,
351445,
310496,
195809,
253168,
351475,
351489,
367897,
367898,
245018,
130342,
130344,
130347,
261426,
212282,
294210,
359747,
359748,
146763,
114022,
253288,
425327,
425331,
163190,
327030,
384379,
253316,
294278,
384391,
318860,
253339,
253340,
318876,
343457,
245160,
359860,
359861,
343480,
310714,
228796,
228804,
425417,
310731,
327122,
425434,
310747,
310758,
253431,
359931,
187900,
343552,
245249,
228868,
409095,
359949,
294413,
253456,
302613,
253462,
146976,
245290,
245291,
343606,
163385,
425534,
138817,
147011,
147020,
196184,
179800,
343646,
212574,
204386,
155238,
204394,
138862,
310896,
188021,
294517,
286351,
188049,
425624,
229021,
245413,
286387,
384693,
376502,
286392,
302778,
409277,
286400,
409289,
425682,
286419,
294621,
245471,
155360,
294629,
212721,
163575,
286457,
286463,
319232,
360194,
409355,
155408,
417556,
294699,
204600,
319289,
384826,
409404,
360253,
409416,
376661,
237397,
368471,
425820,
368486,
384871,
409446,
40809,
368489,
425832,
417648,
417658,
360315,
253828,
327556,
311183,
425875,
294806,
294808,
253851,
376733,
319393,
294820,
253868,
188349,
98240,
212947,
212953,
360416,
294887,
253930,
327666,
385011
] |
d90b1b1f51ee0ae1d031e7ed6caf573a2758ff88 | 7b6ef1b197394fe231d6de6e4d716f6e832d01d1 | /iPadLIDARScanExport/ChooseDemoVC.swift | ed141e45924b09742d15502c02668c64506498a7 | [] | no_license | wata-chinhtran/iPadLIDARScanExport | f81bcd223a64092a2038f3280620275200331ee3 | a5e5fa4edc14d799afcd9f9f425d221149972246 | refs/heads/master | 2022-12-19T13:21:53.916726 | 2020-09-22T10:47:30 | 2020-09-22T10:47:30 | 297,584,596 | 0 | 1 | null | 2020-09-22T10:46:43 | 2020-09-22T08:28:04 | null | UTF-8 | Swift | false | false | 1,508 | swift | //
// ChooseDemoVC.swift
// iPadLIDARScanExport
//
// Created by Chinh Tran on 9/22/20.
// Copyright © 2020 Apple. All rights reserved.
//
import UIKit
import ARKit
class ChooseDemoVC: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
@IBAction func lidarClicked(_ sender: Any) {
guard ARWorldTrackingConfiguration.isSupported else {
fatalError("""
ARKit is not available on this device. For apps that require ARKit
for core functionality, use the `arkit` key in the key in the
`UIRequiredDeviceCapabilities` section of the Info.plist to prevent
the app from installing. (If the app can't be installed, this error
can't be triggered in a production scenario.)
In apps where AR is an additive feature, use `isSupported` to
determine whether to show UI for launching AR experiences.
""") // For details, see https://developer.apple.com/documentation/arkit
}
guard ARWorldTrackingConfiguration.supportsSceneReconstruction(.mesh) else {
fatalError("""
Scene reconstruction requires a device with a LiDAR Scanner, such as the 4th-Gen iPad Pro.
""")
}
}
@IBAction func trueDepthClicked(_ sender: Any) {
}
}
| [
-1
] |
e725559096444edee64f23bb6b22b9161aaab53c | ae4e2e233fc453aaa2d935832437040ad81f2e25 | /ArretadasFGC/ArretadasFGC/Transition.swift | 7fa9296820f95f14cdf434bbf632caf0dbb3daa7 | [] | no_license | jessicalewinter/ArretadasFGC | b74a590741f7ffd7e734328d0ca12303399032e2 | a51c8d77bf1547475a2086ba8c0758a69fc75ba5 | refs/heads/master | 2020-03-27T13:25:51.562369 | 2019-01-04T18:07:02 | 2019-01-04T18:07:02 | 146,609,141 | 2 | 1 | null | 2018-10-30T19:23:29 | 2018-08-29T14:05:51 | Swift | UTF-8 | Swift | false | false | 1,148 | swift | //
// Transition.swift
// ArretadasFGC
//
// Created by Ada 2018 on 05/09/2018.
// Copyright © 2018 Ada 2018. All rights reserved.
//
import UIKit
class Transition: NSObject, UIViewControllerAnimatedTransitioning {
let duration: Double?
var presenting = true
init(duration: Double) {
self.duration = duration
super.init()
}
func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
return duration!
}
func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
let container = transitionContext.containerView
let toView = transitionContext.view(forKey: .to)!
container.addSubview(toView)
toView.transform = CGAffineTransform(translationX: container.frame.origin.x * 2 , y: container.frame.origin.y)
toView.alpha = 0.0
UIView.animate(withDuration: duration!, animations: {
toView.alpha = 1.0
}, completion: { _ in
transitionContext.completeTransition(true)
}
)
}
}
| [
378418
] |
13773b6e1c9703d00a71f8eeb86ae8ecba16cf32 | 2de1025818dbe95ac9612ea2b98849b16c3f292f | /SecondKadaiApp/AppDelegate.swift | 740daed39160b26ad68f6ead378631c0a772b447 | [] | no_license | afuroda/SecondKadaiApp | 47488dd5c6715e3c00e43b4a4baa6f7eb77ff92d | f3fc36fb2b26202a295ad53b9b53f67492dcfe22 | refs/heads/master | 2021-05-12T09:44:49.972804 | 2018-01-13T09:57:38 | 2018-01-13T09:57:38 | 117,332,793 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,188 | swift | //
// AppDelegate.swift
// SecondKadaiApp
//
// Created by 山口航輝 on 2018/01/13.
// Copyright © 2018年 koki.yamaguchi. 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,
278545,
229394,
278548,
229397,
229399,
229402,
352284,
229405,
278556,
278559,
229408,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
286774,
286776,
319544,
286778,
204856,
229432,
352318,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
278623,
278626,
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,
286916,
295110,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
303347,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
286987,
319757,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
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,
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,
279082,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
213575,
172618,
303690,
33357,
303696,
279124,
172634,
262752,
254563,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
295538,
189039,
172660,
287349,
189040,
189044,
287355,
287360,
295553,
172675,
295557,
311942,
303751,
287365,
352905,
311946,
279178,
287371,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
287390,
303773,
172705,
287394,
172707,
303780,
164509,
287398,
205479,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
287427,
312005,
312006,
172748,
287436,
107212,
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,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303981,
303985,
303987,
328563,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
304007,
213895,
304009,
304011,
304013,
295822,
279438,
213902,
189329,
295825,
304019,
189331,
58262,
304023,
304027,
279452,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
197564,
230334,
304063,
304065,
213954,
189378,
156612,
197580,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
295945,
230413,
295949,
197645,
320528,
140312,
295961,
238620,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
132165,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
279661,
205934,
164973,
312432,
279669,
337018,
189562,
279679,
66690,
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,
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,
279929,
181631,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
337306,
288154,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
337335,
288185,
279991,
222652,
312766,
173507,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
288212,
222676,
288214,
148946,
239064,
329177,
288217,
280027,
288220,
288218,
239070,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
370146,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
148990,
296450,
206336,
230916,
230919,
230923,
304651,
304653,
370187,
230940,
222752,
108066,
296486,
296488,
157229,
239152,
230961,
157236,
288320,
288325,
124489,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
239202,
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,
263888,
313044,
280276,
321239,
280283,
313052,
18140,
288478,
313055,
419555,
321252,
313066,
288494,
280302,
313073,
321266,
419570,
288499,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
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,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
305028,
280454,
247688,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
354265,
354270,
239586,
313320,
354281,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
321560,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
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,
288909,
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,
280891,
289087,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
280919,
248153,
354653,
313700,
313705,
280937,
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,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
305662,
305664,
240129,
305666,
305668,
223749,
240132,
281095,
223752,
150025,
338440,
330244,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
264845,
182926,
133776,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
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,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
338823,
322440,
314249,
240519,
183184,
142226,
289687,
240535,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
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,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
306555,
298365,
290174,
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,
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,
28219,
282186,
224849,
282195,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
324757,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
196133,
282295,
323260,
282300,
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,
298822,
315211,
307027,
315221,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
298901,
44948,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
241581,
241583,
323504,
241586,
282547,
241588,
290739,
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,
282639,
290835,
282645,
241693,
241701,
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,
315524,
307338,
233613,
241813,
307352,
299164,
241821,
299167,
315552,
184479,
184481,
315557,
184486,
307370,
307372,
307374,
307376,
299185,
323763,
184503,
176311,
299191,
307386,
258235,
307388,
307385,
307390,
176316,
299200,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
299225,
233701,
307432,
282881,
282893,
323854,
291089,
282906,
291104,
233766,
307508,
315701,
332086,
307510,
307512,
307515,
307518,
282942,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
276052,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
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,
127434,
315856,
176592,
315860,
176597,
283095,
127447,
299481,
176605,
242143,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
283142,
127497,
233994,
135689,
127500,
233998,
127506,
234003,
234006,
127511,
152087,
283161,
242202,
234010,
135707,
135710,
242206,
242208,
291361,
242220,
291378,
152118,
234038,
234041,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
299740,
201444,
299750,
283368,
234219,
283372,
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,
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,
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,
234364,
291711,
234368,
291714,
234370,
291716,
234373,
316294,
201603,
226182,
308105,
234375,
226185,
234379,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
234396,
291742,
226200,
234398,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
324522,
234410,
291756,
291754,
226220,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
324536,
275384,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
234437,
226245,
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,
275462,
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,
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,
308379,
234648,
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,
226500,
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,
283917,
177424,
275725,
349451,
349464,
415009,
283939,
259367,
292143,
283951,
300344,
243003,
283963,
226628,
300357,
283973,
283983,
316758,
357722,
316766,
316768,
292192,
292197,
316774,
218473,
284010,
136562,
324978,
275834,
333178,
275836,
275840,
316803,
316806,
316811,
316814,
226703,
300433,
234899,
300436,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
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,
300527,
308720,
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,
284223,
284226,
284228,
292421,
226886,
284231,
128584,
243268,
284234,
366155,
317004,
276043,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
292433,
284247,
317015,
235097,
243290,
276053,
284249,
284251,
300638,
284253,
284255,
284258,
292452,
292454,
284263,
284265,
292458,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
276095,
284288,
292481,
284290,
325250,
284292,
292485,
292479,
276098,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
276114,
284308,
284312,
284314,
276122,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
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,
284399,
358128,
276206,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
292681,
153417,
358224,
276308,
284502,
317271,
178006,
276315,
292700,
317279,
284511,
227175,
292715,
300912,
292721,
284529,
300915,
292729,
317306,
284540,
292734,
325512,
276365,
317332,
358292,
284564,
284566,
399252,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
284585,
276395,
292784,
358326,
358330,
276410,
276411,
276418,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276452,
292839,
276455,
292843,
276460,
292845,
276464,
178161,
227314,
325624,
276472,
317435,
276479,
276482,
276485,
317446,
276490,
350218,
292876,
350222,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
284739,
325700,
243779,
292934,
243785,
276553,
350293,
350295,
309337,
194649,
227418,
350299,
350302,
227423,
350304,
178273,
309346,
194657,
194660,
350308,
309350,
309348,
292968,
309352,
309354,
301163,
350313,
350316,
227430,
301167,
276583,
350321,
276590,
284786,
276595,
350325,
252022,
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,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
301252,
350406,
227529,
301258,
309450,
276685,
309455,
276689,
309462,
301272,
194780,
309468,
309471,
301283,
317672,
317674,
325867,
243948,
309491,
309494,
243960,
276735,
227583,
227587,
276739,
276742,
227593,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
276811,
235853,
235858,
276829,
276833,
391523,
276836,
293227,
276843,
293232,
276848,
186744,
211324,
227709,
285061,
366983,
317833,
178572,
285070,
285077,
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,
301562,
317951,
309764,
301575,
121352,
293387,
236043,
342541,
113167,
309779,
317971,
309781,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
23094,
277054,
219714,
129603,
301636,
318020,
301639,
301643,
277071,
285265,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
309871,
121458,
277106,
170619,
309885,
309888,
277122,
277128,
285320,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
334488,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
293555,
318132,
342707,
154292,
285368,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
342745,
137946,
342747,
342749,
113378,
228069,
277223,
342760,
285417,
56043,
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,
310080,
293696,
277317,
277322,
293706,
310100,
301911,
301913,
277337,
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,
276579,
293811,
293817,
293820,
203715,
326603,
342994,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
351217,
318450,
293876,
285686,
302073,
121850,
293882,
302075,
285690,
293887,
277504,
277507,
138246,
277511,
293899,
277519,
293908,
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,
294026,
302218,
285835,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
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,
64768,
310531,
285958,
138505,
228617,
318742,
277798,
130345,
113964,
285999,
113969,
318773,
318776,
286010,
417086,
286016,
302403,
294211,
384328,
294221,
294223,
326991,
179547,
302436,
294246,
327015,
310632,
327017,
351594,
351607,
310648,
310651,
310657,
351619,
294276,
310659,
327046,
253320,
310665,
318858,
310672,
351633,
310689,
130468,
277932,
310703,
310710,
130486,
310712,
310715,
302526,
228799,
302534,
310727,
245191,
64966,
163272,
302541,
302543,
310737,
228825,
310749,
310755,
187880,
310764,
286188,
310772,
40440,
212472,
40443,
286203,
310780,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
302617,
286233,
302621,
286240,
146977,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
278057,
310831,
245288,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
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,
278188,
302764,
278192,
319153,
278196,
302781,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
286420,
278227,
286425,
319194,
278235,
278238,
229086,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
188252,
237409,
229233,
294776,
360317,
294785,
327554,
360322,
40851,
294811,
237470,
319390,
40865,
319394,
294817,
294821,
311209,
180142,
343983,
188340,
40886,
319419,
294844,
294847,
237508,
393177,
294876,
294879,
294883,
393190,
294890,
311279,
278513,
237555,
311283,
278516,
278519,
237562
] |
9f5ff1f3f80cbcbc587fd28d02acb5f22477f153 | ecf0709db6c1299df99e9f8188fc54f209ac4acc | /VegasETA WatchKit Extension/ComplicationController.swift | 1cfa9162d916bfa3abb8596115ba3591668273cc | [] | no_license | emmekappa/VegasETA | 8a612db902898f4c13e4274ab404dfd3a496bc13 | cc5012f3d58f669a65f3b05d232f8d182d60987c | refs/heads/master | 2020-07-02T17:12:18.095069 | 2017-05-22T23:14:07 | 2017-05-22T23:14:07 | 74,291,160 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,881 | swift | //
// ComplicationController.swift
// VegasETA WatchKit Extension
//
// Created by Michele Cantelli on 21/05/17.
// Copyright © 2017 Michele Cantelli. All rights reserved.
//
import ClockKit
class ComplicationController: NSObject, CLKComplicationDataSource {
// MARK: - Timeline Configuration
func getSupportedTimeTravelDirections(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTimeTravelDirections) -> Void) {
handler([.forward, .backward])
}
func getTimelineStartDate(for complication: CLKComplication, withHandler handler: @escaping (Date?) -> Void) {
handler(nil)
}
func getTimelineEndDateForComplication(complication: CLKComplication, withHandler handler: (NSDate?) -> Void) {
handler(NSDate(timeIntervalSinceNow: (60 * 60 * 24)))
}
func getPrivacyBehavior(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationPrivacyBehavior) -> Void) {
handler(.showOnLockScreen)
}
func getNextRequestedUpdateDate(handler: @escaping (Date?) -> Void) {
handler(Date(timeIntervalSinceNow: TimeInterval(10*60)))
}
// MARK: - Timeline Population
func getCurrentTimelineEntry(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTimelineEntry?) -> Void) {
switch complication.family {
case .modularSmall:
let template = CLKComplicationTemplateModularSmallRingText()
template.textProvider = CLKSimpleTextProvider(text: "real")
template.fillFraction = self.dayFraction
handler(CLKComplicationTimelineEntry(date: Date(), complicationTemplate: template))
case .utilitarianSmall:
let template = CLKComplicationTemplateUtilitarianSmallRingText()
template.textProvider = CLKSimpleTextProvider(text: "real")
template.fillFraction = self.dayFraction
handler(CLKComplicationTimelineEntry(date: Date(), complicationTemplate: template))
default:
NSLog("%@", "Unknown complication type: \(complication.family)")
handler(nil)
}
}
var dayFraction : Float {
let now = Date()
let calendar = Calendar.current
let componentFlags = Set<Calendar.Component>([.year, .month, .day, .weekOfYear, .hour, .minute, .second, .weekday, .weekdayOrdinal])
var components = calendar.dateComponents(componentFlags, from: now)
components.hour = 0
components.minute = 0
components.second = 0
let startOfDay = calendar.date(from: components)!
return Float(now.timeIntervalSince(startOfDay)) / Float(24*60*60)
}
func getTimelineEntries(for complication: CLKComplication, before date: Date, limit: Int, withHandler handler: @escaping ([CLKComplicationTimelineEntry]?) -> Void) {
// Call the handler with the timeline entries prior to the given date
handler(nil)
}
func getTimelineEntries(for complication: CLKComplication, after date: Date, limit: Int, withHandler handler: @escaping ([CLKComplicationTimelineEntry]?) -> Void) {
// Call the handler with the timeline entries after to the given date
handler(nil)
}
// MARK: - Placeholder Templates
func getLocalizableSampleTemplate(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTemplate?) -> Void) {
if complication.family == .utilitarianSmall {
let template = CLKComplicationTemplateUtilitarianSmallRingText()
template.textProvider = CLKSimpleTextProvider(text: "HI")
template.fillFraction = self.dayFraction
handler(template)
} else {
handler(nil)
}
}
}
| [
-1
] |
df3a17718c9435fed0d785550fb367dd0c7597ae | 083b9bc3be64d4ed412ad5e896a2a63e78f960c5 | /Rokaru/TicketViewController.swift | e066a8957326d306e44937e4b6c082b8d4f6f31f | [] | no_license | werdna521/rokaru-ios | b1e0c3a775908d77c354d706a2fd48458a797476 | 376e5345deb857648d79e9341ffdf70997f13b0f | refs/heads/main | 2023-02-02T15:34:49.324129 | 2020-12-21T03:48:13 | 2020-12-21T03:48:13 | 323,007,443 | 1 | 2 | null | 2020-12-21T03:48:14 | 2020-12-20T06:18:36 | Swift | UTF-8 | Swift | false | false | 495 | swift | //
// TicketViewController.swift
// Rokaru
//
// Created by Endru Tjen on 21/12/20.
//
import UIKit
import QRCode
class TicketViewController: UIViewController {
@IBOutlet weak var _ticket: Ticket!
override func viewDidLoad() {
super.viewDidLoad()
_ticket.title.text = "Nasi Goreng Pinsen Crazy"
_ticket.date.text = "Senin, 21 Desember 2020"
_ticket.time.text = "15:45"
_ticket.qr.image = QRCode("https://mamakgila.com")?.image
}
}
| [
-1
] |
d78d1e8b39e692250a19d6897ecac35b210633aa | 8fd1d1a81b57b5c322e1aaa607d094f37052d7c8 | /Sources/AppDeliverServer/utility/AliyunOSSModule/PutObjectRequest.swift | 29ffb2f5506a838dea138b680b77686ae20c5f01 | [
"MIT"
] | permissive | wyxy2005/AppDeliverServer | 12d271fe2fd943e40c41bb97f5225d95b7ed5049 | 82fb696b15a7233583686fd6b67a5e813a757bb6 | refs/heads/master | 2020-06-18T02:51:48.937162 | 2018-12-01T02:56:55 | 2018-12-01T02:56:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,110 | swift | //
// PutObjectRequest.swift
// AppDeliverServer
//
// Created by zhangcan on 2018/4/12.
//
import Foundation
import PerfectCURL
import PerfectCrypto
import PerfectLib
import PerfectHTTP
class OSSRequest {
var accessKeyId: String = aliyunAccessKeyInfo().accessKeyId
var accessKeySecret = aliyunAccessKeyInfo().accessKeySecret
var bucketName = "appdeliver"
let endPoint = "oss-cn-hangzhou.aliyuncs.com"
var objectKey = ""
///VERB表示HTTP 请求的Method,主要有PUT,GET,POST,HEAD,DELETE等
var verb = ""
///host = bucketName + endPoint
var host: String {
return "\(bucketName).\(endPoint)"
}
var url: String {
return "https://\(self.host)/\(self.objectKey)"
}
var data: [UInt8]?
var date = Date()
var contentMD5: String? {
if let data = data,
let md5 = data.digest(.md5)?.encode(.base64),
let md5Str = String(validatingUTF8: md5) {
return md5Str
}
return nil
}
var contentType = "image/jpg"
///计算获取授权信息
func authorization() -> String? {
let data = signature()
//方法参考https://help.aliyun.com/document_detail/31951.html?spm=a2c4g.11186623.6.869.FWp9NK
if let signed = data.sign(.sha1, key: HMACKey(accessKeySecret))?.encode(.base64),
let base64Str = String(validatingUTF8: signed) {
let authorization = "OSS \(accessKeyId):\(base64Str)"
return authorization
}
return nil
}
///签名
func signature() -> String {
var commentmd5 = ""
if let md5 = self.contentMD5 {
commentmd5 = md5 + "\n"
}
let data = "\(verb)" + "\n"
+ "\(commentmd5)"
+ "\(contentType)" + "\n"
+ "\(GMTDate())" + "\n"
+ "\(canonicalizedOSSHeaders())"
+ "\(canonicalizedResource())"
return data
}
///获取GMT格式date
func GMTDate() -> String {
let date = self.date
let dateFormatter = DateFormatter()
//Wed, 05 Sep. 2012 23:00:00 GMT
dateFormatter.dateFormat = "E, dd MMM yyyy HH:mm:ss zzz"
dateFormatter.locale = Locale.init(identifier: "en_US")
dateFormatter.timeZone = TimeZone(secondsFromGMT: 0)
let dateString = dateFormatter.string(from: date)
return dateString
}
///CanonicalizedOSSHeaders
func canonicalizedOSSHeaders() -> String {
return ""
}
///CanonicalizedResource
func canonicalizedResource() -> String {
return "" + "/\(bucketName)" + "/\(objectKey)"
}
func curlRequest() -> CURLRequest {
return CURLRequest()
}
}
class PutObjectRequest: OSSRequest {
var file: File
init(file: File ,objectName name: String) {
self.file = file
super.init()
do {
self.data = try file.readSomeBytes(count: file.size)
} catch {}
self.objectKey = name
verb = "PUT"
}
override func curlRequest() -> CURLRequest {
let request = self;
return CURLRequest(request.url,
.addHeader(.host, request.host),
.addHeader(.custom(name: "Content-Encoding"), "utf-8"),
.addHeader(.custom(name: "Content-Disposition"), " attachment;filename=oss_download.jpg"),
.addHeader(.custom(name: "Content-MD5"), request.contentMD5 ?? ""),
.addHeader(.custom(name: "Date"), request.GMTDate()),
.addHeader(.custom(name: "Content-Type"), request.contentType),
.addHeader(.custom(name: "Content-Length"), "\(request.data?.count ?? 0)"),
.addHeader(.custom(name: "Authorization"), "\(request.authorization() ?? "")"),
.postData(request.data ?? [UInt8]()),
.httpMethod(HTTPMethod.from(string: request.verb)))
}
}
| [
-1
] |
37aa21b14fe767ee01c155893b900342177a4aa7 | f4378972735fccf0832752c22a494196001c11e6 | /TicTacToe/ViewController.swift | bc9f788b028a2570de1a41f707757d449ff1b572 | [] | no_license | jaleach/Tic-Tac-Toe-Swift | 0123f131d8731e7a4a6dde8e673d4994987ed659 | cbd52ccf1d7aaf6c0b5ae1a3a6fd3a4675a98c0b | refs/heads/master | 2020-12-24T05:56:14.920870 | 2016-11-11T02:37:24 | 2016-11-11T02:37:24 | 73,439,368 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,411 | swift | //
// ViewController.swift
// TicTacToe
//
// Created by James Leach on 11/10/16.
// Copyright © 2016 Dadio. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var winnerLabel: UILabel!
@IBOutlet weak var playAgainButton: UIButton!
@IBAction func playAgain(_ sender: AnyObject) {
activeGame = true
activePlayer = 1
gameState = [0, 0, 0, 0, 0, 0, 0, 0, 0]
for i in 1..<10 {
if let button = view.viewWithTag(i) as? UIButton {
button.setImage(nil, for: [])
}
winnerLabel.isHidden = true
playAgainButton.isHidden = true
winnerLabel.center = CGPoint(x: winnerLabel.center.x - 500, y: winnerLabel.center.y)
playAgainButton.center = CGPoint(x: playAgainButton.center.x - 500, y: playAgainButton.center.y)
}
}
// 1 is nought, 2 is crosses
var activeGame = true
var activePlayer = 1
var gameState = [0, 0, 0, 0, 0, 0, 0, 0, 0] // 0 - empty, 1 - noughts, 2 - crosses
let winningCombinations = [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 8], [2, 4, 6]]
@IBAction func buttonPressed(_ sender: AnyObject) {
let activePosition = sender.tag - 1
if gameState[activePosition] == 0 && activeGame {
gameState[activePosition] = activePlayer
if activePlayer == 1{
sender.setImage(UIImage(named: "nought.png"), for: [])
activePlayer = 2
} else {
sender.setImage(UIImage(named: "cross.png"), for: [])
activePlayer = 1
}
for combination in winningCombinations {
if gameState[combination[0]] != 0 && gameState[combination[0]] == gameState[combination[1]] && gameState[combination[1]] == gameState[combination[2]] {
// We have a winner!
activeGame = false
winnerLabel.isHidden = false
playAgainButton.isHidden = false
if gameState[combination[0]] == 1 {
winnerLabel.text = "The Os have won!"
} else {
winnerLabel.text = "Crosses has won!"
}
UIView.animate(withDuration: 1, animations: {
self.winnerLabel.center = CGPoint(x: self.winnerLabel.center.x + 500, y: self.winnerLabel.center.y)
self.playAgainButton.center = CGPoint(x: self.playAgainButton.center.x + 500, y: self.playAgainButton.center.y)
})
}
}
}
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
winnerLabel.isHidden = true
playAgainButton.isHidden = true
winnerLabel.center = CGPoint(x: winnerLabel.center.x - 500, y: winnerLabel.center.y)
playAgainButton.center = CGPoint(x: playAgainButton.center.x - 500, y: playAgainButton.center.y)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
| [
340337
] |
d6c15636ed84dac5fe79ac8450c7aa5b31f203ef | 7386d885589bf9760753b7fe102cd812a177f4f8 | /CIAC/Models/StaffResponseItem.swift | ca695467e4a157672a4caa70e8211722c37172a3 | [] | no_license | CameronHamidi/CIAC | d1ee63b6634d8bfcd26bb0463a28768985787bed | ea0517b27f672237b05f4cedfd02b6ac1f262117 | refs/heads/master | 2020-03-30T03:00:03.347927 | 2019-04-05T00:15:35 | 2019-04-05T00:15:35 | 150,663,070 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 375 | swift | //
// StaffResponseItem.swift
// CIAC
//
// Created by Cameron Hamidi on 12/27/18.
// Copyright © 2018 Cornell International Affairs Conference. All rights reserved.
//
import Foundation
class StaffResponseItem: Codable {
var staffRooms: [StaffRoomsItem]
var sessions: [String]
}
class StaffRoomsItem: Codable {
var name: String
var rooms: [String]
}
| [
-1
] |
a44e0854df3e062a8cd4504db25eed4f28787ab7 | 4f7acd1f8e59be177c48c5af8d27da81103397d7 | /PhotoExplorer/Scenes/LargeImageViewing/CenteredScrollView.swift | 523cbcd650ae39089197ecb19126ba1f42dcb145 | [] | no_license | misumac/photoexplorer | 141b8faa2ea65a7da1fa495ec6538b048e719188 | 0a725a0c58c540db4f06cc2521271f525372ff8d | refs/heads/master | 2021-01-21T12:01:10.506447 | 2017-09-01T05:56:47 | 2017-09-01T05:56:47 | 102,041,534 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,107 | swift | //
// CenteredScrollView.swift
// PhotoExplorer
//
// Created by Mihai on 2/4/16.
// Copyright © 2016 Mihai. All rights reserved.
//
import UIKit
class CenteredScrollView: UIScrollView {
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
override func drawRect(rect: CGRect) {
// Drawing code
}
*/
override func layoutSubviews() {
super.layoutSubviews()
let boundsSize = self.bounds.size
let centerView = self.subviews[0]
var frameToCenter = centerView.frame
if (frameToCenter.size.width < boundsSize.width) {
frameToCenter.origin.x = (boundsSize.width - frameToCenter.size.width) * 0.5
} else {
frameToCenter.origin.x = 0
}
if (frameToCenter.size.height < boundsSize.height) {
frameToCenter.origin.y = (boundsSize.height - frameToCenter.size.height) * 0.5
} else {
frameToCenter.origin.y = 0
}
centerView.frame = frameToCenter
}
}
| [
-1
] |
9c420785d7f6febfbd0649c510edd2e3ab5db446 | e8a8f27d688a41a1987bf9b5b2aef89a8b81a97d | /DISRailWay/DISRailWay/Classes/Kensa/Denshasen/Controllers/DISDenshasenMainController.swift | d8d2d1026e2b701f9d0934a591d55c84f2790cbf | [
"MIT"
] | permissive | NightMare08/DISRailWay | 4c229cd18109b24e20872a8cd9b0a8a6ec08776d | fa7d0cb8646f55118b289ce9fcc8041f1d869000 | refs/heads/master | 2021-07-25T20:29:58.699451 | 2017-11-07T03:01:14 | 2017-11-07T03:01:14 | 108,822,086 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 880 | swift | //
// DISDenshasenMainController.swift
// DISRailWay
//
// Created by dis on 2017/11/06.
// Copyright © 2017年 jp.co.disol. All rights reserved.
//
import UIKit
class DISDenshasenMainController: DISBaseController {
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: - 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
] |
e700b7120f6f85594ce7b48a9868ee7fe2a6775c | 70b412e7e6caf533f894f63f8ba50f2f5c0645fd | /flix_feed_1/ViewController/NowPlayingViewController.swift | b8b94e6283f9ed397a26cf77b6e8e27ef05473b7 | [
"Apache-2.0"
] | permissive | Vanlao/iOS_flix_feed_1 | bfedc41ee2c6e0f09da9c6c12e21594c5f13769b | b3ca115276b02ad8c1680567e703b6406de633c2 | refs/heads/master | 2020-03-29T10:55:42.391806 | 2018-11-07T20:18:09 | 2018-11-07T20:18:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,630 | swift | //
// NowPlayingViewController.swift
// flix_feed_1
//
// Created by macstudent on 9/21/18.
// Copyright © 2018 Van Lao. All rights reserved.
//
import UIKit
import AlamofireImage
class NowPlayingViewController: UIViewController, UITableViewDataSource{
@IBOutlet weak var tableView: UITableView!
var movies: [[String: Any]] = []
var refreshControl = UIRefreshControl()
override func viewDidLoad() {
super.viewDidLoad()
refreshControl = UIRefreshControl()
refreshControl.addTarget(self, action: #selector(NowPlayingViewController.PulledToRefresh(_:)), for: .valueChanged)
tableView.insertSubview(refreshControl, at: 0)
tableView.dataSource = self
FecthMovies()
}
@objc func PulledToRefresh(_ refreshControl: UIRefreshControl){
FecthMovies()
}
func FecthMovies(){
//requesting url from the API database
let url = URL(string: "https://api.themoviedb.org/3/movie/now_playing?api_key=a07e22bc18f5cb106bfe4cc1f83ad8ed")!
let request = URLRequest(url: url, cachePolicy: .reloadIgnoringLocalCacheData, timeoutInterval: 10)
let session = URLSession(configuration: .default, delegate: nil, delegateQueue: OperationQueue.main)
let task = session.dataTask(with: request) { (data, response, error) in
// This will run when the network request returns
if let error = error {
print(error.localizedDescription)
} else if let data = data {
let dataDictionary = try! JSONSerialization.jsonObject(with: data, options: []) as! [String: Any]
let movieList = dataDictionary["results"] as! [[String: Any]]
self.movies = movieList
self.tableView.reloadData()
self.refreshControl.endRefreshing()
// TODO: Get the array of movies
// TODO: Store the movies in a property to use elsewhere
// TODO: Reload your table view data
}
}
task.resume()
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return movies.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "MovieCell", for: indexPath) as! MovieCellsTableViewCell
let movie = movies[indexPath.row]
let title = movie["title"] as! String
let Overview = movie["overview"] as! String
cell.titleLabel.text = title
cell.overview.text = Overview
let PosterPathString = movie["poster_path"] as! String
let baseURLString = "https://image.tmdb.org/t/p/w500"
let PosterURL = URL(string: baseURLString + PosterPathString)!
cell.PosterImageView.af_setImage(withURL: PosterURL)
return cell
}
// the next function prepare all the info about movie if DetailViewController is loaded.
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
let cell = sender as! UITableViewCell
if let indexPath = tableView.indexPath(for: cell){
let movie = movies[indexPath.row]
let detailViewControl = segue.destination as! DetailViewController
detailViewControl.movieDetail = movie
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
| [
-1
] |
4268dda81b9bbdf2c8a0862981870e41ea513dbb | 7b427ca5c23f729637c981146e5267f1cef44054 | /Linchi/File-Manipulation/FileCache.swift | e8c4c7ed636d010e1ac401b0e39c2310b37074c8 | [
"MIT"
] | permissive | kylebshr/Linchi | 8575ce7596c12d86b9e423e13ba41b37e1dec769 | 2144f63e057e057aafe5733c70c465951871c5fb | refs/heads/master | 2021-01-18T01:25:33.439587 | 2015-08-28T16:51:23 | 2015-08-28T16:51:23 | 41,557,152 | 3 | 0 | null | 2015-08-28T16:18:47 | 2015-08-28T16:18:47 | null | UTF-8 | Swift | false | false | 1,751 | swift | //
// FileCache.swift
// Linchi
//
import Darwin
// TODO: find better name
/// A FileCache stores the content of some files in memory for fast retrieval.
public struct FileCache : SequenceType {
private var allFiles : [String: [UInt8]] = [:]
/// Add a file to `self`
public mutating func addFile(path: String, url: String) {
allFiles[url] = readFile(path)!
}
/// Add all the files in the directory to the server. This is not recursive.
public mutating func addFilesInDirectory(path: String, url: String) throws {
let dir = opendir(path)
guard dir != nil else { throw Error.CannotOpenDirectory }
defer { closedir(dir) }
for var ent = readdir(dir); ent != nil; ent = readdir(dir) {
let info = ent.memory
var name : [Int8] = []
let mirror = Mirror(reflecting: info.d_name)
loop: for (_, value) in mirror.children {
let x = value as! Int8
if x <= 0 { break loop }
name.append(x)
}
let fileName = String.fromUTF8Bytes(name.map { UInt8($0) })
guard !fileName.hasPrefix(".") else { continue }
let filePath = path + fileName
if Int32(info.d_type) == DT_REG {
allFiles[url + fileName] = readFile(filePath)!
}
}
}
public func generate() -> DictionaryGenerator<String, [UInt8]> {
return allFiles.generate()
}
public subscript(url: String) -> [UInt8]? {
get { return allFiles[url] }
set(newValue) { allFiles[url] = newValue }
}
public enum Error : ErrorType {
case CannotOpenDirectory
}
}
| [
-1
] |
a84e15dfdf0f3db302f3cdd7e82a8c3a722ea7dc | 77264b3880f812aed95c57b5d5733ec0d4aee570 | /ParseTutorial/UIViewControllerExtension.swift | 0d7438cfdc407e39d7743d8c768d140760ac1233 | [] | no_license | nguyenttimothy/ggiparseserver | f2d5b89b6e56b902b2b8673f4a50dd2b103c9fcd | 57ab917697209ded2ef9d8609e70d5dd49e98f3a | refs/heads/master | 2021-07-07T16:40:17.222983 | 2017-10-04T04:49:47 | 2017-10-04T04:49:47 | 105,733,066 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,793 | swift | /**
* Copyright (c) 2017 Razeware LLC
*
* 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.
*/
import Foundation
import UIKit
extension UIViewController {
func showErrorView(_ error: Error?) {
guard let error = error as? NSError, let errorMessage = error.userInfo["error"] as? String else {
return
}
let alertController = UIAlertController(title: NSLocalizedString("Error", comment: ""),
message: errorMessage,
preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: NSLocalizedString("Dismiss", comment: ""),
style: .default))
present(alertController, animated: true)
}
}
| [
-1
] |
1cb5b3cb3121858dfe963324b57cb87a6e0896f1 | 3290d4106493760d878a447117e49029e4fbb4fc | /BottomSheet/WelcomeContainerViewController.swift | 9143beadac288ecb4a9e5501477d713a00bab023 | [] | no_license | YamamotoDesu/BottomSheet | 9ba2c618a6cffed0b6be07e1dd675c5e0a849df2 | 951ebeba87b5ee9d9a9de24d1283b416b1e72b64 | refs/heads/main | 2023-08-28T13:46:09.665231 | 2021-10-16T10:05:59 | 2021-10-16T10:05:59 | 417,784,784 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 404 | swift | //
// WelcomeContainerViewController.swift
// BottomSheet
//
// Created by Zafar on 8/13/20.
// Copyright © 2020 Zafar. All rights reserved.
//
import UIKit
final class WelcomeContainerViewController: BottomSheetContainerViewController
<HelloViewController, MyCustomViewController> {
override func viewDidLoad() {
super.viewDidLoad()
// Do something
}
}
| [
-1
] |
514a81cda4e51bc068390e7652364bfdb4d0f093 | 84a90b0ce2fcee746bc985c425b9c7b9c0858c96 | /Survey Project/Survey Project/User.swift | e1e5c8337a6aaac408c747eb96b54d126d34c2f8 | [] | no_license | dani1996dani/Survey-Project-iOS | 08b9fc983cdde87c39cbace090582bb8df0fce83 | ec0f72c50326b2ea830c313b19604dca8f360f61 | refs/heads/master | 2020-04-14T02:47:35.006570 | 2018-12-31T16:11:21 | 2018-12-31T16:11:21 | 163,591,888 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 352 | swift | //
// User.swift
// Survey Project
//
// Created by Daniel Butrashvili on 29/12/2018.
// Copyright © 2018 Daniel Butrashvili. All rights reserved.
//
import Foundation
class User {
var userId : Int
var username : String
init(userId : Int, username : String){
self.userId = userId
self.username = username
}
}
| [
-1
] |
a8930220a0d4f2df0f3124589c9c5202a4ae4353 | 7a88072123f896f9c0ee5630c19ed3e1919c2247 | /Sources/main.swift | 89f3ca65faa8fb175b548cb85c96ea178ba8dd90 | [] | no_license | siavashalipour/Microservice1 | 504944c7c49f93f770f893330bed950c993a4277 | d99a0e232ed2277d3b534e43f30219156e51b692 | refs/heads/master | 2021-01-24T09:36:07.699835 | 2016-09-29T06:13:36 | 2016-09-29T06:13:36 | 69,304,280 | 0 | 0 | null | 2016-09-27T06:17:44 | 2016-09-27T00:31:31 | Swift | UTF-8 | Swift | false | false | 732 | swift | import Foundation
import Kitura
import LoggerAPI
import HeliumLogger
import CloudFoundryEnv
import CloudFoundryDeploymentTracker
do {
// HeliumLogger disables all buffering on stdout
HeliumLogger.use(LoggerMessageType.info)
let controller = try Controller()
Log.info("Server will be started on '\(controller.url)'.")
CloudFoundryDeploymentTracker(repositoryURL: "https://github.com/siavashalipour/Microservice1.git", codeVersion: nil).track()
Kitura.addHTTPServer(onPort: controller.port, with: controller.router)
// Start Kitura-Starter-Bluemix server
Kitura.run()
} catch let error {
Log.error(error.localizedDescription)
Log.error("Oops... something went wrong. Server did not start!")
}
| [
-1
] |
6edb5366e894d3f663a5fdd18ccbfe09894dd52b | f173d5cf6a683195f6607931394eb4c6f092565f | /code/2467. Heap Sort DSA P2 V7 - Heap Sort/7 - Heap Sort/Start/DataStructures/Sources/Heap.swift | cc954791afddfe5b7f3cdbeecc465225ca9ba5df | [
"MIT"
] | permissive | iOSDevLog/raywenderlich | ec4c775b18179be180d5e794553c0d6ed9ef2f97 | 8b81fbeb046abfeda95f9870c3c29b4998dbb12d | refs/heads/master | 2020-05-22T12:02:50.159112 | 2019-05-13T06:53:49 | 2019-05-13T06:53:49 | 186,328,282 | 4 | 2 | null | null | null | null | UTF-8 | Swift | false | false | 3,466 | swift | /// Copyright (c) 2019 Razeware LLC
///
/// 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.
///
/// Notwithstanding the foregoing, you may not use, copy, modify, merge, publish,
/// distribute, sublicense, create a derivative work, and/or sell copies of the
/// Software in any work that is designed, intended, or marketed for pedagogical or
/// instructional purposes related to programming, coding, application development,
/// or information technology. Permission for such use, copying, modification,
/// merger, publication, distribution, sublicensing, creation of derivative works,
/// or sale is expressly withheld.
///
/// 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.
struct Heap<Element: Equatable> {
fileprivate var elements: [Element] = []
let areSorted: (Element, Element) -> Bool
init(_ elements: [Element], areSorted: @escaping (Element, Element) -> Bool) {
self.areSorted = areSorted
self.elements = elements
guard !elements.isEmpty else {
return
}
for index in stride(from: elements.count / 2 - 1, through: 0, by: -1) {
siftDown(from: index)
}
}
var isEmpty: Bool {
return elements.isEmpty
}
var count: Int {
return elements.count
}
func peek() -> Element? {
return elements.first
}
func getChildIndices(ofParentAt parentIndex: Int) -> (left: Int, right: Int) {
let leftIndex = (2 * parentIndex) + 1
return (leftIndex, leftIndex + 1)
}
func getParentIndex(ofChildAt index: Int) -> Int {
return (index - 1) / 2
}
mutating func removeRoot() -> Element? {
guard !isEmpty else {
return nil
}
elements.swapAt(0, count - 1)
let originalRoot = elements.removeLast()
siftDown(from: 0)
return originalRoot
}
mutating func siftDown(from index: Int) {
var parentIndex = index
while true {
let (leftIndex, rightIndex) = getChildIndices(ofParentAt: parentIndex)
var optionalParentSwapIndex: Int?
if leftIndex < count
&& areSorted(elements[leftIndex], elements[parentIndex])
{
optionalParentSwapIndex = leftIndex
}
if rightIndex < count
&& areSorted(elements[rightIndex], elements[optionalParentSwapIndex ?? parentIndex])
{
optionalParentSwapIndex = rightIndex
}
guard let parentSwapIndex = optionalParentSwapIndex else {
return
}
elements.swapAt(parentIndex, parentSwapIndex)
parentIndex = parentSwapIndex
}
}
}
| [
319360,
379649,
319362,
367878,
379655,
319368,
319369,
319370,
319376,
319377,
319379,
319380,
319381,
319382,
319383,
319384,
319385,
339617,
379298,
379305,
379306,
379307,
379308,
333624,
379713,
411719,
307403,
307404,
379725,
379726,
379727,
333648,
379729,
379646,
319320,
379737,
226011,
226012,
379739,
329569,
319330,
379617,
379618,
309605,
309990,
319334,
309994,
379372,
379638,
379514,
379644,
379645,
367870,
379647
] |
d65fa6ee20494cfa211cdd60c67a80bbc0a34a58 | eb731390a9d99dbcaf23a82250911533a03c0b91 | /Package.swift | c3942f9804eb1d78809a4f7f0f3bc446bc32a759 | [
"MIT"
] | permissive | ostanik/spm-phones-exercise | 9889b988e53d35173f8fcb8b5844e858171d05e8 | 8406019d2cd6c05e7d587a80b5eafbc5fe95942a | refs/heads/main | 2023-03-27T00:35:38.412755 | 2021-03-29T14:37:51 | 2021-03-29T14:37:51 | 352,663,708 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 843 | swift | // swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "Phones",
dependencies: [
.package(url: "https://github.com/apple/swift-argument-parser", from: "0.0.1")
],
targets: [
.target(
name: "Phones",
dependencies: [.product(name: "ArgumentParser", package: "swift-argument-parser"), "PhonesCore"],
resources: [.copy("Resources/area_codes.txt")]),
.target(
name: "PhonesCore",
dependencies: []),
.testTarget(
name: "PhonesTests",
dependencies: ["Phones"],
resources: [.copy("Resources/area_codes.txt"),
.copy("Resources/phone_numbers.txt")]),
]
)
| [
275186,
111181
] |
8354980b15c706a0803c0ce47d4a5388dcfe025f | 14fdb060b872917fb83b84a0525817a192815eaf | /Unilib/Sources/Filters.swift | da6369a0cb6f9f5bc00de077efe47031b1068d65 | [
"MIT"
] | permissive | davidbjames/Unilib | e7058233f0441237150941d3b43de6b0cdb722b1 | 1d572cff81d54240953ad9170310b478dd0b276f | refs/heads/master | 2022-07-21T04:23:17.831487 | 2022-07-14T18:46:47 | 2022-07-14T18:46:47 | 69,879,759 | 0 | 0 | null | 2017-07-26T15:07:16 | 2016-10-03T14:39:53 | Swift | UTF-8 | Swift | false | false | 1,222 | swift | //
// Filters.swift
// Unilib
//
// Created by David James on 9/28/16.
// Copyright © 2016-2021 David B James. All rights reserved.
//
import Foundation
// MOVE out of Unilib unless C3 becomes related to form input and validation.
/// Filterer. Returns it's own type (filtered).
public typealias Filter<T> = (T) -> (T)
/// Composite filter. Handles multiple filters via filter().
public class CompositeFilter<T> {
private var filters:[Filter<T>] = []
public init() { }
public func filter(_ input:T) -> T {
var result:T = input
for filter in filters {
result = filter(result)
}
return result
}
public func add(_ filter:@escaping Filter<T>) -> CompositeFilter<T> {
filters.append(filter)
return self
}
public func add(_ factory:CompositeFilter<T>) -> CompositeFilter<T> {
filters.append(contentsOf: factory.filters)
return self
}
}
/// Filter factory.
/// Every concrete filter is actually a factory since it primarily
/// produces something that can be used to filter with.
public protocol FilterFactory {
associatedtype T
static func make() -> CompositeFilter<T>
}
| [
-1
] |
307ce6576e941af61950e8fec8ea0e8dd27d904e | af0952ff35bac06af95dd559fa77074879f2e695 | /MuseumTourGuide/AppDelegate.swift | 72ba44e9a71342bc5ca0417e0188d7754150b495 | [] | no_license | jeffrey0725/MuseumTourGuide | adb60c4f37d3fe03a04b871e39e51f01383eb60c | 567c950718a6d43a2c271092d36502c7bbe15a87 | refs/heads/master | 2020-06-30T06:56:51.339637 | 2019-08-06T02:18:36 | 2019-08-06T02:18:36 | 200,760,478 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,189 | swift | //
// AppDelegate.swift
// MuseumTourGuide
//
// Created by Jeffrey Cheung on 13/11/2018.
// Copyright © 2018 Jeffrey Cheung. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: 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,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
286774,
286776,
319544,
286778,
229432,
204856,
352318,
286791,
237640,
286797,
278605,
311375,
237646,
163920,
196692,
319573,
311383,
278623,
278626,
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,
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,
254563,
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,
295583,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
279231,
287427,
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,
189169,
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,
213902,
189329,
295825,
304019,
189331,
58262,
304023,
304027,
279452,
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,
66690,
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,
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,
279929,
181626,
181631,
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,
288214,
148946,
239064,
288217,
329177,
280027,
288220,
288218,
239070,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
370146,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
148990,
296450,
206336,
230916,
230919,
214535,
230923,
304651,
304653,
370187,
230940,
222752,
108066,
296486,
296488,
157229,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
181854,
239202,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
419489,
190118,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
419522,
313027,
280260,
419525,
206536,
280264,
206539,
206541,
206543,
263888,
313044,
280276,
321239,
280283,
313052,
288478,
313055,
419555,
321252,
313066,
288494,
280302,
280304,
313073,
321266,
419570,
288499,
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,
304968,
280393,
280402,
173907,
313171,
313176,
42842,
280419,
321381,
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,
354653,
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,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
240132,
281095,
223752,
150025,
338440,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
264845,
133776,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
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,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
240519,
322440,
314249,
338823,
183184,
289687,
240535,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
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,
306555,
290174,
298365,
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,
282127,
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,
324757,
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,
323330,
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,
241821,
299167,
315552,
184479,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
299185,
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,
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,
315860,
176597,
127447,
283095,
299481,
176605,
242143,
291299,
127463,
242152,
291305,
127466,
176620,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
127490,
283142,
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,
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,
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,
226171,
234364,
291711,
234368,
291714,
234370,
291716,
234373,
201603,
226182,
234375,
226185,
308105,
234379,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
226200,
234396,
234398,
291742,
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,
234501,
275462,
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,
234648,
308379,
300189,
324766,
119967,
234653,
283805,
234657,
324768,
242852,
300197,
234661,
283813,
234664,
177318,
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,
275725,
349451,
349464,
415009,
283939,
259367,
283951,
292143,
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,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
227440,
316917,
308727,
292343,
300537,
316933,
316947,
308757,
308762,
284191,
316959,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
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,
276052,
284253,
235097,
284255,
300638,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
276095,
284288,
292481,
284290,
325250,
284292,
292485,
292479,
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,
284399,
358128,
276206,
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,
284566,
399252,
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,
292843,
276460,
276464,
178161,
227314,
276466,
325624,
276472,
317435,
276476,
276479,
276482,
276485,
317446,
276490,
350218,
292876,
350222,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
284739,
325700,
243779,
292934,
243785,
276553,
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,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
194708,
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,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
301562,
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,
309871,
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,
342749,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
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,
301913,
277337,
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,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
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,
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,
277804,
285999,
277807,
113969,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
294221,
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,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
278057,
310831,
245288,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
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,
280021,
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,
278519,
237562
] |
3940f6a4b7bcf381b343c3f430e3ab741bed0297 | 93e7e66cd3a64b77c2e77828912203d1639f4463 | /RoboSim/Model/Room.swift | 8529c2237428949080873173e945c6e12c7b1c41 | [] | no_license | devshark666/RoboSim | 1b49a4fee4f60f064ac33160e5dcc7698bc8306a | 06816ae2b6538fa972848174d26495425b8570d4 | refs/heads/main | 2023-03-06T23:50:29.861731 | 2021-02-02T21:36:19 | 2021-02-02T21:36:19 | 335,341,094 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 302 | swift | //
// Room.swift
// RoboSim
//
// Created by Jesper on 14/01/2021.
//
import Foundation
struct Room {
let width: Int
let height: Int
func isPositionWithinBounds(_ position: Position) -> Bool {
return position.x >= 0 && position.x <= width &&
position.y >= 0 && position.y <= height
}
}
| [
-1
] |
8bb18cd74da60e4d6ee4f4171c03284b1fc80b47 | a47a9641d98c9b3a57410b55c19b744178106e7e | /PlayingCard/PlayingCardDeck.swift | 3bab6ee462820974396ac5d33835938ca94ae2c1 | [] | no_license | chloesf/Playing-Card | c47c10a2abb6c6a4b5fe2dc1168f1d47e8c780a7 | 67a5f80246397886dc5e35fd7bc8cd09f168791f | refs/heads/master | 2020-04-13T06:33:09.419854 | 2018-02-15T03:49:43 | 2018-02-15T03:49:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 909 | swift | //
// PlayingCardDeck.swift
// PlayingCard
//
// Created by Husayn Hakeem on 2/11/18.
// Copyright © 2018 HusaynHakeem. All rights reserved.
//
import Foundation
struct PlayingCardDeck {
private(set) var cards = [PlayingCard]()
init() {
for suit in PlayingCard.Suit.all {
for rank in PlayingCard.Rank.all {
cards.append(PlayingCard(suit: suit, rank: rank))
}
}
}
mutating func draw() -> PlayingCard? {
if cards.count > 0 {
return cards.remove(at: cards.count.arc4random)
} else {
return nil
}
}
}
extension Int {
var arc4random : Int {
if self > 0 {
return Int(arc4random_uniform(UInt32(self)))
} else if self < 0 {
return -Int(arc4random_uniform(UInt32(self)))
} else {
return 0
}
}
}
| [
393217
] |
203894cc1ee27238eb6641c360284a075483bb67 | 2349209e74b82382f584ee8ef2721103d16095c3 | /qr-reader/InsahnyTests/InsahnyTests.swift | a6c865c70a35082d3ca1e70729bfe50afdee1f6e | [] | no_license | karibtidoucha/Insahny | 375ee81c29ff6c7a306d8f15facf1f3f230e3e5e | 3f9c3900dcf6efb8d6323c95b217dc2af46faa17 | refs/heads/master | 2020-03-16T16:25:03.620567 | 2018-04-29T05:44:00 | 2018-04-29T05:44:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 771 | swift | //
// InsahnyTests.swift
// InsahnyTests
//
// Created by Nnamdi Ugwuoke on 4/28/18.
// Copyright © 2018 Insahny. All rights reserved.
//
import XCTest
@testable import Insahny
class InsahnyTests: 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 testPost() {
let sender = Sender()
sender.send(results: ["a","b", "c"])
RunLoop.main.run(until: Date().addingTimeInterval(2))
print("done")
}
}
| [
-1
] |
25f62127ede5d94c7d518bb430b1b59da1d55683 | 1429689ced7bd9e208b0635f72a5e1a6f7254fef | /DPDraggableButton/DPDraggableButton.swift | 0a24348b9964cbda31036ded791585c30c6c33e8 | [
"MIT"
] | permissive | mohsinalimat/DPDraggableButton-Swift | 33e6fe0448f5edfa34dacc3fe7ff916de3b0edf0 | 7b1720d27a46550afe4323e25f6a8e73a1e32c18 | refs/heads/master | 2020-12-06T23:27:41.390253 | 2016-08-12T17:36:29 | 2016-08-12T17:40:57 | 65,787,294 | 1 | 0 | null | 2016-08-16T04:23:00 | 2016-08-16T04:23:00 | null | UTF-8 | Swift | false | false | 8,378 | swift | //
// DPDraggableButton.swift
// DPDraggableButtonDemo
//
// Created by Hongli Yu on 8/11/16.
// Copyright © 2016 Hongli Yu. All rights reserved.
//
import Foundation
import UIKit
public enum DPDraggableButtonType {
case DPDraggableRect
case DPDraggableRound
var description: String {
switch self {
case .DPDraggableRect:
return "DPDraggableRect"
case .DPDraggableRound:
return "DPDraggableRound"
}
}
}
let kDPAutoDockingDuration: Double = 0.2
let kDPDoubleTapTimeInterval: Double = 0.36
public class DPDraggableButton: UIButton {
var draggable: Bool = true
var dragging: Bool = false
var autoDocking: Bool = true
var singleTapBeenCanceled: Bool = false
var draggableButtonType: DPDraggableButtonType = .DPDraggableRect
var beginLocation: CGPoint?
var longPressGestureRecognizer: UILongPressGestureRecognizer?
// actions call back
var tapBlock:(()->Void)? { // computed
set(tapBlock) {
if let aTapBlock = tapBlock {
self.tapBlockStored = aTapBlock
self.addTarget(self, action: #selector(tapAction(_:)),
forControlEvents: .TouchUpInside)
}
}
get {
return self.tapBlockStored!
}
}
private var tapBlockStored:(()->Void)?
var doubleTapBlock:(()->Void)?
var longPressBlock:(()->Void)?
var draggingBlock:(()->Void)?
var dragDoneBlock:(()->Void)?
var autoDockingBlock:(()->Void)?
var autoDockingDoneBlock:(()->Void)?
required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)!
self.translatesAutoresizingMaskIntoConstraints = true // TODO: // warnings, fixed constraints by ib
self.configDefaultSettingWithType(.DPDraggableRect)
}
public init() {
super.init(frame: CGRectZero)
}
public init(frame: CGRect,
draggableButtonType: DPDraggableButtonType) {
super.init(frame: frame)
self.addButtonToKeyWindow()
self.configDefaultSettingWithType(draggableButtonType)
}
public init(view: AnyObject, frame: CGRect,
draggableButtonType: DPDraggableButtonType) {
super.init(frame: frame)
view.addSubview(self)
self.configDefaultSettingWithType(draggableButtonType)
}
public func addButtonToKeyWindow() {
if let keyWindow = UIApplication.sharedApplication().keyWindow {
keyWindow.addSubview(self)
} else if (UIApplication.sharedApplication().windows.first != nil) {
UIApplication.sharedApplication().windows.first?.addSubview(self)
}
}
private func configDefaultSettingWithType(type: DPDraggableButtonType) {
// type
self.draggableButtonType = type
// shape
switch (type) {
case .DPDraggableRect:
break
case .DPDraggableRound:
self.layer.cornerRadius = self.frame.size.height / 2.0
self.layer.borderColor = UIColor.lightGrayColor().CGColor
self.layer.borderWidth = 0.5
self.layer.masksToBounds = true
}
// gestures
self.longPressGestureRecognizer = UILongPressGestureRecognizer.init()
if let longPressGestureRecognizer = self.longPressGestureRecognizer {
longPressGestureRecognizer.addTarget(self, action:#selector(longPressHandler(_:)) )
longPressGestureRecognizer.allowableMovement = 0
self.addGestureRecognizer(longPressGestureRecognizer)
}
}
// MARK: Gestures Handler
func longPressHandler(gesture: UILongPressGestureRecognizer) {
switch gesture.state {
case .Began:
if let longPressBlock = self.longPressBlock {
longPressBlock()
}
break
default:
break
}
}
// MARK: Actions
func tapAction(sender: AnyObject) {
let delayInSeconds: Double = (self.doubleTapBlock != nil ? kDPDoubleTapTimeInterval : 0)
let popTime: dispatch_time_t = dispatch_time(DISPATCH_TIME_NOW,
(Int64)(delayInSeconds * (Double)(NSEC_PER_SEC)))
dispatch_after(popTime, dispatch_get_main_queue()) {
if let tapBlock = self.tapBlock {
if (!self.singleTapBeenCanceled
&& !self.dragging) {
tapBlock();
}
}
}
}
// MARK: Touch
public override func touchesBegan(touches: Set<UITouch>,
withEvent event: UIEvent?) {
self.dragging = false
super.touchesBegan(touches, withEvent: event)
let touch: UITouch? = (touches as NSSet).anyObject() as? UITouch
if touch?.tapCount == 2 {
self.doubleTapBlock?()
self.singleTapBeenCanceled = true
} else {
self.singleTapBeenCanceled = false
}
self.beginLocation = (touches as NSSet).anyObject()?.locationInView(self)
}
public override func touchesMoved(touches: Set<UITouch>,
withEvent event: UIEvent?) {
if self.draggable {
self.dragging = true
let touch: UITouch? = (touches as NSSet).anyObject() as? UITouch
let currentLocation: CGPoint? = touch?.locationInView(self)
let offsetX: CGFloat? = (currentLocation?.x)! - (self.beginLocation?.x)!
let offsetY: CGFloat? = (currentLocation?.y)! - (self.beginLocation?.y)!
self.center = CGPointMake(self.center.x + offsetX!, self.center.y + offsetY!)
let superviewFrame: CGRect? = self.superview?.frame
let frame: CGRect = self.frame
let leftLimitX: CGFloat = frame.size.width / 2.0
let rightLimitX: CGFloat? = (superviewFrame?.size.width)! - leftLimitX
let topLimitY: CGFloat = frame.size.height / 2.0
let bottomLimitY: CGFloat? = (superviewFrame?.size.height)! - topLimitY
if (self.center.x > rightLimitX) {
self.center = CGPointMake(rightLimitX!, self.center.y)
} else if (self.center.x <= leftLimitX) {
self.center = CGPointMake(leftLimitX, self.center.y)
}
if (self.center.y > bottomLimitY) {
self.center = CGPointMake(self.center.x, bottomLimitY!)
} else if (self.center.y <= topLimitY) {
self.center = CGPointMake(self.center.x, topLimitY)
}
self.draggingBlock?()
}
}
public override func touchesEnded(touches: Set<UITouch>,
withEvent event: UIEvent?) {
super.touchesEnded(touches, withEvent: event)
if (self.dragging && self.dragDoneBlock != nil) {
self.dragDoneBlock!()
self.singleTapBeenCanceled = true;
}
if (self.dragging && self.autoDocking) {
let superviewFrame: CGRect? = self.superview?.frame
let frame: CGRect = self.frame
let middleX: CGFloat? = (superviewFrame?.size.width)! / 2.0
if (self.center.x >= middleX!) {
UIView.animateWithDuration(kDPAutoDockingDuration,
animations: {
self.center = CGPointMake((superviewFrame?.size.width)! - frame.size.width / 2.0, self.center.y)
self.autoDockingBlock?()
},
completion: { (finished) in
self.autoDockingDoneBlock?()
})
} else {
UIView.animateWithDuration(kDPAutoDockingDuration,
animations: {
self.center = CGPointMake(frame.size.width / 2, self.center.y)
self.autoDockingBlock?()
},
completion: { (finished) in
self.autoDockingDoneBlock?()
})
}
}
self.dragging = false
}
public override func touchesCancelled(touches: Set<UITouch>?,
withEvent event: UIEvent?) {
self.dragging = false
super.touchesCancelled(touches, withEvent:event)
}
// MARK: Remove
class func removeAllFromKeyWindow() {
if let subviews = UIApplication.sharedApplication().keyWindow?.subviews {
for view: AnyObject in subviews {
if view.isKindOfClass(DPDraggableButton) {
view.removeFromSuperview()
}
}
}
}
class func removeAllFromView(superView : AnyObject) {
if let subviews = superView.subviews {
for view: AnyObject in subviews {
if view.isKindOfClass(DPDraggableButton) {
view.removeFromSuperview()
}
}
}
}
}
| [
-1
] |
dd7e1886edd13e32f34a17528092da5763fb3757 | b53511a0f3ae63f0a6aa3d1cb979d1f6bed489c5 | /Mestika Dashboard/Menu/Onboarding/Views/Register/VerificationAddressView.swift | dc7662bf11baf374113f49aead814ec66eb1c67c | [] | no_license | arraisi/SwiftUI-Vision-DG | 815ed1f4ecd70610ba990ef352cc9f1992c73d9e | 9a124961e7360abfb86157188cf184bc067a340d | refs/heads/main | 2023-06-26T13:31:27.650291 | 2021-07-27T10:48:45 | 2021-07-27T10:48:45 | 317,121,110 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 31,081 | swift | //
// VerificationAddressView.swift
// Bank Mestika
//
// Created by Prima Jatnika on 30/09/20.
//
import SwiftUI
import Combine
struct VerificationAddressView: View {
@AppStorage("language")
private var language = LocalizationService.shared.language
@EnvironmentObject var appState: AppState
@EnvironmentObject var registerData: RegistrasiModel
@State var isShowNextView : Bool = false
@State var addressInput: String = ""
// @State var addressRtRwInput: String = ""
@State var addressProvinsiInput: String = ""
@State var addressKotaInput: String = ""
@State var addressKelurahanInput: String = ""
@State var addressKecamatanInput: String = ""
@State var addressKodePosInput: String = ""
let verificationAddress: [MasterModel] = load("verificationAddress.json")
/* Variable for Swipe Gesture to Back */
@GestureState private var dragOffset = CGSize.zero
@State var isShowingAlert: Bool = false
@State var allProvince = MasterProvinceResponse()
@State var allRegency = MasterRegencyResponse()
@State var allDistrict = MasterDistrictResponse()
@State var allVillage = MasterVilageResponse()
var disableForm: Bool {
if (registerData.verificationAddressId == 0) {
return true
}
if (registerData.verificationAddressId != 1) {
if addressInput.isEmpty || registerData.addressInput.isEmpty || addressKelurahanInput.isEmpty || addressKecamatanInput.isEmpty || addressKodePosInput.isEmpty || addressKotaInput.isEmpty || addressProvinsiInput.isEmpty {
return true
}
}
return false
}
@Environment(\.presentationMode) var presentationMode: Binding<PresentationMode>
@State var addressSugestion = [AddressViewModel]()
@State var addressSugestionResult = [AddressResultViewModel]()
@State var showingModal = false
@State var isLoading: Bool = false
@State private var isShowAlert: Bool = false
@State var messageResponse: String = ""
var body: some View {
ZStack(alignment: .top) {
Image("bg_blue")
.resizable()
VStack(spacing: 0) {
AppBarLogo(light: false, onCancel: {})
ScrollView {
VStack {
Text("MAKE SURE YOUR INFORMATION IS CORRECT".localized(language))
.font(.title2)
.bold()
.foregroundColor(.white)
.multilineTextAlignment(.center)
.padding(.vertical, 20)
.padding(.horizontal, 20)
.fixedSize(horizontal: false, vertical: true)
VStack(alignment: .center) {
Text("Does Your Mailing Address Match Your Identity Card/(KTP)?".localized(language))
.font(.title2)
.foregroundColor(Color(hex: "#232175"))
.fontWeight(.bold)
.multilineTextAlignment(.center)
.fixedSize(horizontal: false, vertical: true)
.padding(.top, 20)
.padding(.horizontal, 20)
ZStack {
RadioButtonGroup(
items: verificationAddress,
selectedId: $registerData.verificationAddressId) { selected in
print("Selected is: \(selected)")
if (selected == 1) {
registerData.isAddressEqualToDukcapil = true
} else if (selected == 2) {
registerData.isAddressEqualToDukcapil = false
}
}
.padding(.horizontal, 20)
.padding(.top, 15)
.padding(.bottom, 20)
}
if (registerData.verificationAddressId == 1 || registerData.verificationAddressId == 0) {
EmptyView()
} else {
Group {
Divider()
.padding(.horizontal, 20)
Group {
HStack {
Text("Address".localized(language))
.font(Font.system(size: 12))
.fontWeight(.semibold)
.foregroundColor(Color(hex: "#707070"))
.multilineTextAlignment(.leading)
Spacer()
}
HStack {
MultilineTextField("Address".localized(language), text: $registerData.addressInput, onCommit: {
self.addressInput = self.registerData.addressInput
})
.font(Font.system(size: 11))
.padding(.horizontal)
.background(Color.gray.opacity(0.1))
.cornerRadius(10)
.onReceive(Just(registerData.addressInput)) { newValue in
let filtered = newValue.filter { "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 -@.".contains($0) }
if filtered != newValue {
self.registerData.addressInput = filtered
}
}
Button(action:{
searchAddress()
}, label: {
Image(systemName: "magnifyingglass")
.font(Font.system(size: 20))
.foregroundColor(Color(hex: "#707070"))
})
}
}
.padding(.horizontal, 20)
// Label Province
VStack(alignment: .leading) {
Text("Province".localized(language))
.font(Font.system(size: 12))
.fontWeight(.semibold)
.foregroundColor(Color(hex: "#707070"))
.multilineTextAlignment(.leading)
HStack {
TextField("Province".localized(language), text: $registerData.addressProvinsiInput)
.font(Font.system(size: 14))
.frame(height: 50)
.padding(.leading, 15)
.disabled(true)
Menu {
ForEach(0..<self.allProvince.count, id: \.self) { i in
Button(action: {
registerData.addressProvinsiInput = self.allProvince[i].name
self.addressProvinsiInput = self.allProvince[i].name
self.getRegencyByIdProvince(idProvince: self.allProvince[i].id)
}) {
Text(self.allProvince[i].name)
.font(.custom("Montserrat-Regular", size: 12))
}
}
} label: {
Image(systemName: "chevron.right").padding()
}
}
.frame(height: 36)
.font(Font.system(size: 14))
.background(Color.gray.opacity(0.1))
.cornerRadius(10)
}
.frame(alignment: .leading)
.padding(.horizontal, 20)
// Label City
VStack(alignment: .leading) {
Text("City".localized(language))
.font(Font.system(size: 12))
.fontWeight(.semibold)
.foregroundColor(Color(hex: "#707070"))
.multilineTextAlignment(.leading)
HStack {
TextField("City".localized(language), text: $registerData.addressKotaInput)
.font(Font.system(size: 14))
.frame(height: 50)
.padding(.leading, 15)
.disabled(true)
Menu {
ForEach(0..<self.allRegency.count, id: \.self) { i in
Button(action: {
registerData.addressKotaInput = self.allRegency[i].name
self.addressKotaInput = self.allRegency[i].name
self.getDistrictByIdRegency(idRegency: self.allRegency[i].id)
}) {
Text(self.allRegency[i].name)
.font(.custom("Montserrat-Regular", size: 12))
}
}
} label: {
Image(systemName: "chevron.right").padding()
}
}
.frame(height: 36)
.font(Font.system(size: 14))
.background(Color.gray.opacity(0.1))
.cornerRadius(10)
}
.frame(alignment: .leading)
.padding(.horizontal, 20)
// Label District
VStack(alignment: .leading) {
Text("District".localized(language))
.font(Font.system(size: 12))
.fontWeight(.semibold)
.foregroundColor(Color(hex: "#707070"))
.multilineTextAlignment(.leading)
HStack {
TextField("District".localized(language), text: $registerData.addressKelurahanInput)
.font(Font.system(size: 14))
.frame(height: 50)
.padding(.leading, 15)
.disabled(true)
Menu {
ForEach(0..<self.allDistrict.count, id: \.self) { i in
Button(action: {
registerData.addressKelurahanInput = self.allDistrict[i].name
self.addressKelurahanInput = self.allDistrict[i].name
self.getVilageByIdDistrict(idDistrict: self.allDistrict[i].id)
}) {
Text(self.allDistrict[i].name)
.font(.custom("Montserrat-Regular", size: 12))
}
}
} label: {
Image(systemName: "chevron.right").padding()
}
}
.frame(height: 36)
.font(Font.system(size: 14))
.background(Color.gray.opacity(0.1))
.cornerRadius(10)
}
.frame(alignment: .leading)
.padding(.horizontal, 20)
// Label Village
VStack(alignment: .leading) {
Text("Sub-district".localized(language))
.font(Font.system(size: 12))
.fontWeight(.semibold)
.foregroundColor(Color(hex: "#707070"))
.multilineTextAlignment(.leading)
HStack {
TextField("Sub-district".localized(language), text: $registerData.addressKecamatanInput)
.font(Font.system(size: 14))
.frame(height: 50)
.padding(.leading, 15)
.disabled(true)
Menu {
ForEach(0..<self.allVillage.count, id: \.self) { i in
Button(action: {
registerData.addressKecamatanInput = self.allVillage[i].name
registerData.kodePosKeluarga = self.allVillage[i].postalCode ?? ""
self.addressKodePosInput = self.allVillage[i].postalCode ?? ""
self.addressKecamatanInput = self.allVillage[i].name
}) {
Text(self.allVillage[i].name)
.font(.custom("Montserrat-Regular", size: 12))
}
}
} label: {
Image(systemName: "chevron.right").padding()
}
}
.frame(height: 36)
.font(Font.system(size: 14))
.background(Color.gray.opacity(0.1))
.cornerRadius(10)
}
.frame(alignment: .leading)
.padding(.horizontal, 20)
VStack(alignment: .leading) {
Text("Postal code".localized(language))
.font(Font.system(size: 12))
.fontWeight(.semibold)
.foregroundColor(Color(hex: "#707070"))
HStack {
TextField("Postal code".localized(language), text: $addressKodePosInput) { change in
} onCommit: {
print("on commit")
registerData.addressPostalCodeInput = self.addressKodePosInput
}
.onReceive(Just(addressKodePosInput)) { newValue in
let filtered = newValue.filter { "0123456789".contains($0) }
if filtered != newValue {
self.addressKodePosInput = filtered
}
}
.onReceive(addressKodePosInput.publisher.collect()) {
self.addressKodePosInput = String($0.prefix(5))
}
.keyboardType(.numberPad)
.font(Font.system(size: 14))
.frame(height: 36)
}
.padding(.horizontal)
.background(Color.gray.opacity(0.1))
.cornerRadius(10)
}
.padding(.horizontal, 20)
.padding(.bottom, 30)
}
}
}
.frame(width: UIScreen.main.bounds.width - 50)
.background(Color.white)
.cornerRadius(15)
.shadow(radius: 30)
}
.padding(.horizontal, 30)
.padding(.top, 50)
.padding(.bottom, 10)
}
VStack {
NavigationLink(destination: PasswordView().environmentObject(registerData), isActive: self.$isShowNextView) {EmptyView()}
Button(action: {
if (registerData.isAddressEqualToDukcapil) {
self.registerData.addressInput = registerData.alamatKtpFromNik
self.registerData.addressKelurahanInput = registerData.kelurahanFromNik
self.registerData.addressKecamatanInput = registerData.kecamatanFromNik
self.registerData.addressPostalCodeInput = registerData.kodePosFromNik
self.registerData.addressProvinsiInput = registerData.provinsiFromNik
self.registerData.addressKotaInput = registerData.kabupatenKotaFromNik
self.isShowNextView = true
} else {
self.isShowNextView = true
}
}, label: {
Text("Submit Data".localized(language))
.foregroundColor(.white)
.fontWeight(.bold)
.font(.system(size: 13))
.frame(maxWidth: .infinity, minHeight: 40, maxHeight: 40)
})
.disabled(disableForm)
.background(Color(hex: disableForm ? "#CBD1D9" : "#2334D0"))
.cornerRadius(12)
.padding(.horizontal, 100)
.padding(.top, 10)
.padding(.bottom, 10)
}
.background(Color.white)
}
}
.KeyboardAwarePadding()
.edgesIgnoringSafeArea(.all)
.navigationBarHidden(true)
.navigationBarBackButtonHidden(true)
.onTapGesture() {
UIApplication.shared.endEditing()
}
.onAppear {
self.getAllProvince()
}
.alert(isPresented: $isShowingAlert) {
return Alert(
title: Text("Do you want to cancel registration?".localized(language)),
primaryButton: .default(Text("YES".localized(language)), action: {
self.appState.moveToWelcomeView = true
}),
secondaryButton: .cancel(Text("NO".localized(language))))
}
.popup(isPresented: $showingModal, type: .default, position: .bottom, animation: Animation.spring(), closeOnTap: false, closeOnTapOutside: true) {
addressSuggestionPopUp()
}
.gesture(DragGesture().onEnded({ value in
if(value.startLocation.x < 20 &&
value.translation.width > 100) {
self.isShowingAlert = true
}
}))
}
// MARK: -Fuction for Create Bottom Floater (Modal)
func addressSuggestionPopUp() -> some View {
VStack {
HStack {
Text("Address".localized(language))
.fontWeight(.bold)
.font(.system(size: 19))
.foregroundColor(Color(hex: "#232175"))
Spacer()
}
HStack {
MultilineTextField("Address".localized(language), text: $addressInput, onCommit: {
})
.font(Font.system(size: 14))
Button(action:{
searchAddress(keyword: addressInput)
}, label: {
Image(systemName: "location")
.font(Font.system(size: 20))
.foregroundColor(Color(hex: "#707070"))
})
}
.padding(.horizontal)
.background(Color.gray.opacity(0.1))
.cornerRadius(10)
ScrollView {
VStack {
ForEach(addressSugestionResult, id: \.formatted_address) {data in
Button(action: {
searchAddress(data: data.formatted_address)
self.showingModal.toggle()
}) {
VStack {
HStack{
Text(data.formatted_address)
Spacer()
}
Divider()
}
.padding(.horizontal, 15)
.padding(.vertical, 5)
}
.foregroundColor(.black)
}
}
}
.frame(height: 150)
.padding(.vertical)
}
.frame(width: UIScreen.main.bounds.width - 60)
.padding()
.background(Color.white)
.cornerRadius(20)
}
// MARK: - SEARCH LOCATION
@ObservedObject var addressVM = AddressSummaryViewModel()
func searchAddress(keyword: String? = nil) {
self.isLoading = true
self.addressVM.getAddressSugestionResult(addressInput: keyword ?? registerData.addressInput) { success in
if success {
self.isLoading = self.addressVM.isLoading
self.addressSugestionResult = self.addressVM.addressResult
self.showingModal = true
print("Success")
print("addressSugestionResult => \(self.addressSugestionResult[0])")
}
if !success {
self.isLoading = self.addressVM.isLoading
self.isShowAlert = true
self.messageResponse = self.addressVM.message
print("Not Found")
}
}
}
// MARK: - SEARCH LOCATION COMPLETION
func searchAddress(data: String) {
self.isLoading = true
self.addressVM.getAddressSugestion(addressInput: data) { success in
if success {
self.isLoading = self.addressVM.isLoading
self.addressSugestion = self.addressVM.address
DispatchQueue.main.async {
registerData.addressInput = self.addressSugestion[0].street
self.addressInput = self.addressSugestion[0].street
registerData.addressPostalCodeInput = self.addressSugestion[0].postalCode
registerData.addressKecamatanInput = self.addressSugestion[0].kelurahan
registerData.addressKelurahanInput = self.addressSugestion[0].kecamatan
registerData.addressKotaInput = self.addressSugestion[0].city
registerData.addressProvinsiInput = self.addressSugestion[0].province
self.addressKelurahanInput = self.addressSugestion[0].kecamatan
self.addressKecamatanInput = self.addressSugestion[0].kelurahan
self.addressKotaInput = self.addressSugestion[0].city
self.addressProvinsiInput = self.addressSugestion[0].province
self.addressKodePosInput = self.addressSugestion[0].postalCode
}
self.getAllProvince()
self.showingModal = false
print("Success")
print("self.addressSugestion[0].postalCode => \(self.addressSugestion[0].postalCode)")
}
if !success {
self.isLoading = self.addressVM.isLoading
self.isShowAlert = true
self.messageResponse = self.addressVM.message
print("Not Found")
}
}
}
func getAllProvince() {
self.addressVM.getAllProvince { success in
if success {
self.allProvince = self.addressVM.provinceResult
}
if !success {
}
}
}
func getRegencyByIdProvince(idProvince: String) {
self.addressVM.getRegencyByIdProvince(idProvince: idProvince) { success in
if success {
self.allRegency = self.addressVM.regencyResult
}
if !success {
}
}
}
func getDistrictByIdRegency(idRegency: String) {
self.addressVM.getDistrictByIdRegency(idRegency: idRegency) { success in
if success {
self.allDistrict = self.addressVM.districtResult
}
if !success {
}
}
}
func getVilageByIdDistrict(idDistrict: String) {
self.addressVM.getVilageByIdDistrict(idDistrict: idDistrict) { success in
if success {
self.allVillage = self.addressVM.vilageResult
}
if !success {
}
}
}
}
struct VerificationAddressView_Previews: PreviewProvider {
static var previews: some View {
VerificationAddressView().environmentObject(RegistrasiModel())
}
}
| [
-1
] |
03e4baac2493f250d44638bde5371c9fe0544522 | 5dd626221007117a1bf7c8355c6ea94603312016 | /CocaColaPrototype/Firebase/SignUpViewController.swift | 7fd370f6daec571f6a19477d2eb9926d3a941ba7 | [] | no_license | bolattleubayev/CocaColaPrototype | 06d0b80c6d7830ec15bd164568c0fdf2c2b8abf8 | c1ab453d51bb9eaaca08b1b24e101dc273eee603 | refs/heads/master | 2021-03-27T07:50:50.602034 | 2020-06-08T07:43:15 | 2020-06-08T07:43:15 | 247,803,213 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,962 | swift | //
// SignUpViewController.swift
//
import UIKit
import Firebase
class SignUpViewController: UIViewController {
@IBOutlet var nameTextField: UITextField!
@IBOutlet var emailTextField: UITextField!
@IBOutlet var passwordTextField: UITextField!
@IBAction func registerAccount(sender: UIButton) {
// Validate the input
guard let name = nameTextField.text, name != "", let emailAddress = emailTextField.text, emailAddress != "", let password = passwordTextField.text, password != "" else {
let alertController = UIAlertController(title: "Registration Error", message: "Please make sure you provide your name, email address and password to complete the registration.", preferredStyle: .alert)
let okayAction = UIAlertAction(title: "OK", style: .cancel, handler: nil)
alertController.addAction(okayAction)
present(alertController, animated: true, completion: nil)
return
}
// Register the user account on Firebase
Auth.auth().createUser(withEmail: emailAddress, password: password, completion: { (user, error) in
if let error = error {
let alertController = UIAlertController(title: "Registration Error", message: error.localizedDescription, preferredStyle: .alert)
let okayAction = UIAlertAction(title: "OK", style: .cancel, handler: nil)
alertController.addAction(okayAction)
self.present(alertController, animated: true, completion: nil)
return
}
// Save the name of the user
if let changeRequest = Auth.auth().currentUser?.createProfileChangeRequest() {
changeRequest.displayName = name
changeRequest.commitChanges(completion: { (error) in
if let error = error {
print("Failed to change the display name: \(error.localizedDescription)")
}
})
}
// Dismiss keyboard
self.view.endEditing(true)
// Send verification email
Auth.auth().currentUser?.sendEmailVerification(completion: { (error) in
print("Failed to send verification email")
})
let alertController = UIAlertController(title: "Email Verification", message: "We've just sent a confirmation email to your email address. Please check your inbox and click the verification link in that email to complete the sign up.", preferredStyle: .alert)
let okayAction = UIAlertAction(title: "OK", style: .cancel, handler: { (action) in
// Dismiss the current view controller
self.dismiss(animated: true, completion: nil)
})
alertController.addAction(okayAction)
self.present(alertController, animated: true, completion: nil)
})
}
override func viewDidLoad() {
super.viewDidLoad()
self.title = "Регистрация"
// Modifying the Navigation Bar
navigationController?.navigationBar.prefersLargeTitles = false
navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
navigationController?.navigationBar.isTranslucent = true
navigationController?.view.backgroundColor = .clear
navigationController?.navigationBar.tintColor = .white
navigationController?.navigationBar.shadowImage = UIImage()
if let customFont = UIFont(name: "Avenir", size: 25.0) {
navigationController?.navigationBar.titleTextAttributes = [ NSAttributedString.Key.foregroundColor: UIColor(red: 240.0 / 255.0, green: 240.0 / 255.0, blue: 240.0 / 255.0, alpha: 1.0), NSAttributedString.Key.font: customFont]
}
nameTextField.becomeFirstResponder()
}
// override func didReceiveMemoryWarning() {
// super.didReceiveMemoryWarning()
// // Dispose of any resources that can be recreated.
// }
//
// override func viewWillAppear(_ animated: Bool) {
// super.viewWillAppear(animated)
//
// self.navigationController?.setNavigationBarHidden(false, animated: true)
// }
// override func viewWillDisappear(_ animated: Bool) {
// super.viewWillAppear(animated)
//
// self.navigationController?.setNavigationBarHidden(true, animated: true)
// }
/*
// 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
] |
ece480a488f20c3a7d95e343e7ed1bf26acf1f2d | 46f8d13d3fb28f482fae44cd3458c9d09f9c059b | /sample-chat-swift/sample-chat-swift/Classes/ViewControllers/LoginTableViewController.swift | cfb67e9cf14605e3614180bbfe6b94cbcbe91760 | [] | no_license | Christm4s/quickblox-ios-sdk | 4c504483bc762be4048b97b00f0519a93f51b218 | 36aa7cb58e43e3fe192b18895f9dc9437ef3e1e0 | refs/heads/master | 2021-01-18T08:40:53.169334 | 2016-07-22T08:55:26 | 2016-07-22T08:55:26 | 62,410,551 | 0 | 0 | null | 2016-07-01T17:53:46 | 2016-07-01T17:53:46 | null | UTF-8 | Swift | false | false | 5,180 | swift | //
// LoginTableViewController.swift
// sample-chat-swift
//
// Created by Anton Sokolchenko on 3/31/15.
// Copyright (c) 2015 quickblox. All rights reserved.
//
import UIKit
/**
* Default test users password
*/
let kTestUsersDefaultPassword = "x6Bt0VDy5"
class LoginTableViewController: UsersListTableViewController, NotificationServiceDelegate {
// MARK: ViewController overrides
override func viewDidLoad() {
super.viewDidLoad()
guard let currentUser = ServicesManager.instance().currentUser() else {
return
}
currentUser.password = kTestUsersDefaultPassword
SVProgressHUD.showWithStatus("SA_STR_LOGGING_IN_AS".localized + currentUser.login!, maskType: SVProgressHUDMaskType.Clear)
// Logging to Quickblox REST API and chat.
ServicesManager.instance().logInWithUser(currentUser, completion: {
[weak self] (success:Bool, errorMessage: String?) -> Void in
guard let strongSelf = self else { return }
guard success else {
SVProgressHUD.showErrorWithStatus(errorMessage)
return
}
strongSelf.registerForRemoteNotification()
SVProgressHUD.showSuccessWithStatus("SA_STR_LOGGED_IN".localized)
if (ServicesManager.instance().notificationService.pushDialogID != nil) {
ServicesManager.instance().notificationService.handlePushNotificationWithDelegate(strongSelf)
}
else {
strongSelf.performSegueWithIdentifier("SA_STR_SEGUE_GO_TO_DIALOGS".localized, sender: nil)
}
})
self.tableView.reloadData()
}
// MARK: NotificationServiceDelegate protocol
func notificationServiceDidStartLoadingDialogFromServer() {
SVProgressHUD.showWithStatus("SA_STR_LOADING_DIALOG".localized, maskType: SVProgressHUDMaskType.Clear)
}
func notificationServiceDidFinishLoadingDialogFromServer() {
SVProgressHUD.dismiss()
}
func notificationServiceDidSucceedFetchingDialog(chatDialog: QBChatDialog!) {
let dialogsController = self.storyboard?.instantiateViewControllerWithIdentifier("DialogsViewController") as! DialogsViewController
let chatController = self.storyboard?.instantiateViewControllerWithIdentifier("ChatViewController") as! ChatViewController
chatController.dialog = chatDialog
self.navigationController?.viewControllers = [dialogsController, chatController]
}
func notificationServiceDidFailFetchingDialog() {
self.performSegueWithIdentifier("SA_STR_SEGUE_GO_TO_DIALOGS".localized, sender: nil)
}
// MARK: Actions
/**
Login in chat with user and register for remote notifications
- parameter user: QBUUser instance
*/
func logInChatWithUser(user: QBUUser) {
SVProgressHUD.showWithStatus("SA_STR_LOGGING_IN_AS".localized + user.login!, maskType: SVProgressHUDMaskType.Clear)
// Logging to Quickblox REST API and chat.
ServicesManager.instance().logInWithUser(user, completion:{
[unowned self] (success:Bool, errorMessage: String?) -> Void in
guard success else {
SVProgressHUD.showErrorWithStatus(errorMessage)
return
}
self.registerForRemoteNotification()
self.performSegueWithIdentifier("SA_STR_SEGUE_GO_TO_DIALOGS".localized, sender: nil)
SVProgressHUD.showSuccessWithStatus("SA_STR_LOGGED_IN".localized)
})
}
// MARK: Remote notifications
func registerForRemoteNotification() {
// Register for push in iOS 8
if #available(iOS 8.0, *) {
let settings = UIUserNotificationSettings(forTypes: [UIUserNotificationType.Alert, UIUserNotificationType.Badge, UIUserNotificationType.Sound], categories: nil)
UIApplication.sharedApplication().registerUserNotificationSettings(settings)
UIApplication.sharedApplication().registerForRemoteNotifications()
} else {
// Register for push in iOS 7
UIApplication.sharedApplication().registerForRemoteNotificationTypes([UIRemoteNotificationType.Badge, UIRemoteNotificationType.Sound, UIRemoteNotificationType.Alert])
}
}
// MARK: UITableViewDataSource
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("SA_STR_CELL_USER".localized, forIndexPath: indexPath) as! UserTableViewCell
cell.exclusiveTouch = true
cell.contentView.exclusiveTouch = true
let user = self.users[indexPath.row]
cell.setColorMarkerText(String(indexPath.row + 1), color: ServicesManager.instance().color(forUser: user))
cell.userDescription = "SA_STR_LOGIN_AS".localized + " " + user.fullName!
cell.tag = indexPath.row
return cell
}
// MARK: UITableViewDelegate
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
tableView.deselectRowAtIndexPath(indexPath, animated:true)
let user = self.users[indexPath.row]
user.password = kTestUsersDefaultPassword
self.logInChatWithUser(user)
}
}
| [
-1
] |
26c3dfd8d5c8dd92c7775f79ff27ce2f77549391 | 8cd901ba151f7dc850cdd12eadce32cc159a95ea | /MyworkoutGO/Models/User/SignUpCredentials.swift | 6d882cc29b284a8cce63a962afa7a70b5eb84fd8 | [] | no_license | Sparklydust/MyworkoutGo | 50e0b12af4e1a1b2e028d5989a7ef3b2f4435bef | b98d339380dbfb451a8ebe4c66601ce018ff6adc | refs/heads/main | 2023-02-11T21:46:03.657867 | 2020-12-17T15:32:08 | 2020-12-17T15:32:08 | 297,596,706 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 357 | swift | //
// SignUpCredentials.swift
// MyworkoutGO
//
// Created by Roland Lariotte on 22/09/2020.
//
import Foundation
// MARK: SignUpCredentials
/// User sign up needed credentials.
///
/// The values needed are the email, password
/// and gender.
///
struct SignUpCredentials: Codable {
let email: String
let password: String
let gender: Gender
}
| [
-1
] |
53adf8b4326a5d54cbe322fcf965d884caebb657 | c55f10218377e05ddca5d5cba2cb2636c975d991 | /BTG Fantasy Football Pods/ViewModel/TeamsViewModel.swift | 48d0293a28527cc5f6a710cb9f85c6c5704509ff | [] | no_license | jsween/BTG-Fantasy-Football-Pods | 95775576a87f685937b63ea135eee3037860d20f | 5b3e02133b6baf17f27091e535661fe7bcfa641c | refs/heads/main | 2023-01-23T13:07:35.025335 | 2020-11-12T02:06:51 | 2020-11-12T02:06:51 | 312,141,922 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,147 | swift | //
// TeamsViewModel.swift
// BTG Fantasy Football Pods
//
// Created by Jonathan Sweeney on 11/11/20.
//
import Foundation
import FirebaseFirestore
class TeamsViewModel: ObservableObject {
@Published var teams = [Team]()
private var db = Firestore.firestore()
func fetchData() {
db.collection("teams").addSnapshotListener { (querySnapshot, error) in
guard let documents = querySnapshot?.documents else {
print("No docs...")
return
}
self.teams = documents.map { queryDocumentSnapshot -> Team in
let data = queryDocumentSnapshot.data()
let id = data["id"] as? Int ?? -1
let name = data["name"] as? String ?? ""
let icon = data["icon"] as? String ?? ""
let wins = data["wins"] as? Int ?? -1
let losses = data["losses"] as? Int ?? -1
let rank = data["rank"] as? Int ?? -1
return Team(id: id, name: name, icon: icon, wins: wins, losses: losses, rank: rank)
}
}
}
}
| [
-1
] |
36ea3510e35b0956a00496ea1fdeacaab295569e | d28b7b14c8c30271330fadc39652ccda10cf07fd | /Shared/AACameraView/AACameraView+Helper.swift | a79ea486accedf5cb8f7894c2f67ae1048d04cb6 | [] | no_license | maspin22/soundbite | aa905240bab315a6ca2b83fc3936e7df063b453a | faf856287fa481b03d91b15da566457c0bbf3cd1 | refs/heads/main | 2023-06-20T07:46:20.687726 | 2021-07-23T04:49:27 | 2021-07-23T04:49:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 10,134 | swift | //
// AACameraView+Helper.swift
// AACameraView
import AVFoundation
// MARK: - UIColor extenison
extension UIColor {
/// hex value for color
///
/// - Parameter rgb: hex value
convenience init(rgb: UInt) {
self.init(
red: CGFloat((rgb & 0xFF0000) >> 16) / 255.0,
green: CGFloat((rgb & 0x00FF00) >> 8) / 255.0,
blue: CGFloat(rgb & 0x0000FF) / 255.0,
alpha: CGFloat(1.0)
)
}
}
// MARK: - AVCaptureSession extension
extension AVCaptureSession {
/// Set camera view quality for given output mode to current capture session
///
/// - Parameters:
/// - quality: OUTPUT_QUALITY
/// - mode: OUTPUT_MODE
func setQuality(_ quality: OUTPUT_QUALITY, mode: OUTPUT_MODE) {
var sessionPreset = AVCaptureSession.Preset.low
switch quality {
case .low:
sessionPreset = AVCaptureSession.Preset.low
case .medium:
sessionPreset = AVCaptureSession.Preset.medium
case .high:
sessionPreset = mode == .image ? AVCaptureSession.Preset.photo : AVCaptureSession.Preset.high
}
if self.canSetSessionPreset(sessionPreset) {
self.beginConfiguration()
self.sessionPreset = sessionPreset
self.commitConfiguration()
}
}
/// Set output device to current capture session
///
/// - Parameter output: AVCaptureOutput
func setOutput(_ output: AVCaptureOutput) {
if canAddOutput(output) {
beginConfiguration()
addOutput(output)
commitConfiguration()
}
}
/// Set flash mode for given devices along flash mode to current capture session
///
/// - Parameters:
/// - devices: [AVCaptureDevice]
/// - flashMode: AVCaptureFlashMode
func setFlashMode(_ devices: [AVCaptureDevice], flashMode: AVCaptureDevice.FlashMode) {
self.beginConfiguration()
devices.forEach { (device) in
if (device.position == .back) {
if (device.isFlashModeSupported(flashMode)) {
do {
try device.lockForConfiguration()
} catch {
return
}
device.flashMode = flashMode
device.unlockForConfiguration()
}
}
}
self.commitConfiguration()
}
/// Set camera device to current capture session
///
/// - Parameters:
/// - position: camera position
/// - cameraBack: front camera
/// - cameraFront: back camera
func setCameraDevice(_ position: AVCaptureDevice.Position, cameraBack: AVCaptureDevice?, cameraFront: AVCaptureDevice?) {
beginConfiguration()
let inputs = self.inputs
inputs.forEach { (input) in
if let deviceInput = input as? AVCaptureDeviceInput {
if deviceInput.device == cameraBack && position == .front {
removeInput(deviceInput)
} else if deviceInput.device == cameraFront && position == .back {
removeInput(deviceInput)
}
}
}
switch position {
case .front:
if let validFrontDevice = cameraFront?.isValid {
if !inputs.contains(validFrontDevice) {
addInput(validFrontDevice)
}
}
case .back:
if let validBackDevice = cameraBack?.isValid {
if !inputs.contains(validBackDevice) {
addInput(validBackDevice)
}
}
default:
break
}
commitConfiguration()
}
/// Set preview layer for current camera view
///
/// - Parameter cameraView: camera view
/// - Returns: AVCaptureVideoPreviewLayer
func setPreviewLayer(_ cameraView: UIView) -> AVCaptureVideoPreviewLayer? {
let layer = AVCaptureVideoPreviewLayer(session: self)
layer.videoGravity = AVLayerVideoGravity.resizeAspectFill
DispatchQueue.main.async(execute: { () -> Void in
layer.frame = cameraView.layer.bounds
cameraView.clipsToBounds = true
cameraView.layer.addSublayer(layer)
})
return layer
}
/// Add mic input to current capture session
///
/// - Parameter device: AVCaptureDevice
func addMicInput( _ device: AVCaptureDevice?) {
if let validMic = device?.isValid {
addInput(validMic)
}
}
/// Remove mic input to current capture session
///
/// - Parameter device: AVCaptureDevice
func removeMicInput(_ device: AVCaptureDevice?) {
let inputs = self.inputs
for input in inputs {
if let deviceInput = input as? AVCaptureDeviceInput {
if deviceInput.device == device {
removeInput(deviceInput)
break
}
}
}
}
}
// MARK: - AVCaptureDevice extension
extension AVCaptureDevice {
/// Check if device is valid or not
var isValid: AVCaptureDeviceInput? {
do {
return try AVCaptureDeviceInput(device: self)
} catch let error {
print("AACameraView - ", error.localizedDescription)
return nil
}
}
/// Set Zoom in/out with gesture for current camera view
///
/// - Parameters:
/// - factor: current zoom factor
/// - gesture: UIPinchGestureRecognizer
/// - Returns: updated zoom factor
func setZoom(_ factor: CGFloat , gesture: UIPinchGestureRecognizer) -> CGFloat {
var zoom = factor
var vZoomFactor = gesture.scale * factor
if gesture.state == .ended {
zoom = vZoomFactor >= 1 ? vZoomFactor : 1
}
do {
try lockForConfiguration()
defer {unlockForConfiguration()}
guard vZoomFactor <= activeFormat.videoMaxZoomFactor && vZoomFactor >= 1 else {
return factor
}
videoZoomFactor = vZoomFactor
} catch {
print("AACameraView - \(error.localizedDescription)")
}
return zoom
}
/// Set Focus with gesture for current camera view
///
/// - Parameters:
/// - view: camera view
/// - previewLayer: preview layer
/// - gesture: UITapGestureRecognizer
func setFocus(_ view: UIView, previewLayer: AVCaptureVideoPreviewLayer, gesture: UITapGestureRecognizer) {
let touchPoint: CGPoint = gesture.location(in: view)
let convertedPoint: CGPoint = previewLayer.captureDevicePointConverted(fromLayerPoint: touchPoint)
if isFocusPointOfInterestSupported && isFocusModeSupported(AVCaptureDevice.FocusMode.autoFocus) {
do {
try lockForConfiguration()
focusPointOfInterest = convertedPoint
focusMode = AVCaptureDevice.FocusMode.autoFocus
unlockForConfiguration()
} catch {
print("AACameraView = Unable to focus")
}
}
}
}
// MARK: - UIView extension
extension UIView {
/// Add or remove gesture recognizer for current view
///
/// - Parameters:
/// - flag: Bool
/// - gesture: UIGestureRecognizer
func toggleGestureRecognizer(_ flag: Bool, gesture: UIGestureRecognizer) {
guard flag else {
removeGestureRecognizer(gesture)
return
}
addGestureRecognizer(gesture)
}
}
// MARK: - Helper public functions only
extension AACameraView {
/// Gets recorded duration
open var recordedDuration: CMTime {
return outputVideo?.recordedDuration ?? CMTime.zero
}
/// Gets recorded file size
open var recordedFileSize: Int64 {
return outputVideo?.recordedFileSize ?? 0
}
/// Check for flash light device
open var hasFlash: Bool {
return self.global.cameraBack?.hasFlash ?? false
}
/// Check for front camera device
open var hasFrontCamera: Bool {
return self.global.cameraFront != nil ? true : false
}
/// Gets status of camera authorization
///
/// - Returns: AVAuthorizationStatus
open var status: AVAuthorizationStatus {
return self.global.status
}
/// Toggle camera devices back and front
open func toggleCamera() {
self.cameraPosition = self.cameraPosition == .front ? .back : .front
}
/// Toggle camera mode to image and video
open func toggleMode() {
self.outputMode = self.outputMode == .image ? .videoAudio : .image
}
/// Toggle flash light on and off
open func toggleFlash() {
self.flashMode = self.flashMode == .on ? .off : .on
}
/// Triggers camera for getting the response
open func triggerCamera() {
captureImage()
startVideoRecording()
stopVideoRecording()
}
/// Request for authorization to access the camera devices
///
/// - Parameter completion: response completion
open func requestAuthorization(_ completion: @escaping (Bool) -> Void) {
AVCaptureDevice.requestAccess(for: AVMediaType.video, completionHandler: { (alowedAccess) -> Void in
if self.outputMode == .videoAudio {
AVCaptureDevice.requestAccess(for: AVMediaType.audio, completionHandler: { (alowedAccess) -> Void in
DispatchQueue.main.sync(execute: { () -> Void in
completion(alowedAccess)
})
})
} else {
DispatchQueue.main.sync(execute: { () -> Void in
completion(alowedAccess)
})
}
})
}
}
| [
-1
] |
f70221dee8032e10c1fbb94285508358c7e6ea83 | 1eb1dc6e5678553f874f5e249c8a755c7a1d342e | /S40_Task1.playground/Contents.swift | 46397c1ac1ac2b2b1c6634edf9a41411fdfca5c1 | [] | no_license | JohnSlug/oisSwift | 4105e3ae8f6001a3935fc7c39edc83a525d1957a | 92a815434a0f696a32c348123dd33606219ef0fc | refs/heads/master | 2021-01-25T10:50:55.602797 | 2017-07-21T17:01:57 | 2017-07-21T17:01:57 | 93,889,049 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 263 | swift | //: Playground - noun: a place where people can play
import UIKit
var array = [Int]()
var result: Double = 0
while array.count < 150 {
array.append(Int(arc4random_uniform(10)))
result += Double(array.last!)
}
result /= Double(array.count)
print(result)
| [
-1
] |
6d07297456a578770219a38f79d11253e05bb9d6 | 42f3232946618e0650b712cc272109afde7a101a | /Gui - Projetos/Design Patterns/Guilherme/Builder.playground/Contents.swift | 05421612bc6d0969e91f0d61a3826d65eb6611e8 | [] | no_license | GuilhermeDalosto/Design-Patterns | 198a5fcd2e06b3cf7aceb03ba41c441da34dc67e | f6fd90df23f7e40284d0bdf132432ad0c8784955 | refs/heads/master | 2021-01-03T13:54:08.610532 | 2020-02-27T18:21:25 | 2020-02-27T18:21:25 | 240,092,828 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 228 | swift | import UIKit
let aux = BossBuilder()
func create(){
aux.setAttributes(hp: 10, mp: 5)
aux.setStructure(age: 921, height: 4.31)
aux.setStatistics(name: "Yhelm", level: 3)
let Yhelm = aux.build()
}
create()
| [
-1
] |
b5a9e6258c34e2d81c578a0cae8bb46adf8107fd | 914a22a6457a2b13db40b7800206220db0bbc044 | /Agenda/Home/View/HomeTableViewCell.swift | de0bfe12f2cc8e719b3635321d913d0bc5e207b8 | [] | no_license | CristianeUliana/AluraAgendaRecursosNativos | 57ccca7bb0a46de49392e80345304db94187a353 | 1a347a7b324b13cc276d9c3c8b8df6adc6239931 | refs/heads/main | 2023-04-02T13:00:26.342588 | 2021-03-24T17:05:11 | 2021-03-24T17:05:11 | 350,414,261 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 959 | swift | //
// HomeTableViewCell.swift
// Agenda
//
// Created by Ândriu Coelho on 24/11/17.
// Copyright © 2017 Alura. All rights reserved.
//
import UIKit
class HomeTableViewCell: UITableViewCell {
// MARK: - IBOutlets
@IBOutlet weak var imageAluno: UIImageView!
@IBOutlet weak var labelNomeDoAluno: UILabel!
func configuraCelula(_ aluno: Aluno) {
labelNomeDoAluno.text = aluno.nome
imageAluno.layer.cornerRadius = imageAluno.frame.width / 2
imageAluno.layer.masksToBounds = true
if let imagemDoAluno = aluno.foto as? UIImage {
imageAluno.image = imagemDoAluno
}
}
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
| [
-1
] |
9e0f7cff232c411c120d5f7997f8b32af5f48402 | 0c9711791512084db761391fc8805ad211cd14fe | /ToDoList/ToDoList/New Group/ToDoListViewController.swift | c6552c4ffbad401163d59e6ecad6fc2cd04dd9c6 | [] | no_license | IamGiel/IOS-ToDo | 0be9d52aa2ee5ebc67f1c3767927f806717de94a | ba71d967b0d1d0eb4e23d55dc3db70bb7d5401d3 | refs/heads/master | 2020-04-23T22:37:44.408496 | 2019-03-04T18:50:05 | 2019-03-04T18:50:05 | 171,508,152 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 6,702 | swift | //
// ViewController.swift
// ToDoList
//
// Created by Alpha.giel DeAsis on 2/19/19.
// Copyright © 2019 Alpha.giel DeAsis. All rights reserved.
//
import UIKit
import CoreData
@available(iOS 10.0, *)
class ToDoListViewController: UITableViewController {
@IBOutlet weak var searchBar: UISearchBar!
var itemArray = [Item]() //array of item objects
var alertTextFieldInput = UITextField()
let context = (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext
//an object that provides an interface to the filesystem
let dataFilePath = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first?.appendingPathComponent("items.plist")
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
// Here we create our own plist file called items.plist, we deleted our reference to userDefaults
print(dataFilePath!)
//path where the data is being stored in this app
print(FileManager.default.urls(for: .documentDirectory, in: .userDomainMask))
//set tableview as a delegate of the search bar controller
searchBar.delegate = self;
loadItems()
}
//MARK: Delegate Methods here
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return itemArray.count;
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
print("cellforrowat index path called")
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "ToDoItemCell")
let item = itemArray[indexPath.row];
let cell = tableView.dequeueReusableCell(withIdentifier:"ToDoItemCell", for: indexPath);
cell.textLabel?.text = item.title
//ternary operator ====>
// value = condition ? valueIfTrue : valueIfFalse
cell.accessoryType = item.isDone ? .checkmark : .none;
return cell;
}
//MARK: add new items
@IBAction func addToDoItem(_ sender: UIBarButtonItem) {
// let textField = UITextField()
let alert = UIAlertController(title: "Add New Item", message: nil, preferredStyle: .alert)
let thisAction = UIAlertAction(title: "Add Item", style: .default) { (action) in
// what will happen when user clicks
if(self.alertTextFieldInput.text == "" || (self.alertTextFieldInput.text?.trimmingCharacters(in: .whitespaces).isEmpty)!) { //if user did not enter new list
let alert2 = UIAlertController(title: "Add New Item", message: nil, preferredStyle: .alert)
let oops = UIAlertAction(title: "Add Item", style: .default, handler: { (oopsies) in
print("must add item...")
})
alert2.addAction(oops)
self.present(alert2, animated: true, completion: nil)
} else {
print("success!")
let newItem = Item(context: self.context)
newItem.title = self.alertTextFieldInput.text!
newItem.isDone = false;
self.itemArray.append(newItem)
//self.defaults.set(self.itemArray, forKey: "ToDoListArray")
self.saveData()
}
}
alert.addTextField { (alertTextField) in
alertTextField.placeholder = "im doing this..."
//alertTextField.text
self.alertTextFieldInput = alertTextField;
//print(alertTextField.text)
}
alert.addAction(thisAction)
present(alert, animated: true, completion: nil)
}
//MARK: tableView didSelectRowAt
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
itemArray[indexPath.row].isDone = !itemArray[indexPath.row].isDone
//MARK: Delete data
//context.delete(itemArray[indexPath.row]); //method to remove the data, sepecify the NSManage object at current row
//itemArray.remove(at: indexPath.row) //remove items in a particular index
saveData()
}
func saveData(){
do {
//commit our context to our storage
try context.save()
} catch {
print("error has occured \(error)")
}
tableView.reloadData();
}
//MARK: external internal paramters with default value
func loadItems(with request: NSFetchRequest<Item> = Item.fetchRequest()){
do {
itemArray = try context.fetch(request); // like context.save() we need to add "try" and encapsulate it in a do catch block
} catch {
print("error in fetching data requests = ", error)
}
tableView.reloadData()
}
}
//MARK: search methods
@available(iOS 10.0, *)
extension ToDoListViewController: UISearchBarDelegate {
func searchBarSearchButtonClicked(_ searchBar: UISearchBar) {
let requestWithRule: NSFetchRequest<Item> = Item.fetchRequest()
//MARK: NSPredicates = Foundation class that specifies how data should be fetched or filtered. Its query language, which is like a cross between a SQL WHERE clause and a regular expression
//in order to query objects in core data we use NSPreidcates
requestWithRule.predicate = NSPredicate(format: "title CONTAINS[cd] %@" , searchBar.text!);
//MARK: Sort using NSSortDescriptor
requestWithRule.sortDescriptors = [NSSortDescriptor(key: "title", ascending: true)]
//add sortDescriptors(plural) to our requests
print("printing request with rule ", requestWithRule)
print("this is item, Array ", itemArray)
//Now fetch data with the rules that we specified in previous lines
loadItems(with: requestWithRule)
}
func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {
if (searchBar.text?.count == 0){
loadItems()
//Mark: ResignFirstResponder
//removes keyboard and cursor when textDidChange function is called
DispatchQueue.main.async {
print("dispatch que, resignFirstResponder")
searchBar.resignFirstResponder() // go to the state it was in before it was accessed
}
}
}
}
| [
-1
] |
2105ebcef6b16481fef04ecbae1500bbdf94db9d | e9aa725c30208b948f9093430c059b6214b04ddb | /QSAMusic/QSAMusic/Song/SongListDetail.swift | f578b8174344ffde8d95d184cc20adc846784770 | [] | no_license | johndpope/QSAMusic | cc37ddeba3bb6bd27d19df855619289657f17c20 | 9ba3ed0161a712f5bc5f373df3dd8daeb020acce | refs/heads/master | 2021-01-20T22:02:30.714979 | 2017-08-14T17:01:30 | 2017-08-14T17:01:30 | 101,796,370 | 1 | 0 | null | 2017-08-29T19:00:52 | 2017-08-29T19:00:52 | null | UTF-8 | Swift | false | false | 7,711 | swift | //
// SongListDetail.swift
// QSAMusic
//
// Created by 陈少文 on 17/5/19.
// Copyright © 2017年 qqqssa. All rights reserved.
//
import UIKit
class SongListDetail: QSAKitBaseViewController, UITableViewDelegate, UITableViewDataSource {
var listInfo = NSDictionary()
var songList = [NSDictionary]()
private lazy var tableView: UITableView = {
let tableView = UITableView(frame: CGRect(x: 0, y: 0, width: SwiftMacro().ScreenWidth, height: SwiftMacro().ScreenHeight))
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell")
tableView.delegate = self
tableView.dataSource = self
tableView.showsVerticalScrollIndicator = false
tableView.backgroundColor = UIColor.clear
let headerView = UIView(frame: CGRect(x: 0, y: 0, width: SwiftMacro().ScreenWidth, height: 250))
headerView.backgroundColor = UIColor.clear
tableView.tableHeaderView = headerView
return tableView
}()
private lazy var navigationView: QSAKitBlurView = {
let navigationView = QSAKitBlurView(frame: CGRect(x: 0, y: 0, width: SwiftMacro().ScreenWidth, height: 64), type: Blur_blackColor) as QSAKitBlurView
let title = UILabel(frame: CGRect(x: 0, y: 0, width: SwiftMacro().ScreenWidth - 100, height: 20))
title.text = "歌单详情"
title.textAlignment = .center
title.font = UIFont.systemFont(ofSize: 14)
navigationView.contentViewAddSubview(title)
title.center = CGPoint(x: navigationView.center.x, y: navigationView.center.y + 5)
return navigationView
}()
private lazy var backBtn: UIButton = {
let backBtn = UIButton(frame: CGRect(x: 12, y: 21, width: 30, height: 30))
backBtn.setTitle("<<", for: UIControlState.normal)
backBtn.addTarget(self, action: #selector(back), for: UIControlEvents.touchUpInside)
return backBtn
}()
func back() -> Void {
self.navigationController!.popViewController(animated: true)
}
private lazy var infoImgV: UIImageView = {
let infoImgV = UIImageView(frame: CGRect(x: 0, y: 0, width: SwiftMacro().ScreenWidth, height: SwiftMacro().ScreenWidth))
infoImgV.sd_setImage(with: URL(string: self.listInfo["pic_radio"] as! String), placeholderImage: UIImage(named: "QSAMusic_pc.png"))
return infoImgV
}()
private lazy var tempView: QSAKitBlurView = {
let tempView = QSAKitBlurView(frame: CGRect(x: 0, y: 0, width: SwiftMacro().ScreenWidth, height: SwiftMacro().ScreenWidth), type: Blur_whiteColor) as QSAKitBlurView
tempView.alpha = 0.0
return tempView
}()
private lazy var infoLabel: UILabel = {
let infoLabel = UILabel(frame: CGRect(x: 12, y: 12, width: SwiftMacro().ScreenWidth - 24, height: SwiftMacro().ScreenWidth - 24))
infoLabel.font = UIFont.systemFont(ofSize: 12)
infoLabel.alpha = 0.0
infoLabel.textColor = UIColor.orange
infoLabel.numberOfLines = 0
infoLabel.text = self.listInfo["info"] as? String
return infoLabel
}()
override func viewDidLoad() {
super.viewDidLoad()
view.addSubview(infoImgV)
view.addSubview(tempView)
view.addSubview(infoLabel)
view.addSubview(tableView)
view.addSubview(navigationView)
view.addSubview(backBtn)
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if songList.count < 13 {
return 13
}
return songList.count
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 44.0
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 0.001
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView(frame: CGRect(x: 0, y: 0, width: SwiftMacro().ScreenWidth, height: 44))
view.backgroundColor = UIColor.lightGray
let title = UILabel(frame: CGRect(x: 12, y: 7, width: SwiftMacro().ScreenWidth - 24, height: 30))
title.font = UIFont.systemFont(ofSize: 14)
title.textColor = UIColor.white
title.text = listInfo["title"] as? String
view.addSubview(title)
return view
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell")! as UITableViewCell
cell.textLabel?.font = UIFont.systemFont(ofSize: 12.0)
if indexPath.row < songList.count {
let song = songList[indexPath.row]
if !(song["versions"] as! String == "") {
cell.textLabel?.text = String(format: "%@(%@) - %@", song["title"] as! String, song["versions"] as! String, song["author"] as! String)
} else {
cell.textLabel?.text = String(format: "%@ - %@", song["title"] as! String, song["author"] as! String)
}
cell.isUserInteractionEnabled = true;
} else {
cell.textLabel?.text = "";
cell.isUserInteractionEnabled = false;
}
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
PlayerController.shared.play(playList: songList, index: indexPath.row)
}
func scrollViewDidScroll(_ scrollView: UIScrollView) {
let offset = 250 - SwiftMacro().ScreenWidth
if (scrollView.contentOffset.y <= offset) {
self.infoImgV.frame = CGRect(x: 0, y: -scrollView.contentOffset.y + offset, width: SwiftMacro().ScreenWidth, height: SwiftMacro().ScreenWidth)
self.tempView.alpha = 1.0
self.tempView.frame = CGRect(x: 0, y: -scrollView.contentOffset.y + offset, width: SwiftMacro().ScreenWidth, height: SwiftMacro().ScreenWidth)
self.infoLabel.alpha = 1.0
self.infoLabel.frame = CGRect(x: 12, y: -scrollView.contentOffset.y + offset + 12, width: SwiftMacro().ScreenWidth - 24, height: SwiftMacro().ScreenWidth - 24)
} else {
self.infoImgV.frame = CGRect(x: 0, y: 0, width: SwiftMacro().ScreenWidth, height: SwiftMacro().ScreenWidth)
self.tempView.alpha = 0.0
self.tempView.frame = CGRect(x: 0, y: 0, width: SwiftMacro().ScreenWidth, height: SwiftMacro().ScreenWidth)
self.infoLabel.alpha = 0.0
self.infoLabel.frame = CGRect(x: 12, y: 12, width: SwiftMacro().ScreenWidth - 24, height: SwiftMacro().ScreenWidth - 24)
}
if (scrollView.contentOffset.y <= -5) {
UIView.animate(withDuration: 0.2, animations: {
self.navigationView.center = CGPoint(x: self.navigationView.center.x, y: -32)
})
} else {
UIView.animate(withDuration: 0.2, animations: {
self.navigationView.center = CGPoint(x: self.navigationView.center.x, y: 32)
})
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// 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
] |
e06fe29a5cc57b5816ca65ca29bb4dae9fba16a2 | aa30c9b2b864e70c5d01e2c5811fd320a4605a87 | /TNetServer/TAmf3Socket/net/amfSocket/Amf3Socket.swift | 883113c6790b80252e10337f5e079c1a5b762265 | [] | no_license | tavenzhang/myMove | 8dd7da1d02a0da8f26f3dc4b578083ff4beacb9b | 7a06c6b388cd59920a59650c7c73e29a27b3e7d7 | refs/heads/master | 2021-01-13T13:12:54.172706 | 2017-03-19T21:07:54 | 2017-03-19T21:07:54 | 72,713,479 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,572 | swift | //
// Amf3Socket.swift
// TVideo
import BBSZLib
open class Amf3SocketManager: TSocketGCDServer {
/**
解析消息头
*/
override open func readMsgHead(_ data: NSMutableData) -> Int {
let len = data.getShort(_isByteBigEndian)
return len ;
}
// 解析消息体
override open func readMsgBody(_ data: NSMutableData) -> Bool {
var objNSData: Data?
do {
objNSData = try data.getBytesByLength(curMsgBodyLength).bbs_dataByInflating();
} catch {
TLog("bbs_dataByInflating error");
return false;
}
var amf3Unarchiver: AMFUnarchiver?;
if (objNSData!.count > 0)
{
amf3Unarchiver = AMFUnarchiver(forReadingWith: objNSData, encoding: kAMF3Encoding);
var obj: NSObject?;
if (amf3Unarchiver != nil)
{
obj = amf3Unarchiver!.decodeObject();
}
if self.onMsgResultHandle != nil && obj != nil
{
self.onMsgResultHandle!(obj!);
}
}
return true;
}
/**
发送消息
*/
override open func sendMessage(_ msgData: AnyObject?) -> Void {
let message = msgData as! S_msg_base;
do {
let amf3 = AMF3Archiver()
let dic = message.toDictionary()
TLog("send:--->%@", args: dic);
amf3.encode(dic);
let amfData = try amf3.archiverData().bbs_dataByDeflating();
let mdata = NSMutableData(data: amfData);
mdata.appendString("\r\n");
self.socket?.write(mdata as Data, withTimeout: 1, tag: 1);
}
catch {
TLog("message send error!");
}
}
/**
心跳包消息
- author: taven
- date: 16-07-13 13:07:32
*/
override open func sendHeartMsg() -> Void {
super.sendHeartMsg();
}
}
| [
-1
] |
a3d462cb63ec19ca854f6d9d7e4dc92144802545 | e81911996dcbc44a98c9e468691635725490b934 | /ComicList/AppDelegate.swift | 37b1b8b510db315aa6460ef8cb31af33fa32c6f5 | [] | no_license | arandafj/ComicList | 836cf364b983599fa896ab1e820f71bf9fd7f0bf | f83905c5faf0dfa453e049fca44afbf06c7fd9a0 | refs/heads/master | 2021-01-13T04:07:01.807893 | 2017-01-05T11:23:27 | 2017-01-05T11:23:27 | 78,106,518 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 606 | swift | //
// AppDelegate.swift
// ComicList
//
// Created by Guillermo Gonzalez on 29/09/2016.
// Copyright © 2016 Guillermo Gonzalez. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var coordinator: AppCoordinator?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
let window = UIWindow(frame: UIScreen.main.bounds)
coordinator = AppCoordinator(window: window)
coordinator?.start()
return true
}
}
| [
286730
] |
6b7ba2c82227a8faab311953720e0fbce545f00e | e8bf8e8932c4872f83c4c35590403ce5b8b17666 | /CBTabBarController/Classes/Menu/CBMenuTabItem.swift | 4ecdc024bc4bffec1ec8a9a132b8f960f6098adc | [
"MIT"
] | permissive | Razum1411/VpsvilleUI | a7ad02d1b42433af56fd3e2b0431f7bb9744ccd5 | f9bb32212d0d06a3200c8d0dd9cfb35ffa321f46 | refs/heads/master | 2020-06-26T20:20:10.568816 | 2019-08-28T23:32:44 | 2019-08-28T23:32:44 | 199,746,715 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 333 | swift | //
// CBMenuTabItem.swift
// CBTabBarController
//
// Created by Anton Skopin on 20/03/2019.
// Copyright © 2019 cuberto. All rights reserved.
//
import UIKit
class CBMenuTabItem: UITabBarItem, CBExtendedTabItem {
var attributedTitle: NSAttributedString? {
return nil
}
var tintColor: UIColor?
}
| [
-1
] |
393b3555f44e6e0fd0646208e7b9b292036329cf | e4ddf5f70b3f9ea0bbe1c154468e24e75c5351ff | /NewsFeed/Controller&ViewModel/Controllers/NewsCenter/cells/NewsCenterCell.swift | 38f7a93b5498a3761708f42c7a5616eca0d65ee4 | [] | no_license | iosuandme/NewsFeed | f56280a58f28de06fe27f3d73ed506d8545fa95f | 241b309519e5809d4a0a850c54d2c4db38cf8bd4 | refs/heads/master | 2021-01-17T17:40:07.924356 | 2016-09-03T08:52:04 | 2016-09-03T08:52:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,064 | swift | //
// NewsCenterCell.swift
// NewsFeed
//
// Created by WorkHarder on 8/7/16.
// Copyright © 2016 Kidney. All rights reserved.
//
import UIKit
import ChameleonFramework
let drawingOptions = NSStringDrawingOptions(rawValue: NSStringDrawingOptions.UsesLineFragmentOrigin.rawValue|NSStringDrawingOptions.UsesFontLeading.rawValue)
class NewsCenterCell: BaseActionCell {
enum NewsCellAction: Int {
case Comment = 1
case Share
case Like
case Avatar
}
@IBOutlet weak var avatarButton: UIButton!
@IBOutlet weak var usernameLabel: UILabel!
@IBOutlet weak var viewedButton: UIButton!
@IBOutlet weak var timeButton: UIButton!
@IBOutlet weak var contentLabel: UILabel!
@IBOutlet weak var contentImageView: UIImageView!
@IBOutlet weak var commentsLabel: UILabel!
@IBOutlet weak var commentButton: UIButton!
@IBOutlet weak var shareButton: UIButton!
@IBOutlet weak var likeButton: UIButton!
@IBOutlet weak var flagButton: UIButton!
override func awakeFromNib() {
super.awakeFromNib()
avatarButton.layer.cornerRadius = avatarButton.bounds.height/2
avatarButton.clipsToBounds = true
timeButton.setImageTintColor(ThemeColor, forState: .Normal)
viewedButton.setImageTintColor(ThemeColor, forState: .Normal)
contentImageView.backgroundColor = FlatWhite()
contentImageView.clipsToBounds = true
}
override func configureCell(withBaseData data: [String : AnyObject?], collectionView: UICollectionView?, indexPath: NSIndexPath, delegate: CollectionCellAction?) {
super.configureCell(withBaseData: data, collectionView: collectionView, indexPath: indexPath, delegate: delegate)
commentsLabel.attributedText = data["comments"] as? NSAttributedString
contentLabel.attributedText = data["text"] as? NSAttributedString
let (prefix, postfix) = ("Comments", " (" + (data["commentsCount"] as! String) + ")")
let attrComments = NSMutableAttributedString(string: prefix + postfix)
attrComments.yy_setColor(UIColor.whiteColor(), range: NSMakeRange(0, prefix.characters.count))
attrComments.yy_setColor(UIColor.whiteColor().colorWithAlphaComponent(0.7), range: NSMakeRange(prefix.characters.count, postfix.characters.count))
commentButton.setAttributedTitle(attrComments, forState: .Normal)
likeButton.setTitle((data["likesCount"] as! String) + " Likes", forState: .Normal)
viewedButton.setTitle((data["viewsCount"] as! String), forState: .Normal)
usernameLabel.text = data["authorName"] as? String
timeButton.setTitle(DateHelper.timeAgo(data["date"] as? NSDate), forState: .Normal)
let flag = (data["flag"] as? String)
flagButton.hidden = flag?.characters.count <= 0
if flag?.characters.count > 0 {
flagButton.setTitle(flag, forState: .Normal)
}
}
func configureCell(withRemoteOrLocalData data: [ String : AnyObject? ]) {
self.contentImageView.contentMode = .Center
contentImageView.sd_setImageWithURL(data["image"] as? NSURL, placeholderImage: ImagePlaceHolder) { (image, error, type, url) in
if image != nil {
self.contentImageView.contentMode = .ScaleAspectFill
}
}
avatarButton.sd_setImageWithURL(data["authorAvatar"] as? NSURL, forState: .Normal, placeholderImage: AvatarPlaceHolder)
}
/**
高度计算模型: 16 + 42 + 20 + textHeight + 10 + imageHeight + 14 + 36 + (14 + commentHeight) + 14
- parameter data: cell的数据
*/
static func heightFor(data: [ String : AnyObject? ]) -> CGFloat {
var textHeight = CGFloat(0), imageHeight = CGFloat(0), commentHeight = CGFloat(0)
if let text = data["text"] where (text as! NSAttributedString).length > 0 {
textHeight = (text as! NSAttributedString).boundingRectWithSize(CGSizeMake(Main_Screen_Width-2*10, CGFloat.max), options: drawingOptions, context: nil).height
}
imageHeight = Main_Screen_Width * 210.0/375.0
if let comments = data["comments"] where (comments as! NSAttributedString).length > 0 {
commentHeight = (comments as! NSAttributedString).boundingRectWithSize(CGSizeMake(Main_Screen_Width-2*10, CGFloat.max), options: drawingOptions, context: nil).height + 14
}
return textHeight + imageHeight + commentHeight + 152
}
// MARK: Actions
override func initializeViewTagAndReturnActionViews() -> [UIView] {
shareButton.tag = NewsCenterCell.NewsCellAction.Share.rawValue
likeButton.tag = NewsCenterCell.NewsCellAction.Like.rawValue
commentButton.tag = NewsCenterCell.NewsCellAction.Comment.rawValue
avatarButton.tag = NewsCenterCell.NewsCellAction.Avatar.rawValue
return [avatarButton ,shareButton, likeButton, commentButton]
}
}
| [
-1
] |
fb7d71e173f6595ff574814d4e08dc128791cb56 | 0c3c014da55a2a4d4a3a862bee5d851782bbacb1 | /ambi/RatingViewController.swift | b7f41759ba3055e2397cda4f5060d5167336618b | [] | no_license | Bysonz07/ambi | 15ae6385dd7afebcbec4091f7b04fb204707cb8c | 80f97c7b48ee28a204625797a8e1b30526911cd8 | refs/heads/main | 2023-04-04T23:33:58.027658 | 2021-04-15T03:32:08 | 2021-04-15T03:32:08 | 355,401,054 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 710 | swift | //
// RatingViewController.swift
// ambi
//
// Created by Nicholas Kusuma on 09/04/21.
//
import UIKit
import StoreKit
class RatingViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
SKStoreReviewController.requestReview()
// Do any additional setup after loading the view.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
}
| [
-1
] |
4816e07acb2e81c2f2f5a98c120754fce5788d59 | 415461c5172cfb044672139b312eb0273b648d38 | /FoodE/CollectionViewCell.swift | 0a6b4dc7e58e0577393be716f2d37b15082b6655 | [
"CC-BY-4.0",
"CC-BY-3.0"
] | permissive | rkrobo/FoodE | c8f2a8af97f2a134204cfbe49092bff5a40c8105 | 287afa25b3b13091ad59721bb4c6f3611c26df11 | refs/heads/master | 2021-01-02T08:22:41.526673 | 2017-09-08T20:36:34 | 2017-09-08T20:36:34 | 98,994,549 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 378 | swift | //
// CollectionViewCell.swift
// FoodE
//
// Created by Rola Kitaphanich on 2017-03-30.
// Copyright © 2017 Rola Kitaphanich. All rights reserved.
//
import UIKit
class CollectionViewCell: UICollectionViewCell {
@IBOutlet weak var cellImage: UIImageView!
override func prepareForReuse() {
cellImage.backgroundColor = UIColor.black
}
}
| [
-1
] |
323998b17039ff4f8052e1403884d006e22dfd78 | a2ff9b1fa909485fca10652fb975fcd92ed4673b | /GoogleMapDirectionLib/Model/Info.swift | 294f4668f9e84d0e6f9297aa3cd445ecaed579e6 | [
"Apache-2.0"
] | permissive | ngominhtrint/GoogleMapDirectionLib | fd9ec7ac573d9773cd6b07010d68dfceb06d43ba | 3c040b61a6ebc2973fbeacd0dc2c0d9ed3f3b5d4 | refs/heads/master | 2022-07-09T21:53:10.639242 | 2020-05-17T08:47:14 | 2020-05-17T08:47:14 | 263,612,566 | 12 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 546 | swift | //
// Info.swift
// GoogleMapDirectionLib
//
// Created by TriNgo on 5/12/20.
// Copyright © 2020 RoverDream. All rights reserved.
//
import Foundation
import ObjectMapper
public struct Info: Mappable {
public private(set) var text: String?
public private(set) var value: Double = 0.0
init() { }
public init?(map: Map) { }
public mutating func mapping(map: Map) {
text <- map[InfoKey.text]
value <- map[InfoKey.value]
}
}
fileprivate struct InfoKey {
static let text = "text"
static let value = "value"
}
| [
-1
] |
3ed8f1f63178dea4b3cae8a26e0d9e78e691b1fa | a40d762e7beba76af1f4778fb1d3f1fddfb98e5f | /JukeBox/JukeBoxViewController.swift | 5b2a50fb8b2f139e0014f557b1efad1328df176f | [] | no_license | Sameer0201/JukeBox | 02f9a9ab7bda68d06531bc3e889ec3138af56a14 | c0fd059a5fd9b41a2b5cfc5b39543f55ae41ba84 | refs/heads/master | 2020-03-28T16:00:30.152063 | 2018-09-13T14:21:05 | 2018-09-13T14:21:05 | 148,649,232 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 859 | swift | //
// JukeBoxViewController.swift
// JukeBox
//
// Created by Sameer on 19/07/17.
// Copyright © 2017 Stone. All rights reserved.
//
import UIKit
class JukeBoxViewController: 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.
}
/*
// 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.
}
*/
}
| [
233869,
302927,
290160,
291569,
289519,
314351,
290166,
298359,
289112,
185464
] |
7747b6ffa1d919e5af7566da0894a1f09851fa99 | 957a506bebc947077089eab1b05b3eb76c29c04a | /bliss/Diary+CoreDataProperties.swift | 8ab666ff47b5e2dab9bf49d860670bf195560fb9 | [] | no_license | Hanslen/G52GRP-bliss-app | b90e04cde1fd1ba2dec7d2e357b5070b6760ed61 | 2e6dd55e6c33d2ed6a83f1cf6b694ec3fbee681e | refs/heads/master | 2021-06-07T09:23:00.910935 | 2017-10-07T16:04:12 | 2017-10-07T16:04:12 | 57,451,349 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 473 | swift | //
// Diary+CoreDataProperties.swift
// bliss
//
// Created by Hanslen Chen on 16/2/24.
// Copyright © 2016年 G52GRP-peter. All rights reserved.
//
// Choose "Create NSManagedObject Subclass…" from the Core Data editor menu
// to delete and recreate this implementation file for your updated model.
//
import Foundation
import CoreData
extension Diary {
@NSManaged var title: String?
@NSManaged var context: String?
@NSManaged var date: NSDate?
}
| [
-1
] |
3586e9c37d42264221f68e2df38f2f7ca73aa96c | 095a20da613c7aca1221371aeb0d457b2f33cbc1 | /ID Capture/DocumentDetailsView.swift | fdd0cd07795ab2a59e230e0f56704a176c57aa02 | [] | no_license | AppliedRecognition/Ver-ID-Credentials-iOS-Sample | 25a6778b7aeb96f267065cb57263c1f8ec8b7e80 | a20d7a006d1e8b2283530cfe4bc2370b7d1f740d | refs/heads/master | 2023-08-31T12:10:29.126373 | 2023-08-18T13:17:56 | 2023-08-18T13:17:56 | 117,336,143 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,479 | swift | //
// DocumentDetailsView.swift
// ID Capture
//
// Created by Jakub Dolejs on 07/12/2022.
//
import SwiftUI
import DocumentVerificationClient
struct DocumentDetailsView: View {
@State var document: CapturedDocument
var body: some View {
List {
Image(uiImage: document.faceCapture.image)
.resizable()
.overlay(alignment: .topLeading) {
Canvas { context, size in
let scale = size.width / document.faceCapture.image.size.width
let faceRect = document.faceCapture.face.bounds.applying(CGAffineTransform(scaleX: scale, y: scale))
context.stroke(Path(roundedRect: faceRect, cornerRadius: 4), with: .color(Color.green), style: StrokeStyle(lineWidth: 2))
}
}
.aspectRatio(85.6/53.98, contentMode: .fit)
.frame(maxWidth: .infinity)
.cornerRadius(16)
ForEach(document.textFields) { section in
Section(section.title) {
ForEach(section.fields) { field in
ListEntry(field: field)
}
}
}
}
.listStyle(.plain)
.navigationTitle("Document details")
.toolbar {
if #available(iOS 16, *) {
ShareLink(item: self.document, subject: Text("Captured document"), preview: SharePreview("Captured document")) {
Image(systemName: "square.and.arrow.up")
}
}
}
}
}
struct ListEntry: View {
let field: DocumentField
var body: some View {
HStack {
if let image = field.image {
Image(uiImage: image).resizable().aspectRatio(contentMode: .fit).background(Color.white).cornerRadius(8)
Spacer()
Text(field.name)
} else {
Text(field.name)
Spacer()
if let value = field.value {
Text(value)
}
}
}
}
}
struct DocumentDetailsView_Previews: PreviewProvider {
static var previews: some View {
NavigationView {
if let doc = CapturedDocument.sample {
DocumentDetailsView(document: doc)
} else {
Text("Unable to load preview")
}
}
}
}
| [
-1
] |
5192041492acd7a274a202e86e0754b83cc9fe69 | 250f700941bd87f5f2b307c1667aa63bdcac73cd | /Chapter 5/Exc_8/Exc_8/main.swift | 51341ac5357bbd5e99f037a10d5fbcac6c63224e | [] | no_license | lsgsk/Algorithms | 3ea1ae7f7bd4f134d9efada0035d13f216660ed1 | 030a3ab8ee0743baf800bfb802fe052fa9dda34f | refs/heads/master | 2020-03-22T12:58:09.660584 | 2019-09-30T15:06:15 | 2019-09-30T15:06:15 | 140,073,961 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 469 | swift | import Foundation
print("Hello, World!")
var queue = PrioritetQueue<Int>()
queue.Enqueue(value: 2, prioritet : Prioritet.Normal)
print(queue)
queue.Enqueue(value: 5, prioritet : Prioritet.High)
print(queue)
queue.Enqueue(value: 0, prioritet : Prioritet.Low)
print(queue)
queue.Enqueue(value: 1, prioritet : Prioritet.Normal)
print(queue)
queue.Enqueue(value: 4, prioritet : Prioritet.Low)
print(queue)
queue.Enqueue(value: 3, prioritet : Prioritet.High)
print(queue)
| [
-1
] |
c7ddbdf40e5081c6a171289e4665217dc381d133 | 83c81a9ff3b03f8ec04f46c0c854458603d22122 | /QRCodeScanner/UIButton+Extension.swift | a57ffca64e94993d098b920b54b7f521362cb3d2 | [] | no_license | MaochunS/iOS-QRCodeScanner | 417774a22d69f5c32b02d0b7138f044b059933b4 | f81821408f29b2cde77a37ab3f1e8543bf2d91d2 | refs/heads/master | 2023-03-15T11:56:51.346724 | 2023-03-11T01:49:58 | 2023-03-11T01:49:58 | 282,164,007 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 719 | swift | //
// UIButton+Extension.swift
// iOS_CarrefourFastShipping
//
// Created by maochun on 2022/3/26.
//
import UIKit
extension UIButton {
func setBackgroundColor(color: UIColor, forState: UIControl.State) {
let minimumSize: CGSize = CGSize(width: 1.0, height: 1.0)
UIGraphicsBeginImageContext(minimumSize)
if let context = UIGraphicsGetCurrentContext() {
context.setFillColor(color.cgColor)
context.fill(CGRect(origin: .zero, size: minimumSize))
}
let colorImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
self.clipsToBounds = true
self.setBackgroundImage(colorImage, for: forState)
}
}
| [
-1
] |
629220766126e230baab387f913dfbf9cf68e5b6 | 6e3d6bbbca66e706d2be5ec82e5019c754c4ede5 | /MyApp/Class/Cell/ProductCell/Detail/ShopInfo.swift | 6d1266bcf2c2e0ec2d900dd47f0c3ae65952b2cc | [] | no_license | Traopv/FsoftApp | 29d14635054d19948a96931a8bcfeece2a359af2 | a468efa17b2481c4b8c5b85609f19bcf1c8c689e | refs/heads/master | 2022-11-30T01:25:49.068706 | 2020-08-12T10:09:09 | 2020-08-12T10:09:09 | 286,391,950 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 462 | swift | //
// ShopInfo.swift
// MyApp
//
// Created by admin on 8/12/20.
// Copyright © 2020 admin. All rights reserved.
//
import UIKit
class ShopInfo: UITableViewCell {
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
| [
172545,
168324,
321259,
317933,
321261,
398865,
273075,
348949,
273080,
155614,
319775
] |
ef47842ef310b0bd5394bdd479f52faa43d013e1 | 627390a6395c9fd38321df0fc4b5c957bfdd03f9 | /KataCashRegister/Utility/Constant.swift | 2377280bd2496d6520b31219136310b24cbda608 | [] | no_license | ShikhaVijay/KataCashRegister | 9ba677d598ce2966332ae580d6c4dfcce2ce9989 | b6585ee4ccc234c3c3df07af34c6797971a7fbdc | refs/heads/master | 2020-05-05T13:24:42.782677 | 2019-04-08T06:20:39 | 2019-04-08T06:20:39 | 180,076,196 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 544 | swift | //
// Constant.swift
// KataCashRegister
//
// Created by NSMeter on 08/04/19.
// Copyright © 2019 KataBNPPF. All rights reserved.
//
import Foundation
class Constant {
static let kCustomMessagekey = "customeMessageKey"
static let kRegex = "regex"
static let COMPANY_NAME = "KATA"
static let priceErrorMessage = "Enter integer value max upto 2 decimal in Price"
static let quantityErrorMessage = "Enter non-decimal numeric value in Quantity"
static let rowHeight = 50
static let headerheight = 50
}
| [
-1
] |
6bc1f9efd860be8b221ae80300acccf630d307ab | 94bb81316dd7ba93a47bc54378247ecca588ebc1 | /gamen_test/SceneDelegate.swift | 88ce0b45d8840a52464a81be6d38b965fa2d960b | [] | no_license | dobocreate/gamen_test | 22dd29c682031cfc7a4305207af3b5c500d56783 | e6369460f5ec03f272382a2a1635fe7154c74ea0 | refs/heads/main | 2023-07-19T18:27:59.753164 | 2021-08-25T14:14:36 | 2021-08-25T14:14:36 | 399,844,362 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,295 | swift | //
// SceneDelegate.swift
// gamen_test
//
// Created by 岸田展明 on 2021/08/25.
//
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,
393613,
262551,
262553,
385441,
385444,
262567,
385452,
262574,
393649,
385460,
262587,
344512,
262593,
360917,
369119,
328178,
328180,
328183,
328190,
254463,
328193,
164362,
328207,
410129,
393748,
262679,
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,
213642,
377485,
352919,
98969,
344745,
361130,
336556,
434868,
164535,
336568,
164539,
328379,
328387,
352969,
344777,
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,
386004,
345046,
386012,
386019,
386023,
328690,
435188,
328703,
328710,
418822,
377867,
328715,
361490,
386070,
336922,
345119,
377888,
214060,
345134,
345139,
361525,
386102,
361537,
377931,
345172,
189525,
156762,
402523,
361568,
148580,
345200,
361591,
386168,
361594,
410746,
214150,
345224,
386187,
345247,
361645,
345268,
402615,
361657,
337093,
402636,
328925,
165086,
66783,
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,
403073,
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,
411865,
411869,
411874,
379108,
411877,
387303,
346344,
395496,
338154,
387307,
346350,
338161,
387314,
436474,
321787,
379135,
411905,
411917,
379154,
395539,
387350,
387353,
338201,
182559,
338212,
248112,
362823,
436556,
321880,
362844,
379234,
354674,
321911,
420237,
379279,
272787,
354728,
338353,
338382,
272849,
248279,
256474,
182755,
338404,
338411,
330225,
248309,
330254,
199189,
420377,
330268,
191012,
330320,
199250,
191069,
346722,
248427,
191085,
338544,
346736,
191093,
346743,
346769,
150184,
174775,
248505,
174778,
363198,
223936,
355025,
273109,
355029,
264919,
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,
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,
175637,
405017,
134689,
339504,
265779,
421442,
413251,
265796,
265806,
224854,
224858,
339553,
257636,
224871,
372328,
257647,
372338,
224885,
224888,
224891,
224895,
372354,
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,
438438,
225448,
438441,
356521,
225451,
258223,
225456,
430257,
225459,
225462,
225468,
389309,
225472,
372931,
225476,
430275,
389322,
225485,
225488,
225491,
266454,
225494,
225497,
225500,
225503,
225506,
356580,
225511,
217319,
225515,
225519,
381177,
397572,
389381,
381212,
356638,
356641,
356644,
356647,
266537,
389417,
356650,
356656,
332081,
307507,
340276,
356662,
397623,
332091,
225599,
201030,
348489,
332107,
151884,
430422,
348503,
250201,
250211,
340328,
250217,
348523,
348528,
332153,
356734,
389503,
332158,
438657,
250239,
389507,
348548,
356741,
332175,
160152,
373146,
340380,
373149,
70048,
356783,
373169,
266688,
324032,
201158,
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,
389806,
332464,
332473,
381626,
332484,
332487,
332494,
357070,
357074,
332512,
332521,
340724,
332534,
348926,
389927,
348979,
152371,
348983,
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,
373635,
324485,
324488,
185226,
381834,
324493,
324496,
324499,
430996,
324502,
324511,
422817,
324514,
201638,
373672,
324525,
5040,
111539,
324534,
5047,
324539,
324542,
398280,
349129,
340940,
340942,
209874,
340958,
431073,
398307,
340964,
209896,
201712,
209904,
349173,
381947,
201724,
349181,
431100,
431107,
349203,
209944,
209948,
357411,
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,
349762,
333396,
374359,
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,
219144,
268299,
333838,
350225,
186388,
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,
350426,
350449,
375027,
358645,
350459,
350462,
350465,
350469,
268553,
350477,
268560,
350481,
432406,
350487,
325915,
350491,
325918,
350494,
325920,
350500,
194854,
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,
416255,
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,
326463,
375616,
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,
252846,
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,
351366,
384136,
384140,
384144,
384152,
384158,
384161,
351399,
384169,
367795,
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,
253445,
359948,
359951,
245295,
359984,
343610,
400977,
400982,
179803,
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
] |
e122f3f1f5daf5264a67cabc86ecbd86a68f93a5 | 6e72bfb69388f3be8af7e2887c56de30ff2a0ba1 | /appinventor/components-ios/src/Application.swift | f94c154b3bda430004ee97a3de9d64c724097f3f | [
"Apache-2.0"
] | permissive | bobanss/appinventor-sources | 4a0fbc1867ffb2696cb19ff27ff68f0296236883 | 719e7244bf676675b95339871f16e54521a9a47f | refs/heads/master | 2023-07-06T10:30:09.141453 | 2023-06-18T01:07:42 | 2023-06-18T01:07:42 | 208,414,643 | 0 | 0 | Apache-2.0 | 2019-09-14T08:57:27 | 2019-09-14T08:57:27 | null | UTF-8 | Swift | false | false | 2,761 | swift | // mode: swift; swift-mode:basic-offset: 2; -*-
// Copyright 2016-2023 MIT, All rights reserved
// Released under the Apache License, Version 2.0
// http://www.apache.org/licenses/LICENSE-2.0
import Foundation
import UIKit
@objc open class Application: UIResponder, UIApplicationDelegate {
fileprivate var assetManager_: AssetManager?
@objc let name: String
static var current: Application? = nil
/**
* Create an Application using the currently running application bundle.
*/
public override init() {
if let appName = Bundle.main.infoDictionary?[kCFBundleNameKey as String] as? String {
name = appName
} else {
name = "<unknown>"
}
assetManager_ = AssetManager()
super.init()
}
/**
*
*/
@objc public init(from url: URL) {
var temp_name = "UnknownApp"
do {
let fileregex = try NSRegularExpression(pattern: "/([^./]+).aia$")
if let result = fileregex.firstMatch(in: url.absoluteString, range: NSMakeRange(0, url.absoluteString.lengthOfBytes(using: .utf8))) {
let range = result.range(at: 1)
temp_name = (url.absoluteString as NSString).substring(with: range)
}
} catch {
// wtf
}
name = temp_name
super.init()
}
@objc public init(named name: String) {
self.name = name
}
@objc convenience init(from url: URL, isRepl: Bool) {
if isRepl {
self.init()
} else {
self.init(from: url)
}
}
@objc open func makeCurrent() {
Application.current = self
}
@objc open var assetManager: AssetManager {
get {
if assetManager_ == nil {
assetManager_ = AssetManager(for: self)
}
return assetManager_!
}
}
@objc open var assetPath: String? {
let resourcePath = Bundle.main.resourcePath ?? ""
let path = "\(resourcePath)/samples/\(name)/assets"
if FileManager.default.fileExists(atPath: path) {
return path
}
return nil
}
@objc open func pushScreen(named name: String, with startValue: NSObject? = nil) {
let newForm = ReplForm(nibName: nil, bundle: nil)
newForm.formName = name
if let startValue = startValue {
newForm.startValue = startValue
}
SCMInterpreter.shared.setCurrentForm(newForm)
ReplForm.activeForm?.navigationController?.pushViewController(newForm, animated: true)
// There is a race condition in screen switching in the app and when the web editor sends the
// updated code, so we force the new form to be active even though it hasn't yet appeared.
Form.activeForm = newForm
RetValManager.shared().pushScreen(name, withValue: startValue ?? "" as NSObject)
}
@objc open func popScreen(with closeValue: String) {
RetValManager.shared().popScreen(closeValue)
}
}
| [
-1
] |
9442ac2169f20d4dfac43c2518bf8485d6fe61a7 | 4ca8463eb672edd42edd3f0bf3fb3998a5494306 | /BluetoothHeadphoneUnTurnOffer/AppDelegate.swift | 4dd769a432d180657c2091fdaec527350618f5b4 | [] | no_license | archagon/ios-bluetooth-headphone-unsleeper | 4fd7fd8ded30ea320e31cb82230a787261645e37 | 7e1519f14df1a41cd88293000172f621df60669b | refs/heads/master | 2021-01-21T08:19:59.310707 | 2017-05-17T21:57:24 | 2017-05-17T21:57:24 | 91,623,509 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 851 | swift | //
// AppDelegate.swift
// BluetoothHeadphoneUnTurnOffer
//
// Created by Alexei Baboulevitch on 2017-5-17.
// Copyright © 2017 Alexei Baboulevitch. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
return true
}
func applicationWillResignActive(_ application: UIApplication) {
}
func applicationDidEnterBackground(_ application: UIApplication) {
}
func applicationWillEnterForeground(_ application: UIApplication) {
}
func applicationDidBecomeActive(_ application: UIApplication) {
}
func applicationWillTerminate(_ application: UIApplication) {
}
}
| [
323617,
352010
] |
4e051da869bf122b9e49c69cd8188e169c71e918 | 519b116bf6f066905ccbcb5569080dd0927259bc | /AsyncTest/PromiseKitTester.swift | 13ca99fe6f1ebde4e586a5fee21e418a85c73795 | [] | no_license | tmyk110/AsyncTest | 2c10792afb484f2c4d532ec2d891b9636136c7d0 | ece6048002902309b554b573c26a9304d83f651c | refs/heads/master | 2021-09-06T02:06:13.114839 | 2018-02-01T14:52:53 | 2018-02-01T14:52:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 296 | swift | //
// PromiseKitTester.swift
// AsyncTest
//
// Created by Tomoyuki Ito on 2018/02/01.
// Copyright © 2018 Tomoyuki Ito. All rights reserved.
//
// GitHub
// https://github.com/mxcl/PromiseKit
import PromiseKit
class PromiseKitTester {
static func test() {
}
}
| [
-1
] |
2ae00b789c7416381bc7b2e04bebc13f6f46e3c8 | b43e1435d38fbdb6374273b47944e22ddcd27e0a | /MobileAttendance/MobileAttendance/Controller/LoginController.swift | ba245004f63e78bbb19e531697594f976e1c0ad8 | [] | no_license | anggasenna/MobileAttendance | 9bd93b601cf0e15ae6eb2177065cabb97d73357f | 8738ebc9d53824eff5e9d18c960b7dcfebec5fc7 | refs/heads/master | 2020-03-27T15:21:47.546281 | 2018-08-30T07:38:28 | 2018-08-30T07:38:28 | 146,713,346 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,303 | swift | //
// ViewController.swift
// MobileAttendance
//
// Created by MacOs on 8/26/18.
// Copyright © 2018 Tafta. All rights reserved.
//
import UIKit
import SQLite3
class LoginController: UIViewController {
@IBOutlet weak var loginButton: UIButton!
@IBOutlet weak var userField: UITextField!
@IBOutlet weak var passwordField: UITextField!
let defaults = UserDefaults.standard
var db: OpaquePointer?
var loginList = [Login]()
var usernameDefault = ""
var passwordDefault = ""
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let fileURL = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false).appendingPathComponent("Coba.sqlite")
if sqlite3_open(fileURL.path, &db) != SQLITE_OK {
print("error opening database")
} else {
print("Connected")
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func loginCheck(username: String, password: String) -> Bool {
loginList.removeAll()
let query = "SELECT * FROM Login WHERE username='\(username)' AND password='\(password)'"
var stmt: OpaquePointer?
if sqlite3_prepare(db, query, -1, &stmt, nil) != SQLITE_OK {
let errmsg = String(cString: sqlite3_errmsg(db)!)
print("error: \(errmsg)")
}
while sqlite3_step(stmt) == SQLITE_ROW {
let id = sqlite3_column_int(stmt, 0)
let username = String(cString: sqlite3_column_text(stmt, 1))
let password = String(cString: sqlite3_column_text(stmt, 2))
loginList.append(Login(id: Int(id), username: username, password: password))
}
if loginList.isEmpty {
return false
} else {
return true
}
}
@IBAction func loginButtonPressed(_ sender: UIButton) {
let usernameInput = userField.text!
let passwordInput = passwordField.text!
if self.loginCheck(username: usernameInput, password: passwordInput) == true {
// let alert = UIAlertController(title: "Sukses", message: "Welcome!", preferredStyle: .alert)
// let OkAction = UIAlertAction(title: "OK", style: .default, handler: nil)
// alert.addAction(OkAction)
defaults.set(usernameInput, forKey: "username")
defaults.set(passwordInput, forKey: "password")
performSegue(withIdentifier: "goToHome", sender: self)
} else {
let alert = UIAlertController(title: "Gagal", message: "Salah!", preferredStyle: .alert)
let OkAction = UIAlertAction(title: "OK", style: .default, handler: nil)
alert.addAction(OkAction)
present(alert, animated: true, completion: nil)
}
}
}
| [
-1
] |
5247543cd6f8fe68f319a2d7fbfe7ccd1833e7c4 | 36229240cdeac02f5fb0a5935dfa70050da99c87 | /swift-book-practice-sheet.playground/Pages/10. Properties.xcplaygroundpage/Contents.swift | 5c7b1359930df24c253f40b7b6583cf36a13085f | [] | no_license | alexcristea/swift-language-workbook | 0663dec14f3a3fcc57b5dfa1d77d59125f977dae | 77d871166fee25122b0c8eb40b3bfbaacf20d913 | refs/heads/master | 2020-06-29T20:56:03.025187 | 2017-01-17T05:40:35 | 2017-01-17T05:40:35 | 200,622,667 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,570 | swift | //: [Previous](@previous)
//:
//: ## Properties
//:
//: Properties associate values with a particular class, structure, or enumeration.
//:
//: ----
//: ### Stored Properties
//:
//: In its simplest form, a stored property is a constant or variable that is stored as part of an instance of a particular class or structure.
//: ----
//: ### Stored Properties of Constant Structure Instances
//:
//: If you create an instance of a structure and assign that instance to a constant, you cannot modify the instance’s properties, even if they were declared as variable properties
//:
//: When an instance of a value type is marked as a constant, so are all of its properties
//:
//: If you assign an instance of a reference type to a constant, you can still change that instance’s variable properties
//: ----
//: ### Lazy Stored Properties
//:
//: A lazy stored property is a property whose initial value is not calculated until the first time it is used. You indicate a lazy stored property by writing the lazy modifier before its declaration.
//: ----
//: ### Stored Properties and Instance Variables
//:
//: A Swift property does not have a corresponding instance variable, and the backing store for a property is not accessed directly.
//: ----
//: ### Computed Properties
//:
//: In addition to stored properties, classes, structures, and enumerations can define computed properties, which do not actually store a value.
//: ----
//: ### Shorthand Setter Declaration
//:
//: If a computed property’s setter does not define a name for the new value to be set, a default name of newValue is used.
//: ----
//: ### Read-Only Computed Properties
//:
//: A computed property with a getter but no setter is known as a read-only computed property.
//:
//: You must declare computed properties—including read-only computed properties—as variable properties with the var keyword, because their value is not fixed.
//: ----
//: ### Property Observers
//:
//: Property observers observe and respond to changes in a property’s value.
//:
//: If you implement a willSet observer, it’s passed the new property value as a constant parameter.
//:
//: Similarly, if you implement a didSet observer, it’s passed a constant parameter containing the old property value.
//: ----
//: ### Global and Local Variables
//:
//: Global variables are variables that are defined outside of any function, method, closure, or type context.
//:
//: Local variables are variables that are defined within a function, method, or closure context.
//:
//: Stored variables, like stored properties, provide storage for a value of a certain type and allow that value to be set and retrieved.
//:
//: You can also define computed variables and define observers for stored variables, in either a global or local scope.
//:
//: Global constants and variables are always computed lazily, in a similar manner to Lazy Stored Properties (No need for lazy keyword).
//:
//: Local constants and variables are never computed lazily.
//: ----
//: ### Type properties
//:
//: You can also define properties that belong to the type itself, not to any one instance of that type.
//: ----
//: ### Type Property Syntax
//:
//: You define type properties with the static keyword. For computed type properties for class types, you can use the class keyword instead to allow subclasses to override the superclass’s implementation.
//: ----
//: ### Querying and Setting Type properties
//:
//: Type properties are queried and set with dot syntax, just like instance properties.
//:
//: [Next](@next)
| [
-1
] |
1585432331ec650de06d580055d9227cbee3257e | 11d272d6d304a1c9a822316ad55012137e97d1f9 | /leaderBoardAndCredits.swift | ea3122dd1f875a10fd26d57466af94e6a9be9bc1 | [] | no_license | HaydenCrabb/TradeApp | 69569579a8a6fa1e1759307df2321d9fc67da039 | 22df7ab322f7811cd502eafd655a00c5994eb49f | refs/heads/master | 2023-03-18T07:06:54.459220 | 2021-03-03T06:28:26 | 2021-03-03T06:28:26 | 344,020,678 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,037 | swift | //
// leaderBoardAndCredits.swift
// TradeApp2.0
//
// Created by Hayden Crabb on 7/27/17.
// Copyright © 2017 Coconut Productions. All rights reserved.
//
import UIKit
import Firebase
import AVFoundation
class leaderboardAndCredits:UIViewController, UITableViewDelegate, UITableViewDataSource
{
var Students: [String] = []
var Wealths: [Int] = []
var StudentsAndWealths: [String: Int] = [:]
var backTickSoundPlayer:AVAudioPlayer = AVAudioPlayer()
var leaderboard:Bool = true
override func viewDidLoad() {
let backTickPath = Bundle.main.path(forResource: "backTick.mp3", ofType: nil)!
let backTickSound = NSURL(fileURLWithPath: backTickPath)
do {
try backTickSoundPlayer = AVAudioPlayer(contentsOf: backTickSound as URL)
backTickSoundPlayer.prepareToPlay()
} catch {
}
mainTableView.layer.cornerRadius = 10
mainTableView.layer.masksToBounds = true
mainTableView.allowsSelection = false
if leaderboard
{
for outlet in creditOutlets
{
outlet.isHidden = true
}
Database.database().reference(withPath: UsersInformation.classWeAreIn).child("NamesOfUsers").observeSingleEvent(of: .value, with: { (snapshot) in
if snapshot.exists()
{
let allData = snapshot.value as! [String:[String:Int]]
for user in allData
{
let tempDict = user.value
self.StudentsAndWealths[user.key] = tempDict["Wealth"]
self.Wealths.append(tempDict["Wealth"]!)
}
self.Wealths = self.quicksort(list: self.Wealths)
self.matchUsersAndWealths()
self.mainTableView.reloadData()
}
})
}
else
{
mainTableView.isHidden = true
titleOutlet.text = "Credits"
}
}
func matchUsersAndWealths()
{
var i = 0
while StudentsAndWealths.count != 0 {
for data in StudentsAndWealths
{
if data.value == Wealths[i]
{
Students.append(data.key)
StudentsAndWealths[data.key] = nil
i = i + 1
}
}
}
}
func quicksort(list:[Int]) -> [Int] {
if list.count == 0 {
return []
}
let pivotValue = list[0]
let listStripped = list.count > 1 ? list[1...list.count - 1] : []
let smaller: [Int] = listStripped.filter{$0 >= pivotValue}
let greater: [Int] = listStripped.filter{$0 < pivotValue}
return quicksort(list: smaller) + Array(arrayLiteral:pivotValue) + quicksort(list: greater)
}
@IBAction func backButtonWasPressed(_ sender: Any) {
backTickSoundPlayer.play()
self.performSegue(withIdentifier: "creditsToMain", sender: nil)
}
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
{
return Students.count
}
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
{
let myCell = mainTableView.dequeueReusableCell(withIdentifier: "NamedCell", for: indexPath) as! LeaderboardTableViewCell
if Students[indexPath.row] == UsersInformation.currentUsersUsername
{
myCell.backgroundColor = UIColor(displayP3Red: 0.29, green: 0.6, blue: 0.34, alpha: 0.7)
}
myCell.nameLabel.text = "\(indexPath.row + 1). \(Students[indexPath.row])"
myCell.wealthLabel.text = "$\(Wealths[indexPath.row])"
return myCell
}
@IBOutlet var creditOutlets: [UILabel]!
@IBOutlet var titleOutlet: UILabel!
@IBOutlet var mainTableView: UITableView!
}
| [
-1
] |
e3316fc21a2d822ad85355b075b1ac0503d42bd3 | 2a9d363d32dbaeb059aaba99552f5879b2da1cde | /Box2D/Collision/b2DynamicTree.swift | 671eb89af3cd9e4e0434d5251208ce512375f888 | [
"Zlib"
] | permissive | taroyuyu/Box2DSwift | e9764554311505671216e8b82557980158841590 | b4197fc376713260dc478c8b662446d69792845d | refs/heads/master | 2022-12-17T12:18:01.669470 | 2020-09-12T08:48:36 | 2020-09-12T08:48:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 23,753 | swift | /**
Copyright (c) 2006-2014 Erin Catto http://www.box2d.org
Copyright (c) 2015 - Yohei Yoshihara
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
This version of box2d was developed by Yohei Yoshihara. It is based upon
the original C++ code written by Erin Catto.
*/
import Foundation
public let b2_nullNode = -1
/// A node in the dynamic tree. The client does not interact with this directly.
open class b2TreeNode<T> : CustomStringConvertible {
/// Enlarged AABB
open var aabb = b2AABB()
open var userData: T? = nil
var parentOrNext: Int = b2_nullNode
var child1: Int = b2_nullNode
var child2: Int = b2_nullNode
// leaf = 0, free node = -1
var height: Int = -1
func IsLeaf() -> Bool {
return child1 == b2_nullNode
}
open var description: String {
return "{aabb=\(aabb), parentOrNext=\(parentOrNext), child1=\(child1), child2=\(child2), height=\(height)}"
}
}
/// A dynamic AABB tree broad-phase, inspired by Nathanael Presson's btDbvt.
/// A dynamic tree arranges data in a binary tree to accelerate
/// queries such as volume queries and ray casts. Leafs are proxies
/// with an AABB. In the tree we expand the proxy AABB by b2_fatAABBFactor
/// so that the proxy AABB is bigger than the client object. This allows the client
/// object to move by small amounts without triggering a tree update.
///
/// Nodes are pooled and relocatable, so we use node indices rather than pointers.
open class b2DynamicTree<T> : CustomStringConvertible {
var m_root: Int
var m_nodes: [b2TreeNode<T>]
var m_nodeCount: Int
var m_nodeCapacity: Int
var m_freeList: Int
/// This is used to incrementally traverse the tree for re-balancing.
//var m_path : UInt
var m_insertionCount: Int
/// Constructing the tree initializes the node pool.
public init() {
m_root = b2_nullNode
m_nodeCapacity = 16
m_nodeCount = 0
m_nodes = Array<b2TreeNode<T>>()
m_nodes.reserveCapacity(m_nodeCapacity)
// Build a linked list for the free list.
for i in 0 ..< m_nodeCapacity - 1 {
m_nodes.append(b2TreeNode())
m_nodes.last!.parentOrNext = i + 1
m_nodes.last!.height = -1
}
m_nodes.append(b2TreeNode())
m_nodes.last!.parentOrNext = b2_nullNode
m_nodes.last!.height = -1
m_freeList = 0
m_insertionCount = 0
}
/// Destroy the tree, freeing the node pool.
deinit {
}
/// Create a proxy. Provide a tight fitting AABB and a userData pointer.
open func createProxy(aabb: b2AABB, userData: T?) -> Int {
let proxyId = allocateNode()
// Fatten the aabb.
let r = b2Vec2(b2_aabbExtension, b2_aabbExtension)
m_nodes[proxyId].aabb.lowerBound = aabb.lowerBound - r
m_nodes[proxyId].aabb.upperBound = aabb.upperBound + r
m_nodes[proxyId].userData = userData
m_nodes[proxyId].height = 0
insertLeaf(proxyId)
return proxyId
}
/// Destroy a proxy. This asserts if the id is invalid.
open func destroyProxy(_ proxyId: Int) {
assert(0 <= proxyId && proxyId < m_nodes.count)
assert(m_nodes[proxyId].IsLeaf())
removeLeaf(proxyId)
freeNode(proxyId)
}
/**
Move a proxy with a swepted AABB. If the proxy has moved outside of its fattened AABB,
then the proxy is removed from the tree and re-inserted. Otherwise
the function returns immediately.
- returns: true if the proxy was re-inserted.
*/
open func moveProxy(_ proxyId: Int, aabb: b2AABB, displacement: b2Vec2) -> Bool {
assert(0 <= proxyId && proxyId < m_nodes.count)
assert(m_nodes[proxyId].IsLeaf())
if m_nodes[proxyId].aabb.contains(aabb) {
return false
}
removeLeaf(proxyId)
// Extend AABB.
var b = aabb
let r = b2Vec2(b2_aabbExtension, b2_aabbExtension)
b.lowerBound = b.lowerBound - r
b.upperBound = b.upperBound + r
// Predict AABB displacement.
let d = b2_aabbMultiplier * displacement
if d.x < 0.0 {
b.lowerBound.x += d.x
}
else {
b.upperBound.x += d.x
}
if d.y < 0.0 {
b.lowerBound.y += d.y
}
else {
b.upperBound.y += d.y
}
m_nodes[proxyId].aabb = b
insertLeaf(proxyId)
return true
}
/**
Get proxy user data.
- returns: the proxy user data or 0 if the id is invalid.
*/
open func getUserData(_ proxyId: Int) -> T? {
assert(0 <= proxyId && proxyId < m_nodes.count)
return m_nodes[proxyId].userData
}
/// Get the fat AABB for a proxy.
open func getFatAABB(_ proxyId: Int) -> b2AABB {
assert(0 <= proxyId && proxyId < m_nodes.count)
return m_nodes[proxyId].aabb
}
/// Query an AABB for overlapping proxies. The callback class
/// is called for each proxy that overlaps the supplied AABB.
open func query<T: b2QueryWrapper>(callback: T, aabb: b2AABB) {
var stack = b2GrowableStack<Int>(capacity: 256)
stack.push(m_root)
while (stack.count > 0) {
let nodeId = stack.pop()
if nodeId == b2_nullNode {
continue
}
let node = m_nodes[nodeId]
if b2TestOverlap(node.aabb, aabb) {
if node.IsLeaf() {
let proceed = callback.queryCallback(nodeId)
if proceed == false {
return
}
}
else {
stack.push(node.child1)
stack.push(node.child2)
}
}
}
}
/// Ray-cast against the proxies in the tree. This relies on the callback
/// to perform a exact ray-cast in the case were the proxy contains a shape.
/// The callback also performs the any collision filtering. This has performance
/// roughly equal to k * log(n), where k is the number of collisions and n is the
/// number of proxies in the tree.
/// @param input the ray-cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1).
/// @param callback a callback class that is called for each proxy that is hit by the ray.
open func rayCast<T: b2RayCastWrapper>(callback: T, input: b2RayCastInput) {
let p1 = input.p1
let p2 = input.p2
var r = p2 - p1
assert(r.lengthSquared() > 0.0)
r.normalize()
// v is perpendicular to the segment.
let v = b2Cross(1.0, r)
let abs_v = b2Abs(v)
// Separating axis for segment (Gino, p80).
// |dot(v, p1 - c)| > dot(|v|, h)
var maxFraction = input.maxFraction
// Build a bounding box for the segment.
var segmentAABB = b2AABB()
let t = p1 + maxFraction * (p2 - p1)
segmentAABB.lowerBound = b2Min(p1, t)
segmentAABB.upperBound = b2Max(p1, t)
var stack = b2GrowableStack<Int>(capacity: 256)
stack.push(m_root)
while stack.count > 0 {
let nodeId = stack.pop()
if nodeId == b2_nullNode {
continue
}
let node = m_nodes[nodeId]
if b2TestOverlap(node.aabb, segmentAABB) == false {
continue
}
// Separating axis for segment (Gino, p80).
// |dot(v, p1 - c)| > dot(|v|, h)
let c = node.aabb.center
let h = node.aabb.extents
let separation = abs(b2Dot(v, p1 - c)) - b2Dot(abs_v, h)
if separation > 0.0 {
continue
}
if node.IsLeaf() {
var subInput = b2RayCastInput()
subInput.p1 = input.p1
subInput.p2 = input.p2
subInput.maxFraction = maxFraction
let value = callback.rayCastCallback(subInput, nodeId)
if value == 0.0 {
// The client has terminated the ray cast.
return
}
if value > 0.0 {
// Update segment bounding box.
maxFraction = value
let t = p1 + maxFraction * (p2 - p1)
segmentAABB.lowerBound = b2Min(p1, t)
segmentAABB.upperBound = b2Max(p1, t)
}
}
else {
stack.push(node.child1)
stack.push(node.child2)
}
}
}
/// Validate this tree. For testing.
open func validate() {
validateStructure(m_root)
validateMetrics(m_root)
var freeCount = 0
var freeIndex = m_freeList
while freeIndex != b2_nullNode {
assert(0 <= freeIndex && freeIndex < m_nodes.count)
freeIndex = m_nodes[freeIndex].parentOrNext
freeCount += 1
}
assert(getHeight() == computeHeight())
//assert(m_nodeCount + freeCount == m_nodes.count)
}
/// Compute the height of the binary tree in O(N) time. Should not be
/// called often.
open func getHeight() -> Int {
if m_root == b2_nullNode {
return 0
}
return m_nodes[m_root].height
}
/// Get the maximum balance of an node in the tree. The balance is the difference
/// in height of the two children of a node.
open func getMaxBalance() -> Int {
var maxBalance = 0
for i in 0 ..< m_nodes.count {
let node = m_nodes[i]
if node.height <= 1 {
continue
}
assert(node.IsLeaf() == false)
let child1 = node.child1
let child2 = node.child2
let balance = abs(m_nodes[child2].height - m_nodes[child1].height)
maxBalance = max(maxBalance, balance)
}
return maxBalance
}
/// Get the ratio of the sum of the node areas to the root area.
open func getAreaRatio() -> b2Float {
if m_root == b2_nullNode {
return 0.0
}
let root = m_nodes[m_root]
let rootArea = root.aabb.perimeter
var totalArea: b2Float = 0.0
for i in 0 ..< m_nodes.count {
let node = m_nodes[i]
if node.height < 0 {
// Free node in pool
continue
}
totalArea += node.aabb.perimeter
}
return totalArea / rootArea
}
/// Build an optimal tree. Very expensive. For testing.
open func rebuildBottomUp() {
var nodes = [Int](repeating: 0, count: m_nodes.count)
//int32* nodes = (int32*)b2Alloc(m_nodeCount * sizeof(int32))
var count = 0
// Build array of leaves. Free the rest.
for i in 0 ..< m_nodes.count {
if m_nodes[i].height < 0 {
// free node in pool
continue
}
if m_nodes[i].IsLeaf() {
m_nodes[i].parentOrNext = b2_nullNode
nodes[count] = i
count += 1
}
else {
freeNode(i)
}
}
while count > 1 {
var minCost = b2_maxFloat
var iMin = -1, jMin = -1
for i in 0 ..< count {
let aabbi = m_nodes[nodes[i]].aabb
for j in i + 1 ..< count {
let aabbj = m_nodes[nodes[j]].aabb
var b = b2AABB()
b.combine(aabbi, aabbj)
let cost = b.perimeter
if cost < minCost {
iMin = i
jMin = j
minCost = cost
}
}
}
let index1 = nodes[iMin]
let index2 = nodes[jMin]
let child1 = m_nodes[index1]
let child2 = m_nodes[index2]
let parentIndex = allocateNode()
let parent = m_nodes[parentIndex]
parent.child1 = index1
parent.child2 = index2
parent.height = 1 + max(child1.height, child2.height)
parent.aabb.combine(child1.aabb, child2.aabb)
parent.parentOrNext = b2_nullNode
child1.parentOrNext = parentIndex
child2.parentOrNext = parentIndex
nodes[jMin] = nodes[count-1]
nodes[iMin] = parentIndex
count -= 1
}
m_root = nodes[0]
// b2Free(nodes)
validate()
}
/// Shift the world origin. Useful for large worlds.
/// The shift formula is: position -= newOrigin
/// @param newOrigin the new origin with respect to the old origin
open func shiftOrigin(_ newOrigin: b2Vec2) {
// Build array of leaves. Free the rest.
for i in 0 ..< m_nodes.count {
m_nodes[i].aabb.lowerBound -= newOrigin
m_nodes[i].aabb.upperBound -= newOrigin
}
}
fileprivate func allocateNode() -> Int {
if m_freeList == b2_nullNode {
let node = b2TreeNode<T>()
node.parentOrNext = b2_nullNode
node.height = -1
m_nodes.append(node)
m_freeList = m_nodes.count - 1
}
let nodeId = m_freeList
m_freeList = m_nodes[nodeId].parentOrNext
m_nodes[nodeId].parentOrNext = b2_nullNode
m_nodes[nodeId].child1 = b2_nullNode
m_nodes[nodeId].child2 = b2_nullNode
m_nodes[nodeId].height = 0
m_nodes[nodeId].userData = nil
return nodeId
}
func freeNode(_ nodeId: Int) {
assert(0 <= nodeId && nodeId < m_nodes.count)
assert(0 < m_nodes.count)
m_nodes[nodeId].parentOrNext = m_freeList
m_nodes[nodeId].height = -1
m_freeList = nodeId
}
func insertLeaf(_ leaf: Int) {
m_insertionCount += 1
if m_root == b2_nullNode {
m_root = leaf
m_nodes[m_root].parentOrNext = b2_nullNode
return
}
// Find the best sibling for this node
let leafAABB = m_nodes[leaf].aabb
var index = m_root
while m_nodes[index].IsLeaf() == false {
let child1 = m_nodes[index].child1
let child2 = m_nodes[index].child2
let area = m_nodes[index].aabb.perimeter
var combinedAABB = b2AABB()
combinedAABB.combine(m_nodes[index].aabb, leafAABB)
let combinedArea = combinedAABB.perimeter
// Cost of creating a new parent for this node and the new leaf
let cost = 2.0 * combinedArea
// Minimum cost of pushing the leaf further down the tree
let inheritanceCost = 2.0 * (combinedArea - area)
// Cost of descending into child1
var cost1: b2Float
if m_nodes[child1].IsLeaf() {
var aabb = b2AABB()
aabb.combine(leafAABB, m_nodes[child1].aabb)
cost1 = aabb.perimeter + inheritanceCost
}
else {
var aabb = b2AABB()
aabb.combine(leafAABB, m_nodes[child1].aabb)
let oldArea = m_nodes[child1].aabb.perimeter
let newArea = aabb.perimeter
cost1 = (newArea - oldArea) + inheritanceCost
}
// Cost of descending into child2
var cost2: b2Float
if m_nodes[child2].IsLeaf() {
var aabb = b2AABB()
aabb.combine(leafAABB, m_nodes[child2].aabb)
cost2 = aabb.perimeter + inheritanceCost
}
else {
var aabb = b2AABB()
aabb.combine(leafAABB, m_nodes[child2].aabb)
let oldArea = m_nodes[child2].aabb.perimeter
let newArea = aabb.perimeter
cost2 = newArea - oldArea + inheritanceCost
}
// Descend according to the minimum cost.
if cost < cost1 && cost < cost2 {
break
}
// Descend
if cost1 < cost2 {
index = child1
}
else {
index = child2
}
}
let sibling = index
// Create a new parent.
let oldParent = m_nodes[sibling].parentOrNext
let newParent = allocateNode()
m_nodes[newParent].parentOrNext = oldParent
m_nodes[newParent].userData = nil
m_nodes[newParent].aabb.combine(leafAABB, m_nodes[sibling].aabb)
m_nodes[newParent].height = m_nodes[sibling].height + 1
if oldParent != b2_nullNode {
// The sibling was not the root.
if m_nodes[oldParent].child1 == sibling {
m_nodes[oldParent].child1 = newParent
}
else {
m_nodes[oldParent].child2 = newParent
}
m_nodes[newParent].child1 = sibling
m_nodes[newParent].child2 = leaf
m_nodes[sibling].parentOrNext = newParent
m_nodes[leaf].parentOrNext = newParent
}
else {
// The sibling was the root.
m_nodes[newParent].child1 = sibling
m_nodes[newParent].child2 = leaf
m_nodes[sibling].parentOrNext = newParent
m_nodes[leaf].parentOrNext = newParent
m_root = newParent
}
// Walk back up the tree fixing heights and AABBs
index = m_nodes[leaf].parentOrNext
while index != b2_nullNode {
index = balance(index)
let child1 = m_nodes[index].child1
let child2 = m_nodes[index].child2
assert(child1 != b2_nullNode)
assert(child2 != b2_nullNode)
m_nodes[index].height = 1 + max(m_nodes[child1].height, m_nodes[child2].height)
m_nodes[index].aabb.combine(m_nodes[child1].aabb, m_nodes[child2].aabb)
index = m_nodes[index].parentOrNext
}
//Validate()
}
func removeLeaf(_ leaf: Int) {
if leaf == m_root {
m_root = b2_nullNode
return
}
let parent = m_nodes[leaf].parentOrNext
let grandParent = m_nodes[parent].parentOrNext
var sibling: Int
if m_nodes[parent].child1 == leaf {
sibling = m_nodes[parent].child2
}
else {
sibling = m_nodes[parent].child1
}
if grandParent != b2_nullNode {
// Destroy parent and connect sibling to grandParent.
if m_nodes[grandParent].child1 == parent {
m_nodes[grandParent].child1 = sibling
}
else {
m_nodes[grandParent].child2 = sibling
}
m_nodes[sibling].parentOrNext = grandParent
freeNode(parent)
// Adjust ancestor bounds.
var index = grandParent
while index != b2_nullNode {
index = balance(index)
let child1 = m_nodes[index].child1
let child2 = m_nodes[index].child2
m_nodes[index].aabb.combine(m_nodes[child1].aabb, m_nodes[child2].aabb)
m_nodes[index].height = 1 + max(m_nodes[child1].height, m_nodes[child2].height)
index = m_nodes[index].parentOrNext
}
}
else {
m_root = sibling
m_nodes[sibling].parentOrNext = b2_nullNode
freeNode(parent)
}
//Validate()
}
// Perform a left or right rotation if node A is imbalanced.
// Returns the new root index.
func balance(_ iA : Int) -> Int {
assert(iA != b2_nullNode)
let A = m_nodes[iA]
if A.IsLeaf() || A.height < 2 {
return iA
}
let iB = A.child1
let iC = A.child2
assert(0 <= iB && iB < m_nodes.count)
assert(0 <= iC && iC < m_nodes.count)
let B = m_nodes[iB]
let C = m_nodes[iC]
let balance = C.height - B.height
// Rotate C up
if balance > 1 {
let iF = C.child1
let iG = C.child2
let F = m_nodes[iF]
let G = m_nodes[iG]
assert(0 <= iF && iF < m_nodes.count)
assert(0 <= iG && iG < m_nodes.count)
// Swap A and C
C.child1 = iA
C.parentOrNext = A.parentOrNext
A.parentOrNext = iC
// A's old parent should point to C
if C.parentOrNext != b2_nullNode {
if m_nodes[C.parentOrNext].child1 == iA {
m_nodes[C.parentOrNext].child1 = iC
}
else {
assert(m_nodes[C.parentOrNext].child2 == iA)
m_nodes[C.parentOrNext].child2 = iC
}
}
else {
m_root = iC
}
// Rotate
if F.height > G.height {
C.child2 = iF
A.child2 = iG
G.parentOrNext = iA
A.aabb.combine(B.aabb, G.aabb)
C.aabb.combine(A.aabb, F.aabb)
A.height = 1 + max(B.height, G.height)
C.height = 1 + max(A.height, F.height)
}
else {
C.child2 = iG
A.child2 = iF
F.parentOrNext = iA
A.aabb.combine(B.aabb, F.aabb)
C.aabb.combine(A.aabb, G.aabb)
A.height = 1 + max(B.height, F.height)
C.height = 1 + max(A.height, G.height)
}
return iC
}
// Rotate B up
if balance < -1 {
let iD = B.child1
let iE = B.child2
let D = m_nodes[iD]
let E = m_nodes[iE]
assert(0 <= iD && iD < m_nodes.count)
assert(0 <= iE && iE < m_nodes.count)
// Swap A and B
B.child1 = iA
B.parentOrNext = A.parentOrNext
A.parentOrNext = iB
// A's old parent should point to B
if B.parentOrNext != b2_nullNode {
if m_nodes[B.parentOrNext].child1 == iA {
m_nodes[B.parentOrNext].child1 = iB
}
else {
assert(m_nodes[B.parentOrNext].child2 == iA)
m_nodes[B.parentOrNext].child2 = iB
}
}
else {
m_root = iB
}
// Rotate
if D.height > E.height {
B.child2 = iD
A.child1 = iE
E.parentOrNext = iA
A.aabb.combine(C.aabb, E.aabb)
B.aabb.combine(A.aabb, D.aabb)
A.height = 1 + max(C.height, E.height)
B.height = 1 + max(A.height, D.height)
}
else {
B.child2 = iE
A.child1 = iD
D.parentOrNext = iA
A.aabb.combine(C.aabb, D.aabb)
B.aabb.combine(A.aabb, E.aabb)
A.height = 1 + max(C.height, D.height)
B.height = 1 + max(A.height, E.height)
}
return iB
}
return iA
}
func computeHeight() -> Int {
let height = computeHeight(m_root)
return height
}
// Compute the height of a sub-tree.
func computeHeight(_ nodeId : Int) -> Int {
assert(0 <= nodeId && nodeId < m_nodes.count)
let node = m_nodes[nodeId]
if node.IsLeaf() {
return 0
}
let height1 = computeHeight(node.child1)
let height2 = computeHeight(node.child2)
return 1 + max(height1, height2)
}
func validateStructure(_ index : Int) {
if index == b2_nullNode {
return
}
if index == m_root {
assert(m_nodes[index].parentOrNext == b2_nullNode)
}
let node = m_nodes[index]
let child1 = node.child1
let child2 = node.child2
if node.IsLeaf() {
assert(child1 == b2_nullNode)
assert(child2 == b2_nullNode)
assert(node.height == 0)
return
}
assert(0 <= child1 && child1 < m_nodes.count)
assert(0 <= child2 && child2 < m_nodes.count)
assert(m_nodes[child1].parentOrNext == index)
assert(m_nodes[child2].parentOrNext == index)
validateStructure(child1)
validateStructure(child2)
}
func validateMetrics(_ index : Int) {
if index == b2_nullNode {
return
}
let node = m_nodes[index]
let child1 = node.child1
let child2 = node.child2
if node.IsLeaf() {
assert(child1 == b2_nullNode)
assert(child2 == b2_nullNode)
assert(node.height == 0)
return
}
assert(0 <= child1 && child1 < m_nodes.count)
assert(0 <= child2 && child2 < m_nodes.count)
let height1 = m_nodes[child1].height
let height2 = m_nodes[child2].height
let height = 1 + max(height1, height2)
assert(node.height == height)
var aabb = b2AABB()
aabb.combine(m_nodes[child1].aabb, m_nodes[child2].aabb)
assert(aabb.lowerBound == node.aabb.lowerBound)
assert(aabb.upperBound == node.aabb.upperBound)
validateMetrics(child1)
validateMetrics(child2)
}
open var description: String {
return "b2DynamicTree[root=\(m_root), nodes=\(m_nodes)]"
}
}
| [
129529
] |
9b02df0902412dd248240a4dd05f23756e44b6ec | b174506c46d85df03a140813785541edf6e2a44a | /AirQuality/Countries/CountryCollectionViewCell.swift | 4e9096e5297b5125c77f8cd674a5ea5674c88319 | [] | no_license | HolyBuz/AirQuality | d619a0a197d9ee825b711ee00799a23934e7387c | 91973cd2ed233c2824cdf7b3872172e871d69891 | refs/heads/master | 2023-01-10T12:02:11.431769 | 2020-11-15T22:43:20 | 2020-11-15T22:43:20 | 257,030,437 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,639 | swift | import UIKit
final class CountryCollectionViewCell: UICollectionViewCell {
private lazy var countryNameLabel: UILabel = {
let label = UILabel()
label.font = UIFont.systemFont(ofSize: 20)
label.textAlignment = .center
label.textColor = .systemGray
return label
}()
override init(frame: CGRect) {
super.init(frame: frame)
setupViews()
setupHierarchy()
setupLayout()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func setupViews() {
contentView.backgroundColor = .systemGray6
contentView.layer.cornerRadius = 5
layer.cornerRadius = 15.0
layer.borderWidth = 0.0
layer.shadowColor = UIColor.black.cgColor
layer.shadowOffset = CGSize(width: 0, height: 2)
layer.shadowRadius = 5.0
layer.shadowOpacity = 0.3
layer.masksToBounds = false
}
private func setupHierarchy() {
contentView.addSubview(countryNameLabel)
}
private func setupLayout() {
countryNameLabel.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
countryNameLabel.topAnchor.constraint(equalTo: contentView.topAnchor),
countryNameLabel.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
countryNameLabel.leftAnchor.constraint(equalTo: contentView.leftAnchor),
countryNameLabel.rightAnchor.constraint(equalTo: contentView.rightAnchor)
])
}
func update(using viewModel: CountryViewModel) {
countryNameLabel.text = viewModel.displayString
}
override func prepareForReuse() {
countryNameLabel.text = nil
}
}
| [
-1
] |
2f6aa4fdc9c9398fa9f950e0dbaeefa0400ef4fd | ad97da5ea4a4a470cb30790cc57635d5a44aea2c | /SDiOS-SourceTree/RootViewController.swift | 155f0e106c05890239fda97dfe81121c4082ad9e | [] | no_license | Darvellh/sdios-sourcetree | 19d2846fe1b4ee33c598e8d6f412b625c3f30cf7 | e4099bc7ac6ecff1e36ad3fcd6ee9d1e827a979e | refs/heads/master | 2016-08-13T01:07:45.319806 | 2016-02-29T17:18:43 | 2016-02-29T17:18:43 | 52,808,578 | 0 | 6 | null | 2016-02-29T22:11:15 | 2016-02-29T17:09:54 | Swift | UTF-8 | Swift | false | false | 4,889 | swift | //
// RootViewController.swift
// SDiOS-SourceTree
//
// Created by Darvell Hunt on 2/29/16.
// Copyright © 2016 Darvell Hunt. All rights reserved.
//
import UIKit
class RootViewController: UIViewController, UIPageViewControllerDelegate {
var pageViewController: UIPageViewController?
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
// Configure the page view controller and add it as a child view controller.
self.pageViewController = UIPageViewController(transitionStyle: .PageCurl, navigationOrientation: .Horizontal, options: nil)
self.pageViewController!.delegate = self
let startingViewController: DataViewController = self.modelController.viewControllerAtIndex(0, storyboard: self.storyboard!)!
let viewControllers = [startingViewController]
self.pageViewController!.setViewControllers(viewControllers, direction: .Forward, animated: false, completion: {done in })
self.pageViewController!.dataSource = self.modelController
self.addChildViewController(self.pageViewController!)
self.view.addSubview(self.pageViewController!.view)
// Set the page view controller's bounds using an inset rect so that self's view is visible around the edges of the pages.
var pageViewRect = self.view.bounds
if UIDevice.currentDevice().userInterfaceIdiom == .Pad {
pageViewRect = CGRectInset(pageViewRect, 40.0, 40.0)
}
self.pageViewController!.view.frame = pageViewRect
self.pageViewController!.didMoveToParentViewController(self)
// Add the page view controller's gesture recognizers to the book view controller's view so that the gestures are started more easily.
self.view.gestureRecognizers = self.pageViewController!.gestureRecognizers
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
var modelController: ModelController {
// Return the model controller object, creating it if necessary.
// In more complex implementations, the model controller may be passed to the view controller.
if _modelController == nil {
_modelController = ModelController()
}
return _modelController!
}
var _modelController: ModelController? = nil
// MARK: - UIPageViewController delegate methods
func pageViewController(pageViewController: UIPageViewController, spineLocationForInterfaceOrientation orientation: UIInterfaceOrientation) -> UIPageViewControllerSpineLocation {
if (orientation == .Portrait) || (orientation == .PortraitUpsideDown) || (UIDevice.currentDevice().userInterfaceIdiom == .Phone) {
// In portrait orientation or on iPhone: Set the spine position to "min" and the page view controller's view controllers array to contain just one view controller. Setting the spine position to 'UIPageViewControllerSpineLocationMid' in landscape orientation sets the doubleSided property to true, so set it to false here.
let currentViewController = self.pageViewController!.viewControllers![0]
let viewControllers = [currentViewController]
self.pageViewController!.setViewControllers(viewControllers, direction: .Forward, animated: true, completion: {done in })
self.pageViewController!.doubleSided = false
return .Min
}
// In landscape orientation: Set set the spine location to "mid" and the page view controller's view controllers array to contain two view controllers. If the current page is even, set it to contain the current and next view controllers; if it is odd, set the array to contain the previous and current view controllers.
let currentViewController = self.pageViewController!.viewControllers![0] as! DataViewController
var viewControllers: [UIViewController]
let indexOfCurrentViewController = self.modelController.indexOfViewController(currentViewController)
if (indexOfCurrentViewController == 0) || (indexOfCurrentViewController % 2 == 0) {
let nextViewController = self.modelController.pageViewController(self.pageViewController!, viewControllerAfterViewController: currentViewController)
viewControllers = [currentViewController, nextViewController!]
} else {
let previousViewController = self.modelController.pageViewController(self.pageViewController!, viewControllerBeforeViewController: currentViewController)
viewControllers = [previousViewController!, currentViewController]
}
self.pageViewController!.setViewControllers(viewControllers, direction: .Forward, animated: true, completion: {done in })
return .Mid
}
}
| [
299110,
285490,
321843,
291602,
275509,
280344,
304349
] |
7a6e753c2b835e570302d66653b0c1a3e65ffb42 | f0e2cac8b5db716c4e5b468b6058e9948c0d456c | /LBTAPodcast/MainTabBarController.swift | 502aabf2346dbcefd9bb4e51b1ec49406686607a | [] | no_license | adityadaniel/LBTAPodcast | 286fe7d5b9b8e9f9786077b1454daa8699aeee63 | e7d52666999e77935003122799ae79e40681b9ef | refs/heads/master | 2020-04-19T03:11:33.737781 | 2019-03-13T04:55:51 | 2019-03-13T04:55:51 | 167,927,073 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,310 | swift | //
// MainTabBarController.swift
// LBTAPodcast
//
// Created by Daniel Aditya Istyana on 28/12/18.
// Copyright © 2018 Daniel Aditya Istyana. All rights reserved.
//
import UIKit
class MainTabBarController: UITabBarController {
let playerDetailsView = PlayerDetailViews.initFromNib()
override func viewDidLoad() {
super.viewDidLoad()
tabBar.tintColor = .purple
// make all navbar have large titles
UINavigationBar.appearance().prefersLargeTitles = true
// run setup on all view controllers
setupViewControllers()
setupPlayerDetailsView()
}
@objc func minimizePlayerDetails() {
maximizedTopAnchorConstraint.isActive = false
bottomAnchorConstraint.constant = view.frame.height
minimizedTopAnchorConstraint.isActive = true
UIView.animate(withDuration: 0.5, delay: 0, usingSpringWithDamping: 0.7, initialSpringVelocity: 1, options: .curveEaseOut, animations: {
self.view.layoutIfNeeded()
self.tabBar.transform = CGAffineTransform.identity
})
self.playerDetailsView.miniPlayerView.alpha = 1
self.playerDetailsView.maximizedStackView.alpha = 0
}
func maximizePlayerDetails(episode: Episode?) {
minimizedTopAnchorConstraint.isActive = false
maximizedTopAnchorConstraint.isActive = true
maximizedTopAnchorConstraint.constant = 0
bottomAnchorConstraint.constant = 0
// Check if episode is not nil to prevent crashing the app
if episode != nil {
playerDetailsView.episode = episode
}
UIView.animate(withDuration: 0.5, delay: 0, usingSpringWithDamping: 0.7, initialSpringVelocity: 1, options: .curveEaseOut, animations: {
self.view.layoutIfNeeded()
self.tabBar.transform = CGAffineTransform(scaleX: 0, y: 100)
self.playerDetailsView.miniPlayerView.alpha = 0
self.playerDetailsView.maximizedStackView.alpha = 1
})
}
var maximizedTopAnchorConstraint: NSLayoutConstraint!
var minimizedTopAnchorConstraint: NSLayoutConstraint!
var bottomAnchorConstraint: NSLayoutConstraint!
fileprivate func setupPlayerDetailsView() {
view.insertSubview(playerDetailsView, belowSubview: tabBar)
// use autolayout
playerDetailsView.translatesAutoresizingMaskIntoConstraints = false
// autolayout constraint
maximizedTopAnchorConstraint = playerDetailsView.topAnchor.constraint(equalTo: view.topAnchor, constant: view.frame.height)
maximizedTopAnchorConstraint.isActive = true
bottomAnchorConstraint = playerDetailsView.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: view.frame.height)
bottomAnchorConstraint.isActive = true
minimizedTopAnchorConstraint = playerDetailsView.topAnchor.constraint(equalTo: tabBar.topAnchor, constant: -64)
playerDetailsView.topAnchor.constraint(equalTo: tabBar.topAnchor, constant: -64).isActive = true
playerDetailsView.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true
playerDetailsView.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true
}
//MARK:- Setup all view controllers
func setupViewControllers() {
viewControllers = [
generateNavigationController(with: PodcastsSearchController(), title: "Search", imageName: "Search"),
generateNavigationController(with: ViewController(), title: "Favorites", imageName: "Style"),
generateNavigationController(with: ViewController(), title: "Downloads", imageName: "Album")
]
}
//MARK:- Helper functions to generate view controllers
fileprivate func generateNavigationController(with rootViewController: UIViewController, title: String, imageName: String) -> UIViewController {
let vc = UINavigationController(rootViewController: rootViewController
)
vc.tabBarItem.title = title
vc.navigationBar.topItem?.title = title
vc.tabBarItem.image = UIImage(named: imageName)
return vc
}
}
| [
-1
] |
1420bc48a3def0a76ed190f3868be69a0762dc57 | e2d48a6a5ced1b5e38ec649ad36bacf8d382d450 | /BLShopping/BLShopping/ViewControllers/LoginSignupVC/LoginSignupVC.swift | 5cc0cfde1808018066030686b1b617b4ae6a39fd | [] | no_license | baolanlequang/blshopping-ios | b2ca4696c010cc327923500c0dadc5970b23069b | eae5832b54cba6caa941dd769d572c39f214a351 | refs/heads/master | 2022-02-21T11:47:39.088432 | 2019-09-26T10:54:33 | 2019-09-26T10:54:33 | 204,253,987 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 9,940 | swift | //
// LoginSignupVC.swift
// BLShopping
//
// Created by Bao Lan Le Quang on 8/31/19.
// Copyright © 2019 BLShopping. All rights reserved.
//
import UIKit
import MXSegmentedPager
import FBSDKCoreKit
import FBSDKLoginKit
import MBProgressHUD
import SwiftyJSON
protocol LoginSignupVCDelegate {
func onBackClick();
func onLoginSucceed();
}
class LoginSignupVC: MXSegmentedPagerController, LoginSignupHeaderViewDelegate, LoginViewDelegate, SignUpViewDelegate, GIDSignInUIDelegate {
var headerView: LoginSignupHeaderView?;
var delegate: LoginSignupVCDelegate?;
var loginView: LoginView?;
var signupView: SignUpView?;
var isShowSignUp = false;
override func viewDidLoad() {
super.viewDidLoad()
self.navigationController?.isNavigationBarHidden = true;
self.headerView = Bundle.main.loadNibNamed("LoginSignupHeaderView", owner: self, options: nil)?.first as? LoginSignupHeaderView;
self.headerView?.delegate = self;
self.segmentedPager.backgroundColor = .white
// Parallax Header
self.segmentedPager.parallaxHeader.view = headerView
self.segmentedPager.parallaxHeader.mode = .topFill
self.segmentedPager.parallaxHeader.height = 150
self.segmentedPager.parallaxHeader.minimumHeight = 0
// Segmented Control customization
self.segmentedPager.segmentedControl.selectionIndicatorLocation = .down
self.segmentedPager.segmentedControl.backgroundColor = UIColor.init(hexString: "f9f9f9");
self.segmentedPager.segmentedControl.titleTextAttributes = [NSAttributedString.Key.foregroundColor : UIColor.init(hexString: "727272") ?? UIColor.black, NSAttributedString.Key.font: UIFont.systemFont(ofSize: 14.0)];
self.segmentedPager.segmentedControl.selectedTitleTextAttributes = [NSAttributedString.Key.foregroundColor : UIColor.black]
self.segmentedPager.segmentedControl.selectionStyle = .fullWidthStripe
self.segmentedPager.segmentedControl.selectionIndicatorColor = UIColor.init(hexString: "fdd835");
self.segmentedPager.segmentedControl.borderType = .bottom;
self.segmentedPager.segmentedControl.borderColor = UIColor.gray;
self.segmentedPager.segmentedControl.borderWidth = 0.5;
self.loginView = Bundle.main.loadNibNamed("LoginView", owner: self, options: nil)?.first as? LoginView;
self.loginView?.delegate = self;
self.signupView = Bundle.main.loadNibNamed("SignUpView", owner: self, options: nil)?.first as? SignUpView;
self.signupView?.delegate = self;
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated);
if (self.isShowSignUp == true) {
self.segmentedPager.pager.showPage(at: 1, animated: true);
}
else {
self.segmentedPager.pager.showPage(at: 0, animated: true);
}
}
override func numberOfPages(in segmentedPager: MXSegmentedPager) -> Int {
return 2;
}
override func segmentedPager(_ segmentedPager: MXSegmentedPager, titleForSectionAt index: Int) -> String {
return ["Đăng nhập", "Đăng ký"][index];
}
override func segmentedPager(_ segmentedPager: MXSegmentedPager, viewForPageAt index: Int) -> UIView {
if (index == 0) {
return self.loginView!;
}
else {
return self.signupView!;
}
}
// MARK: - LoginSignupHeaderViewDelegate
func onClickBack() {
self.delegate?.onBackClick();
self.dismiss(animated: true) {
}
}
// MAKR: - GIDSignInUIDelegate
func sign(inWillDispatch signIn: GIDSignIn!, error: Error!) {
}
func sign(_ signIn: GIDSignIn!, present viewController: UIViewController!) {
self.navigationController?.present(viewController, animated: true, completion: nil);
}
func sign(_ signIn: GIDSignIn!, dismiss viewController: UIViewController!) {
viewController.dismiss(animated: true, completion: nil);
}
// MARK: - LoginViewDelegate
func didBtnLoginFacebookClicked() {
if (FBSDKAccessToken.current() != nil) {
self.getUserInfoFacebook();
}
else {
let loginManager = FBSDKLoginManager();
loginManager.logIn(withReadPermissions: ["public_profile", "email"], from: self) { (result, error) in
if (error != nil) {
}
else if (result?.isCancelled)! {
}
else {
self.getUserInfoFacebook();
}
}
}
}
func didBtnLoginGoogleClicked() {
GIDSignIn.sharedInstance().uiDelegate = self;
GIDSignIn.sharedInstance().signIn();
}
func didBtnLoginClicked(email: String, password: String) {
self.login(email: email, password: password);
}
// MARK: - SignUpViewDelegate
func didBtnRegisterClicked(fullName: String, email: String, password: String) {
self.signup(fullName: fullName, email: email, password: password);
}
// MARK: - CALL APIs
func getUserInfoFacebook() -> Void {
if (FBSDKAccessToken.current() != nil) {
print("token: \(FBSDKAccessToken.current().tokenString)");
let hub = MBProgressHUD.showAdded(to: self.view, animated: true);
let parameters = ["fields":"id, name, email, picture, birthday"];
FBSDKGraphRequest.init(graphPath: "me", parameters: parameters).start(completionHandler: { (connection, result, error) in
if (error != nil) {
hub.hide(animated: true)
print("FBSDKGraphRequest error: \(String(describing: error))");
}
else {
print("FBSDKGraphRequest result \(String(describing: result))");
let json = JSON.init(result ?? [:]);
let facebookID = json["id"].stringValue;
hub.hide(animated: true)
}
})
}
}
func login(email: String, password: String) {
let hud = MBProgressHUD.showAdded(to: self.view, animated: true);
requestLogin(email: email, password: password) { (operation, responseObject, error) in
hud.hide(animated: true)
if (error == nil) {
let json = JSON(responseObject ?? [:])
let status = json["status"]
if (status["code"].intValue == 1) {
let data = json["data"]
let userDTO = UserDTO(jsonData: data)
BLGlobal.shared.userDTO = userDTO;
BLGlobal.shared.saveUser();
self.delegate?.onLoginSucceed();
self.dismiss(animated: true, completion: nil);
}
else {
showAlert(title: "", message: status["msg"].stringValue, viewController: self)
}
}
else {
showAlert(title: "", message: (error?.localizedDescription)!, viewController: self)
}
}
}
func signup(fullName: String, email: String, password: String) {
let hud = MBProgressHUD.showAdded(to: self.view, animated: true);
requestSignup(fullName: fullName, email: email, password: password) { (operation, responseObject, error) in
hud.hide(animated: true)
if (error == nil) {
let json = JSON(responseObject ?? [:])
let status = json["status"]
if (status["code"].intValue == 1) {
let data = json["data"]
let userDTO = UserDTO(jsonData: data)
BLGlobal.shared.userDTO = userDTO;
BLGlobal.shared.saveUser();
self.delegate?.onLoginSucceed();
self.dismiss(animated: true, completion: nil);
}
else {
showAlert(title: "", message: status["msg"].stringValue, viewController: self)
}
}
else {
showAlert(title: "", message: (error?.localizedDescription)!, viewController: self)
}
}
}
func loginByFacebook(facebookID: String, fullName: String, email: String, avatar: String) {
let hud = MBProgressHUD.showAdded(to: self.view, animated: true);
requestLoginByFacebook(facebookID: facebookID, fullName: fullName, email: email, avatar: avatar) { (operation, responseObject, error) in
hud.hide(animated: true)
if (error == nil) {
let json = JSON(responseObject ?? [:])
let status = json["status"]
if (status["code"].intValue == 1) {
let data = json["data"]
let userDTO = UserDTO(jsonData: data)
BLGlobal.shared.userDTO = userDTO;
BLGlobal.shared.saveUser();
self.delegate?.onLoginSucceed();
self.dismiss(animated: true, completion: nil);
}
else {
showAlert(title: "", message: status["msg"].stringValue, viewController: self)
}
}
else {
showAlert(title: "", message: (error?.localizedDescription)!, viewController: self)
}
}
}
}
| [
-1
] |
0f54dafdf322261757feb89eafe9b8bbbbde7ff6 | b3ea8dc29b7f00035f0768acf31b54d88773d925 | /Limonadier/Limonadier/Scenes/MainScene/MainViewController.swift | c5118142cfb32dd6ffdd5d08ab17dfdd35486bef | [] | no_license | cdann/Limonadier | 02ba264d054f227920dacbf74d38a69e084634a7 | 870f4f79516a35c63c6f381f796eabc153ed1fff | refs/heads/master | 2020-09-27T15:02:55.645006 | 2020-02-15T14:41:45 | 2020-02-15T14:41:45 | 226,542,090 | 0 | 0 | null | 2019-12-07T16:29:24 | 2019-12-07T16:22:37 | null | UTF-8 | Swift | false | false | 2,755 | swift | //
// MainViewController.swift
// RxSample
//
// Created by celine dann on 27/11/2019.
// Copyright (c) 2019 mstv. All rights reserved.
//
//
import Foundation
import UIKit
import RxSwift
import RxCocoa
import Domain
protocol MainScene: class {
func alert(_ errorMessage: String, subtitle: String?)
}
protocol MainViewIntents: class {
func display(viewModel: MainViewModel)
}
class MainViewController: UIViewController {
var presenter: MainViewPresenter!
@IBOutlet weak var playlistContainer: UIView!
@IBOutlet weak var trackSenderContainer: UIView!
var playlistController: PlaylistController?
var trackSenderController: TrackSenderViewController?
override init(nibName nibNameOrNil: String? = "MainViewController", bundle nibBundleOrNil: Bundle? = nil) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
// MARK: - View LifeCycle
deinit {
print("Deinit \(self)")
}
override func viewDidLoad() {
super.viewDidLoad()
presenter.attach()
self.attachChildrenView()
}
public func attachChildrenView() {
if let playlistController = playlistController {
self.addChild(playlistController, in: self.playlistContainer)
}
if let trackSenderController = trackSenderController {
self.addChild(trackSenderController, in: self.trackSenderContainer)
}
}
private func addChild(_ childController: UIViewController, in containerView: UIView) {
self.addChild(childController)
guard let view = childController.view else { return }
containerView.addSubview(view)
view.translatesAutoresizingMaskIntoConstraints = false
view.topAnchor.constraint(equalTo: containerView.topAnchor).isActive = true
view.leftAnchor.constraint(equalTo: containerView.leftAnchor).isActive = true
view.bottomAnchor.constraint(equalTo: containerView.bottomAnchor).isActive = true
view.rightAnchor.constraint(equalTo: containerView.rightAnchor).isActive = true
}
}
extension MainViewController: MainScene {
func alert(_ errorMessage: String, subtitle: String? = nil) {
let alertCtrl = UIAlertController(title: errorMessage, message: subtitle, preferredStyle: .alert)
alertCtrl.addAction(UIAlertAction(title: "ok", style: .default, handler: { (action) in
print("ok")
}))
self.present(alertCtrl, animated: false, completion: nil)
}
}
extension MainViewController: MainViewIntents {
// MARK: - Display
func display(viewModel: MainViewModel) {
}
}
| [
-1
] |
22cc419568e1b1282a58e3d17c955685b386aef9 | 766de7822f1073e14817c1315160039c53597fed | /properties.playground/section-1.swift | b01d551c4884bd5cd6544767ed2faa14e45833b1 | [] | no_license | kukulski/swiftPlayground | 073ed494cb4c5aef2970fbfdeb087827e7c23c20 | 7146f68abcd7a339a3cb487d073ee3ebe7f74e4c | refs/heads/master | 2021-01-23T03:21:31.408460 | 2014-06-04T15:41:56 | 2014-06-04T15:41:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,289 | swift | // Playground - noun: a place where people can play
import Cocoa
struct Consty {
let val: Int
init(_ v:Int) { val = v}
init(val:Int) { self.val = val}
}
let thing = Consty(val: 3)
//thing.val = 4
thing.val
let another = Consty(4)
struct Vary {
var val: Int
}
var vary = Vary(val:3)
vary.val = 4
let nowConsty = Vary(val: 3)
//nowConsty.val = 4
operator infix ^|^ {associativity left precedence 140}
operator postfix %/ {}
struct Point {
static let SWRT2 = sqrt(2)
var x:Double, y:Double
var len:Double { return sqrt(x*x+y*y)}
var normalized:Point { return Point(x/len, y/len)}
init(_ x:Double, _ y:Double) { self.x = x; self.y = y}
init( x:Double, y:Double) { self.init(x,y)}
init (theta:Double, r:Double) {
self.init(r*cos(theta), r*sin(theta))
}
}
@postfix func %/ (vector: Point) -> Point {
return Point(x: -vector.x, y: -vector.y)
}
//^4
//3^
func ^ (left:Double, right:Double) -> Double {
return pow(left,right)
}
3^4
3.0 ^ 0.5
2.0^3
func ^|^ (left:Point, right:Point) -> Point {
return Point(left.x, right.y)
}
let foo = Point(theta:3.14, r:1)
foo
let hypPoint = Point(x:4,y:3)
hypPoint.len
hypPoint.normalized
hypPoint%/
foo ^|^ hypPoint
| [
-1
] |
d993061d29a9867dab4fc458ba5a33f3c15931a4 | bf40b2b219fd02c1ef2a4fd48d3dd56322887989 | /TaskHero/TaskHero/UI/Shared/Extensions/Date+Extension.swift | bb6993ae3eac0c81e71db9508f5efc0ccef7386a | [] | no_license | gwenth/taskhero | 168fe6ef769eb13e6607a0d85ffe6a604c7f6d94 | fe1cda0484fcfd3e32fa3d257f0545d7242ea2e0 | refs/heads/master | 2020-04-06T04:26:11.335640 | 2017-02-23T11:09:21 | 2017-02-23T11:09:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 940 | swift | import Foundation
extension Date {
func dateStringFormatted() -> String {
let today = Date()
let dateFormat = DateFormatter()
dateFormat.dateFormat = "MM-yyyy"
let dateInFormat = dateFormat.string(from: today as Date)
return dateInFormat
}
func getYears() -> [String] {
let dateFormat = DateFormatter()
dateFormat.dateFormat = "yyyy"
var years = [String]()
var now = Date()
let currentYear = dateFormat.string(from: now as Date)
years.append(currentYear)
let oneYear = TimeInterval(60 * 60 * 24 * 365)
for _ in 1...3 {
now = now + oneYear
let dateInFormat = dateFormat.string(from: now as Date)
years.append(dateInFormat)
}
print(years)
return years
}
func getCalendarDates() -> Calendar {
return Calendar.current
}
}
| [
-1
] |
fbaa2ac30b1d459cedc7ebe430a9470d5218de6e | 1edf1725d8d780aa3b00e335ef7e9351bc2aab8e | /fetchExercise/fetchExerciseTests/fetchExerciseTests.swift | f9a0dceb64d7435ea604645e4c2af35fc24d6816 | [] | no_license | SignificantOtter630/fetchExercise | 7c7bdee475ce010e8ee0bd11727ca26c05a857b2 | bfdcf6c4c7ec95d97cebbd844842eda2bd76dc21 | refs/heads/main | 2023-04-15T11:54:29.877104 | 2021-05-03T01:25:00 | 2021-05-03T01:25:00 | 363,541,174 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 913 | swift | //
// fetchExerciseTests.swift
// fetchExerciseTests
//
// Created by Louis Sun on 5/1/21.
//
import XCTest
@testable import fetchExercise
class fetchExerciseTests: 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,
282633,
358410,
354316,
313357,
360462,
182296,
241692,
98333,
16419,
223268,
102437,
229413,
292902,
204840,
354345,
223274,
344107,
278570,
233517,
176175,
253999,
124975,
346162,
229430,
319542,
124984,
358456,
352315,
288833,
352326,
311372,
354385,
196691,
315476,
280661,
329814,
278615,
338007,
307289,
200794,
354393,
356447,
254048,
309345,
280675,
280677,
313447,
278634,
315498,
319598,
288879,
352368,
299121,
284788,
233589,
280694,
333940,
237689,
215164,
313469,
215166,
278655,
292992,
333955,
280712,
215178,
241808,
323729,
325776,
317587,
278677,
284826,
278685,
346271,
311458,
278691,
49316,
233636,
258214,
333991,
333992,
362659,
284842,
32941,
278704,
239793,
278708,
125109,
131256,
182456,
184505,
299198,
379071,
299203,
301251,
309444,
338119,
346314,
282831,
321745,
254170,
356576,
338150,
176362,
286958,
125169,
338164,
336120,
327929,
356602,
184570,
243962,
125183,
309503,
125188,
313608,
125193,
375051,
180493,
125198,
325905,
254226,
125203,
272660,
368916,
125208,
325912,
299293,
151839,
278816,
125217,
233762,
211235,
217380,
305440,
151847,
282919,
338218,
254251,
125235,
332085,
280887,
125240,
332089,
278842,
282939,
315706,
287041,
241986,
260418,
332101,
182598,
348492,
323916,
319821,
383311,
254286,
344401,
250192,
6481,
348500,
323920,
366929,
155990,
366930,
272729,
6489,
379225,
106847,
323935,
391520,
321894,
280939,
242029,
246127,
354676,
354677,
139640,
246136,
106874,
246137,
291192,
362881,
248194,
340357,
225670,
395659,
395661,
227725,
240016,
291224,
39324,
317852,
283038,
61857,
285090,
61859,
289189,
375207,
340398,
377264,
61873,
342450,
61880,
283064,
278970,
319930,
336317,
293310,
342466,
278978,
127427,
127428,
254406,
188871,
283075,
324039,
317901,
281040,
278993,
326100,
278999,
328152,
176601,
242139,
369116,
285150,
287198,
279008,
342498,
242148,
195045,
279013,
334309,
279018,
281072,
279029,
254456,
279032,
233978,
279039,
342536,
287241,
340490,
348682,
279050,
254488,
289304,
279065,
342553,
291358,
207393,
182817,
375333,
377386,
358954,
197167,
283184,
23092,
315960,
348732,
352829,
301638,
348742,
322120,
55881,
348749,
281166,
244310,
354911,
436832,
139872,
66150,
111208,
344680,
191082,
313966,
281199,
346737,
346740,
139892,
344696,
279164,
356989,
189057,
152195,
311941,
348806,
369289,
279177,
330379,
344715,
184973,
311949,
330387,
330388,
352917,
227990,
230040,
271000,
342682,
346779,
344738,
139939,
279206,
295590,
287404,
336558,
303793,
299699,
299700,
164533,
338613,
314040,
287417,
158394,
342713,
285373,
66242,
363211,
164560,
279252,
361176,
318173,
363230,
289502,
295652,
338662,
422631,
285415,
346858,
289518,
199414,
154359,
348920,
344827,
344828,
35583,
363263,
205568,
162561,
299776,
285444,
322319,
166676,
207640,
326429,
336671,
344865,
326433,
279336,
318250,
189228,
295724,
152365,
312108,
318252,
353069,
355121,
328499,
242485,
353078,
230199,
353079,
355130,
336702,
355137,
355139,
252741,
420677,
353094,
353095,
299849,
355146,
283467,
293711,
355152,
281427,
353109,
377686,
281433,
230234,
189275,
355165,
127841,
357218,
293730,
303972,
351077,
275303,
342887,
355178,
242541,
207729,
246641,
330609,
246648,
361337,
209785,
269178,
177019,
279417,
254850,
359298,
260996,
359299,
240518,
287622,
228233,
228234,
308107,
349067,
56208,
295824,
308112,
209817,
324506,
324507,
318364,
189348,
324517,
289703,
353195,
140204,
353197,
363438,
347055,
373687,
353216,
349121,
363458,
359364,
213960,
279498,
211914,
316364,
338899,
359381,
359387,
340955,
248797,
207838,
347103,
50143,
130016,
340961,
343005,
64485,
314342,
123881,
324586,
359406,
289774,
304110,
320494,
340974,
347123,
316405,
240630,
349175,
201720,
295927,
304122,
314362,
320507,
328700,
328706,
320516,
230410,
254987,
320527,
146448,
324625,
316437,
418837,
197657,
281626,
201755,
252958,
336929,
300068,
357414,
248872,
345132,
238639,
252980,
300084,
359478,
322612,
324666,
238651,
302139,
132158,
361535,
336960,
21569,
257094,
359495,
238664,
361543,
250954,
250956,
300111,
314448,
341073,
353367,
156764,
156765,
361566,
314467,
281700,
250981,
253029,
322663,
300136,
316520,
228458,
207979,
357486,
316526,
351344,
187506,
353397,
160891,
341115,
363644,
248961,
150657,
187521,
349316,
279685,
349318,
222343,
228491,
228493,
285838,
337039,
169104,
162961,
177296,
347283,
308372,
326804,
296086,
119962,
300187,
296092,
300188,
351390,
339102,
302240,
343203,
300201,
300202,
253099,
253100,
238765,
279728,
367799,
339130,
113850,
64700,
343234,
367810,
259268,
283847,
353479,
62665,
353481,
353482,
244940,
283852,
283853,
290000,
228563,
351446,
296153,
357595,
279774,
359647,
298212,
304356,
330984,
228588,
234733,
253167,
279792,
353523,
298228,
351478,
216315,
208124,
316669,
363771,
388349,
128251,
228609,
351490,
261377,
279814,
322824,
369930,
242954,
292107,
312587,
328971,
353551,
251153,
349462,
257305,
245019,
320796,
126237,
130338,
130343,
130348,
66862,
353584,
351537,
345396,
300343,
116026,
222524,
286018,
193859,
279875,
337225,
230729,
224586,
372043,
177484,
251213,
238927,
353616,
296273,
337227,
120148,
318805,
283991,
159066,
222559,
314720,
292195,
230756,
294243,
333160,
230765,
243056,
279920,
312689,
314739,
116084,
327025,
327031,
382330,
357759,
306559,
337281,
357762,
378244,
298374,
314758,
314760,
388487,
368011,
314766,
296335,
112017,
112018,
234898,
306579,
282007,
357786,
290207,
314783,
251298,
333220,
314789,
279974,
208293,
282024,
241066,
316842,
286129,
173491,
210358,
284089,
228795,
292283,
302529,
302531,
163268,
380357,
415171,
300487,
361927,
300489,
370123,
148940,
280013,
310732,
64975,
312782,
327121,
222675,
366037,
210390,
210391,
353750,
210393,
228827,
286172,
310757,
187878,
280041,
361963,
54765,
191981,
321009,
251378,
343542,
280055,
300536,
288249,
343543,
359930,
286205,
290301,
210433,
282114,
366083,
228867,
323080,
230921,
253452,
323087,
304656,
329232,
316946,
146964,
398869,
308764,
423453,
349726,
134686,
282146,
306723,
355876,
245287,
245292,
349741,
169518,
347694,
230959,
286254,
288309,
290358,
235070,
425535,
288318,
349763,
124485,
56902,
288326,
288327,
292425,
243274,
128587,
333388,
333393,
349781,
290390,
235095,
300630,
196187,
343647,
374372,
282213,
323178,
54893,
138863,
222832,
314998,
247416,
370296,
366203,
175741,
337534,
337535,
339585,
294529,
224901,
282245,
282246,
288392,
229001,
310923,
188048,
323217,
239250,
282259,
345752,
229020,
255649,
245412,
40613,
40614,
40615,
229029,
282280,
298661,
323236,
321207,
296632,
319162,
370363,
280251,
224958,
282303,
286399,
218819,
321219,
306890,
280267,
212685,
333517,
333520,
241361,
245457,
302802,
333521,
333523,
280278,
280280,
298712,
18138,
278234,
294622,
321247,
278240,
12010,
212716,
212717,
280300,
282348,
284401,
360177,
282358,
313081,
286459,
325371,
124669,
194303,
278272,
175873,
319233,
339715,
323331,
323332,
339720,
280329,
284429,
278291,
294678,
321302,
366360,
116505,
249626,
284442,
325404,
169754,
321310,
282400,
339745,
241441,
325410,
341796,
257830,
247590,
362283,
317232,
282417,
339762,
321337,
259899,
282427,
360252,
325439,
315202,
307011,
339783,
345929,
341836,
337745,
325457,
18262,
341847,
370522,
188251,
350044,
345951,
362337,
284514,
345955,
296806,
292712,
288619,
325484,
362352,
292720,
313203,
325492,
341879,
241528,
194429,
124798,
325503,
182144,
305026,
253829,
333701,
67463,
243591,
243597,
325518,
350093,
282518,
282519,
124824,
214937,
329622,
118685,
298909,
350109,
319392,
292771,
354212,
294823,
333735,
284587,
362417,
124852,
243637,
288697,
362431,
214977,
163781,
247757,
212942,
344013,
212946,
212951,
219101,
280541,
354269,
354272,
354274,
292836,
298980,
294886,
337895,
354280,
253929,
247785,
174057,
327661,
362480,
325619,
333817,
313339
] |
bf95f5e61767355d63074d73d6d43bd6d82667b6 | ed306dbc9f5d50d8f4506dd5407da6cec50c488b | /swift Guy/Gyroscope/Gyroscope/ViewController.swift | 9be85519efb554cef91e6b6d3f2337a87a2a45ac | [] | no_license | Johnnyhaha/SwiftBeginnerTutorialProject | b8e411ffec7a9b329db18789b41682cfb175ffd5 | 279e7c971a4624b81a0f072a2b77016dae8cddd6 | refs/heads/master | 2021-05-07T17:27:56.561406 | 2017-10-31T05:01:22 | 2017-10-31T05:01:22 | 108,735,032 | 4 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 1,031 | swift | //
// ViewController.swift
// Gyroscope
//
// Created by Johnny_L on 2017/8/28.
// Copyright © 2017年 Johnny_L. All rights reserved.
//
import UIKit
import CoreMotion
class ViewController: UIViewController {
var motionManager = CMMotionManager()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func viewDidAppear(_ animated: Bool)
{
motionManager.gyroUpdateInterval = 0.2
motionManager.startGyroUpdates(to: OperationQueue.current!) { (data, error) in
if let myData = data
{
if myData.rotationRate.x > 2
{
print("YOUR TILTED YOUR DEVICE")
}
// print(myData.rotationRate)
}
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
| [
-1
] |
e21ad4dde4c88d0786f14cff6d097612af46020f | ab6089d05ab47e9f64813c5571e814fd182bf9b2 | /InstaCopy/InstaCopy/Model/User.swift | 9df8a82214921c0bd625c5e9b854d446b44d6165 | [] | no_license | chuiizeet/Instagram-clone-IOS | 857c0116b3dd3bcff7c8fabec15b7efa2581c72b | a66efee39a0a5059a60d0cdaa78a8040db1f803e | refs/heads/master | 2020-05-30T08:52:49.059896 | 2019-07-01T02:04:33 | 2019-07-01T02:04:33 | 189,628,334 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,326 | swift | //
// User.swift
// InstaCopy
//
// Created by imac on 6/24/19.
// Copyright © 2019 JeguLabs. All rights reserved.
//
import Firebase
class User {
// Attributes
var username: String!
var name: String!
var profileImageUrl: String!
var uid: String!
var isFollowed = false
init(uid: String, dictionary: Dictionary<String, AnyObject>) {
self.uid = uid
if let username = dictionary["username"] as? String {
self.username = username
}
if let name = dictionary["name"] as? String {
self.name = name
}
if let profileImageUrl = dictionary["profileImageUrl"] as? String {
self.profileImageUrl = profileImageUrl
}
}
func follow() {
guard let currentUid = Auth.auth().currentUser?.uid else { return }
// UPDATE: - get uid like this to work with update
guard let uid = uid else { return }
// set is followed to true
self.isFollowed = true
// add followed user to current user-following structure
USER_FOLLOWING_REF.child(currentUid).updateChildValues([uid: 1])
// add current user to followed user-follower structure
USER_FOLLOWER_REF.child(uid).updateChildValues([currentUid: 1])
}
func unfollow() {
guard let currentUid = Auth.auth().currentUser?.uid else { return }
// UPDATE: - get uid like this to work with update
guard let uid = uid else { return }
self.isFollowed = false
USER_FOLLOWING_REF.child(currentUid).child(uid).removeValue()
USER_FOLLOWER_REF.child(uid).child(currentUid).removeValue()
}
func checkIfUserIsFollowed(completion: @escaping(Bool) ->()) {
guard let currentUid = Auth.auth().currentUser?.uid else { return }
USER_FOLLOWING_REF.child(currentUid).observeSingleEvent(of: .value) { (snapshot) in
if snapshot.hasChild(self.uid) {
self.isFollowed = true
completion(true)
} else {
self.isFollowed = false
completion(false)
}
}
}
}
| [
-1
] |
5d0350cee4f367328e06e1d6c12d980c38effe44 | 41e32b3257c08ccf7584cb4063e40476637b5e76 | /MVVMDemo/Api/MoviesWebService.swift | cff221660c956fe224b9067397639f87b1341e64 | [] | no_license | Sob7y/Mvvm-demo | b0e96b92c643905580fd154894c0c3942f0f1d23 | 7baf77e4ee52178c3db24efe180124109ff6515d | refs/heads/master | 2021-01-14T02:17:40.980904 | 2020-02-23T18:29:26 | 2020-02-23T18:29:26 | 242,568,464 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,106 | swift | //
// MoviesWebService.swift
// MVVMDemo
//
// Created by Mohammed Khaled on 02/22/20.
// Copyright © 2020 Mohammed Khaled. All rights reserved.
//
import Foundation
import ObjectMapper
protocol MoviesWebServiceProtocol: class {
func getMoviesList(page: Int, compeltion: @escaping ((Result<MoviesResponseModel, ErrorResult>) -> Void))
}
class MoviesWebService: MoviesWebServiceProtocol {
static let shared = MoviesWebService()
func getMoviesList(page: Int, compeltion: @escaping ((Result<MoviesResponseModel, ErrorResult>) -> Void)) {
MainWebService.fetch(endPoint: RouteMoviesApi.getLatestMovies(page: page)) { (result) in
switch result {
case .success(let response):
guard let moviesResponse = Mapper<MoviesResponseModel>().map(JSONObject: response) else {
return
}
compeltion(Result.success(moviesResponse))
case .failure(let error):
compeltion(Result.failure(ErrorResult.network(string: error.localizedDescription)))
}
}
}
}
| [
-1
] |
bd69d14eca0606f2bafce79da522b774661f51be | f9649a4efd842815290fcc98e90ac94ebe7acbe3 | /MorseTorch/MorseTorch/ViewController.swift | 35c0b2b55b58b62be51ab7f37703582201718491 | [] | no_license | michaeljspagna/MorseTorch | 9b369de87ce00ca4bdb302bbd568b308bbfcac5c | d624bceec24768364fffe3c163944a8b7418283f | refs/heads/main | 2022-12-25T13:26:31.698525 | 2020-10-06T01:44:59 | 2020-10-06T01:44:59 | 301,585,053 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,609 | swift | //
// ViewController.swift
// MorseTorch
//
// Created by Michael Spagna on 10/5/20.
//
import UIKit
class ViewController: UIViewController, UITextFieldDelegate, UITextViewDelegate {
//MARK: Properties
@IBOutlet weak var inputTextField: UITextField!
@IBOutlet weak var morseTextView: UITextView!
let morseCode = MorseCode()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
self.setUpMoresTextView()
self.setUPInoutTextField()
}
@IBAction func convertBrn(_ sender: UIButton) {
let inputText = self.inputTextField.text ?? ""
let morseArray = morseCode.stringToMorseArray(inputMsg: inputText)
let morseString = morseCode.morseArrayToMorseString(morseArray: morseArray)
self.morseTextView.text = morseString
}
@IBAction func sosBtn(_ sender: UIButton) {
let sosArray = self.morseCode.SOS
let sosString = self.morseCode.morseArrayToMorseString(morseArray: sosArray)
self.morseCode.flashMorseString(morseString: sosString)
}
@IBAction func flashBtn(_ sender: UIButton) {
let morseString = self.morseTextView.text ?? ""
self.morseCode.flashMorseString(morseString: morseString)
}
func setUpMoresTextView() -> Void{
self.morseTextView.delegate = self
self.morseTextView.isEditable = false
self.morseTextView.backgroundColor = UIColor.white
}
func setUPInoutTextField() -> Void{
self.inputTextField.delegate = self
}
}
| [
-1
] |
c900a96438e04d7548c45cd1adfd7d0c59ea738a | 60608407aeeed39734c31f55df2db7164a89293d | /MinCloud/FileManager.swift | efad872c441d6685aa41f271be83e62548108792 | [
"MIT"
] | permissive | ifanrx/hydrogen-ios-sdk | 2cac5cf5c6a3a2c4d7871c2791b7fa7184536135 | b3af7f80d2f8a7e9743f81bf22266ba150ab8e47 | refs/heads/master | 2021-06-21T13:15:56.993332 | 2021-01-11T02:21:34 | 2021-01-11T02:21:34 | 178,309,362 | 2 | 3 | MIT | 2021-01-11T02:21:35 | 2019-03-29T01:27:53 | Swift | UTF-8 | Swift | false | false | 17,240 | swift | //
// FileTable.swift
// BaaSSDK
//
// Created by pengquanhua on 2019/3/28.
// Copyright © 2019 ifanr. All rights reserved.
//
import Foundation
import Moya
/// 知晓云文件管理类
/// 通过 FileManager 来操作知晓云上的文件。
@objc(BaaSFileManager)
open class FileManager: NSObject {
static var FileProvider = MoyaProvider<FileAPI>(plugins: logPlugin)
@objc public var callBackQueue: DispatchQueue = .main
// MARK: File
/// 获取文件详情
///
/// - Parameters:
/// - fileId: 文件 Id
/// - select: 筛选条件,只返回指定的字段。可选
/// - expand: 扩展条件。可选
/// - completion: 结果回调
/// - Returns:
@discardableResult
@objc public func get(_ fileId: String, completion:@escaping FileResultCompletion) -> RequestCanceller? {
let request = FileManager.FileProvider.request(.getFile(fileId: fileId), callbackQueue: callBackQueue) { result in
ResultHandler.parse(result, handler: { (file: File?, error: NSError?) in
completion(file, error)
})
}
return RequestCanceller(cancellable: request)
}
/// 查询文件列表
/// - Parameter:
/// - query: 查询条件,满足条件的文件将被返回。可选
/// - completion: 结果回调
/// - Returns:
@discardableResult
@objc public func find(query: Query? = nil, completion:@escaping FileListResultCompletion) -> RequestCanceller? {
let queryArgs: [String: Any] = query?.queryArgs ?? [:]
let request = FileManager.FileProvider.request(.findFiles(parameters: queryArgs), callbackQueue: callBackQueue) { result in
ResultHandler.parse(result, handler: { (listResult: FileList?, error: NSError?) in
completion(listResult, error)
})
}
return RequestCanceller(cancellable: request)
}
/// 删除多个文件
///
/// - Parameters:
/// - fileIds: 文件 Id 数组
/// - completion: 结果回调
/// - Returns:
@discardableResult
@objc public func delete(_ fileIds: [String], completion:@escaping BOOLResultCompletion) -> RequestCanceller? {
let request = FileManager.FileProvider.request(.deleteFiles(parameters: ["id__in": fileIds]), callbackQueue: callBackQueue) { result in
ResultHandler.parse(result, handler: { (_: Bool?, error: NSError?) in
if error != nil {
completion(false, error)
} else {
completion(true, nil)
}
})
}
return RequestCanceller(cancellable: request)
}
/// 上传文件
///
/// - Parameters:
/// - filename: 文件名称
/// - localPath: 文件本地路径
/// - categoryName: 文件分类名称
/// - progressBlock: progressBlock
/// - completion: 结果回调
/// - Returns:
@discardableResult
@objc public func upload(filename: String, localPath: String, categoryName: String? = nil, progressBlock: @escaping ProgressBlock, completion:@escaping FileResultCompletion) -> RequestCanceller? {
guard let fileSize = getFileSize(for: localPath) else {
callBackQueue.async {
completion(nil, HError.init(code: 400, description: "fileSize is 0!") as NSError)
}
return nil
}
let url = URL(fileURLWithPath: localPath)
let formData = MultipartFormData(provider: .file(url), name: "file")
return upload(filename: filename, fileFormData: formData, fileSize: fileSize, categoryName: categoryName, categoryId: nil, progressBlock: progressBlock, completion: completion)
}
/// 上传文件
///
/// - Parameters:
/// - filename: 文件名称
/// - localPath: 文件本地路径
/// - mimeType: 文件类型
/// - categoryName: 文件分类名称
/// - categoryId: 文件分类 Id
/// - progressBlock: progressBlock
/// - completion: 结果回调
/// - Returns:
@discardableResult
@objc public func upload(filename: String, localPath: String, mimeType: String? = nil, categoryName: String? = nil, categoryId: String? = nil, progressBlock: @escaping ProgressBlock, completion:@escaping FileResultCompletion) -> RequestCanceller? {
guard let fileSize = getFileSize(for: localPath) else {
callBackQueue.async {
completion(nil, HError.init(code: 400, description: "fileSize is 0!") as NSError)
}
return nil
}
let url = URL(fileURLWithPath: localPath)
let formData = MultipartFormData(provider: .file(url), name: "file", mimeType: mimeType)
return upload(filename: filename, fileFormData: formData, fileSize: fileSize, categoryName: categoryName, categoryId: categoryId, progressBlock: progressBlock, completion: completion)
}
/// 上传文件
///
/// - Parameters:
/// - filename: 文件名称
/// - fileData: 文件的内容数据
/// - mimeType: 文件类型
/// - categoryName: 文件分类名称
/// - categoryId: 文件分类 Id
/// - progressBlock: progressBlock
/// - completion: 结果回调
/// - Returns:
@discardableResult
@objc public func upload(filename: String, fileData: Data, mimeType: String? = nil, categoryName: String? = nil, categoryId: String? = nil, progressBlock: @escaping ProgressBlock, completion:@escaping FileResultCompletion) -> RequestCanceller? {
let formData = MultipartFormData(provider: .data(fileData), name: "file", fileName: filename, mimeType: mimeType)
let fileSize = fileData.count
return upload(filename: filename, fileFormData: formData, fileSize: fileSize, categoryName: categoryName, categoryId: categoryId, progressBlock: progressBlock, completion: completion)
}
@discardableResult
func upload(filename: String, fileFormData: MultipartFormData, fileSize: Int, categoryName: String? = nil, categoryId: String? = nil, progressBlock: @escaping ProgressBlock, completion:@escaping FileResultCompletion) -> RequestCanceller? {
let canceller = RequestCanceller()
var parameters: [String: Any] = ["filename": filename]
if let categoryName = categoryName {
parameters["category_name"] = categoryName
}
if let categoryId = categoryId {
parameters["category_id"] = categoryId
}
parameters["file_size"] = fileSize
let request = FileManager.FileProvider.request(.upload(parameters: parameters), callbackQueue: callBackQueue) { result in
ResultHandler.parse(result, handler: { (resultInfo: MappableDictionary?, error: NSError?) in
if error != nil {
completion(nil, error)
} else {
let fileInfo = resultInfo?.value
guard let policy = fileInfo?.getString("policy"),
let authorization = fileInfo?.getString("authorization"),
let path = fileInfo?.getString("path"),
let uploadUrl = fileInfo?.getString("upload_url") else {
completion(nil, HError.init(code: 500) as NSError)
return
}
let id = fileInfo?.getString("id")
let cdnPath = fileInfo?.getString("cdn_path")
let parameters: [String: String] = ["policy": policy, "authorization": authorization]
var formDatas: [MultipartFormData] = []
for (key, value) in parameters {
let formData = MultipartFormData(provider: .data(value.data(using: .utf8)!), name: key)
formDatas.append(formData)
}
formDatas.append(fileFormData)
let uploadRequest = FileManager.FileProvider.request(.UPUpload(url: uploadUrl, formDatas: formDatas), callbackQueue: self.callBackQueue, progress: { progress in
progressBlock(progress.progressObject)
}, completion: { result in
ResultHandler.parse(result, handler: { (upyunInfo: MappableDictionary?, error: NSError?) in
var file: File?
if let upyunInfo = upyunInfo {
file = File()
file?.Id = id
file?.path = path
file?.cdnPath = cdnPath
file?.mimeType = upyunInfo.value.getString("mimetype")
file?.name = filename
file?.size = upyunInfo.value.getInt("file_size")
}
completion(file, error)
})
})
canceller.cancellable = uploadRequest
}
})
}
canceller.cancellable = request
return canceller
}
/// 获取文件分类
/// - Parameter:
/// - query: 查询条件,满足条件的分类将被返回。可选
/// - completion: 结果回调
/// - Returns:
@discardableResult
@objc public func getCategoryList(query: Query? = nil, completion:@escaping FileCategoryListResultCompletion) -> RequestCanceller? {
let queryArgs: [String: Any] = query?.queryArgs ?? [:]
let request = FileManager.FileProvider.request(.findCategories(parameters: queryArgs), callbackQueue: callBackQueue) { result in
ResultHandler.parse(result, handler: { (listResult: FileCategoryList?, error: NSError?) in
completion(listResult, error)
})
}
return RequestCanceller(cancellable: request)
}
// MARK: FileCategory
/// 获取分类详情
///
/// - Parameters:
/// - Id: 分类 Id
/// - completion: 结果回调
/// - Returns:
@discardableResult
@objc public func getCategory(_ Id: String, completion:@escaping FileCategoryResultCompletion) -> RequestCanceller? {
let request = FileManager.FileProvider.request(.getCategory(categoryId: Id), callbackQueue: callBackQueue) { result in
ResultHandler.parse(result, handler: { (category: FileCategory?, error: NSError?) in
completion(category, error)
})
}
return RequestCanceller(cancellable: request)
}
/// 指定分类下的文件列表
///
/// - Parameters:
/// - categoryId: 分类 Id
/// - query: 查询条件,满足条件的文件将被返回。可选
/// - completion: 结果回调
/// - Returns:
@discardableResult
@objc public func find(categoryId: String, query: Query? = nil, completion: @escaping FileListResultCompletion) -> RequestCanceller? {
var queryArgs: [String: Any] = query?.queryArgs ?? [:]
queryArgs["category_id"] = categoryId
let request = FileManager.FileProvider.request(.findFilesInCategory(parameters: queryArgs), callbackQueue: callBackQueue) { result in
ResultHandler.parse(result, handler: { (listResult: FileList?, error: NSError?) in
completion(listResult, error)
})
}
return RequestCanceller(cancellable: request)
}
/// 从 M3U8,MP4 或其他格式视频中获取一张截图。
///
/// - Parameters:
/// - parameters: 参数,可设置的字段如下
/// - source: 视频文件的 id;必填
/// - save_as: 截图时间格式,格式:HH:MM:SS;必填
/// - category_id: 文件所属类别 ID;选填
/// - random_file_link: 是否使用随机字符串作为文件的下载地址,不随机可能会覆盖之前的文件;可选,默认为 true
/// - size: 截图尺寸,格式为 宽x高,默认是视频尺寸;可选
/// - format: 截图格式,可选值为 jpg,png, webp, 默认根据 save_as 的后缀生成;可选
/// - completion: 回调结果
/// - Returns:
@discardableResult
@objc public func genVideoSnapshot(_ parameters: [String: Any], completion: @escaping OBJECTResultCompletion) -> RequestCanceller {
let request = FileManager.FileProvider.request(.genVideoSnapshot(parameters: parameters), callbackQueue: callBackQueue) { result in
ResultHandler.parse(result, handler: { (user: MappableDictionary?, error: NSError?) in
completion(user?.value, error)
})
}
return RequestCanceller(cancellable: request)
}
/// 多个 M3U8 拼接成一个。
///
/// - Parameters:
/// - parameters: 参数,可设置的字段如下
/// - m3u8s: 数组,包含视频文件的 id, 拼接 M3U8 的存储地址,按提交的顺序进行拼接;必填
/// - save_as: 截图时间格式,格式:HH:MM:SS;必填
/// - category_id: 文件所属类别 ID;选填
/// - random_file_link: 是否使用随机字符串作为文件的下载地址,不随机可能会覆盖之前的文件;可选,默认为 true
/// - completion: 回调结果
/// - Returns:
@discardableResult
@objc public func videoConcat(_ parameters: [String: Any], completion: @escaping OBJECTResultCompletion) -> RequestCanceller {
let request = FileManager.FileProvider.request(.videoConcat(parameters: parameters), callbackQueue: callBackQueue) { result in
ResultHandler.parse(result, handler: { (user: MappableDictionary?, error: NSError?) in
completion(user?.value, error)
})
}
return RequestCanceller(cancellable: request)
}
/// 从 M3U8 中剪辑一段,或去掉一段保留前后两段。
///
/// - Parameters:
/// - parameters: 参数,可设置的字段如下
/// - m3u8: 视频文件的 id;必填
/// - save_as: 截图时间格式,格式:HH:MM:SS;必填
/// - category_id: 文件所属类别 ID;选填
/// - random_file_link: 是否使用随机字符串作为文件的下载地址,不随机可能会覆盖之前的文件;可选,默认为 true
/// - include: 包含某段内容的开始结束时间,单位是秒。当 index 为 false 时,为开始结束分片序号;可选,数组类型
/// - exclude: 不包含某段内容的开始结束时间,单位是秒。当 index 为 false 时,为开始结束分片序号;可选,数组类型
/// 说明: index include 或者 exclude 中的值是否为 ts 分片序号,默认为 false;可选,数组类型
/// - completion: 回调结果
/// - Returns:
@discardableResult
@objc public func videoClip(_ parameters: [String: Any], completion: @escaping OBJECTResultCompletion) -> RequestCanceller {
let request = FileManager.FileProvider.request(.videoClip(parameters: parameters), callbackQueue: callBackQueue) { result in
ResultHandler.parse(result, handler: { (user: MappableDictionary?, error: NSError?) in
completion(user?.value, error)
})
}
return RequestCanceller(cancellable: request)
}
/// 获取 M3U8 时长和分片信息。
///
/// - Parameters:
/// - fileId: 数组,包含视频文件的 id
/// - completion: 回调结果
/// - Returns:
@discardableResult
@objc public func videoMeta(_ fileId: String, completion: @escaping OBJECTResultCompletion) -> RequestCanceller {
let request = FileManager.FileProvider.request(.videoMeta(parameters: ["m3u8": fileId]), callbackQueue: callBackQueue) { result in
ResultHandler.parse(result, handler: { (user: MappableDictionary?, error: NSError?) in
completion(user?.value, error)
})
}
return RequestCanceller(cancellable: request)
}
/// 获取音视频的元信息。
///
/// - Parameters:
/// - fileId: 文件的 id
/// - completion: 回调结果
/// - Returns:
@discardableResult
@objc public func videoAudioMeta(_ fileId: String, completion: @escaping OBJECTResultCompletion) -> RequestCanceller {
let request = FileManager.FileProvider.request(.videoAudioMeta(parameters: ["source": fileId]), callbackQueue: callBackQueue) { result in
ResultHandler.parse(result, handler: { (user: MappableDictionary?, error: NSError?) in
completion(user?.value, error)
})
}
return RequestCanceller(cancellable: request)
}
}
extension FileManager {
fileprivate func getFileSize(for localPath: String) -> Int? {
var fileSize: Int? = 0
do {
let attr = try Foundation.FileManager.default.attributesOfItem(atPath: localPath)
fileSize = attr[FileAttributeKey.size] as? Int
} catch {
return nil
}
return fileSize
}
}
| [
-1
] |
2ab5193a6b87608b78782d854e2f4c15c68d018b | 7029a54868e685e50f5a4815fa705483602b5b12 | /WDental/view/controller/FirstAccessViewController.swift | f96108341ed401f8d0864ea79fc59d0d95765045 | [] | no_license | sidraqueToodoo/WDental | 51b49f336909bd65857e72aa1f64c76c5fdb1c4e | 902360c7618ac54de85e20cd4b34a97397d429b4 | refs/heads/main | 2023-07-29T22:59:34.750815 | 2021-09-27T13:09:52 | 2021-09-27T13:09:52 | 406,092,686 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 7,779 | swift | //
// FirstAccessViewController.swift
// WDental
//
// Created by Sidraque on 16/09/21.
//
import UIKit
class FirstAccessViewController: UIViewController, UIScrollViewDelegate, UITextFieldDelegate {
@IBOutlet weak var activityIndicator: UIActivityIndicatorView!
@IBOutlet weak var lbCpf: UILabel!
@IBOutlet weak var tfCpf: UITextField!
@IBOutlet weak var ivCheckCpf: UIImageView!
@IBOutlet weak var lbBirthDate: UILabel!
@IBOutlet weak var tfBirthDate: UITextField!
@IBOutlet weak var ivCheckBirthDate: UIImageView!
@IBOutlet weak var lbEmail: UILabel!
@IBOutlet weak var tfEmail: UITextField!
@IBOutlet weak var ivCheckEmail: UIImageView!
@IBOutlet weak var lbConfirmEmail: UILabel!
@IBOutlet weak var tfConfirmEmail: UITextField!
@IBOutlet weak var ivCheckConfirmEmail: UIImageView!
@IBOutlet weak var lbPassword: UILabel!
@IBOutlet weak var tfPassword: UITextField!
@IBOutlet weak var ivCheckPassword: UIImageView!
@IBOutlet weak var lbConfirmPassword: UILabel!
@IBOutlet weak var tfConfirmPassword: UITextField!
@IBOutlet weak var ivCheckConfirmPassword: UIImageView!
// MARK: - Injection
let viewModel = RegisterViewModel(dataService: DataService.shared)
// MARK: - View life cycle
override func viewDidLoad() {
super.viewDidLoad()
self.hideKeyboardWhenTappedAround()
activityIndicator.hidesWhenStopped = true
}
// MARK: - Networking
private func attemptFetchRegister(withId id: Int) {
viewModel.fetchRegister(withId: id)
viewModel.updateLoadingStatus = {
let _ = self.viewModel.isLoading ? self.activityIndicatorStart() : self.activityIndicatorStop()
}
viewModel.showAlertClosure = {
if let error = self.viewModel.error {
let alert = UIAlertController(title: "Error", message: error.localizedDescription, preferredStyle: UIAlertController.Style.alert)
alert.addAction(UIAlertAction(title: "Voltar", style: UIAlertAction.Style.cancel, handler: { _ in
}))
self.present(alert, animated: true, completion: nil)
}
}
viewModel.didFinishFetch = {
print(self.viewModel.postID!)
print(self.viewModel.name!)
print(self.viewModel.email!)
print(self.viewModel.body!)
}
}
// MARK: - UI Setup
private func activityIndicatorStart() {
activityIndicator.startAnimating()
print("start")
}
private func activityIndicatorStop() {
let alert = UIAlertController(title: "Cadastrado com sucesso", message: "Volte para tela de login", preferredStyle: UIAlertController.Style.alert)
alert.addAction(UIAlertAction(title: "Ir para Login", style: UIAlertAction.Style.default, handler: { _ in
self.performSegue(withIdentifier: "loginSegue", sender: nil)
}))
self.present(alert, animated: true, completion: nil)
print("stop")
}
@IBAction func actionRegister(_ sender: UIButton) {
attemptFetchRegister(withId: 15)
}
@IBAction func changedTextFields(_ sender: UITextField) {
if tfCpf.text?.isEmpty == false {
lbCpf.isHidden = false
}else{
ivCheckCpf.image = UIImage?(nil)
lbCpf.isHidden = true
}
if tfBirthDate.text?.isEmpty == false {
lbBirthDate.isHidden = false
}else{
ivCheckBirthDate.image = UIImage?(nil)
lbBirthDate.isHidden = true
}
if tfEmail.text?.isEmpty == false {
lbEmail.isHidden = false
}else{
ivCheckEmail.image = UIImage?(nil)
lbEmail.isHidden = true
}
if tfConfirmEmail.text?.isEmpty == false {
lbConfirmEmail.isHidden = false
}else{
ivCheckConfirmEmail.image = UIImage?(nil)
lbConfirmEmail.isHidden = true
}
if tfPassword.text?.isEmpty == false {
lbPassword.isHidden = false
}else{
ivCheckPassword.image = UIImage?(nil)
lbPassword.isHidden = true
}
if tfConfirmPassword.text?.isEmpty == false {
lbConfirmPassword.isHidden = false
}else{
ivCheckConfirmPassword.image = UIImage?(nil)
lbConfirmPassword.isHidden = true
}
//MARK: - MASK CPF
if let selectedRange = tfCpf.selectedTextRange {
let cursorPosition = tfCpf.offset(from: tfCpf.beginningOfDocument, to: selectedRange.start)
var appendString = ""
switch cursorPosition {
case 3:
appendString = "."
case 7:
appendString = "."
case 11:
appendString = "-"
default:
break
}
tfCpf.text?.append(appendString)
if (tfCpf.text?.count)! == 14{
tfCpf.isEnabled = false
tfCpf.isEnabled = true
}
}
//MARK: - MASK DATA
if let selectedRange2 = tfBirthDate.selectedTextRange {
let cursorPosition = tfBirthDate.offset(from: tfBirthDate.beginningOfDocument, to: selectedRange2.start)
var appendString = ""
switch cursorPosition {
case 2:
appendString = "/"
case 5:
appendString = "/"
default:
break
}
tfBirthDate.text?.append(appendString)
if (tfBirthDate.text?.count)! == 10{
tfBirthDate.isEnabled = false
tfBirthDate.isEnabled = true
}
}
}
@IBAction func didBeginData(_ sender: UITextField) {
if tfBirthDate.text?.isEmpty == false {
tfBirthDate.text = nil
}
}
@IBAction func didBeginCpf(_ sender: UITextField) {
if tfCpf.text?.isEmpty == false {
tfCpf.text = nil
}
}
@IBAction func didEndTextFields(_ sender: UITextField) {
if tfCpf.text?.isEmpty == false {
ivCheckCpf.image = UIImage(named: "ok")
lbCpf.isHidden = false
}
if tfBirthDate.text?.isEmpty == false {
ivCheckBirthDate.image = UIImage(named: "ok")
lbBirthDate.isHidden = false
}
if tfEmail.text?.isEmpty == false {
ivCheckEmail.image = UIImage(named: "ok")
lbEmail.isHidden = false
}
if tfConfirmEmail.text?.isEmpty == false {
ivCheckConfirmEmail.image = UIImage(named: "ok")
lbConfirmEmail.isHidden = false
}
if tfPassword.text?.isEmpty == false {
ivCheckPassword.image = UIImage(named: "ok")
lbPassword.isHidden = false
}
if tfConfirmPassword.text?.isEmpty == false {
ivCheckConfirmPassword.image = UIImage(named: "ok")
lbConfirmPassword.isHidden = false
}
}
}
extension UIViewController {
func hideKeyboardWhenTappedAround() {
let tap: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(UIViewController.dismissKeyboard))
tap.cancelsTouchesInView = false
view.addGestureRecognizer(tap)
}
@objc func dismissKeyboard() {
view.endEditing(true)
}
}
| [
-1
] |
d5d59f62ed317f08aa970b64488014eac3c4fb3e | b0f06087d30a37169e7a04b3868e94b9869cdd07 | /ApexyLoaderExample/ApexyLoaderExample/Sources/Presentation/Result/ResultViewController.swift | becaf7348298b00a9b5e3ee9b908d648c981205e | [
"MIT"
] | permissive | leramovie/apexy-ios | e02f620f1a119d9d4dc543a2b1fc77bc370cbfbc | 392e61efb4d35a9d4ee93552530185c3c9213ad9 | refs/heads/master | 2023-04-23T23:31:20.584762 | 2021-04-26T15:49:00 | 2021-04-26T16:05:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,446 | swift | //
// ResultViewController.swift
// ApexyLoaderExample
//
// Created by Daniil Subbotin on 04.03.2021.
//
import ApexyLoader
import UIKit
final class ResultViewController: UIViewController {
@IBOutlet private var activityIndicatorView: UIActivityIndicatorView!
@IBOutlet private var repoTextView: UITextView!
private let repoLoader: RepoLoading
private var observer: LoaderObservation?
init(repoLoader: RepoLoading = ServiceLayer.shared.repoLoader) {
self.repoLoader = repoLoader
super.init(nibName: nil, bundle: nil)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
super.viewDidLoad()
observer = repoLoader.observe { [weak self] in
self?.stateDidUpdate()
}
stateDidUpdate()
}
private func stateDidUpdate() {
if repoLoader.state.isLoading {
activityIndicatorView.startAnimating()
} else {
activityIndicatorView.stopAnimating()
}
switch repoLoader.state {
case .failure(_, let content?),
.loading(let content?),
.success(let content):
let repos = content.map { $0.name }.joined(separator: "\n")
repoTextView.text = "Repositories:\n\n\(repos)"
default:
break
}
}
}
| [
-1
] |
e627f085410627283ea2e0a20fe63950539dcb75 | 358817c5985369b72fe48a298bf6a8886ee65b1f | /CoreGraphics/Animation-SpringingView/Animation-SpringingView/ViewController.swift | b9465525a0608fcdd47212c7ce4e04e52565276d | [
"MIT"
] | permissive | miguelius/practice-swift | 16310e8188aac2c79fb984ee4dc36d5ae69ee450 | 0ee3618fee2b2701f27e0f50f995eddc892f030f | refs/heads/master | 2021-05-13T14:37:39.692460 | 2017-08-25T16:49:59 | 2017-08-25T16:49:59 | 116,742,836 | 1 | 0 | null | 2018-01-09T00:05:51 | 2018-01-09T00:05:51 | null | UTF-8 | Swift | false | false | 883 | swift | //
// ViewController.swift
// Animation-SpringingView
//
// Created by Domenico on 16.04.15.
// License: MIT
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let v = UIView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
v.backgroundColor = UIColor.blue
self.view.addSubview(v)
UIView.animate(withDuration: 0.8,
delay: 0,
usingSpringWithDamping: 0.7,
initialSpringVelocity: 20,
animations: {
v.center.y += 100
},
completion:nil)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
| [
-1
] |
a96ec8c4f63c35361c2e84c8f5530aa3a45b618d | b7b532e5a92f68afe3c88feb6f66dd26688e5600 | /Countries/Sources/ViewModels/CountriesListViewModel.swift | cb64d0b9ae4d7bf5a4b2f8bcae82a719735f4e8b | [] | no_license | shunding/CountriesSample | 0a12b66d618545f3ba66787ab20260b1c426394c | d2d49289624d677ece8b454aa4777dff5b2e195e | refs/heads/master | 2021-01-19T12:44:03.420527 | 2018-03-16T15:36:11 | 2018-03-16T15:36:11 | 100,803,656 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,923 | swift | //
// CountriesListViewModel.swift
// Countries
//
// Created by Alex Drozhak on 8/19/17.
// Copyright © 2017 Alex Drozhak. All rights reserved.
//
import RxSwift
import RxCocoa
struct CountryCellModel {
let name: String
let population: String
init(with country: Country) {
self.name = country.name
self.population = "Population: \(country.population)"
}
}
struct CountriesListViewModel: LoadableViewModel {
typealias T = Countries
var countriesList: Driver<[CountryCellModel]>?
let cellDidSelect: PublishSubject<Int> = PublishSubject<Int>()
var presentDetails: Observable<String>?
var eventDriver: EventDriver<T>?
init(apiClient: CountriesAPIClient,
refreshDriver: Driver<Void>) {
let driver = refreshDriver
.debug("Refresh Driver")
.startWith(())
.flatMapLatest { (_) -> Driver<LoadingEvent<Countries>> in
return apiClient.allCountries()
.debug("Fetch all countries")
.map { .data($0) }
.asDriver(onErrorJustReturn: .error)
.startWith(.loading)
}
eventDriver = EventDriver(driver: driver)
let countriesDataDriver = driver
.map { event -> [CountryCellModel]? in
switch event {
case .data(let data):
let models = data.map { CountryCellModel(with: $0) }
return models
default: return nil
}
}
.filter { $0 != nil }
.map { $0! }
countriesList = countriesDataDriver.map { $0 }
if let list = countriesList {
presentDetails = cellDidSelect
.withLatestFrom(list) { ($0, $1) }
.map { $1[$0].name }
}
}
}
| [
-1
] |
8420365fb6ce5001333d0e734d5728617db9b52c | 08f42e5d22b9997f3846d78f0bf580375d709507 | /SwiftProgressViewDemo/RingViewController.swift | d885912e37aa1263afd13c69cc10966f7517d959 | [
"MIT"
] | permissive | carabina/SwiftProgressView | fe62bfd26629f3e936bff0102c1f50317cbc1096 | 150f10e7d7f1622a8bfc1453fc600b9f35db43ca | refs/heads/master | 2021-07-22T06:03:31.983299 | 2017-10-31T10:42:02 | 2017-10-31T10:42:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 984 | swift | //
// RingViewController.swift
// SwiftProgressViewDemo
//
// Created by Julie on 31/10/17.
// Copyright © 2017 ZHOU DENGFENG DEREK. All rights reserved.
//
import UIKit
import SwiftProgressView
class RingViewController: UIViewController {
@IBOutlet weak var progressView: ProgressRingView!
@IBAction func progressChanged(_ sender: UISlider) {
progressView.setProgress(CGFloat(sender.value), animated: false)
}
@IBAction func circleLineWidthChanged(_ sender: UISlider) {
progressView.circleLineWidth = CGFloat(sender.value)
}
@IBAction func progressLineWidthChanged(_ sender: UISlider) {
progressView.progressLineWidth = CGFloat(sender.value)
}
@IBAction func changeCircleColor(_ sender: UIButton) {
progressView.circleColor = sender.backgroundColor!
}
@IBAction func changeProgressColor(_ sender: UIButton) {
progressView.progressColor = sender.backgroundColor!
}
}
| [
-1
] |
6a0ad09a81986a0ae66b9687d2f7c81502cadcef | 7b62eea25717cee11ec28a11fed6be3b0ef10962 | /Parse/Wingman/BrowseDetailViewController.swift | 5db064e4597f273532e466d9a1234a95650ebf6c | [] | no_license | Will16/Wingman | 41b768647df281dc0e9f618b92542ac4f8f5234d | 44504e88ca263db46299549b77d72f6a39705bfe | refs/heads/master | 2016-09-06T06:28:30.572248 | 2015-12-15T22:01:40 | 2015-12-15T22:01:40 | 40,737,677 | 1 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 9,129 | swift | //
// BrowseDetailViewController.swift
// Wingman
//
// Created by William McDuff on 2015-03-06.
// Copyright (c) 2015 Ebony Nyenya. All rights reserved.
//
import UIKit
import MessageUI
class BrowseDetailViewController: UIViewController, MFMessageComposeViewControllerDelegate, userLocationProtocol, CLLocationManagerDelegate {
var registerInfo: [String: AnyObject]?
var postData: [String: AnyObject]?
var venueLocation: PFGeoPoint?
var phoneNumber: String?
var myCustomBackButtonItem: UIBarButtonItem?
var customButton: UIButton?
@IBOutlet weak var usernameLabel: UILabel!
@IBOutlet weak var userImage: UIImageView!
@IBOutlet weak var genderLabel: UILabel!
@IBOutlet weak var interestsLabel: UILabel!
@IBOutlet weak var clubOrBarLabel: UILabel!
@IBOutlet weak var distanceLabel: UILabel!
@IBOutlet weak var startTimeLabel: UILabel!
@IBOutlet weak var endTimeLabel: UILabel!
@IBOutlet weak var joinButton: UIButton!
var imageView: UIImageView?
// var tempGeoPoint = PFGeoPoint(latitude: 33.78604932800356, longitude: -84.37840104103088)
@IBAction func joinButton(sender: AnyObject) {
messageUser()
}
override func viewDidLoad() {
super.viewDidLoad()
joinButton.titleLabel!.adjustsFontSizeToFitWidth = true
joinButton.titleLabel!.minimumScaleFactor = 0.3
fillLabels()
GlobalVariableSharedInstance.startUpdatingLocation()
GlobalVariableSharedInstance.delegate = self
customButton = UIButton(type: UIButtonType.Custom)
customButton!.setBackgroundImage(UIImage(named: "backbutton"), forState: UIControlState.Normal)
customButton!.sizeToFit()
customButton!.hidden = true
customButton!.addTarget(self, action: "popToRoot:", forControlEvents: UIControlEvents.TouchUpInside)
myCustomBackButtonItem = UIBarButtonItem(customView: customButton!)
self.navigationItem.leftBarButtonItem = myCustomBackButtonItem
imageView = UIImageView(frame: CGRect(x: -80, y: 0, width: 300, height: 40))
imageView!.clipsToBounds = true
imageView!.contentMode = .ScaleAspectFill
imageView!.hidden = true
let image = UIImage(named: "bar")
imageView!.image = image
navigationItem.titleView = imageView
// Do any additional setup after loading the view.
self.userImage.hidden = true
self.joinButton.hidden = true
userImage.clipsToBounds = true
userImage.layer.cornerRadius = userImage.frame.size.height/2
interestsLabel.layer.cornerRadius = interestsLabel.frame.size.width/18
self.view.layoutSubviews()
print(self.phoneNumber, terminator: "")
customButton!.hidden = false
springScaleFrom(customButton!, x: -100, y: 0, scaleX: 0.5, scaleY: 0.5)
imageView!.hidden = false
springScaleFrom(imageView!, x: 200, y: 0, scaleX: 0.5, scaleY: 0.5)
self.userImage.hidden = false
springScaleFrom(userImage!, x: 0, y: -400, scaleX: 0.5, scaleY: 0.5)
self.joinButton.hidden = false
springScaleFrom(joinButton!, x: 0, y: 200, scaleX: 0.5, scaleY: 0.5)
}
override func viewWillAppear(animated: Bool) {
}
override func viewDidAppear(animated:Bool){
// self.navigationController?.navigationItem.backBarButtonItem =
}
func popToRoot(sender:UIBarButtonItem) {
self.navigationController?.popToRootViewControllerAnimated(true)
}
func fillLabels() {
if let registerInfo = registerInfo {
if let username = registerInfo["username"] as? String {
self.usernameLabel.text = username
}
if let interests = registerInfo["interests"] as? String {
self.interestsLabel.text = interests
}
if let gender = registerInfo["gender"] as? String {
self.genderLabel.text = gender
}
if let imageFile = registerInfo["imageFile"] as? PFFile {
//taking PPFile and turning it into data and then into UIImage
imageFile.getDataInBackgroundWithBlock({
(imageData: NSData!, error: NSError!) in
if (error == nil) {
let image : UIImage = UIImage(data:imageData)!
//image object implementation
self.userImage.image = image
}
})
}
}
if let postData = postData {
if let clubOrBar = postData["clubOrBar"] as? String {
self.clubOrBarLabel.text = clubOrBar
}
if let startTime = postData["startTime"] as? Int {
self.startTimeLabel.text = "From: \(startTime)"
}
if let endTime = postData["endTime"] as? Int {
self.endTimeLabel.text = "To: \(endTime)"
}
// if let wingmanGender = postData["wingmanGender"] as? String {
//
// self.seekingLabel.text = "Seeking \(wingmanGender) Wingman"
//
// }
//
//retrieving location from Parse
if let venueLocation = postData["location"] as? PFGeoPoint {
self.venueLocation = venueLocation
}
}
}
//sending phone number to TextMessageViewController before going to text messaging client
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func didReceiveUserLocation(location: CLLocation) {
if let latitude = self.venueLocation?.latitude as Double? {
if let longitude = self.venueLocation?.longitude as Double? {
if let venueLocation = CLLocation(latitude: latitude, longitude: longitude) as CLLocation? {
// let tempCLLocation = CLLocation(latitude: self.tempGeoPoint!.latitude, longitude: self.tempGeoPoint!.longitude) as CLLocation?
//convert meters into miles
let dist1 = venueLocation.distanceFromLocation(location) * 0.00062137
// let dist1 = venueLocation.distanceFromLocation(tempCLLocation!) * 0.00062137
//rounding to nearest hundredth
let dist2 = Double(round(100 * dist1) / 100)
self.distanceLabel.text = "Which is \(dist2) mi from you"
print("THE DISTANCE: \(dist2)", terminator: "")
}
}
}
}
func messageUser() {
if MFMessageComposeViewController.canSendText() {
let messageController:MFMessageComposeViewController = MFMessageComposeViewController()
if let phoneNumber = self.phoneNumber as String? {
messageController.recipients = ["\(phoneNumber)"]
messageController.messageComposeDelegate = self
self.presentViewController(messageController, animated: true, completion: nil)
}
}
}
func messageComposeViewController(controller: MFMessageComposeViewController, didFinishWithResult result: MessageComposeResult) {
controller.dismissViewControllerAnimated(true, completion: nil)
}
@IBAction func logout(sender: AnyObject) {
PFUser.logOut()
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let nc = storyboard.instantiateViewControllerWithIdentifier("loginNC") as! UINavigationController
//presents LoginViewController without tabbar at bottom
self.presentViewController(nc, animated: true, completion: nil)
}
}
| [
-1
] |
d3da26c868b08ac91e689c297a455ee5bf8debf1 | 71d9ff510d37a267119a4f013deaf1ebf1829060 | /2021_02_07_openMarket/OpenMarket/Model/Network/OpenMarketJSONDecoder.swift | f89bc2aab495a92094adb09033475b7f798ec17a | [] | no_license | lina0322/iOS_yagom_starter_camp | 7215f87d6f7c7f042744c14fef51555d7a472f3d | 89ad6d9b0eb33ac7119445226aa5afc8a175e7ad | refs/heads/main | 2023-04-22T04:28:36.184458 | 2021-05-17T06:52:29 | 2021-05-17T06:52:29 | 302,688,623 | 0 | 7 | null | null | null | null | UTF-8 | Swift | false | false | 1,077 | swift | //
// ProductJSONDecoder.swift
// OpenMarket
//
// Created by 임리나 on 2021/01/25.
//
import Foundation
struct OpenMarketJSONDecoder<T: Decodable> {
static func decodeData(about apiRequestType: APIRequestType, networkHandler: NetworkHandler = NetworkHandler(), completionHandler: @escaping (Result<T, OpenMarketError>) -> ()) {
guard let urlRequest = URLRequestManager.makeURLRequest(for: .get, about: apiRequestType) else {
completionHandler(.failure(.wrongURLRequest))
return
}
networkHandler.startLoad(urlRequest: urlRequest) { result in
switch result {
case .success(let data):
do {
let decodedData = try JSONDecoder().decode(T.self, from: data)
completionHandler(.success(decodedData))
} catch {
completionHandler(.failure(.decodingFailure))
}
case .failure(let error):
completionHandler(.failure(error))
}
}
}
}
| [
-1
] |
8b60686df4dd0acc076f83aa1452e2793f85d4e7 | bde27230cae2aa1f4d6ff65e705df94aeca528a3 | /AssignmentSmartApp/View Model/MovieDetailsViewModel.swift | e8409c60cbad4c9c394c253346cc0c8aa3744e77 | [] | no_license | ankchdry/smartAppAssignment | 2c377c4c40d87e442500fd988704166134f80576 | c87e16c671472771e6e36e7d0e43706f3c3225f9 | refs/heads/master | 2022-07-18T15:13:54.091516 | 2020-05-16T02:55:47 | 2020-05-16T02:55:47 | 264,183,751 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 326 | swift | //
// MovieDetailsViewModel.swift
// AssignmentSmartApp
//
// Created by Ankit Chaudhary on 14/05/20.
// Copyright © 2020 spectorAi. All rights reserved.
//
import Foundation
import RxSwift
import RxCocoa
class MovieDetailsViewModel: ViewModelType {
var movieListData = BehaviorRelay<MovieBrief?>.init(value: nil)
}
| [
-1
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.