blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 2
625
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 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
sequencelengths 1
9.02k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b76061c09a7bcea84684cb8edf6993509708e217 | 61f16162ccbbd2b8ec8d288e98ceb31c02881327 | /examples/generated/test/swift/layouts/FixedParentFitChild.swift | 1a870fda8f941247e51034524e6cc8bd93031cac | [
"MIT"
] | permissive | mohsinalimat/Lona | ece357e2d46b04eeced6b0e2f345f11c75351af0 | 285dbfaf022bc3f89d0a5080448a150b93edf450 | refs/heads/master | 2021-04-17T06:11:35.938758 | 2018-03-19T23:27:31 | 2018-03-19T23:27:31 | 126,309,890 | 1 | 0 | MIT | 2018-03-22T09:18:22 | 2018-03-22T09:18:22 | null | UTF-8 | Swift | false | false | 8,192 | swift | import UIKit
import Foundation
// MARK: - FixedParentFitChild
public class FixedParentFitChild: UIView {
// MARK: Lifecycle
public init() {
super.init(frame: .zero)
setUpViews()
setUpConstraints()
update()
}
public required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
// MARK: Private
private var view1View = UIView(frame: .zero)
private var view4View = UIView(frame: .zero)
private var view5View = UIView(frame: .zero)
private var topPadding: CGFloat = 24
private var trailingPadding: CGFloat = 24
private var bottomPadding: CGFloat = 24
private var leadingPadding: CGFloat = 24
private var view1ViewTopMargin: CGFloat = 0
private var view1ViewTrailingMargin: CGFloat = 0
private var view1ViewBottomMargin: CGFloat = 0
private var view1ViewLeadingMargin: CGFloat = 0
private var view1ViewTopPadding: CGFloat = 24
private var view1ViewTrailingPadding: CGFloat = 24
private var view1ViewBottomPadding: CGFloat = 24
private var view1ViewLeadingPadding: CGFloat = 24
private var view4ViewTopMargin: CGFloat = 0
private var view4ViewTrailingMargin: CGFloat = 0
private var view4ViewBottomMargin: CGFloat = 0
private var view4ViewLeadingMargin: CGFloat = 0
private var view5ViewTopMargin: CGFloat = 0
private var view5ViewTrailingMargin: CGFloat = 0
private var view5ViewBottomMargin: CGFloat = 0
private var view5ViewLeadingMargin: CGFloat = 12
private var heightAnchorConstraint: NSLayoutConstraint?
private var view1ViewTopAnchorConstraint: NSLayoutConstraint?
private var view1ViewLeadingAnchorConstraint: NSLayoutConstraint?
private var view1ViewTrailingAnchorConstraint: NSLayoutConstraint?
private var view4ViewLeadingAnchorConstraint: NSLayoutConstraint?
private var view4ViewTopAnchorConstraint: NSLayoutConstraint?
private var view4ViewHeightAnchorParentConstraint: NSLayoutConstraint?
private var view5ViewLeadingAnchorConstraint: NSLayoutConstraint?
private var view5ViewTopAnchorConstraint: NSLayoutConstraint?
private var view5ViewHeightAnchorParentConstraint: NSLayoutConstraint?
private var view4ViewHeightAnchorConstraint: NSLayoutConstraint?
private var view4ViewWidthAnchorConstraint: NSLayoutConstraint?
private var view5ViewHeightAnchorConstraint: NSLayoutConstraint?
private var view5ViewWidthAnchorConstraint: NSLayoutConstraint?
private func setUpViews() {
addSubview(view1View)
view1View.addSubview(view4View)
view1View.addSubview(view5View)
backgroundColor = Colors.bluegrey100
view1View.backgroundColor = Colors.red50
view4View.backgroundColor = Colors.red200
view5View.backgroundColor = Colors.deeporange200
}
private func setUpConstraints() {
translatesAutoresizingMaskIntoConstraints = false
view1View.translatesAutoresizingMaskIntoConstraints = false
view4View.translatesAutoresizingMaskIntoConstraints = false
view5View.translatesAutoresizingMaskIntoConstraints = false
let heightAnchorConstraint = heightAnchor.constraint(equalToConstant: 600)
let view1ViewTopAnchorConstraint = view1View
.topAnchor
.constraint(equalTo: topAnchor, constant: topPadding + view1ViewTopMargin)
let view1ViewLeadingAnchorConstraint = view1View
.leadingAnchor
.constraint(equalTo: leadingAnchor, constant: leadingPadding + view1ViewLeadingMargin)
let view1ViewTrailingAnchorConstraint = view1View
.trailingAnchor
.constraint(equalTo: trailingAnchor, constant: -(trailingPadding + view1ViewTrailingMargin))
let view4ViewLeadingAnchorConstraint = view4View
.leadingAnchor
.constraint(equalTo: view1View.leadingAnchor, constant: view1ViewLeadingPadding + view4ViewLeadingMargin)
let view4ViewTopAnchorConstraint = view4View
.topAnchor
.constraint(equalTo: view1View.topAnchor, constant: view1ViewTopPadding + view4ViewTopMargin)
let view4ViewHeightAnchorParentConstraint = view4View
.heightAnchor
.constraint(
lessThanOrEqualTo: view1View.heightAnchor,
constant: -(view1ViewTopPadding + view4ViewTopMargin + view1ViewBottomPadding + view4ViewBottomMargin))
let view5ViewLeadingAnchorConstraint = view5View
.leadingAnchor
.constraint(equalTo: view4View.trailingAnchor, constant: view4ViewTrailingMargin + view5ViewLeadingMargin)
let view5ViewTopAnchorConstraint = view5View
.topAnchor
.constraint(equalTo: view1View.topAnchor, constant: view1ViewTopPadding + view5ViewTopMargin)
let view5ViewHeightAnchorParentConstraint = view5View
.heightAnchor
.constraint(
lessThanOrEqualTo: view1View.heightAnchor,
constant: -(view1ViewTopPadding + view5ViewTopMargin + view1ViewBottomPadding + view5ViewBottomMargin))
let view4ViewHeightAnchorConstraint = view4View.heightAnchor.constraint(equalToConstant: 100)
let view4ViewWidthAnchorConstraint = view4View.widthAnchor.constraint(equalToConstant: 60)
let view5ViewHeightAnchorConstraint = view5View.heightAnchor.constraint(equalToConstant: 60)
let view5ViewWidthAnchorConstraint = view5View.widthAnchor.constraint(equalToConstant: 60)
view4ViewHeightAnchorParentConstraint.priority = UILayoutPriority.defaultLow
view5ViewHeightAnchorParentConstraint.priority = UILayoutPriority.defaultLow
NSLayoutConstraint.activate([
heightAnchorConstraint,
view1ViewTopAnchorConstraint,
view1ViewLeadingAnchorConstraint,
view1ViewTrailingAnchorConstraint,
view4ViewLeadingAnchorConstraint,
view4ViewTopAnchorConstraint,
view4ViewHeightAnchorParentConstraint,
view5ViewLeadingAnchorConstraint,
view5ViewTopAnchorConstraint,
view5ViewHeightAnchorParentConstraint,
view4ViewHeightAnchorConstraint,
view4ViewWidthAnchorConstraint,
view5ViewHeightAnchorConstraint,
view5ViewWidthAnchorConstraint
])
self.heightAnchorConstraint = heightAnchorConstraint
self.view1ViewTopAnchorConstraint = view1ViewTopAnchorConstraint
self.view1ViewLeadingAnchorConstraint = view1ViewLeadingAnchorConstraint
self.view1ViewTrailingAnchorConstraint = view1ViewTrailingAnchorConstraint
self.view4ViewLeadingAnchorConstraint = view4ViewLeadingAnchorConstraint
self.view4ViewTopAnchorConstraint = view4ViewTopAnchorConstraint
self.view4ViewHeightAnchorParentConstraint = view4ViewHeightAnchorParentConstraint
self.view5ViewLeadingAnchorConstraint = view5ViewLeadingAnchorConstraint
self.view5ViewTopAnchorConstraint = view5ViewTopAnchorConstraint
self.view5ViewHeightAnchorParentConstraint = view5ViewHeightAnchorParentConstraint
self.view4ViewHeightAnchorConstraint = view4ViewHeightAnchorConstraint
self.view4ViewWidthAnchorConstraint = view4ViewWidthAnchorConstraint
self.view5ViewHeightAnchorConstraint = view5ViewHeightAnchorConstraint
self.view5ViewWidthAnchorConstraint = view5ViewWidthAnchorConstraint
// For debugging
heightAnchorConstraint.identifier = "heightAnchorConstraint"
view1ViewTopAnchorConstraint.identifier = "view1ViewTopAnchorConstraint"
view1ViewLeadingAnchorConstraint.identifier = "view1ViewLeadingAnchorConstraint"
view1ViewTrailingAnchorConstraint.identifier = "view1ViewTrailingAnchorConstraint"
view4ViewLeadingAnchorConstraint.identifier = "view4ViewLeadingAnchorConstraint"
view4ViewTopAnchorConstraint.identifier = "view4ViewTopAnchorConstraint"
view4ViewHeightAnchorParentConstraint.identifier = "view4ViewHeightAnchorParentConstraint"
view5ViewLeadingAnchorConstraint.identifier = "view5ViewLeadingAnchorConstraint"
view5ViewTopAnchorConstraint.identifier = "view5ViewTopAnchorConstraint"
view5ViewHeightAnchorParentConstraint.identifier = "view5ViewHeightAnchorParentConstraint"
view4ViewHeightAnchorConstraint.identifier = "view4ViewHeightAnchorConstraint"
view4ViewWidthAnchorConstraint.identifier = "view4ViewWidthAnchorConstraint"
view5ViewHeightAnchorConstraint.identifier = "view5ViewHeightAnchorConstraint"
view5ViewWidthAnchorConstraint.identifier = "view5ViewWidthAnchorConstraint"
}
private func update() {}
}
| [
-1
] |
49f6d6e31178dab180e18595874e03553dd6d70a | aae14c3ef1ec259d4e17ddec87586fc412f98b76 | /FilteringInPractice/ViewController.swift | 49f00840a89abc76c8f32b9212a57acbd167b0d5 | [] | no_license | mohamed7420/FilteringInPractice | 7ce95285571f049897ac1153a159463dfee48d5a | 5eacc6bf8f7c06c5f0f84c7934903468d099b749 | refs/heads/main | 2023-08-23T03:25:00.204275 | 2021-11-03T23:49:00 | 2021-11-03T23:49:00 | 424,414,954 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,693 | swift | //
// ViewController.swift
// FilteringInPractice
//
// Created by Mohamed osama on 03/11/2021.
//
import UIKit
import RxSwift
import RxCocoa
class ViewController: UIViewController {
private let disposeBag = DisposeBag()
private var items = BehaviorRelay(value: [Item]())
lazy var values: [Item] = {
return items.value
}()
//MARK:- IBOutlets
@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var filteredSegementedControll: UISegmentedControl!
override func viewDidLoad() {
super.viewDidLoad()
setupTableView()
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if let navVC = segue.destination as? UINavigationController , let vc = navVC.viewControllers.first as? AddItemViewController{
vc.selectedItem.subscribe(onNext: {
self.values.append($0)
self.items.accept(self.values)
DispatchQueue.main.async {
self.tableView.reloadData()
}
}).disposed(by: disposeBag)
}
}
//MARK:- IBActions
@IBAction func didSegementedAction(_ sender: UISegmentedControl) {
guard let selectedSize = sender.titleForSegment(at: filteredSegementedControll.selectedSegmentIndex - 1) else {return}
applyFiltering(selectedSize, index: sender.selectedSegmentIndex)
}
private func applyFiltering(_ text: String = "All" , index: Int ){
items.filter { items in
print(items[index].sizeType?.rawValue)
return items[index].sizeType?.rawValue == text
}.subscribe(onNext:{
print($0)
}).disposed(by: disposeBag)
}
}
//MARK:- TableViewDelegate
extension ViewController: UITableViewDelegate , UITableViewDataSource{
fileprivate func setupTableView(){
self.tableView.delegate = self
self.tableView.dataSource = self
self.tableView.rowHeight = UITableView.automaticDimension
self.tableView.separatorStyle = .none
self.tableView.reloadData()
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as? UITableViewCell else {
fatalError()
}
cell.textLabel?.text = values[indexPath.row].txt
cell.detailTextLabel?.text = values[indexPath.row].sizeType?.rawValue.capitalized
return cell
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return values.count
}
}
| [
-1
] |
6f1baa5b1090f7df2b4f435c21426d7873caf686 | fe32623a67187a14877e9486341d838303cff1ac | /RecipeApp/RecipeApp/SceneDelegate.swift | 1ce8506e376da6da2e00de3fc521744634240fc9 | [] | no_license | soman24/RecipeApp | 09c89e31631ae78e321173283100e325b47de7d9 | 4cc60d94ea2a5db501fd5722421ab14dbddc6df9 | refs/heads/main | 2023-09-03T05:37:27.616301 | 2021-11-21T23:06:19 | 2021-11-21T23:06:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,658 | swift | //
// SceneDelegate.swift
// RecipeApp
//
// Created by Soman Khan on 11/3/21.
//
import UIKit
import Parse
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 }
if PFUser.current() != nil {
let main = UIStoryboard(name: "Main", bundle: nil)
let mainNavigationController = main.instantiateViewController(withIdentifier: "MainNavigationController")
window?.rootViewController = mainNavigationController
}
}
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,
393228,
393231,
393251,
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,
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,
360917,
328180,
328183,
328190,
254463,
328193,
328207,
410129,
393748,
262679,
377372,
188959,
385571,
197160,
377384,
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,
385714,
434868,
164535,
164539,
328379,
328387,
352969,
344777,
385743,
385749,
139998,
369382,
361196,
418555,
344832,
336644,
344837,
344843,
328462,
361231,
394002,
336660,
418581,
418586,
434971,
369436,
369439,
418591,
262943,
418594,
336676,
418600,
418606,
369464,
361274,
328516,
336709,
328520,
336712,
361289,
213848,
426842,
361307,
197469,
361310,
254813,
361318,
344936,
361323,
361335,
328574,
369544,
361361,
222129,
345036,
386004,
345046,
386012,
386019,
435188,
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,
165086,
66783,
222438,
328942,
386286,
386292,
206084,
345377,
345380,
353572,
345383,
263464,
337207,
345400,
378170,
369979,
386366,
337235,
263509,
353634,
337252,
271731,
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,
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,
419510,
419513,
403139,
337607,
419528,
419531,
419536,
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,
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,
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,
264919,
264942,
363252,
264965,
338701,
256787,
363294,
396067,
346917,
396070,
215854,
355123,
355141,
355144,
338764,
355151,
330581,
387929,
330585,
355167,
265056,
265059,
355176,
355180,
412600,
379849,
347082,
396246,
330711,
248794,
248799,
347106,
437219,
257009,
265208,
199681,
338951,
330761,
330769,
396329,
347178,
404526,
396337,
330803,
396340,
339002,
388155,
248905,
330827,
248915,
339037,
412765,
257121,
265321,
248952,
420985,
330890,
248986,
44199,
380071,
339118,
330959,
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,
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,
224888,
224891,
224895,
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,
225027,
257796,
257802,
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,
381069,
225425,
250003,
225430,
250008,
356507,
225439,
135328,
225442,
438434,
225445,
225448,
356521,
438441,
225451,
258223,
225456,
430257,
225459,
225462,
225468,
389309,
225472,
372931,
225476,
389322,
225485,
225488,
225491,
266454,
225494,
225497,
225500,
225503,
225506,
225511,
217319,
225515,
225519,
381177,
397572,
381212,
356638,
356641,
356644,
356647,
266537,
356650,
389417,
356656,
332081,
340276,
356662,
397623,
332091,
225599,
348489,
151884,
332118,
348503,
430422,
340328,
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,
340512,
324134,
381483,
356908,
324141,
324143,
356917,
324150,
324156,
168509,
348734,
324161,
324165,
356935,
348745,
381513,
324171,
324174,
324177,
389724,
332381,
373344,
381546,
340628,
184983,
373399,
258723,
332460,
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,
324511,
422817,
324514,
201638,
398246,
373672,
324525,
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,
357419,
209969,
209973,
209976,
209980,
209988,
209991,
209996,
431180,
349268,
250968,
210011,
373853,
341094,
210026,
210028,
210032,
349296,
210037,
210042,
210045,
349309,
152704,
349313,
210053,
210056,
373905,
259217,
210068,
210072,
210078,
210085,
210089,
210096,
210100,
324792,
210108,
357571,
210116,
210128,
210132,
333016,
210139,
210144,
218355,
218361,
275709,
275713,
242947,
275717,
349460,
349486,
349492,
415034,
210261,
365912,
259423,
374113,
251236,
374118,
390518,
357756,
374161,
112021,
349591,
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,
366173,
423529,
423533,
210547,
415354,
333440,
267910,
333515,
259789,
366301,
333535,
153311,
366308,
366312,
431852,
399086,
366319,
210673,
366322,
399092,
366326,
333566,
268042,
210700,
366349,
210707,
399129,
333595,
210720,
358192,
366384,
210740,
366388,
358201,
325441,
366403,
325447,
341831,
341839,
341844,
415574,
358235,
350046,
399200,
399208,
268144,
358256,
358260,
325494,
399222,
325505,
399244,
333709,
333725,
333737,
382891,
382898,
350153,
358348,
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,
383331,
383334,
391531,
383342,
334204,
194942,
391564,
366991,
334224,
342431,
375209,
375220,
334263,
326087,
358857,
195041,
104940,
416255,
350724,
186898,
342546,
350740,
342551,
342555,
416294,
350762,
252463,
358962,
334397,
358973,
252483,
219719,
399957,
334425,
375401,
334466,
334469,
162446,
342680,
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,
244572,
433001,
400238,
211826,
211832,
392061,
351102,
252801,
260993,
351105,
400260,
211846,
342931,
252823,
400279,
392092,
400286,
252838,
359335,
211885,
252846,
400307,
351169,
359362,
170950,
326599,
359367,
187335,
359383,
359389,
383968,
343018,
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,
351382,
384152,
384158,
384161,
351399,
384169,
367795,
384182,
367801,
384189,
351424,
384192,
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,
384324,
212296,
212304,
367966,
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,
359984,
343610,
400977,
400982,
179803,
155255,
155274,
368289,
245410,
425652,
425663,
155328,
245463,
155352,
155356,
155364,
245477,
155372,
245487,
212723,
409336,
155394,
155404,
155423,
360224,
155439,
204592,
155444,
155448,
417596,
384829,
360262,
155463,
155477,
376665,
155484,
261982,
425823,
155488,
376672,
155492,
327532,
261997,
376686,
262000,
262003,
262006,
147319,
327542,
262009,
425846,
262012,
155517,
155523,
155526,
360327,
376715,
155532,
262028,
262031,
262034,
262037,
262040,
262043,
253854,
262046,
155550,
262049,
262052,
327590,
155560,
155563,
155566,
393152,
393170,
155604,
384986,
155620,
253924,
155622,
253927,
327655,
360432,
393204,
360439,
253944,
393209,
393215
] |
0579e06c94f6dd67d0f4b261b477b761463fc826 | b0069cfa317b9281f064a7fbd9d1463c33ee1ac4 | /FirebaseCore/Internal/Sources/HeartbeatLogging/HeartbeatsBundle.swift | a7db6a5e900a003c79b05a970b2cf032ce5b8efc | [
"Apache-2.0",
"LicenseRef-scancode-proprietary-license"
] | permissive | firebase/firebase-ios-sdk | 5bb2b5ef2be28c993e993517059452ddb8bee1e6 | 1dc90cdd619c5e8493df4a01138e2d87e61bc027 | refs/heads/master | 2023-08-29T23:15:28.905909 | 2023-08-29T21:49:41 | 2023-08-29T21:49:41 | 89,033,556 | 5,048 | 1,594 | Apache-2.0 | 2023-09-14T21:11:30 | 2017-04-22T00:26:50 | Objective-C | UTF-8 | Swift | false | false | 5,547 | swift | // Copyright 2021 Google LLC
//
// 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 Foundation
/// A type that can be converted to a `HeartbeatsPayload`.
protocol HeartbeatsPayloadConvertible {
func makeHeartbeatsPayload() -> HeartbeatsPayload
}
/// A codable collection of heartbeats that has a fixed capacity and optimizations for storing
/// heartbeats of
/// multiple time periods.
struct HeartbeatsBundle: Codable, HeartbeatsPayloadConvertible {
/// The maximum number of heartbeats that can be stored in the buffer.
let capacity: Int
/// A cache used for keeping track of the last heartbeat date recorded for a given time period.
///
/// The cache contains the last added date for each time period. The reason only the date is
/// cached is
/// because it's the only piece of information that should be used by clients to determine whether
/// or not
/// to append a new heartbeat.
private(set) var lastAddedHeartbeatDates: [TimePeriod: Date]
/// A ring buffer of heartbeats.
private var buffer: RingBuffer<Heartbeat>
/// A default cache provider that provides a dictionary of all time periods mapping to a default
/// date.
static var cacheProvider: () -> [TimePeriod: Date] {
let timePeriodsAndDates = TimePeriod.allCases.map { ($0, Date.distantPast) }
return { Dictionary(uniqueKeysWithValues: timePeriodsAndDates) }
}
/// Designated initializer.
/// - Parameters:
/// - capacity: The heartbeat capacity of the inititialized collection.
/// - cache: A cache of time periods mapping to dates. Defaults to using static `cacheProvider`.
init(capacity: Int,
cache: [TimePeriod: Date] = cacheProvider()) {
buffer = RingBuffer(capacity: capacity)
self.capacity = capacity
lastAddedHeartbeatDates = cache
}
/// Appends a heartbeat to this collection.
/// - Parameter heartbeat: The heartbeat to append.
mutating func append(_ heartbeat: Heartbeat) {
guard capacity > 0 else {
return // Do not append if capacity is non-positive.
}
do {
// Push the heartbeat to the back of the buffer.
if let overwrittenHeartbeat = try buffer.push(heartbeat) {
// If a heartbeat was overwritten, update the cache to ensure it's date
// is removed.
lastAddedHeartbeatDates = lastAddedHeartbeatDates.mapValues { date in
overwrittenHeartbeat.date == date ? .distantPast : date
}
}
// Update cache with the new heartbeat's date.
heartbeat.timePeriods.forEach {
lastAddedHeartbeatDates[$0] = heartbeat.date
}
} catch let error as RingBuffer<Heartbeat>.Error {
// A ring buffer error occurred while pushing to the buffer so the bundle
// is reset.
self = HeartbeatsBundle(capacity: capacity)
// Create a diagnostic heartbeat to capture the failure and add it to the
// buffer. The failure is added as a key/value pair to the agent string.
// Given that the ring buffer has been reset, it is not expected for the
// second push attempt to fail.
let errorDescription = error.errorDescription.replacingOccurrences(of: " ", with: "-")
let diagnosticHeartbeat = Heartbeat(
agent: "\(heartbeat.agent) error/\(errorDescription)",
date: heartbeat.date,
timePeriods: heartbeat.timePeriods
)
let secondPushAttempt = Result {
try buffer.push(diagnosticHeartbeat)
}
if case .success = secondPushAttempt {
// Update cache with the new heartbeat's date.
diagnosticHeartbeat.timePeriods.forEach {
lastAddedHeartbeatDates[$0] = diagnosticHeartbeat.date
}
}
} catch {
// Ignore other error.
}
}
/// Removes the heartbeat associated with the given date.
/// - Parameter date: The date of the heartbeat needing removal.
/// - Returns: The heartbeat that was removed or `nil` if there was no heartbeat to remove.
@discardableResult
mutating func removeHeartbeat(from date: Date) -> Heartbeat? {
var removedHeartbeat: Heartbeat?
var poppedHeartbeats: [Heartbeat] = []
while let poppedHeartbeat = buffer.pop() {
if poppedHeartbeat.date == date {
removedHeartbeat = poppedHeartbeat
break
}
poppedHeartbeats.append(poppedHeartbeat)
}
poppedHeartbeats.reversed().forEach {
do {
try buffer.push($0)
} catch {
// Ignore error.
}
}
return removedHeartbeat
}
/// Makes and returns a `HeartbeatsPayload` from this heartbeats bundle.
/// - Returns: A heartbeats payload.
func makeHeartbeatsPayload() -> HeartbeatsPayload {
let agentAndDates = buffer.map { heartbeat in
(heartbeat.agent, [heartbeat.date])
}
let userAgentPayloads = [String: [Date]](agentAndDates, uniquingKeysWith: +)
.map(HeartbeatsPayload.UserAgentPayload.init)
.sorted { $0.agent < $1.agent } // Sort payloads by user agent.
return HeartbeatsPayload(userAgentPayloads: userAgentPayloads)
}
}
| [
135915,
391819,
323698,
385014,
135831
] |
3e6650d7dfaa7b9364f15ed0c5e196eb054b0c2a | 70fa3fe9e9dae9902c303c86ff5e04f660803c32 | /Sources/Safe.swift | 2f5ba3eca7973de930815904042aa32d188b950b | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | nokonoko2057/SwiftExtensions-1 | 99af07c3303e24c59ec7a322bad801a29466b59d | 684193923868557af54338325ce633edac1c4c67 | refs/heads/master | 2022-03-18T09:29:49.825646 | 2019-12-11T16:53:46 | 2019-12-11T16:53:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 775 | swift | //
// Safe.swift
// SwiftExtensions
//
// Created by Tatsuya Tanaka on 20171218.
// Copyright © 2017年 tattn. All rights reserved.
//
import Foundation
@propertyWrapper
public struct Safe<Wrapped: Codable>: Codable {
public let wrappedValue: Wrapped?
public init(wrappedValue: Wrapped?) {
self.wrappedValue = wrappedValue
}
public init(from decoder: Decoder) throws {
do {
let container = try decoder.singleValueContainer()
self.wrappedValue = try container.decode(Wrapped.self)
} catch {
self.wrappedValue = nil
}
}
public func encode(to encoder: Encoder) throws {
var container = encoder.singleValueContainer()
try container.encode(wrappedValue)
}
}
| [
-1
] |
d0ed2ab48aa0e1ba52a4b578217985d6f0f3ccc8 | 7ce200e2cd493507931f7ccfd1e1619118c5a697 | /fitsmeright/Scence/Main/Feed/NotificationVC/NotificationCA.swift | 27ff88d22c6e10ed1d84c6e546bc72b1214c213a | [] | no_license | thelynnparkk/fitsmeright | 02d888c01bf841da83e0b72e93308ad127991444 | 5ab0e49a8b4f5a35d28afa4c6e7f85f74460a102 | refs/heads/master | 2020-04-10T08:50:21.524039 | 2019-04-10T15:06:38 | 2019-04-10T15:06:38 | 160,916,807 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,065 | swift | //
// NotificationCA.swift
// fitsmeright
//
// Created by Lynn Park on 28/3/2562 BE.
// Copyright © 2562 silpakorn. All rights reserved.
//
import UIKit
class NotificationCADisplayed: AGCADisplayed {
}
extension NotificationCA:
UICollectionViewDelegate,
UICollectionViewDataSource,
UICollectionViewDelegateFlowLayout,
AGCCDelegate,
AGCRVDelegate
{
}
class NotificationCA: AGCA {
//MARK: - Enum
//MARK: - UI
//MARK: - NSLayout
//MARK: - Constraint
typealias Displayed = NotificationCADisplayed
typealias CC = FriendRequestCC
var displayedCasted: Displayed? {
return displayedCA as? Displayed
}
//MARK: - Instance
//MARK: - Flag
//MARK: - Storage
//MARK: - Apperance
//MARK: - Initial
override func setupInit() {
super.setupInit()
//MARK: Core
//MARK: Component
collection.setupCollectionDefault()
collection.setupScrollVertical()
collection.register(nibWithCellClass: CC.self)
collection.delegate = self
collection.dataSource = self
collection.backgroundColor = .clear
collection.allowsSelection = true
collection.contentInsetAdjustmentBehavior = .always
collection.isPrefetchingEnabled = true
let layout = UICollectionViewFlowLayout()
collection.collectionViewLayout = layout
//MARK: Other
//MARK: Snp
//MARK: Localize
setupLocalize()
//MARK: Data
}
override func setupPrepare() {
super.setupPrepare()
}
override func setupDeinit() {
super.setupDeinit()
}
//MARK: - Setup View
//MARK: - Setup Data
override func setupData(with displayed: AGCADisplayed?) {
if let displayed = displayed as? Displayed {
displayedCA = displayed
} else {
displayedCA = Displayed()
}
collection.reloadData()
collection.isUserInteractionEnabled = true
collection.collectionViewLayout.invalidateLayout()
collection.refreshControl?.endRefreshing()
}
//MARK: - Event
//MARK: - Public
override func setupLocalize() {
}
//MARK: - Private
//MARK: - Core - UICollectionViewDataSource
func numberOfSections(in collectionView: UICollectionView) -> Int {
return displayedCA.sections.count
}
public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
guard !isSectionEmpty() else {
return 0
}
return displayedCA.sections[section].items.count
}
public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
guard !isSectionEmpty() else {
return UICollectionViewCell()
}
let cell = collectionView.dequeueReusableCell(withClass: CC.self, for: indexPath)
let item = displayedCasted?.sections[indexPath.section].items[indexPath.row] as? CC.Displayed
cell.indexPath = indexPath
cell.delegate = self
item?.isAnimated = false
cell.setupData(with: item)
cell.roundedIcon()
return cell
}
//MARK: - Core - UICollectionViewDelegate
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
guard !isRowInSectionEmpty(with: indexPath) else {
return
}
collectionView.deselectItem(at: indexPath, animated: true)
delegate?.agCAPressed(self, action: [], indexPath: indexPath)
}
// func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForFooterInSection section: Int) -> CGSize {
// return CRV.Sizing.size(with: collectionView.frame, height: 50)
// }
//MARK: - Core - UICollectionViewDelegateFlowLayout
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return CC.Sizing.size(with: collectionView.bounds)
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
return CC.Sizing.inset()
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
return CC.Sizing.lineSpace()
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
return CC.Sizing.itemSpace()
}
//MARK: - Custom - AGCCDelegate
func agCCPressed(_ cell: AGCC, action: Any, indexPath: IndexPath) {
delegate?.agCAPressed(self, action: action, indexPath: indexPath)
}
//MARK: - Custom - AGCRVDelegate
func agCRVPressed(_ view: AGCRV, action: Any, section: Int) {
}
//MARK: - Pod - Protocol
}
| [
-1
] |
ee9c16a34d34ba9a73735e2deaad49534058c6a7 | 6a6e69e4419f43977deb25153fb98c5f20213afd | /Calculator SimulatorUITests/Calculator_SimulatorUITests.swift | 4f3eb4783e0b7d5d67ea9bfa88d51a18efcd1939 | [] | no_license | kpritchett/Calculator-Simulator | 03ab48ccfb69a14b7671b607065943320f36945a | da2bfcf5021da759c39b464c08b431bd8bc3d6d8 | refs/heads/master | 2021-01-21T21:04:58.372574 | 2017-05-24T14:18:13 | 2017-05-24T14:18:13 | 92,299,890 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,274 | swift | //
// Calculator_SimulatorUITests.swift
// Calculator SimulatorUITests
//
// Created by Student on 4/4/17.
// Copyright © 2017 Student. All rights reserved.
//
import XCTest
class Calculator_SimulatorUITests: XCTestCase {
override func setUp() {
super.setUp()
// 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
// UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
XCUIApplication().launch()
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
}
| [
333827,
243720,
282634,
313356,
237599,
241695,
223269,
229414,
292901,
354342,
102441,
315433,
278571,
325675,
354346,
124974,
282671,
102446,
229425,
243763,
241717,
229431,
180279,
215095,
319543,
213051,
288829,
325695,
288835,
237638,
313415,
239689,
315468,
311373,
278607,
196687,
311377,
354386,
223317,
315477,
354394,
323678,
321632,
315489,
45154,
313446,
227432,
215144,
233578,
194667,
307306,
278637,
288878,
319599,
278642,
284789,
131190,
288890,
292987,
215165,
131199,
227459,
235661,
241809,
323730,
278676,
311447,
327834,
284827,
299166,
278690,
233635,
311459,
299176,
284840,
278698,
284843,
278703,
278707,
125108,
180409,
278713,
295099,
223418,
299197,
227517,
280767,
258233,
299202,
139459,
309443,
176325,
131270,
301255,
227525,
280779,
233678,
227536,
282832,
280792,
311520,
325857,
182503,
319719,
338151,
317676,
286957,
125166,
125170,
313595,
125180,
184574,
125184,
309504,
125192,
125197,
125200,
227601,
125204,
319764,
278805,
334104,
282908,
299294,
125215,
282912,
233761,
278817,
311582,
211239,
282920,
125225,
317738,
321839,
315698,
98611,
125236,
282938,
307514,
278843,
168251,
287040,
319812,
227655,
280903,
319816,
323914,
201037,
282959,
229716,
289109,
168280,
379224,
391521,
239973,
381286,
313703,
285031,
280938,
242027,
242028,
321901,
278895,
354671,
287089,
199030,
291193,
291194,
248188,
313726,
211327,
291200,
158087,
227721,
242059,
311692,
285074,
227730,
240020,
315798,
291225,
317851,
285083,
227743,
283039,
289185,
285089,
293281,
305572,
242079,
156069,
289195,
377265,
299449,
311739,
319931,
293309,
278974,
311744,
317889,
291266,
278979,
278988,
289229,
281038,
326093,
281039,
283088,
283089,
278992,
279000,
242138,
285152,
279009,
291297,
188899,
195044,
279014,
242150,
319976,
279017,
311787,
281071,
319986,
279030,
311800,
279033,
317949,
279042,
233987,
322057,
342537,
279053,
182802,
283154,
303635,
279061,
188954,
279066,
322077,
291359,
227881,
293420,
283185,
279092,
23093,
234037,
244279,
244280,
338491,
301635,
309831,
322119,
55880,
377419,
303693,
281165,
301647,
326229,
309847,
189016,
115287,
111197,
295518,
287327,
242274,
244326,
279143,
287345,
313970,
301688,
189054,
287359,
297600,
291455,
279176,
311944,
334473,
316044,
184974,
311950,
316048,
287379,
227991,
295575,
289435,
303772,
205469,
221853,
285348,
279207,
295591,
295598,
279215,
318127,
342705,
299698,
285362,
164532,
287412,
166581,
154295,
287418,
303802,
66243,
291529,
287434,
225996,
363212,
287438,
242385,
303826,
279253,
158424,
230105,
299737,
322269,
342757,
295653,
289511,
230120,
330473,
234216,
285419,
289517,
279278,
312046,
215790,
170735,
199415,
234233,
279293,
289534,
322302,
205566,
299777,
285443,
228099,
291591,
295688,
322312,
285450,
312076,
295698,
166677,
291605,
283418,
285467,
221980,
281378,
234276,
318247,
262952,
262953,
279337,
318251,
289580,
262957,
283431,
293673,
301872,
242481,
303921,
234290,
285493,
230198,
285496,
201534,
281407,
295745,
222017,
293702,
318279,
283466,
281426,
279379,
295769,
201562,
234330,
281434,
322396,
230238,
301919,
293729,
279393,
349025,
303973,
279398,
177002,
308075,
242540,
310132,
295797,
177018,
269179,
279418,
308093,
314240,
291713,
158594,
240517,
287623,
228232,
299912,
320394,
316299,
416649,
234382,
308111,
308113,
293780,
289691,
209820,
277404,
240543,
283551,
189349,
289704,
279465,
177074,
304050,
289720,
289723,
189373,
213956,
19398,
345030,
279499,
56270,
191445,
304086,
183254,
183258,
234469,
314343,
304104,
324587,
320492,
183276,
203758,
320495,
234476,
289773,
277493,
320504,
312313,
312317,
328705,
234499,
293894,
320520,
230411,
320526,
234513,
238611,
140311,
293911,
316441,
197658,
132140,
189487,
281647,
322609,
312372,
203829,
238646,
300087,
238650,
320571,
21567,
308288,
160834,
336962,
314437,
349254,
238663,
300109,
207954,
234578,
296023,
314458,
156763,
277600,
281699,
230500,
285795,
322664,
228457,
318571,
279659,
234606,
300145,
238706,
312435,
187508,
230514,
279666,
302202,
285819,
314493,
285823,
234626,
279686,
222344,
285834,
318602,
228492,
337037,
234635,
177297,
162962,
187539,
308375,
324761,
285850,
296091,
119965,
302239,
234655,
300192,
339106,
306339,
234662,
300200,
3243,
238764,
322733,
279729,
300215,
294075,
64699,
228541,
283846,
312519,
283849,
148687,
290001,
189651,
316628,
279766,
189656,
279775,
310496,
298209,
304353,
304352,
279780,
228587,
279789,
290030,
302319,
234741,
283894,
316661,
208123,
292092,
279803,
228608,
234756,
322826,
242955,
312588,
177420,
318732,
126229,
318746,
320795,
320802,
130342,
304422,
130344,
292145,
298290,
312628,
300342,
222523,
286012,
181568,
279872,
294210,
216387,
286019,
193858,
279874,
300354,
300355,
304457,
230730,
372039,
296269,
234830,
224591,
238928,
296274,
314708,
318804,
283990,
357720,
300378,
300379,
316764,
314721,
292194,
230757,
281958,
314727,
134504,
306541,
327023,
234864,
312688,
284015,
296304,
230772,
314740,
314742,
314745,
290170,
224637,
306558,
290176,
243073,
179586,
306561,
314752,
294278,
314759,
296328,
298378,
304523,
368012,
318860,
314765,
296330,
279955,
306580,
314771,
224662,
234902,
282008,
314776,
318876,
290206,
148899,
314788,
298406,
282023,
241067,
279979,
314797,
286128,
279988,
286133,
284086,
310714,
302523,
284090,
228796,
302530,
280003,
228804,
310725,
306630,
415170,
300488,
292291,
306634,
280011,
302539,
300490,
310731,
310735,
312785,
222674,
280025,
310747,
239069,
144862,
286176,
320997,
187877,
310758,
280042,
280043,
191980,
300526,
337391,
282097,
296434,
308722,
40439,
191991,
286201,
300539,
288252,
312830,
286208,
290304,
228868,
292359,
218632,
323079,
230922,
323083,
294413,
304655,
323088,
282132,
230933,
302613,
282135,
316951,
374297,
302620,
313338,
282147,
306730,
230960,
288305,
239159,
290359,
323132,
157246,
288319,
288322,
280131,
349764,
310853,
124486,
194118,
288328,
286281,
292426,
282182,
224848,
290391,
128600,
306777,
235096,
212574,
345697,
204386,
300645,
312937,
224874,
243306,
312941,
310896,
294517,
314997,
288377,
290425,
325246,
333438,
235136,
280193,
282244,
239238,
288391,
286344,
323208,
282248,
179853,
286351,
188049,
229011,
239251,
323226,
179868,
229021,
302751,
282272,
282279,
298664,
317102,
286392,
300729,
302778,
306875,
280252,
296636,
282302,
280253,
286400,
323265,
321217,
280259,
239305,
280266,
296649,
212684,
241360,
282321,
286419,
241366,
280279,
18139,
294621,
282336,
294629,
153318,
12009,
282347,
288492,
282349,
34547,
67316,
323315,
286457,
284410,
282366,
286463,
319232,
278273,
282375,
323335,
282379,
116491,
280333,
216844,
284430,
161553,
124691,
284436,
278292,
118549,
116502,
282390,
278294,
325403,
321308,
321309,
282399,
241440,
282401,
325411,
315172,
241447,
333609,
286507,
294699,
284460,
280367,
300849,
282418,
282424,
280377,
321338,
319289,
413500,
280381,
241471,
280386,
280391,
153416,
315209,
280396,
307024,
317268,
237397,
307030,
241494,
188250,
284508,
300893,
284515,
276326,
282471,
296807,
282476,
292719,
296815,
313200,
313204,
317305,
124795,
317308,
339840,
315265,
280451,
327556,
188293,
282503,
67464,
243592,
325514,
315272,
315275,
184207,
124816,
311183,
282517,
294806,
214936,
294808,
239515,
214943,
298912,
319393,
333734,
219046,
284584,
313257,
292783,
300983,
343993,
288698,
98240,
294849,
214978,
280517,
280518,
214983,
282572,
282573,
153553,
231382,
323554,
292835,
190437,
292838,
294887,
317416,
313322,
298987,
278507,
311277,
296942,
124912,
327666,
278515,
325620,
239610
] |
45ec1908118fb277d52d551d1a02d545b3d4d731 | 43b396253dca3d9112103b001ef218764ba9da66 | /FlickrWorldAroundMe/Framework/utils-ios/IBInspectable/UIView+IBInspectable.swift | a3455a1fa0aa9539bf5decc81da5a071c5f96e88 | [
"MIT"
] | permissive | daniele99999999/FlickrWorldAroundMe | e913301a4d4d18201d5507bfe2fbdf4601fd02df | e0d29b53345aa5cde68c2137e6a90f03e2742fdd | refs/heads/master | 2020-05-01T09:25:55.232379 | 2019-04-07T23:10:18 | 2019-04-07T23:10:18 | 177,400,079 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,801 | swift | //
// UIView+IBInspectable.swift
//
//
// Created by daniele salvioni on 03/12/2018.
// Copyright © 2018 Daniele Salvioni. All rights reserved.
//
import UIKit
extension UIView
{
@IBInspectable var borderWidth: CGFloat
{
get
{
return layer.borderWidth
}
set
{
layer.borderWidth = newValue
}
}
@IBInspectable var rotation: CGFloat
{
get
{
return 0
}
set
{
self.transform = CGAffineTransform(rotationAngle: rotation / 180 * .pi)
}
}
@IBInspectable var borderColor: UIColor
{
get
{
return UIColor(cgColor: self.layer.borderColor!)
}
set
{
layer.borderColor = newValue.cgColor
}
}
@IBInspectable var cornerRadius: CGFloat
{
get
{
return layer.cornerRadius
}
set
{
layer.masksToBounds = (newValue > 0)
layer.cornerRadius = newValue
}
}
@available(iOS 11.0, *)
@IBInspectable var roundTL: Bool
{
get
{
return layer.maskedCorners.contains(.layerMinXMinYCorner)
}
set
{
if newValue { layer.maskedCorners.insert(.layerMinXMinYCorner) }
else { layer.maskedCorners.remove(.layerMinXMinYCorner) }
}
}
@available(iOS 11.0, *)
@IBInspectable var roundBL: Bool
{
get
{
return layer.maskedCorners.contains(.layerMinXMaxYCorner)
}
set
{
if newValue { layer.maskedCorners.insert(.layerMinXMaxYCorner) }
else { layer.maskedCorners.remove(.layerMinXMaxYCorner) }
}
}
@available(iOS 11.0, *)
@IBInspectable var roundTR: Bool
{
get
{
return layer.maskedCorners.contains(.layerMaxXMinYCorner)
}
set
{
if newValue { layer.maskedCorners.insert(.layerMaxXMinYCorner) }
else { layer.maskedCorners.remove(.layerMaxXMinYCorner) }
}
}
@available(iOS 11.0, *)
@IBInspectable var roundBR: Bool
{
get
{
return layer.maskedCorners.contains(.layerMaxXMaxYCorner)
}
set
{
if newValue { layer.maskedCorners.insert(.layerMaxXMaxYCorner) }
else { layer.maskedCorners.remove(.layerMaxXMaxYCorner) }
}
}
@IBInspectable var rotatioAngle : CGFloat
{
get
{
return 0
}
set
{
transform = CGAffineTransform(rotationAngle: newValue / 180 * CGFloat(Double.pi) )
}
}
}
| [
-1
] |
9d8e755d7077812e98ea85fc5d82528f614b216f | 7afb7c7ce7241948c59de0976366be1f6e8b365b | /Fringe/Fringe/Controller/VC/Host VC/HostPrivacyVC.swift | 50a9da0de6071368dcb1ed1a47e1bd3b0947d8f3 | [] | no_license | happyguleria1234/Fringe-app-Github | 098ef9013a75f1660e10e605b8ba23426aa6d4ed | 4acf4b19ef5699ac2723b390391cc53bd3e6746f | refs/heads/main | 2023-09-02T15:18:25.810262 | 2021-10-31T12:51:43 | 2021-10-31T12:51:43 | 394,952,002 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,716 | swift | //
// HostPrivacyVC.swift
// Fringe
//
// Created by Dharmani Apps on 02/09/21.
//
import UIKit
import Foundation
import WebKit
class HostPrivacyVC : BaseVC, WKNavigationDelegate {
@IBOutlet weak var privacyWebView: WKWebView!
//------------------------------------------------------
//MARK: Memory Management Method
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
//------------------------------------------------------
deinit { //same like dealloc in ObjectiveC
}
//------------------------------------------------------
//MARK: Custome
func openLinks() {
privacyWebView.frame = view.bounds
privacyWebView.navigationDelegate = self
let url = URL(string: PreferenceManager.shared.userBaseURL + "/Privacy.html")!
let urlRequest = URLRequest(url: url)
privacyWebView.load(urlRequest)
privacyWebView.autoresizingMask = [.flexibleWidth,.flexibleHeight]
}
//------------------------------------------------------
//MARK: Actions
@IBAction func btnBack(_ sender: Any) {
self.pop()
}
//------------------------------------------------------
//MARK: UIViewController
override func viewDidLoad() {
super.viewDidLoad()
openLinks()
}
//------------------------------------------------------
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
NavigationManager.shared.isEnabledBottomMenuForHost = false
}
//------------------------------------------------------
}
| [
-1
] |
3473a15eb89e12523da7bd71e13fc7727d7a4609 | 383f77f9cc3b941ae19b1d441bad093864cede33 | /Sources/Solana/Actions/getMintData/getMintData.swift | 44afa1dd10558b317910673ee50603f73d6d12f2 | [
"MIT"
] | permissive | Ahmed-Ali/Solana.Swift | 1d728b0fc417687525f0b5157bc6a4cf999e020a | ddc230fac0b4f18467ec5484941a1ff172874a95 | refs/heads/master | 2023-07-31T11:10:00.505509 | 2021-09-09T05:14:11 | 2021-09-09T05:14:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,289 | swift | import Foundation
public extension Action {
func getMintData(mintAddress: PublicKey, programId: PublicKey = .tokenProgramId, onComplete: @escaping ((Result<Mint, Error>) -> Void)) {
self.api.getAccountInfo(account: mintAddress.base58EncodedString, decodedTo: Mint.self) { result in
switch result {
case .success(let account):
if account.owner != programId.base58EncodedString {
onComplete(.failure(SolanaError.other("Invalid mint owner")))
return
}
if let data = account.data.value {
onComplete(.success(data))
return
}
onComplete(.failure(SolanaError.other("Invalid data")))
return
case .failure(let error):
onComplete(.failure(error))
return
}
}
}
func getMultipleMintDatas(mintAddresses: [PublicKey], programId: PublicKey = .tokenProgramId, onComplete: @escaping (Result<[PublicKey: Mint], Error>) -> Void) {
return ContResult.init { cb in
self.api.getMultipleAccounts(pubkeys: mintAddresses.map { $0.base58EncodedString }, decodedTo: Mint.self) {
cb($0)
}
}.flatMap {
let account = $0
if account.contains(where: {$0.owner != programId.base58EncodedString}) == true {
return .failure(SolanaError.other("Invalid mint owner"))
}
let values = account.compactMap { $0.data.value }
guard values.count == mintAddresses.count else {
return .failure(SolanaError.other("Some of mint data are missing"))
}
var mintDict = [PublicKey: Mint]()
for (index, address) in mintAddresses.enumerated() {
mintDict[address] = values[index]
}
return .success(mintDict)
}.run(onComplete)
}
}
extension ActionTemplates {
public struct GetMintData: ActionTemplate {
public init(programId: PublicKey = .tokenProgramId, mintAddress: PublicKey) {
self.programId = programId
self.mintAddress = mintAddress
}
public typealias Success = Mint
public let programId: PublicKey
public let mintAddress: PublicKey
public func perform(withConfigurationFrom actionClass: Action, completion: @escaping (Result<Mint, Error>) -> Void) {
actionClass.getMintData(mintAddress: mintAddress, programId: programId, onComplete: completion)
}
}
public struct GetMultipleMintData: ActionTemplate {
public init(programId: PublicKey = .tokenProgramId, mintAddresses: [PublicKey]) {
self.programId = programId
self.mintAddresses = mintAddresses
}
public typealias Success = [PublicKey: Mint]
public let programId: PublicKey
public let mintAddresses: [PublicKey]
public func perform(withConfigurationFrom actionClass: Action, completion: @escaping (Result<[PublicKey : Mint], Error>) -> Void) {
actionClass.getMultipleMintDatas(mintAddresses: mintAddresses, programId: programId, onComplete: completion)
}
}
}
| [
-1
] |
5e3f5e30b2bcfc816ec0fc849eeac84986ecacc5 | 3c1c4141c8eb134265fa5869a898638e380cbc04 | /Shadow Button/Shadow Button/AppDelegate.swift | e821807d75d75b885deb449ca821acf8a301377d | [] | no_license | ariflr/Quiz12Okt_1 | 78d9f2fd8715efcec174b229bc409655144993b6 | 347703ef8c0f367fdf629bb0054cfd1906b366a3 | refs/heads/master | 2021-07-15T16:16:09.225402 | 2017-10-17T04:17:37 | 2017-10-17T04:17:37 | 106,637,185 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,192 | swift | //
// AppDelegate.swift
// Shadow Button
//
// Created by arif luqman rabono on 10/12/17.
// Copyright © 2017 arif luqman rabono. 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,
311349,
286774,
286776,
319544,
286778,
229432,
204856,
352318,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
303241,
131209,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
295110,
286922,
286924,
286926,
319694,
286928,
131281,
131278,
278743,
278747,
295133,
155872,
131299,
319716,
237807,
303345,
286962,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
295220,
287032,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
172534,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
172552,
287238,
320007,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
172618,
303690,
33357,
287309,
303696,
279124,
172634,
262752,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
295538,
189039,
172660,
287349,
189040,
189044,
287355,
287360,
295553,
172675,
295557,
287365,
311942,
303751,
352905,
279178,
287371,
311946,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
164509,
303773,
172705,
287394,
172707,
303780,
287390,
287398,
205479,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
279231,
287427,
312005,
312006,
107208,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
312035,
279267,
295654,
279272,
230128,
312048,
312050,
230131,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303985,
328563,
303987,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
213895,
304007,
304009,
304011,
230284,
304013,
295822,
279438,
189325,
189329,
295825,
304019,
213902,
189331,
58262,
304023,
304027,
279452,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
230334,
304063,
238528,
304065,
213954,
189378,
156612,
295873,
213963,
197580,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
230413,
295949,
197645,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
296044,
279661,
205934,
164973,
312432,
279669,
337018,
189562,
279679,
304258,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
238766,
165038,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
230679,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
230718,
296259,
378181,
296262,
230727,
238919,
296264,
320840,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
148843,
410987,
230763,
230768,
296305,
312692,
230773,
304505,
304506,
181626,
279929,
181631,
148865,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
337306,
288154,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
279991,
288185,
337335,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
222676,
288212,
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,
402969,
230940,
222752,
108066,
296486,
296488,
157229,
239152,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
181854,
239202,
370279,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
419489,
190118,
198310,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
419522,
313027,
280260,
419525,
206536,
280264,
206539,
206541,
206543,
313044,
280276,
321239,
280283,
313052,
18140,
288478,
313055,
321252,
313066,
288494,
280302,
280304,
313073,
321266,
288499,
419570,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
337732,
304968,
280393,
280402,
173907,
313171,
313176,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
354265,
354270,
239586,
313320,
354281,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
321560,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
288947,
280755,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
305464,
280888,
280891,
289087,
108865,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
248153,
215387,
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,
436684,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
240132,
281095,
223752,
150025,
338440,
330244,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
289317,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
264845,
182926,
133776,
182929,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
240519,
322440,
314249,
338823,
183184,
142226,
289687,
224151,
240535,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
420829,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
380226,
298306,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
298365,
290174,
306555,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
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,
282255,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
196133,
282295,
282300,
323260,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
118593,
307009,
413506,
307012,
241475,
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,
290739,
241588,
282547,
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,
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,
307338,
233613,
241813,
307352,
299164,
299167,
315552,
184479,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
299185,
323763,
184503,
299191,
176311,
307385,
307386,
307388,
258235,
307390,
176316,
299200,
184512,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
184586,
282893,
291089,
282906,
291104,
233766,
299304,
295583,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
276052,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
291226,
242075,
283033,
194654,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
291254,
283062,
127417,
291260,
127421,
283069,
127424,
299457,
127429,
127431,
127434,
315856,
127440,
176592,
315860,
176597,
127447,
283095,
299481,
127449,
176605,
242143,
127455,
127457,
291299,
127460,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
127490,
127494,
283142,
127497,
233994,
135689,
127500,
291341,
233998,
127506,
234003,
127509,
234006,
127511,
152087,
283161,
242202,
234010,
135707,
242206,
135710,
242208,
291361,
242220,
291378,
234038,
152118,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
291456,
135808,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
299706,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
299740,
242396,
201444,
299750,
283368,
234219,
283372,
185074,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
291593,
234248,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
292433,
316233,
234313,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
242530,
349027,
234338,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
291711,
234368,
291714,
234370,
291716,
234373,
201603,
226182,
234375,
308105,
226185,
234379,
324490,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
234396,
324508,
291742,
226200,
234398,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
324522,
234410,
291756,
226220,
291754,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
275384,
324536,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
226245,
234437,
234439,
226239,
234443,
291788,
234446,
275406,
193486,
234449,
316370,
193488,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
324599,
234490,
234493,
316416,
234496,
308226,
234501,
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,
234648,
275606,
234650,
275608,
324757,
300189,
324766,
119967,
234653,
308379,
283805,
234657,
242852,
300197,
234661,
283813,
234664,
324768,
275626,
234667,
316596,
308414,
234687,
300226,
308418,
234692,
300229,
308420,
308422,
226500,
283844,
300234,
283850,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
283917,
177424,
349451,
275725,
349464,
415009,
283939,
259367,
292143,
283951,
300344,
226617,
243003,
283963,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
292192,
316768,
218464,
292197,
316774,
243046,
218473,
284010,
136562,
324978,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
300436,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
284076,
144814,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
227440,
316917,
308727,
292343,
300537,
316933,
316947,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
292414,
284223,
284226,
284228,
292421,
226886,
284231,
128584,
243268,
284234,
276043,
317004,
366155,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
276053,
284247,
317015,
284249,
243290,
284251,
235097,
284253,
300638,
284255,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
292479,
284288,
292481,
284290,
325250,
284292,
292485,
276095,
276098,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
276160,
358080,
284354,
358083,
284358,
276166,
358089,
284362,
276170,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
276187,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
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,
284502,
317271,
178006,
276315,
292700,
317279,
284511,
227175,
292715,
300912,
292721,
284529,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
317332,
358292,
284564,
399252,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
292776,
284585,
276395,
292784,
276402,
358326,
161718,
358330,
276410,
276411,
276418,
276425,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276448,
276452,
292839,
276455,
350186,
292843,
276460,
292845,
276464,
178161,
227314,
276466,
325624,
350200,
276472,
317435,
276476,
276479,
276482,
350210,
276485,
317446,
178181,
276490,
350218,
292876,
350222,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
178224,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
243779,
325700,
284739,
292934,
243785,
276553,
350293,
350295,
309337,
194649,
227418,
350302,
227423,
350304,
178273,
309346,
194657,
194660,
350308,
309350,
309348,
292968,
309352,
227426,
276579,
227430,
276583,
309354,
301167,
276590,
350321,
350313,
350316,
284786,
350325,
252022,
276595,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
284837,
153765,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
309450,
276685,
309455,
276689,
309462,
301272,
276699,
194780,
309468,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
227571,
309491,
309494,
243960,
276735,
227583,
227587,
276739,
211204,
276742,
227593,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
293227,
276843,
293232,
276848,
186744,
211324,
227709,
285061,
366983,
317833,
178572,
285070,
285077,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
129486,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
293387,
236043,
342541,
317963,
113167,
55822,
309779,
317971,
309781,
277011,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
219714,
129603,
301636,
318020,
301639,
301643,
277071,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
121458,
277106,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
334488,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
293555,
342707,
154292,
277173,
318132,
285368,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
342745,
137946,
342747,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
56045,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
293696,
310080,
277317,
277322,
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,
244731,
285690,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
293960,
310344,
277577,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
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,
384302,
285999,
277804,
113969,
277807,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
294221,
146765,
294223,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
146784,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
228776,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
310727,
64966,
245191,
163272,
277959,
277963,
302541,
277966,
302543,
310737,
277971,
228825,
163290,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
286233,
302617,
302621,
286240,
146977,
187936,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
278057,
310831,
245288,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286313,
40554,
286312,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
278227,
286420,
229076,
286425,
319194,
278235,
301163,
278238,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
278320,
319280,
319290,
229192,
302925,
188247,
280021,
188252,
237409,
229233,
294776,
360317,
294785,
327554,
360322,
40840,
294803,
40851,
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
] |
4d59fbf887ee364df1244ac674569a7464245821 | 43681a825bc5f4f8be23659243facae734b9ec07 | /Tests/CalculatorTests/OtherCalculatorTests.swift | 12b12efa905e0a390e8d094c17afef9d094c0d6d | [] | no_license | gnolanltu/Chapter2c | 99eb3613b6c92c570b5af7c3fb8cec1765d51d37 | e4d0e77c48d2db7691720f5651f028b74658c20c | refs/heads/master | 2020-02-26T16:05:37.406260 | 2016-10-15T18:25:17 | 2016-10-15T18:25:17 | 71,005,545 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,456 | swift | import XCTest
@testable import Calculator
extension OtherCalculatorTests {
static var allTests : [(String, (OtherCalculatorTests) -> () throws -> Void)] {
return [
("testSubWorksWithNegativeResult", testSubWorksWithNegativeResult),
("testMulByZeroCheck", testMulByZeroCheck),
("testMulNotEqual", testMulNotEqual),
("testMulLessThan", testMulLessThan),
("testMulGreaterThan", testMulGreaterThan),
("testMulParams", testMulParams),
("testDivByZeroCheck", testDivByZeroCheck)
]
}
}
class OtherCalculatorTests: XCTestCase {
var otherCalc : Calculator!
override func setUp() {
super.setUp()
otherCalc = Calculator()
}
override func tearDown() {
otherCalc = nil
}
func testSubWorksWithNegativeResult() {
XCTAssertEqual(otherCalc.sub(1,3),-2)
}
func testMulByZeroCheck() {
XCTAssertEqual(otherCalc.mul(2,0),0)
}
func testMulNotEqual() {
XCTAssertNotEqual(otherCalc.mul(2,2),5)
}
func testMulLessThan() {
XCTAssertLessThan(otherCalc.mul(2,2),5)
}
func testMulGreaterThan() {
XCTAssertGreaterThan(otherCalc.mul(2,3),5)
}
func testMulParams() {
let cases = [(4,3,12), (2,4,8), (3,5,15), (4,6,24)]
cases.forEach {
XCTAssertEqual(otherCalc.mul($0, $1), $2)
}
}
func testDivByZeroCheck() {
XCTAssertEqual(otherCalc.div(12,0),9999)
}
} | [
-1
] |
349448c4a815eb0eeb6f209b7a8ea776f8dd7e79 | 238616f6387a477e0542b4960a84100f77f92b24 | /Listpie/ProfileVC.swift | c42f78f1ef6ab8ac221679969338fd91af2caeb7 | [
"MIT"
] | permissive | ebru/listpie | ba780c05735af5167fb435a085357705092757d4 | 780beacef37e9dcf18a557dc99c6f8f01ce66b41 | refs/heads/master | 2020-08-28T20:51:08.096769 | 2019-11-30T07:36:54 | 2019-11-30T07:36:54 | 217,817,214 | 2 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 7,441 | swift | //
// ProfileVC.swift
// Listpie
//
// Created by Ebru on 14/09/2017.
// Copyright © 2017 Ebru Kaya. All rights reserved.
//
import UIKit
import Firebase
import SVProgressHUD
class ProfileVC: UIViewController {
var userID = String()
var isCurrentUser = Bool()
let currentUserID = (Auth.auth().currentUser?.uid)!
var profileID = String()
var user = User()
var refresher: UIRefreshControl!
var activeRow = 0
// Outlets
@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var logoutButton: UIBarButtonItem!
@IBOutlet weak var emptyDataView: UIStackView!
// Actions
@IBAction func logout(_ sender: Any) {
let alertController = UIAlertController(title: "Log out of the account?", message: nil, preferredStyle: UIAlertControllerStyle.alert)
let cancelAction = UIAlertAction(title: "Cancel", style: UIAlertActionStyle.cancel)
{
(result : UIAlertAction) -> Void in
}
alertController.addAction(cancelAction)
let okAction = UIAlertAction(title: "Log Out", style: UIAlertActionStyle.default)
{
(result : UIAlertAction) -> Void in
do {
try Auth.auth().signOut()
self.performSegue(withIdentifier: LOGOUT_SEGUE, sender: self)
} catch {
print(error)
}
}
alertController.addAction(okAction)
self.present(alertController, animated: true, completion: nil)
}
@IBAction func followOrEditBtnWasPressed(_ sender: Any) {
if isCurrentUser {
performSegue(withIdentifier: TO_EDIT_PROFILE, sender: self)
} else {
if user.isFollowed {
DataService.instance.removeUserFromFollowings(withUserID: profileID, forUID: currentUserID) { (isRemoved) in
self.reloadUserData()
}
} else {
DataService.instance.followUser(withUserID: profileID, forUID: currentUserID) { (isFollowed) in
self.reloadUserData()
}
}
}
}
// Custom Functions
@objc func refresh() {
DataService.instance.getUser(forUID: profileID, forCID: currentUserID) { (returnedUser) in
self.user = returnedUser
if self.user.lists.count >= 1 {
self.emptyDataView.isHidden = true
} else {
self.emptyDataView.isHidden = false
}
DispatchQueue.main.async {
self.tableView.reloadData()
self.refresher.endRefreshing()
}
}
}
func reloadUserData() {
DataService.instance.getUser(forUID: profileID, forCID: currentUserID) { (returnedUser) in
self.user = returnedUser
self.navigationItem.title = self.user.username
DispatchQueue.main.async {
SVProgressHUD.dismiss()
self.tableView.reloadData()
}
}
}
// System Functions
override func viewDidLoad() {
super.viewDidLoad()
emptyDataView.isHidden = true
SVProgressHUD.show()
if userID.isEmpty {
profileID = currentUserID
logoutButton.isEnabled = true
logoutButton.tintColor = .black
isCurrentUser = true
} else if userID == currentUserID {
profileID = currentUserID
logoutButton.isEnabled = false
logoutButton.tintColor = .clear
isCurrentUser = true
} else {
profileID = userID
logoutButton.isEnabled = false
logoutButton.tintColor = .clear
isCurrentUser = false
}
DataService.instance.getUser(forUID: profileID, forCID: currentUserID) { (returnedUser) in
self.user = returnedUser
self.navigationItem.title = self.user.username
if self.user.lists.count >= 1 {
self.emptyDataView.isHidden = true
} else {
self.emptyDataView.isHidden = false
}
DispatchQueue.main.async {
SVProgressHUD.dismiss()
self.tableView.reloadData()
}
}
refresher = UIRefreshControl()
refresher.addTarget(self, action: #selector(ProfileVC.refresh), for: UIControlEvents.valueChanged)
tableView.addSubview(refresher)
}
override func viewWillAppear(_ animated: Bool) {
reloadUserData()
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == TO_EDIT_PROFILE {
let editProfileVC = segue.destination as! EditProfileVC
editProfileVC.user = user
let barBtn = UIBarButtonItem()
barBtn.title = ""
navigationItem.backBarButtonItem = barBtn
}
if segue.identifier == TO_LIST_FROM_PROFILE {
let listVC = segue.destination as! ListVC
if !user.lists.isEmpty {
listVC.list = user.lists[activeRow]
} else {
listVC.list = List()
}
let barBtn = UIBarButtonItem()
barBtn.title = ""
navigationItem.backBarButtonItem = barBtn
}
}
}
// Extensions
extension ProfileVC: UITableViewDataSource, UITableViewDelegate {
func numberOfSections(in tableView: UITableView) -> Int {
return 3
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
switch section {
case 0:
return 1
case 1:
return 1
case 2:
return user.lists.count
default:
return 0
}
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
switch indexPath.section {
case 0:
guard let cell = tableView.dequeueReusableCell(withIdentifier: "UserProfileCell") as? UserProfileCell else { return UITableViewCell() }
cell.configureCell(user: user, isCurrentUser: isCurrentUser)
cell.selectionStyle = .none
return cell
case 1:
guard let cell = tableView.dequeueReusableCell(withIdentifier: "UserProfileListsLabelCell") as? UserProfileListsLabelCell else { return UITableViewCell() }
cell.listsLbl.text = "Lists"
cell.selectionStyle = .none
return cell
case 2:
guard let cell = tableView.dequeueReusableCell(withIdentifier: "UserProfileListsCell") as? UserProfileListsCell else { return UITableViewCell() }
cell.configureCell(list: user.lists[indexPath.row])
cell.selectionStyle = .none
return cell
default:
break
}
return UITableViewCell()
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
switch indexPath.section {
case 2:
activeRow = indexPath.row
performSegue(withIdentifier: TO_LIST_FROM_PROFILE, sender: self)
default:
break
}
}
}
| [
-1
] |
558686a066513294e6c356a2df2567f642435755 | cf615cb9b00706fb6e320d71c67aba4cf9d45f50 | /Yellr/Yellr/LocalPostDataModel.swift | f929bbfd7572c587a54f2acd127c7128ee39fe9e | [] | no_license | dkd903/yellr-ios | d46bdb32284876078ed5045831ae470ceb0825b6 | b53d3d5a0def1d288cc293e97bc9334df57ec245 | refs/heads/master | 2020-05-29T11:56:23.763982 | 2015-10-24T17:31:43 | 2015-10-24T17:31:43 | 36,257,781 | 2 | 1 | null | 2015-05-25T22:26:16 | 2015-05-25T22:26:15 | null | UTF-8 | Swift | false | false | 2,185 | swift | //
// LocalPostDataModel.swift
// Yellr
//
// Created by Debjit Saha on 6/5/15.
// Copyright (c) 2015 wxxi. All rights reserved.
//
import Foundation
class LocalPostDataModel: NSObject {
var lp_last_name : AnyObject?
var lp_language_code : AnyObject?
var lp_post_id : AnyObject?
var lp_verified_user : AnyObject?
var lp_post_datetime : AnyObject?
var lp_file_name : AnyObject?
var lp_media_text : AnyObject?
var lp_media_type_name : AnyObject?
var lp_preview_file_name : AnyObject?
var lp_media_caption : AnyObject?
var lp_first_name : AnyObject?
var lp_question_text : AnyObject?
var lp_is_up_vote : AnyObject?
var lp_down_vote_count : AnyObject?
var lp_has_voted : AnyObject?
var lp_language_name : AnyObject?
var lp_up_vote_count : AnyObject?
init( lp_last_name : AnyObject?, lp_language_code : AnyObject?, lp_post_id : AnyObject?, lp_verified_user : AnyObject?, lp_post_datetime : AnyObject?, lp_file_name : AnyObject?, lp_media_text : AnyObject?, lp_media_type_name : AnyObject?, lp_preview_file_name : AnyObject?, lp_media_caption : AnyObject?, lp_first_name : AnyObject?, lp_question_text : AnyObject?, lp_is_up_vote : AnyObject?, lp_down_vote_count : AnyObject?, lp_has_voted : AnyObject?, lp_language_name : AnyObject?, lp_up_vote_count : AnyObject?) {
self.lp_last_name = lp_last_name
self.lp_language_code = lp_language_code
self.lp_post_id = lp_post_id
self.lp_verified_user = lp_verified_user
self.lp_post_datetime = lp_post_datetime
self.lp_file_name = lp_file_name
self.lp_media_text = lp_media_text
self.lp_media_type_name = lp_media_type_name
self.lp_media_caption = lp_media_caption
self.lp_preview_file_name = lp_preview_file_name
self.lp_first_name = lp_first_name
self.lp_question_text = lp_question_text
self.lp_is_up_vote = lp_is_up_vote
self.lp_down_vote_count = lp_down_vote_count
self.lp_has_voted = lp_has_voted
self.lp_language_name = lp_language_name
self.lp_up_vote_count = lp_up_vote_count
super.init();
}
} | [
-1
] |
cc16cf2ab08ab62c94b186cb6e94d7df296d6d49 | 2efd692498cdb2b7ea869c32645cb7108fd2b197 | /ToDoApp(Programmatically)/ViewModel/TodoViewModel.swift | b059b86763c34994fed80ad5790f9ab4cee05f19 | [] | no_license | fortuneagu/TODO-App | b80053d92a98215fd834473959c189c1ee3f0430 | d231ede19205834f573604f6cbb4e61ee544ccbd | refs/heads/master | 2023-07-27T22:51:11.376690 | 2021-09-18T22:09:26 | 2021-09-18T22:09:26 | 407,976,574 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 365 | swift | //
// TodoViewModel.swift
// ToDoApp(Programmatically)
//
//
import UIKit.UIImage
struct TodoViewModel {
let title: String
let importance: String
let describe: String
let image: UIImage?
init(with model: TodoList) {
title = model.title!
describe = model.describe!
importance = model.importance!
image = UIImage(named: "info")
}
}
| [
-1
] |
6a434c93754a3add61fbaa15e8b05228120d16cc | f2b5133c0b5aa8a52d7e1d2df1b1ea583311088b | /MoviesApplication/Network/ApiManager.swift | 8708fb4761d2d3d15d744cb9f94020e1414ea07f | [] | no_license | jovanaaloleska/MoviesApplication | 6493d2e52bd0889abe9111d173a9646832491b00 | 795e115426efde7c3081c3ec4e5f1c8bb749afac | refs/heads/master | 2023-07-28T18:07:14.470714 | 2021-08-31T14:59:28 | 2021-08-31T14:59:28 | 387,461,922 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,030 | swift | //
// ApiManager.swift
// MoviesApplication
//
// Created by Jovana Loleska on 8/20/21.
//
import Foundation
import Alamofire
typealias completionHandler = ((_ success: Bool, _ responseData: [String:Any]?, _ statusCode: Int?) ->())
class ApiManager {
static let sharedInstance = ApiManager()
private func executeRequest (request: URLRequestConvertible, completion: @escaping completionHandler) {
AF.request(request).responseJSON { (response) in
switch response.result {
case .success(let value):
let json = value as? [String:Any]
if let response = response.response{
let statusCode = response.statusCode
if statusCode == 200 {
completion(true, json, statusCode)
} else {
completion(false, nil, statusCode)
}
}
case .failure(let error):
if let response = response.response {
let statusCode = response.statusCode
completion(false, nil, statusCode)
} else {
completion(false, nil, nil)
}
}
}
}
func getPopularShows(page: Int, completion: @escaping completionHandler) {
executeRequest(request: Router.PopularShows(page: page), completion: completion)
}
func getAiringToday(page: Int, completion: @escaping completionHandler) {
executeRequest(request: Router.AiringToday(page: page), completion: completion)
}
func getOnTheAirShows(page: Int, completion: @escaping completionHandler) {
executeRequest(request: Router.OnTheAirShows(page: page), completion: completion)
}
func getTopRatedShows(page: Int, completion: @escaping completionHandler) {
executeRequest(request: Router.TopRatedShows(page: page), completion: completion)
}
}
| [
-1
] |
a318992c6f3a3822fb63737c71353fed309264d6 | 8f3ec6866eab023570d43485279c2c0a1eddb631 | /Demo/Models/知识/Cells/KnowledgeHomeCell/KnowledgeRecomCell.swift | ba943e10395b8fb680139378ff6ef1e8cfb58f57 | [] | no_license | wangyongyue/ultimate | e09a1cdfe51dbc4f6d00c1944e5b9b035865828d | 3a736a35d0420ce15bb72e8973d0caa5cd968848 | refs/heads/master | 2020-06-30T10:24:32.903700 | 2019-12-09T05:56:30 | 2019-12-09T05:56:30 | 200,800,206 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,625 | swift | //
// KnowledgeRecomCell.swift
// Demo
//
// Created by apple on 2019/11/15.
// Copyright © 2019 test. All rights reserved.
//
import UIKit
import VueSwift
class KnowledgeRecomCell: UITableViewCell {
lazy private var headImage:UIImageView = {
let a = UIImageView()
a.layer.cornerRadius = 12
a.layer.masksToBounds = true
a.image = UIImage.init(named: "know_tou")
return a
}()
lazy private var nameLabel:UILabel = {
let a = UILabel()
a.textAlignment = .left
a.font = UIFont.boldSystemFont(ofSize: 12)
a.text = ""
return a
}()
lazy private var toDoLabel:UILabel = {
let a = UILabel()
a.textAlignment = .left
a.font = UIFont.boldSystemFont(ofSize: 12)
a.textColor = UIColor.lightGray
a.text = "Irobodslkd吃或,二人世界,咖啡控"
return a
}()
lazy private var timeLabel:UILabel = {
let a = UILabel()
a.textAlignment = .right
a.font = UIFont.boldSystemFont(ofSize: 12)
a.textColor = UIColor.lightGray
a.text = "1小时前"
return a
}()
lazy private var headerLabel:UILabel = {
let a = UILabel()
a.textAlignment = .left
a.text = "都说黄种人的身体素质大不了NFL,但是,又高又壮的蒙古摔跤手也不行吗?"
a.numberOfLines = 0
return a
}()
lazy private var conetentLabel:UILabel = {
let a = UILabel()
a.textAlignment = .left
a.text = "题目问的不错,能发自内心的希望同袍有朝一日鞥进军NFL的想法很好,而且将中华大地56个名族中最好的老实交代了司法局上来看对方水电费吉林省的飞机上来看东方嘉盛"
a.numberOfLines = 2
return a
}()
lazy private var line:UIView = {
let a = UIView()
a.backgroundColor = bgColor
return a
}()
lazy private var tap:UITapGestureRecognizer = {
let a = UITapGestureRecognizer()
return a
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.contentView.addSubview(self.headImage)
self.contentView.addSubview(self.nameLabel)
self.contentView.addSubview(self.toDoLabel)
self.contentView.addSubview(self.timeLabel)
self.contentView.addSubview(self.headerLabel)
self.contentView.addSubview(self.conetentLabel)
self.contentView.addSubview(self.line)
self.headerLabel.snp.makeConstraints { (make) in
make.top.equalTo(10)
make.left.equalTo(12)
make.right.equalTo(-12)
}
self.headImage.snp.makeConstraints { (make) in
make.top.equalTo(self.headerLabel.snp_bottomMargin).offset(10)
make.left.equalTo(self.headerLabel)
make.height.equalTo(30)
make.width.equalTo(30)
}
self.toDoLabel.snp.makeConstraints { (make) in
make.centerY.equalTo(self.headImage)
make.left.equalTo(self.headImage.snp_rightMargin).offset(10)
}
self.conetentLabel.snp.makeConstraints { (make) in
make.top.equalTo(self.headImage.snp_bottomMargin).offset(20)
make.left.equalTo(12)
make.right.equalTo(-12)
}
self.timeLabel.snp.makeConstraints { (make) in
make.top.equalTo(self.conetentLabel.snp_bottomMargin).offset(20)
make.left.equalTo(12)
}
self.line.snp.makeConstraints { (make) in
make.height.equalTo(6)
make.left.equalTo(0)
make.right.equalTo(0)
make.bottom.equalTo(0)
}
self.contentView.addGestureRecognizer(tap)
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override func setV_Model(_ aModel: VueData) {
if aModel is KnowledgeRecomCellModel{
let m = aModel as! KnowledgeRecomCellModel
tap.v_tap {
m.v_identifier = 0
m.v_to()
}
}
}
}
class KnowledgeRecomCellModel:VueData{
var name:String?
override func v_height() -> CGFloat {
return 180
}
}
| [
-1
] |
2404bc62505294ebfcf7b69b2eed3f2ace517ede | 63fa4e4e40ace8ed4f1c277d60a94c987962e117 | /RealmTableViewUITests/RealmTableViewUITests.swift | 6b3c1e80e3527e307a90ea30a2c7f5ce696d5070 | [] | no_license | brian-tran16/rxrealm-rxdataSource | 9cc7236b7eeb9268c9c0c5d5687b1464b304e363 | 5c2c0d7e81ee7c177d44a16e6435de50e1eea9ec | refs/heads/master | 2021-05-10T15:42:05.605537 | 2018-01-23T05:02:42 | 2018-01-23T05:02:42 | 118,559,753 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,254 | swift | //
// RealmTableViewUITests.swift
// RealmTableViewUITests
//
// Created by Tran Anh on 1/23/18.
// Copyright © 2018 anh. All rights reserved.
//
import XCTest
class RealmTableViewUITests: XCTestCase {
override func setUp() {
super.setUp()
// 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
// UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
XCUIApplication().launch()
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
}
| [
333827,
182277,
243720,
282634,
313356,
155665,
305173,
241695,
223269,
229414,
315431,
354342,
102441,
315433,
325675,
278571,
313388,
124974,
282671,
354346,
229425,
243763,
321589,
241717,
229431,
180279,
213051,
288829,
325695,
286787,
288835,
307269,
237638,
313415,
239689,
233548,
315468,
311373,
196687,
278607,
311377,
315477,
223317,
368732,
180317,
323678,
315488,
45154,
280676,
313446,
215144,
217194,
194667,
233578,
278637,
307306,
319599,
288878,
278642,
284789,
131190,
249976,
215165,
131199,
278669,
333968,
241809,
323730,
278676,
311447,
153752,
327834,
284827,
329884,
278684,
299166,
278690,
233635,
311459,
215204,
333990,
284840,
299176,
284843,
323761,
184498,
125108,
180409,
280761,
278713,
223418,
227517,
295099,
280767,
299202,
139459,
309443,
176325,
131270,
338118,
299208,
227525,
301255,
280779,
233678,
282832,
321744,
227536,
301270,
301271,
229591,
356575,
311520,
325857,
147679,
147680,
280803,
182503,
338151,
307431,
317676,
286957,
125166,
125170,
395511,
313595,
184574,
125184,
309504,
125192,
217352,
125200,
194832,
227601,
325904,
125204,
319764,
278805,
338196,
334104,
315674,
282908,
311582,
125215,
282912,
233761,
278817,
125225,
317738,
325930,
311596,
334121,
338217,
321839,
336177,
315698,
98611,
125236,
282938,
307514,
127292,
278843,
287040,
319812,
311622,
227655,
280903,
323914,
201037,
383309,
282959,
229716,
250196,
289109,
379224,
323934,
391521,
239973,
285031,
313703,
416103,
280938,
242027,
242028,
321901,
354671,
354672,
287089,
278895,
250227,
227702,
199030,
315768,
315769,
291193,
223611,
139641,
313726,
211327,
291200,
311679,
313736,
227721,
242059,
106893,
285074,
227730,
240020,
190870,
315798,
190872,
291225,
285083,
293275,
317851,
242079,
285089,
293281,
289185,
305572,
156069,
301482,
289195,
375211,
334259,
338359,
319931,
293309,
278974,
336319,
317889,
291266,
278979,
336323,
278988,
289229,
281038,
326093,
278992,
283089,
373196,
129484,
281039,
279000,
242138,
176602,
285152,
369121,
160224,
279009,
195044,
291297,
279014,
319976,
279017,
311787,
334315,
281071,
319986,
236020,
279030,
311800,
293368,
279033,
317949,
279042,
283138,
233987,
287237,
324098,
377352,
334345,
309770,
340489,
342537,
279053,
283154,
303635,
303634,
279061,
279060,
182802,
279066,
322077,
291359,
342560,
370122,
227881,
293420,
289328,
236080,
283185,
279092,
23093,
234037,
244279,
338491,
340539,
309831,
55880,
322119,
377419,
303693,
281165,
301647,
281170,
115287,
189016,
244311,
309847,
332379,
111197,
295518,
287327,
242274,
244326,
279143,
279150,
287345,
287348,
301688,
189054,
287359,
291455,
297600,
303743,
301702,
164487,
279176,
311944,
334473,
344714,
316044,
311950,
326288,
311953,
336531,
287379,
295575,
227991,
289435,
303772,
221853,
205469,
285348,
340645,
314020,
279207,
295591,
176810,
248494,
318127,
293552,
279215,
285362,
299698,
295598,
166581,
279218,
164532,
342705,
285360,
287418,
314043,
303802,
287412,
154295,
66243,
291529,
287434,
225996,
363212,
135888,
242385,
279249,
303826,
369365,
369366,
279253,
158424,
230105,
299737,
322269,
338658,
295653,
342757,
289511,
230120,
234216,
330473,
285419,
330476,
289517,
279278,
170735,
312046,
215790,
125683,
230133,
199415,
342775,
234233,
242428,
279293,
205566,
289534,
35584,
299777,
322302,
228099,
285443,
375552,
295688,
346889,
285450,
322312,
312076,
326413,
285457,
295698,
291605,
166677,
207639,
283418,
285467,
221980,
281378,
234276,
336678,
283431,
262952,
262953,
279337,
318247,
318251,
262957,
203560,
164655,
328495,
234290,
285493,
230198,
285496,
301883,
201534,
281407,
289599,
222017,
295745,
342846,
318279,
283466,
281426,
279379,
244569,
234330,
281434,
295769,
201562,
230238,
275294,
301919,
279393,
293729,
357219,
281444,
303973,
279398,
351078,
177002,
308075,
242542,
310132,
295797,
201590,
207735,
228214,
295799,
177018,
269179,
279418,
308093,
336765,
314240,
291713,
158594,
330627,
340865,
240517,
228232,
416649,
279434,
236427,
320394,
316299,
234382,
189327,
252812,
308113,
308111,
310166,
209820,
240543,
283551,
293801,
279465,
326571,
177074,
304050,
326580,
289720,
326586,
289723,
189373,
281541,
345030,
19398,
359365,
213961,
326602,
127945,
211913,
279499,
56270,
191445,
183254,
304086,
207839,
340960,
234469,
340967,
314343,
123880,
304104,
324587,
183276,
289773,
203758,
234476,
248815,
320495,
287730,
320492,
240631,
214009,
201721,
312313,
312317,
234499,
418819,
293894,
330759,
322571,
230411,
320526,
330766,
234513,
238611,
140311,
293911,
238617,
197658,
316441,
326684,
336930,
330789,
248871,
113710,
189487,
281647,
322609,
318515,
312372,
203829,
238646,
300087,
238650,
320571,
21567,
308288,
336962,
314437,
349254,
238663,
300109,
207954,
234578,
250965,
205911,
296023,
339031,
156763,
281698,
281699,
230500,
285795,
250982,
322664,
228457,
279659,
234606,
300145,
230514,
238706,
187508,
312435,
279666,
300147,
302202,
285819,
285823,
150656,
234626,
279686,
222344,
285833,
318602,
234635,
285834,
228492,
337037,
187539,
347286,
308375,
285850,
234655,
330912,
300192,
302239,
306339,
234662,
300200,
249003,
208044,
238764,
302251,
3243,
322733,
294069,
324790,
300215,
294075,
339131,
228541,
64699,
343230,
283841,
148674,
283846,
312519,
279752,
283849,
148687,
290001,
189651,
316628,
279766,
189656,
279775,
304352,
339167,
310496,
298209,
304353,
279780,
228587,
279789,
302319,
251124,
316661,
279803,
208123,
292092,
228608,
320769,
322826,
242955,
312588,
126229,
245018,
320795,
320802,
304422,
130342,
130344,
130347,
292145,
298290,
208179,
312628,
345398,
300342,
159033,
222523,
286012,
181568,
279872,
279874,
300355,
193858,
294210,
372039,
304457,
345418,
230730,
337228,
296269,
234830,
224591,
222542,
238928,
296274,
331091,
314708,
150868,
283990,
314711,
357720,
300378,
300379,
316764,
314721,
292194,
230757,
281958,
314727,
134504,
306541,
314734,
284015,
234864,
296304,
316786,
312688,
314740,
314742,
327030,
314745,
290170,
310650,
224637,
306558,
337280,
306561,
243073,
294278,
296328,
296330,
298378,
318860,
368012,
9618,
279955,
306580,
112019,
224662,
234902,
282008,
318876,
282013,
290206,
343457,
148899,
314788,
314790,
282023,
333224,
298406,
245160,
241067,
279980,
314797,
279979,
286128,
173492,
279988,
286133,
284086,
259513,
310714,
284090,
228796,
54719,
415170,
292291,
302530,
280003,
228804,
306630,
300488,
306634,
339403,
300490,
310731,
302539,
337359,
329168,
312785,
327122,
222674,
280020,
329170,
310735,
280025,
310747,
239069,
144862,
286176,
320997,
310758,
187877,
280042,
280043,
191980,
300526,
329198,
337391,
282097,
308722,
296434,
306678,
40439,
191991,
300539,
288252,
210429,
312830,
359931,
290304,
245249,
228868,
218632,
230922,
302602,
323083,
294413,
359949,
329231,
304655,
323088,
282132,
230933,
302613,
316951,
175640,
374297,
282135,
302620,
313338,
222754,
312879,
230960,
288305,
239159,
290359,
323132,
235069,
157246,
288319,
288322,
280131,
349764,
310853,
124486,
282182,
288328,
286281,
292426,
292424,
333389,
224848,
349780,
290391,
196184,
239192,
306777,
128600,
235096,
212574,
99937,
204386,
323171,
345697,
300643,
282214,
300645,
312937,
204394,
138862,
206447,
310896,
294517,
314997,
290425,
288377,
339579,
337533,
325246,
280193,
282244,
239238,
288391,
323208,
282248,
286344,
179853,
286351,
188049,
239251,
229011,
280217,
323226,
179868,
229021,
302751,
198304,
282272,
245413,
282279,
212649,
298666,
317102,
286387,
300725,
337590,
286392,
300729,
302778,
306875,
280252,
280253,
282302,
323262,
286400,
323265,
321217,
333508,
282309,
296649,
239305,
306891,
280266,
302798,
9935,
282321,
333522,
286419,
313042,
241366,
280279,
282330,
18139,
280285,
294621,
282336,
325345,
321250,
294629,
153318,
333543,
337638,
12009,
181992,
282347,
288492,
282349,
34547,
67316,
323315,
286457,
284410,
313082,
200444,
288508,
282366,
286463,
319232,
288515,
280326,
282375,
249606,
284425,
300810,
282379,
216844,
280333,
284430,
116491,
300812,
161553,
124691,
278292,
278294,
282390,
116502,
282399,
341791,
282401,
339746,
186148,
186149,
216868,
241447,
315172,
294699,
284460,
280367,
300849,
282418,
280373,
282424,
280377,
321338,
319289,
282428,
280381,
345918,
241471,
280386,
325444,
280391,
153416,
325449,
315209,
159563,
280396,
307024,
337746,
317268,
325460,
307030,
18263,
237397,
341846,
188250,
284508,
300893,
307038,
370526,
237411,
284515,
276326,
282471,
296807,
292713,
282476,
292719,
313200,
325491,
313204,
124795,
339840,
182145,
315265,
280451,
325508,
333700,
243590,
282503,
67464,
327556,
305032,
325514,
350091,
350092,
315272,
184207,
311183,
315275,
282517,
294806,
350102,
214936,
337816,
294808,
329627,
239515,
214943,
333727,
319393,
298912,
294820,
118693,
219046,
333734,
294824,
298921,
284584,
313257,
292783,
126896,
300983,
288698,
98240,
294849,
280517,
280518,
282572,
282573,
153553,
231382,
329696,
323554,
292835,
190437,
292838,
294887,
317416,
313322,
278507,
329707,
174058,
296942,
311277,
124912,
327666,
278515,
325620,
239610
] |
ab183ff405d1139adf70fd759a3096d42a3fe01f | 3b7072b8a773e7f5aec1ee1ecae7fbadc4a76a36 | /Deviget-Challenge/Deviget-Challenge/PostSplitView/PostListSplitViewController.swift | 8535f84c6da0d6e78aa0c5bbe8c6079a99ebd244 | [] | no_license | mercadermtz/Deviget-iOS-Swift-Test | 8c265e43b6e6ea9925884bd23c8132493cbe8507 | 56ad5c7e4d1e50bf99b439f83241ce315750626f | refs/heads/master | 2020-12-11T21:41:34.620763 | 2020-01-16T20:07:14 | 2020-01-16T20:07:14 | 233,965,979 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 688 | swift | //
// PostListSplitViewController.swift
// Deviget-Challenge
//
// Created by OLX - Gaston D Ippoliti on 15/01/2020.
// Copyright © 2020 GastonDippoliti. All rights reserved.
//
import UIKit
class PostListSplitViewController: UISplitViewController {
override func viewDidLoad() {
super.viewDidLoad()
preferredDisplayMode = .allVisible
delegate = self
}
}
extension PostListSplitViewController: UISplitViewControllerDelegate {
func splitViewController(_ splitViewController: UISplitViewController, collapseSecondary secondaryViewController: UIViewController, onto primaryViewController: UIViewController) -> Bool {
return true
}
}
| [
-1
] |
a62bc3ecf56ac3df9e24d0b224fd565ef9db1021 | 11684ad98884e7ab01aaf9870ba7285d37f0d3f0 | /SwiftSyntax_L3/Lesson3_Collections.playground/Contents.swift | add77f900ef57fc200391f05345f21d000026e74 | [] | no_license | qwertyshan/Playground | 6ef533470f89f783003d6a80c5104a27255ce7d5 | 5ffcce60e7101297ec5dfc7ddedc6e3d0c7e7b54 | refs/heads/master | 2021-01-10T04:50:43.644356 | 2016-01-15T10:44:24 | 2016-01-15T10:44:24 | 45,069,284 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,948 | swift | //: # Collections
import UIKit
import Foundation
// Array - ordered list of items
// Dictionary - collection of key-value pairs
// Set - unordered list of distinct values
//: ### Initializing Arrays
// The verbose way
var numbers = Array<Double>()
// More often you will see ...
var moreNumbers = [Double]()
moreNumbers = [85.0, 90.0, 95.0]
// Array literal syntax
let differentNumbers = [97.5, 98.5, 99.0]
// Array concatenation is super convenient in Swift.
moreNumbers = moreNumbers + differentNumbers
// An array can hold any type of object.
var circuit = [livingRoomSwitch, kitchenSwitch, bathroomSwitch]
//: ### Array operations: append, insert, remove, count, retrieve
var roadTripMusic = ["Neil Young","Kendrick Lamar","Flo Rida", "Nirvana"]
roadTripMusic.append("Rae Sremmurd")
roadTripMusic.insert("Dej Loaf", atIndex: 2)
roadTripMusic.removeAtIndex(3)
roadTripMusic.insert("Keith Urban", atIndex: 3)
roadTripMusic.count
let musician = roadTripMusic[2]
//: ### Dictionary initialization
// Initializer syntax
var groupsDict = [String:String]()
// Dictionary literal
var animalGroupsDict = [ "geese":"flock", "lions": "pride"]
// Another example
var averageLifeSpanDict = [String:Range<Int>]()
var lifeSpanDict = ["African Grey Parrot": 50...70, "Tiger Salamander": 12...15, "Bottlenose Dolphin": 20...30]
//: ### Dictionary operations: insert, remove, count, update, retrieve
// Adding items to a dictionary
animalGroupsDict["crows"] = "murder"
animalGroupsDict["monkeys"] = "troop"
// The count method is available to all collections.
animalGroupsDict.count
print(animalGroupsDict)
// Removing items from a dictionary
animalGroupsDict["crows"] = nil
animalGroupsDict
// Updating a value
animalGroupsDict["monkeys"] = "barrel"
var group = animalGroupsDict.updateValue("gaggle", forKey: "geese")
group.dynamicType
animalGroupsDict.updateValue("crash", forKey:"rhinoceroses")
print(animalGroupsDict)
//Retrieving the value for a particular key
let groupOfWhales = animalGroupsDict["whales"]
//: Why would the code below return an optional?
//:
//: animalGroupsDict["whales"]
// We unwrap a value returned from a dictionary just like we would unwrap any other optional.
if let groupOfWhales = animalGroupsDict["whales"] {
print("We saw a \(groupOfWhales) of whales from the boat.")
} else {
print("No value found for that key.")
}
// What happens if the key isn't found?
if let groupOfSasquatches = animalGroupsDict["Sasquatches"] {
print("We saw a \(groupOfSasquatches) of Sasquatches on our hike.")
} else {
print("No value found for that key.")
}
//: ## Sets
//: Literal syntax
var cutlery: Set = ["fork", "knife", "spoon"]
var flowers:Set<Character> = ["🌷","🌹","🌸"]
//: Initializer syntax
var utensils = Set<String>()
var trees = Set<Character>()
//: Set operations: Insert, Remove, Count
trees.insert("🌲")
trees.insert("🌳")
trees.insert("🌵")
trees.remove("🌵")
trees.count
| [
-1
] |
40ed6d01c59305ecd2a3969f4abec908caceab55 | 22dc9c931e09c1040e3a9cfd42eba88df0475ecd | /TouchID Example/AppDelegate.swift | e328106850cd257e5a59201118a2802dd3ebd5b2 | [] | no_license | macdevnet/iOS-Touch-Id-Example | 4707a7545f9a7db45cefed30676e39cdc46d12bd | 645a95958ddeffe3705e8e1b14c14936a3751864 | refs/heads/master | 2020-04-15T07:45:10.253296 | 2016-09-12T14:17:21 | 2016-09-12T14:17:21 | 68,015,833 | 3 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 270 | swift | //
// AppDelegate.swift
// TouchID Example
//
// Created by Scotty on 12/09/2016.
// Copyright © 2016 Streambyte Limited. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
}
| [
145767
] |
a6fe296f795c16397650373b4822cd6a91cd2144 | f9c8b8c16ad9cf79957d91b5fc2985e82808e95d | /GHFollowers/Custom Views/Labels/GFBodyLabel.swift | dec9165da47e7b15ecdcd913450e5076ad74381b | [] | no_license | erenerinanc/GHFollowers | c7d08521c62ba2514697944f63a3d5e08c0ec375 | e14bb5445fec349834d9ef6f8ffc361b4cae5423 | refs/heads/main | 2023-07-04T23:00:42.926989 | 2021-08-25T11:25:40 | 2021-08-25T11:25:40 | 393,344,802 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 883 | swift | //
// GFBodyLabel.swift
// GHFollowers
//
// Created by Eren Erinanc on 21.06.2021.
//
import UIKit
class GFBodyLabel: UILabel {
override init(frame: CGRect) {
super.init(frame: frame)
configure()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
convenience init(textAlignment: NSTextAlignment) {
self.init(frame: .zero)
self.textAlignment = textAlignment
}
private func configure() {
textColor = .secondaryLabel
font = UIFont.preferredFont(forTextStyle: .body)
adjustsFontSizeToFitWidth = true
minimumScaleFactor = 0.75
lineBreakMode = .byWordWrapping
self.translatesAutoresizingMaskIntoConstraints = false
}
}
| [
345896,
334075,
324813,
380415
] |
e4b93eec29e1e778a5b2ed095a9b566b52b420e7 | 9b80276fe35c40a119d251264ef78120dff864bc | /EventApp/Delegates/SceneDelegate.swift | 02f7db16249ccfc9d655e6c74e89fabccfc3091a | [] | no_license | Sj7800/EventApp | d824477115392a35ae8f27a4e1ba272dbff473d4 | b78b6db546b69d497576a86836e144eeb7bcaae6 | refs/heads/main | 2023-06-15T11:14:56.476846 | 2021-07-10T18:26:02 | 2021-07-10T18:26:02 | 384,730,294 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,295 | swift | //
// SceneDelegate.swift
// EventApp
//
// Created by Swapanjeet Singh on 08/07/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,
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,
164107,
336140,
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,
385714,
434868,
164535,
336568,
328379,
164539,
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,
115661,
386004,
345046,
386012,
386019,
328690,
435188,
328703,
328710,
418822,
328715,
377867,
361490,
386070,
271382,
336922,
345119,
377888,
345134,
345139,
361525,
386102,
361537,
377931,
345172,
189525,
156762,
402523,
361568,
148580,
345200,
361591,
386168,
410746,
361594,
214150,
345224,
386187,
345247,
361645,
345268,
402615,
361657,
337093,
402636,
328925,
165086,
66783,
165092,
222438,
386286,
328942,
386292,
206084,
328967,
345377,
353572,
345380,
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,
370208,
419360,
394787,
419363,
370214,
419369,
394796,
419377,
419386,
206397,
214594,
419401,
419404,
353868,
419408,
214611,
419412,
403040,
345702,
222831,
370298,
353920,
403073,
403076,
345737,
198282,
403085,
403092,
345750,
419484,
345758,
345763,
419492,
419498,
419502,
370351,
419507,
337588,
419510,
419513,
419518,
337601,
403139,
337607,
419528,
419531,
419536,
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,
337751,
247639,
370520,
313181,
182110,
354143,
354157,
345965,
345968,
345971,
345975,
403321,
1914,
354173,
247692,
395148,
337809,
247701,
329625,
436127,
436133,
247720,
337834,
362414,
337845,
190393,
346059,
346064,
247760,
346069,
419810,
329699,
354275,
190440,
354314,
346140,
436290,
378956,
395340,
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,
321787,
379135,
411905,
411917,
379154,
395539,
387350,
387353,
338201,
182559,
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,
191085,
338544,
346736,
191093,
346743,
346769,
150184,
174775,
248505,
174778,
363198,
223936,
355025,
273109,
355029,
264919,
256735,
338661,
264942,
363252,
338680,
264965,
338701,
256787,
363294,
199455,
396067,
346917,
396070,
215854,
355123,
355141,
355144,
338764,
355151,
330581,
330585,
387929,
355167,
265056,
265059,
355176,
355180,
355185,
412600,
207809,
379849,
396246,
330711,
248794,
248799,
437219,
257009,
265208,
265215,
199681,
338951,
330761,
330769,
330775,
248863,
158759,
396329,
347178,
404526,
396337,
330803,
396340,
339002,
388155,
339010,
347208,
248905,
330827,
248915,
183384,
339037,
412765,
257121,
322660,
265321,
248952,
420985,
330886,
330890,
347288,
248986,
44199,
380071,
339118,
249018,
339133,
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,
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,
339425,
249313,
339429,
339435,
249329,
69114,
372229,
208399,
380433,
175637,
405017,
134689,
339504,
265779,
421442,
413251,
265796,
265806,
224854,
224858,
339553,
257636,
224871,
372328,
257647,
372338,
224885,
224888,
224891,
224895,
372354,
421509,
126597,
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,
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,
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,
372739,
405534,
266295,
266298,
217158,
421961,
200786,
356440,
217180,
430181,
266351,
356467,
266365,
192640,
266375,
381069,
225425,
250003,
225430,
250008,
356507,
250012,
225439,
135328,
225442,
438434,
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,
356580,
225511,
217319,
225515,
225519,
381177,
397572,
389381,
381212,
356638,
356641,
356644,
356647,
266537,
356650,
389417,
356656,
332081,
307507,
340276,
356662,
397623,
332091,
225599,
201030,
348489,
332107,
151884,
430422,
348503,
332118,
250201,
250203,
250211,
340328,
250217,
348523,
348528,
332153,
356734,
389503,
332158,
438657,
332162,
389507,
348548,
356741,
250239,
332175,
160152,
373146,
340380,
373149,
70048,
356783,
373169,
266688,
324032,
201158,
340452,
127473,
217590,
340473,
324095,
324100,
324103,
324112,
340501,
324118,
324122,
340512,
332325,
324134,
381483,
356908,
324141,
324143,
356917,
324150,
324156,
168509,
348734,
324161,
324165,
356935,
381513,
348745,
324171,
324174,
324177,
389724,
332381,
373344,
340580,
348777,
381546,
119432,
340628,
184983,
373399,
258723,
332460,
389806,
332464,
332473,
381626,
332484,
332487,
332494,
357070,
357074,
332512,
332521,
340724,
332534,
155647,
373499,
348926,
389927,
348979,
152371,
348983,
340792,
398141,
357202,
389971,
357208,
389979,
430940,
357212,
357215,
439138,
201580,
201583,
349041,
340850,
381815,
430967,
324473,
398202,
119675,
324476,
430973,
340859,
340863,
324479,
324482,
373635,
324485,
324488,
185226,
381834,
324493,
324496,
324499,
430996,
324502,
324511,
422817,
324514,
201638,
398246,
373672,
324525,
5040,
111539,
324534,
5047,
324539,
324542,
398280,
349129,
340940,
340942,
209874,
340958,
431073,
398307,
340964,
209896,
201712,
209904,
349173,
381947,
201724,
431100,
349181,
431107,
209944,
209948,
357411,
250915,
250917,
169002,
357419,
209966,
209969,
209973,
209976,
209980,
209988,
209991,
209996,
431180,
341072,
349268,
177238,
250968,
210011,
373853,
341094,
210026,
210028,
210032,
349296,
210037,
210042,
210045,
349309,
152704,
160896,
349313,
210053,
210056,
349320,
373905,
259217,
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,
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,
358192,
366384,
366388,
210740,
358201,
325441,
366403,
325447,
341831,
341835,
341839,
341844,
415574,
358235,
341852,
350046,
399200,
399208,
358256,
268144,
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,
211161,
350426,
350449,
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,
260802,
350918,
154318,
342737,
391895,
154329,
416476,
64231,
113389,
342769,
203508,
375541,
342777,
391938,
391949,
375569,
326417,
375572,
375575,
375580,
162592,
334633,
326444,
383794,
326452,
326455,
375613,
244542,
260925,
375616,
326463,
326468,
342857,
326474,
326479,
326486,
416599,
342875,
244572,
326494,
433001,
400238,
326511,
211826,
211832,
392061,
351102,
359296,
252801,
260993,
351105,
400260,
211846,
342921,
342931,
400279,
252823,
392092,
400286,
252838,
359335,
211885,
252846,
400307,
351169,
359362,
351172,
170950,
359367,
326599,
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,
351382,
384152,
384158,
384161,
351399,
384169,
367795,
244917,
384182,
367801,
384189,
351424,
384192,
343232,
367817,
244938,
384202,
253132,
326858,
384209,
146644,
351450,
384225,
359650,
343272,
351467,
384247,
351480,
384250,
351483,
351492,
343307,
384270,
261391,
359695,
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,
155241,
245358,
155255,
155274,
368289,
245410,
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,
376672,
155488,
155492,
327532,
261997,
376686,
262000,
262003,
327542,
147319,
262006,
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,
311244,
393170,
155604,
155620,
253924,
155622,
327655,
253927,
360432,
393204,
360439,
253944,
393209,
393215
] |
231b6370304f3a0da3b9b111a9666d51eb8b7981 | 6924359fdc0c28529970a2fcfa7d467b46473588 | /3W Restos/SaveRestoVC.swift | ff892a75486f886c73ae0b637e338bf0c15766d9 | [] | no_license | srg-shgn/3WRestos | f2d1ddaf1831980bd237a65f9e715103d522fca4 | 72e318d2f308915eea668c4ae8502b5f02602c32 | refs/heads/master | 2021-01-15T15:57:15.356111 | 2017-08-08T14:45:07 | 2017-08-08T14:45:07 | 99,703,417 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,757 | swift | //
// SaveRestoVC.swift
// 3W Restos
//
// Created by Serge Sahaguian on 19/01/2017.
// Copyright © 2017 3wa. All rights reserved.
//
import UIKit
class SaveRestoVC: UIViewController {
var model: ModelController!
var addressSelected: String!
var newPosition: Position!
@IBOutlet weak var priceSegmentedControl: UISegmentedControl!
@IBOutlet weak var adressTF: UITextField!
@IBOutlet weak var nameTF: UITextField!
@IBOutlet weak var descriptionTF: UITextView!
@IBOutlet weak var restoImage: UIImageView!
@IBOutlet weak var addImageBtn: UIButton!
@IBAction func pressAddImage(_ sender: Any) {
pickImage()
}
@IBAction func pressSave(_ sender: UIBarButtonItem) {
var price: String
switch priceSegmentedControl.selectedSegmentIndex {
case 0:
price = "€"
case 1:
price = "€€"
case 2:
price = "€€€"
default:
price = "€"
}
if (nameTF.text?.characters.count)! < 1 {
buildAlert(msg: "Merci d'entrer un nom !")
return
}
if (descriptionTF.text?.characters.count)! < 1 {
buildAlert(msg: "Merci d'entrer une description !")
return
}
let name = nameTF.text
let description = descriptionTF.text
if let myImage = restoImage.image {
model.addNewRestaurant(name: name!, address: addressSelected, price: price, description: description!, position: newPosition, restoImage: myImage)
} else {
buildAlert(msg: "Merci d'ajouter une photo !")
return
}
let restoListVC = self.storyboard?.instantiateViewController(withIdentifier: "restoListID") as! RestosListVC
restoListVC.model = self.model
//on utilse la méthode ci dessous qui demande au NavigationController de charger restoListVC
self.navigationController?.show(restoListVC, sender: self)
}
override func viewDidLoad() {
super.viewDidLoad()
adressTF.text = addressSelected
}
private func buildAlert(msg: String) {
let alertController = UIAlertController(title: "message de 3W Restos", message: msg, preferredStyle: .alert)
let defaultAction = UIAlertAction(title: "OK", style: .default, handler: nil)
alertController.addAction(defaultAction)
present(alertController, animated: true, completion: nil)
}
}
extension SaveRestoVC: UIImagePickerControllerDelegate, UINavigationControllerDelegate {
func pickImage() {
let picker = UIImagePickerController()
picker.delegate = self
picker.allowsEditing = true //affiche l'édireur d'image
present(picker, animated: true, completion: nil)
}
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
var selectedImageFromPicker: UIImage?
if let editedImage = info["UIImagePickerControllerEditedImage"] as! UIImage? {
//on a une editedImage si o a croppé l'image dans l'éditeur
selectedImageFromPicker = editedImage
} else if let orignalImage = info["UIImagePickerControllerOriginalImage"] as! UIImage? {
selectedImageFromPicker = orignalImage
}
if let selectedImage = selectedImageFromPicker {
restoImage.image = selectedImage
}
addImageBtn.isHidden = true
dismiss(animated: true, completion: nil)
}
func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
dismiss(animated: true, completion: nil)
}
}
| [
-1
] |
e40e7bb9307c1654b29eb28a9c1df2bdf979e813 | 8d41846831018df5524842916b76905da3cc17f0 | /DesignPatterns/main.swift | fddd0f4173590f5459c1d6c1d563dc921901bbc5 | [] | no_license | mtalaga/Swift-Design-Patterns | 1c93362f6d0b4fd478115acc2ed474315309b785 | 3ca57fd991a4a5b91541ef829f6597b9ad7808b4 | refs/heads/master | 2020-04-18T00:25:37.839600 | 2016-09-12T19:56:08 | 2016-09-12T19:56:08 | 67,447,705 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 752 | swift | //
// main.swift
// DesignPatterns
//
// Created by Michał Talaga on 04.07.2016.
// Copyright © 2016 Michal Talaga. All rights reserved.
//
let wd : WildDuck = WildDuck()
wd.fly()
wd.quack()
var wdata: WeatherData = WeatherData()
var curr: ShowCurrentData = ShowCurrentData(subject: wdata)
var avg: ShowAvgData = ShowAvgData(subject: wdata)
wdata.setData(30.9, hum: 65, press: 1013.4)
wdata.setData(25.4, hum: 73, press: 1003.6)
var espresso: Drink = Espresso()
print ("\(espresso.description) \(espresso.calculatePrice())")
var hardFired: Drink = HardFired()
hardFired = Chocolate(drink: hardFired)
hardFired = Chocolate(drink: hardFired)
hardFired = Creme(drink: hardFired)
print("\(hardFired.description) \(hardFired.calculatePrice())") | [
-1
] |
b7b29e942eb533e9687511942629e5efe2bcaa43 | bc146a9403ff053d9e4b9f93e4b51b43eeaa6b17 | /Filterer/DataController.swift | eaa6998846d4a7602e64bd7037407060a1834927 | [] | no_license | jiemushi/Filterer-Swift-3 | 81128ce6a1c4ac2ae5a395d3aaaecedebe9778c3 | 2f9800af4881cb6a8556d9b7e58c7a576c57608b | refs/heads/master | 2021-01-21T11:56:52.945469 | 2017-05-19T05:43:56 | 2017-05-19T05:43:56 | 91,766,257 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,470 | swift | //
// DataController.swift
// PhotoFeed
//
// Created by Mike Spears on 2016-01-10.
// Copyright © 2016 YourOganisation. All rights reserved.
//
import Foundation
import CoreData
class DataController {
let managedObjectContext: NSManagedObjectContext
init(moc: NSManagedObjectContext) {
self.managedObjectContext = moc
}
convenience init?() {
guard let modelURL = Bundle.main.url(forResource: "Model", withExtension: "momd") else {
return nil
}
guard let mom = NSManagedObjectModel(contentsOf: modelURL) else {
return nil
}
let psc = NSPersistentStoreCoordinator(managedObjectModel: mom)
let moc = NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType)
moc.persistentStoreCoordinator = psc
let urls = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)
let persistantStoreFileURL = urls[0].appendingPathComponent("Bookmarks.sqlite")
do {
try psc.addPersistentStore(ofType: NSSQLiteStoreType, configurationName: nil, at: persistantStoreFileURL, options: nil)
} catch {
fatalError("Error adding store.")
}
self.init(moc: moc)
}
func tagFeedItem(_ tagTitle: String, feedItem: FeedItem) {
let tagsFetch = NSFetchRequest<NSFetchRequestResult>(entityName: "Tag")
tagsFetch.predicate = NSPredicate(format: "title == %@", tagTitle)
var fetchedTags: [Tag]!
do {
fetchedTags = try self.managedObjectContext.fetch(tagsFetch) as! [Tag]
} catch {
fatalError("fetch failed")
}
var tag: Tag
if fetchedTags.count == 0 {
tag = NSEntityDescription.insertNewObject(forEntityName: "Tag", into: self.managedObjectContext) as! Tag
tag.title = tagTitle
} else {
tag = fetchedTags[0]
}
let newImage = NSEntityDescription.insertNewObject(forEntityName: "Image", into: self.managedObjectContext) as! Image
newImage.title = feedItem.title
newImage.imageURL = feedItem.imageURL.absoluteString
newImage.tag = tag
do {
try self.managedObjectContext.save()
} catch {
fatalError("couldn't save context")
}
}
}
| [
-1
] |
cacf8d5837a378b4c19c24948de23629bc5202ed | 2980d55bd9f8f27760c218b1a40567073b0fa00c | /MobileWallet/Common/Extensions/Date.swift | fa2179b01d46d70f169a1f86b2586eec6c88248e | [
"BSD-3-Clause"
] | permissive | tari-project/wallet-ios | 3847c5712e8982c4de0665c2aa80af240fa5d2d9 | 08e029de86955316e4a9f60a91c6346aefb3073a | refs/heads/master | 2023-08-31T14:42:42.627737 | 2023-08-30T11:10:31 | 2023-08-30T11:10:31 | 213,589,121 | 26 | 23 | BSD-3-Clause | 2023-09-11T10:30:33 | 2019-10-08T08:30:30 | Swift | UTF-8 | Swift | false | false | 3,305 | swift | // Date.swift
/*
Package MobileWallet
Created by Jason van den Berg on 2019/11/14
Using Swift 5.0
Running on macOS 10.15
Copyright 2019 The Tari Project
Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the
following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of
its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import Foundation
extension Date {
/*
Creates a readable string from a given date
*/
func relativeDayFromToday() -> String? {
if Calendar.current.isDateInToday(self) {
let components = Calendar.current.dateComponents([.hour, .minute], from: self, to: Date())
guard let hours = components.hour else { return nil }
if hours == 0 {
guard let minutes = components.minute else { return nil }
guard minutes != 0 else {
return localized("tx_list.now")
}
return String(
format: localized("tx_list.relative_minutes"),
"\(minutes)"
)
}
return String(
format: localized("tx_list.relative_hours"),
"\(hours)"
)
} else if Calendar.current.isDateInYesterday(self) {
return localized("tx_list.yesterday")
} else {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = DateFormatter.dateFormat(fromTemplate: "MMM d, yyyy", options: 0, locale: .current)
// dateFormatter.timeZone = TimeZone.current
return dateFormatter.string(from: self)
}
}
/*
Creates a date and time string from a given date
*/
func formattedDisplay() -> String? {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = DateFormatter.dateFormat(fromTemplate: "MMMM d yyyy h:mm a", options: 0, locale: .current)
dateFormatter.timeZone = TimeZone.current
return dateFormatter.string(from: self)
}
}
| [
-1
] |
99cde464cddc2db48294ce9fb40885768f1e90de | e694f532b44337f774f767f8e2142313aeaa6fb8 | /News/Scenes/News/NewsViewDataSource.swift | 72725ce9ac871d304816c6c922a69845004ea88a | [] | no_license | duylinh/newsapi | be105b245b934e3d8076a52f5e77829f5bd98d42 | 9aa63a26ebc54776deb21e6309b301ebed02ed64 | refs/heads/master | 2021-01-13T23:39:03.291567 | 2020-02-25T01:26:14 | 2020-02-25T01:26:14 | 242,530,707 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,560 | swift | //
// NewsViewDataSource.swift
// News
//
// Created by Duy Linh Tran on 2/23/20.
// Copyright © 2020 Duy Linh Tran. All rights reserved.
//
import Foundation
import UIKit
// swiftlint:disable all
final class NewsViewDataSource: NSObject {
// MARK: - Properties
private unowned let viewModel: NewsViewModel
// MARK: - Con(De)structor
init(viewModel: NewsViewModel) {
self.viewModel = viewModel
}
// MARK: - Internal methods
func configure(with tableView: UITableView) {
tableView.backgroundColor = Colors.paleGrey
tableView.dataSource = self
tableView.delegate = self
tableView.register(ArticleCell.nib, forCellReuseIdentifier: ArticleCell.Identifier)
}
func configure(with collectionView: UICollectionView) {
collectionView.delegate = self
collectionView.dataSource = self
collectionView.backgroundColor = .clear
collectionView.isScrollEnabled = false
let flowLayout = AlignedCollectionViewFlowLayout(horizontalAlignment: .left, verticalAlignment: .top)
flowLayout.itemSize = CGSize(width: 155, height: 40)
flowLayout.minimumInteritemSpacing = 10
flowLayout.minimumLineSpacing = 10
flowLayout.estimatedItemSize = CGSize(width: 155, height: 40)
collectionView.collectionViewLayout = flowLayout
}
}
extension NewsViewDataSource: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return viewModel.articles.count
}
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if let itemCell = tableView.dequeueReusableCell(withIdentifier: ArticleCell.Identifier, for: indexPath) as? ArticleCell {
let item = self.viewModel.articles[indexPath.row]
itemCell.configure(item)
return itemCell
}
return UITableViewCell()
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
let item = self.viewModel.articles[indexPath.row]
self.viewModel.delegate?.didSelectItem(item)
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return ArticleCell.height
}
}
extension NewsViewDataSource : UICollectionViewDataSource {
public func numberOfSections(in collectionView: UICollectionView) -> Int {
return 1
}
public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return viewModel.keywords.count
}
public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
if let cell: KeywordCell = collectionView.dequeueReusableCell(withReuseIdentifier: KeywordCell.Identifier , for: indexPath) as? KeywordCell {
let item: KeywordModel = viewModel.keywords[indexPath.row]
cell.configure(with: item)
return cell
}
return UICollectionViewCell()
}
}
extension NewsViewDataSource: UICollectionViewDelegate {
public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
viewModel.updateKeywords(with: indexPath)
}
}
| [
-1
] |
22a8538580c1bb0c6dc16835ee492ccb10a14ff3 | 3b788db06a4556944a9fcf0a6857ae6ec9105be4 | /FAStoryKit/Views/ButtonView.swift | ed60bd798853ab7df8d13bea14fcedb6f3c9a43b | [
"MIT"
] | permissive | quacklabs/FAStoryKit | 1c7f8740114144a8f2db90a2b9fce021204f3363 | 176062a3302a833a356af5752bb272cb4f33c4a9 | refs/heads/master | 2022-12-19T05:51:01.548695 | 2020-09-17T10:07:44 | 2020-09-17T10:07:44 | 283,416,034 | 0 | 0 | null | 2020-07-29T06:19:32 | 2020-07-29T06:19:31 | null | UTF-8 | Swift | false | false | 3,814 | swift | //
// ButtonView.swift
// FAStoryKit
//
// Created by Mark Boleigha on 31/07/2020.
// Copyright © 2020 Sprinthub. MIT License
//
import UIKit
public class ButtonView: UIView {
var imageView: UIImageView!
var textView: UILabel!
// internal var clicked: (() -> Void)?
public var clicked: (() -> Void)?
// public var customView: UIView {
// didSet {
// _setupUI()
// }
// }
public var image: UIImage?
public var text: NSMutableAttributedString?
public var font: UIFont?
public var tint: UIColor?
public var customView: UIView?
var view: UIView!
init() {
super.init(frame: .zero)
_setupUI()
}
required public init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func _setupUI() {
self.backgroundColor = .white
view = UIView()
view.translatesAutoresizingMaskIntoConstraints = false
self.addSubview(view)
self.imageView = UIImageView()
self.imageView.contentMode = .scaleAspectFit
self.imageView.translatesAutoresizingMaskIntoConstraints = false
self.imageView.clipsToBounds = true
self.textView = UILabel()
textView.numberOfLines = 2
textView.lineBreakMode = .byWordWrapping
textView.textAlignment = .center
// textView.textColor = tint ?? .black
self.textView.translatesAutoresizingMaskIntoConstraints = false
self.textView.clipsToBounds = true
self.view.addSubview(imageView)
self.view.addSubview(textView)
self.addSubview(view)
NSLayoutConstraint.activate([
self.view.widthAnchor.constraint(equalToConstant: 60),
self.view.heightAnchor.constraint(equalToConstant: 80),
self.view.centerXAnchor.constraint(equalTo: self.centerXAnchor),
self.view.centerYAnchor.constraint(equalTo: self.centerYAnchor),
self.imageView.centerXAnchor.constraint(equalTo: self.view.centerXAnchor),
self.imageView.topAnchor.constraint(equalTo: self.view.topAnchor, constant: 10),
self.imageView.heightAnchor.constraint(equalToConstant: 30),
self.imageView.widthAnchor.constraint(equalToConstant: 30),
self.textView.topAnchor.constraint(equalTo: self.imageView.bottomAnchor, constant: 5),
self.textView.bottomAnchor.constraint(equalTo: self.view.bottomAnchor, constant: -5),
self.textView.leadingAnchor.constraint(equalTo: self.view.leadingAnchor),
self.textView.trailingAnchor.constraint(equalTo: self.view.trailingAnchor)
])
self.view.layer.borderColor = self.tint?.cgColor ?? UIColor.black.cgColor
self.view.layer.borderWidth = 0.4
self.view.layer.shadowOffset = CGSize(width: 0, height: 1)
self.view.layer.cornerRadius = 3
self.imageView.image = image?.withRenderingMode( (tint != nil) ? .alwaysTemplate : .alwaysOriginal)
self.imageView.tintColor = tint
self.textView.attributedText = text
self.textView.textColor = tint ?? UIColor.black
self.textView.font = self.font ?? UIFont.systemFont(ofSize: 11)
self.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.click)))
// self.textView.setNeedsDisplay()
// self.imageView.setNeedsDisplay()
self.setNeedsDisplay()
self.layoutIfNeeded()
}
public func apply() {
self.subviews.forEach({
$0.removeFromSuperview()
})
DispatchQueue.main.async {
self._setupUI()
}
}
@objc func click() {
self.clicked?()
}
//
}
| [
-1
] |
259b5e84a820b39749373cd9dac71e9eb1cf82e6 | ef804950949bdc915592b9872e857f6ae92e9d5c | /PixelGram/Classes/Shared/ViewModels/ImageViewModel.swift | 4ca744ec4105761e77bc9b192ac5b3b96a404631 | [
"MIT"
] | permissive | robbdimitrov/pixelgram-ios | 37f678aab664e3f0d5c76128dac41dff6e8f18f7 | b1b48b23b8ed3853e0e378c5b27b24ca73dbc00a | refs/heads/master | 2021-09-01T00:18:36.073508 | 2017-12-23T19:12:47 | 2017-12-23T19:12:47 | 108,124,827 | 2 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,224 | swift | //
// ImageViewModel.swift
// PixelGram
//
// Created by Robert Dimitrov on 10/27/17.
// Copyright © 2017 Robert Dimitrov. All rights reserved.
//
import UIKit
import RxSwift
class ImageViewModel {
var image: Image
var user: User?
var likes: Variable<Int>
static let dateFormatter = DateFormatter()
init(with image: Image) {
likes = Variable(image.likes)
self.image = image
user = UserLoader.shared.user(withId: image.owner)
configureDateFormatter()
}
// Getters
var isLikedByCurrentUser: Bool {
return image.isLiked
}
var isOwnedByCurrentUser: Bool {
if let currentUserId = Session.shared.currentUser?.id {
return image.owner == currentUserId
}
return false
}
var imageURL: URL? {
if image.filename.count > 0 {
return URL(string: APIClient.shared.urlForImage(image.filename))
}
return nil
}
var usernameText: String {
return user?.username ?? "Loading.."
}
var ownerAvatarURL: URL? {
if let avatarURL = user?.avatarURL, avatarURL.count > 0 {
return URL(string: APIClient.shared.urlForImage(avatarURL))
}
return nil
}
var likesText: String {
return "\(image.likes) \(image.likes == 1 ? "like" : "likes")"
}
var descriptionText: NSAttributedString? {
let usernameFont = UIFont.boldSystemFont(ofSize: 15.0)
let attributedString = NSMutableAttributedString(string: "\(user?.username ?? "Loading...") \(image.description)")
attributedString.setAttributes([.font : usernameFont], range: (attributedString.string as NSString).range(of: user?.username ?? "Loading..."))
return attributedString
}
var dateCreatedText: String {
return ImageViewModel.dateFormatter.string(from: image.dateCreated)
}
// MARK: - Actions
func likeImage(with user: User) {
let imageId = image.id
let isLiked = image.isLiked
let numberOfLikes = image.likes
let completion: () -> Void = {}
let failure: (String) -> Void = { [weak self] error in
self?.image.isLiked = isLiked
self?.image.likes = numberOfLikes
print("Liking image failed \(error)")
}
if isLikedByCurrentUser {
if let userId = Session.shared.currentUser?.id {
APIClient.shared.dislikeImage(withUserId: userId, imageId: imageId, completion: completion, failure: failure)
}
} else {
APIClient.shared.likeImage(withImageId: imageId, completion: completion, failure: failure)
}
image.isLiked = !isLiked
image.likes = (!isLiked ? numberOfLikes + 1 : numberOfLikes - 1)
}
// Configure date formatter
func configureDateFormatter() {
ImageViewModel.dateFormatter.dateStyle = .medium
ImageViewModel.dateFormatter.timeStyle = .short
ImageViewModel.dateFormatter.doesRelativeDateFormatting = true
}
}
| [
-1
] |
b88ee4d018aecbdb8f399070d3021ef980fd6128 | 29c983c1faed86e6149d2134003787214d9acb6e | /mockTabBrowser/AppDelegate.swift | c34e67835e3871a550f157345367a0d00f650920 | [] | no_license | mzgk/mockTabCollection | ef755de3403de85e076a7060653c492da59567a0 | 79ba6dd586426eda9e37be11969911cd2b6495a5 | refs/heads/master | 2020-07-04T05:36:49.654941 | 2016-11-18T10:06:50 | 2016-11-18T10:06:50 | 74,105,425 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,170 | swift | //
// AppDelegate.swift
// mockTabBrowser
//
// Created by mzgk on 2016/11/18.
// Copyright © 2016年 mzgk. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
278539,
294924,
229388,
278542,
229391,
327695,
229394,
278548,
229397,
229399,
229402,
352284,
229405,
278556,
278559,
229408,
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,
131264,
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,
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,
320007,
287238,
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,
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,
279231,
287427,
312005,
312006,
107208,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
312035,
279267,
295654,
279272,
230128,
312048,
312050,
230131,
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,
303987,
328563,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
304007,
213895,
304009,
304011,
230284,
304013,
295822,
279438,
189325,
189329,
295825,
304019,
189331,
213902,
58262,
304023,
304027,
279452,
234648,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
197564,
230334,
304063,
238528,
304065,
213954,
189378,
156612,
295873,
213963,
197580,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
230413,
295949,
197645,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
132165,
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,
230679,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
230718,
296259,
378181,
296262,
230727,
238919,
296264,
320840,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
148843,
410987,
230763,
230768,
296305,
312692,
230773,
304505,
304506,
181626,
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,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
288212,
222676,
148946,
288214,
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,
214535,
230923,
304651,
304653,
370187,
402969,
230940,
222752,
108066,
296486,
296488,
157229,
239152,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
181854,
239202,
370279,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
419489,
190118,
198310,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
419522,
313027,
280260,
419525,
206536,
280264,
206539,
206541,
206543,
263888,
313044,
280276,
321239,
280283,
313052,
18140,
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,
337732,
304968,
280393,
280402,
173907,
313171,
313176,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
354265,
354270,
239586,
313320,
354281,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
321560,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
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,
305464,
280891,
289087,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
248153,
215387,
354653,
354656,
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,
436684,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
330244,
281095,
223752,
150025,
338440,
240132,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
264845,
182926,
133776,
182929,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
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,
224151,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
420829,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
380226,
298306,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
306555,
298365,
290174,
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,
28219,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282255,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
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,
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,
298901,
44948,
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,
307386,
258235,
307388,
307385,
307390,
176316,
299200,
184512,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
323854,
291089,
282906,
291104,
233766,
295583,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
276052,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
283033,
242075,
291226,
194654,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
127431,
127434,
315856,
176592,
127440,
315860,
176597,
283095,
127447,
299481,
127449,
176605,
242143,
127455,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
127490,
283142,
127494,
127497,
233994,
135689,
127500,
291341,
233998,
127506,
234003,
127509,
234006,
127511,
152087,
283161,
242202,
234010,
135707,
135710,
242206,
242208,
291361,
242220,
291378,
152118,
234038,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
299740,
242396,
201444,
299750,
283368,
234219,
283372,
185074,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
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,
226230,
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,
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,
308379,
324757,
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,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
283917,
177424,
349451,
275725,
349464,
415009,
283939,
259367,
292143,
283951,
300344,
226617,
243003,
283963,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
316768,
292192,
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,
227426,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
316917,
292343,
308727,
300537,
316933,
316947,
308757,
308762,
284191,
316959,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
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,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
292479,
284288,
292481,
284290,
325250,
284292,
292485,
325251,
276095,
276098,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
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,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
186151,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
292681,
153417,
358224,
284499,
276308,
178006,
317271,
284502,
276315,
292700,
317279,
284511,
227175,
292715,
300912,
292721,
284529,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
317332,
358292,
284564,
399252,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
284585,
276395,
292776,
292784,
276402,
358326,
161718,
358330,
276410,
276411,
276418,
276425,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276448,
276452,
292839,
276455,
350186,
292843,
276460,
292845,
276464,
178161,
227314,
276466,
325624,
350200,
276472,
317435,
276476,
276479,
276482,
350210,
276485,
317446,
178181,
276490,
350218,
292876,
350222,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
178224,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
243779,
325700,
284739,
292934,
243785,
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,
227440,
350328,
292985,
301178,
350332,
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,
129486,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
293387,
236043,
342541,
317963,
113167,
55822,
309779,
317971,
309781,
277011,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
219714,
129603,
301636,
318020,
301639,
301643,
277071,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
309871,
121458,
277106,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
334488,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
293555,
318132,
342707,
154292,
277173,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
342745,
137946,
342747,
342749,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
56045,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
310080,
293696,
277317,
277322,
293706,
277329,
162643,
310100,
301911,
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,
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,
384302,
285999,
277804,
113969,
277807,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
294221,
146765,
294223,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
146784,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
228776,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
310727,
245191,
64966,
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,
310780,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
302617,
286233,
302621,
286240,
146977,
187936,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
278057,
310831,
245288,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286312,
40554,
286313,
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,
286420,
278227,
229076,
286425,
319194,
278235,
278238,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
280021,
188252,
237409,
229233,
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,
237508,
393177,
294876,
294879,
294883,
393190,
294890,
311279,
278513,
237555,
311283,
278516,
278519,
237562
] |
b67f5aacdc9cbad90daddb03640a48e13de18d96 | 8b2c434e10a7c83e32b67dd34a57eda4533fabb7 | /RickAndMortyAPI/DetailCell/DetailCell.swift | 41016309ae41f621a163ad717bd3bb0a596c84b6 | [] | no_license | anton2030t/Rick-and-Morty-API | bc30fa108ea9aee06c983efe4398c689d7b363a5 | 098a60a34bf7f50c671e3ac75d3a077a5a868098 | refs/heads/master | 2022-11-16T15:44:18.828454 | 2020-07-13T22:47:46 | 2020-07-13T22:47:46 | 279,392,174 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 640 | swift | //
// DetailCell.swift
// RickAndMortyAPI
//
// Created by Anton Larchenko on 13.07.2020.
// Copyright © 2020 Anton Larchenko. All rights reserved.
//
import UIKit
class DetailCell: UITableViewCell {
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var contentLabel: UILabel!
static let identifier = "DetailCell"
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
}
}
| [
100480,
317952,
431104,
211843,
337412,
300800,
300801,
300802,
271112,
348935,
271117,
373908,
276756,
288149,
196119,
334231,
305202,
289336,
306623,
306625,
306626,
323530,
323532,
323536,
327248,
312531,
358868,
384982,
180695,
180696,
312535,
287066,
358875,
358876,
384988,
287071,
37215,
265569,
339039,
270691,
317283,
350049,
340582,
302183,
355170,
384995,
302573,
340589,
330605,
271088,
271089,
308081,
302195,
317296,
222836,
262518,
340599,
244602,
305661
] |
f13a607e3c6443d263d683091a66222de37f6270 | da022226483b3eee8b8f92d4fd89bde7ecb01897 | /Comparte/Comparte/FamiliaViewController.swift | d3de66f27de2bb22ef55603307ab44911abf4b77 | [] | no_license | groupwaretech/Reto | b6584576773bb522cb8307bac168891ff06002b1 | 0fa65aceba7bb5dd961945d46393340b90697bd5 | refs/heads/master | 2021-01-20T05:07:45.519962 | 2015-02-28T17:08:28 | 2015-02-28T17:08:28 | 31,468,973 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,609 | swift | //
// FamiliaViewController.swift
// Comparte
//
// Created by HEINSOHN BUSINESS on 28/02/15.
// Copyright (c) 2015 App Design Vault. All rights reserved.
//
import Foundation
import UIKit
class FamiliaViewController : UIViewController {
internal var index: Int!
@IBOutlet var titleText: UINavigationItem!
@IBOutlet var back: UIBarButtonItem!
@IBOutlet var image: UIImageView!
@IBOutlet var familyDescription: UITextView!
struct Family {
let name : String
let image : String
let description : String
}
var families = [Family]()
override func viewDidLoad() {
super.viewDidLoad()
NSLog("%i", index)
self.families = [Family(name:"Familia Morales Yepes", image:"Familia-1", description: "Familia ubicada en la zona nororiental de Medellín, integrada por 12 personas. Actualmente los niños no están cursando sus estudios debido a la escacez económica, desplazamiento de los mismos. Esta es una familia muy necesitada.")
,Family(name:"Familia Gómez Pérez", image:"Familia-2", description: "Familia ubicada en el sector de Iguaná, integrada por 5 personas. Actualmente el padre de familia no tiene un empleo estable, él tiene habilidades en carpinteria. Sería de mucha ayuda si puede colaborar en encontrar un empleo")
,Family(name:"Familia Carrillo Rodríguez", image:"Familia-3", description: "Familia ubicada en el sector de Iguaná, integrada por 6 personas. El padre de familia busca urgente un empleo que le pemita llevar el sustento a casa. Sus habilidades están en su experiencia en la construcción")
,Family(name:"Familia Manzanera Bermudes", image:"Familia-4", description: "Familia ubicada en el sector de Manrrique en Medellín, integrada por 5 personas")
,Family(name:"Familia Vélez Contreras", image:"Familia-5", description: "Familia ubicada en el sector de Iguaná, integrada por 8 personas")]
titleText.title = self.families[index].name
image.image = UIImage(named: self.families[index].image)
familyDescription.text = self.families[index].description
switch index {
case 0:
NSLog("%@", "Case 0")
case 1:
NSLog("%@", "Case 1")
case 2:
NSLog("%@", "Case 2")
default:
NSLog("%@", "Default")
}
}
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
}
} | [
-1
] |
f8164955488a034a0d7a59c82b04e535814c0469 | dd58d331afd7727a9795e47822d2af59272bfe0a | /AudioKitSynthOne/Manager/Manager+callbacks.swift | d5bcb758c993bf813ec1bc8c3210016d622c9425 | [
"MIT"
] | permissive | gacky/AudioKitSynthOne | 44181e1bb3af390f6f66b075d0daf5f3c0b7ea96 | f7d11d3a142d5e7015a3bffe8c2b6b0087652b1a | refs/heads/master | 2020-04-08T17:13:49.440671 | 2018-10-07T03:31:40 | 2018-10-07T03:31:40 | 159,557,795 | 1 | 0 | MIT | 2018-11-28T20:01:35 | 2018-11-28T20:01:34 | null | UTF-8 | Swift | false | false | 5,184 | swift | //
// Manager+callbacks.swift
// AudioKitSynthOne
//
// Created by Aurelius Prochazka on 6/8/18.
// Copyright © 2018 AudioKit. All rights reserved.
//
extension Manager {
func setupCallbacks() {
guard let s = conductor.synth else {
AKLog("Manager view state is invalid because synth is not instantiated")
return
}
octaveStepper.callback = { value in
self.keyboardView.firstOctave = Int(value) + 2
}
configKeyboardButton.callback = { _ in
self.configKeyboardButton.value = 0
self.performSegue(withIdentifier: "SegueToKeyboardSettings", sender: self)
}
midiButton.callback = { _ in
self.midiButton.value = 0
self.performSegue(withIdentifier: "SegueToMIDI", sender: self)
}
modWheelSettings.callback = { _ in
self.modWheelSettings.value = 0
self.performSegue(withIdentifier: "SegueToMOD", sender: self)
}
midiLearnToggle.callback = { _ in
// Toggle MIDI Learn Knobs in subview
for knob in self.midiKnobs { knob.midiLearnMode = self.midiLearnToggle.isSelected }
// Update display label
if self.midiLearnToggle.isSelected {
let message = NSLocalizedString("MIDI Learn: Touch a knob to assign", comment: "MIDI Learn Instructions")
self.updateDisplay(message)
} else {
let message = NSLocalizedString("MIDI Learn Off", comment: "MIDI Learn Instructions")
self.updateDisplay(message)
self.saveAppSettingValues()
}
}
holdButton.callback = { value in
self.keyboardView.holdMode = !self.keyboardView.holdMode
if value == 0.0 {
self.stopAllNotes()
}
self.holdButton.accessibilityValue = self.keyboardView.holdMode ? NSLocalizedString("On", comment: "On") : NSLocalizedString("Off", comment: "Off")
}
monoButton.callback = { value in
let monoMode = value > 0 ? true : false
self.keyboardView.polyphonicMode = !monoMode
s.setSynthParameter(.isMono, value)
self.conductor.updateSingleUI(.isMono, control: self.monoButton, value: value)
self.monoButton.accessibilityValue = self.keyboardView.polyphonicMode ? NSLocalizedString("Off", comment: "Off") : NSLocalizedString("On", comment: "On")
}
keyboardToggle.callback = { value in
if value == 1 {
self.keyboardToggle.setTitle("Hide", for: .normal)
// Tell VoiceOver to NOT read elements in bottomContainerView if hidden by keyboard.
for subview in self.bottomContainerView.subviews {
subview.accessibilityElementsHidden = true
}
} else {
self.keyboardToggle.setTitle("Show", for: .normal)
// Tell VoiceOver to read elements in bottomContainerView as the keyboard is not hidden.
for subview in self.bottomContainerView.subviews {
subview.accessibilityElementsHidden = false
}
// Add panel to bottom
if self.bottomChildPanel == self.topChildPanel {
self.bottomChildPanel = self.bottomChildPanel?.rightPanel()
}
guard let bottom = self.bottomChildPanel else { return }
self.switchToChildPanel(bottom, isOnTop: false)
}
// Animate Keyboard
let newConstraintValue: CGFloat = (value == 1.0) ? 0 : -299
UIView.animate(withDuration: Double(0.4), animations: {
self.keyboardBottomConstraint.constant = newConstraintValue
self.view.layoutIfNeeded()
})
self.appSettings.showKeyboard = self.keyboardToggle.value
self.saveAppSettings()
}
modWheelPad.callback = { value in
switch self.activePreset.modWheelRouting {
case 0:
// Cutoff
let newValue = 1 - value
let scaledValue = Double.scaleRangeLog2(newValue, rangeMin: 120, rangeMax: 7_600)
s.setSynthParameter(.cutoff, scaledValue * 3)
self.conductor.updateSingleUI(.cutoff, control: self.modWheelPad, value: s.getSynthParameter(.cutoff))
case 1:
// LFO 1 Rate
s.setDependentParameter(.lfo1Rate, value, self.conductor.lfo1RateModWheelID)
case 2:
// LFO 2 Rate
s.setDependentParameter(.lfo2Rate, value, self.conductor.lfo2RateModWheelID)
default:
break
}
}
pitchBend.callback = { value01 in
s.setDependentParameter(.pitchbend, value01, Conductor.sharedInstance.pitchBendID)
}
pitchBend.completionHandler = { _, touchesEnded, reset in
if touchesEnded && !reset {
self.pitchBend.resetToCenter()
}
if reset {
s.setDependentParameter(.pitchbend, 0.5, Conductor.sharedInstance.pitchBendID)
}
}
}
}
| [
-1
] |
73062281c664ed299125a877e7d3e2a4f062563b | e960e843979d88e01820f1d2023dd7b8c915894d | /iDiary/CustomControlls/SearchBar.swift | 124e4b50d3be019b6154f7c01107d880e2e4f681 | [] | no_license | DeveloperBibin/diary | 592eebaf740235bc37e45ea2e704726ad129bd45 | e57b83ad0b9ed516555b8707c93d6d0169363a41 | refs/heads/master | 2022-04-06T22:29:01.029793 | 2020-02-20T04:38:24 | 2020-02-20T04:38:24 | 236,680,690 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 780 | swift | //
// SearchBar.swift
// iDiary
//
// Created by Bibin Benny on 05/02/20.
// Copyright © 2020 Bibin Benny. All rights reserved.
//
import SwiftUI
struct SearchBar: View {
@Binding var text : String
var placeHolder : String = "Search"
var body: some View {
HStack {
Image(systemName : "magnifyingglass")
.foregroundColor(Color(.secondaryLabel))
TextField(self.placeHolder, text: $text)
}
.padding(8)
.background(Color(.tertiarySystemFill))
.clipShape(RoundedRectangle(cornerRadius: 12))
.padding([.top,.trailing,.leading], 9)
}
}
struct SearchBar_Previews: PreviewProvider {
static var previews: some View {
SearchBar(text: .constant(""))
}
}
| [
-1
] |
c805eb2b8c861ad3b0f021a5aa0d8c23375f1279 | 1feaaae92689d4d64411c7a3cdcb151f2a4c29c0 | /FirebaseTemplate/FirebaseTemplate/Views/Post1.swift | 102da0bf7f69e08e2eb4a6cf516fa3f04b52de65 | [] | no_license | Mohammed-Baqer/swiftui-firebase-template | 7cb09c3db0204dd8628840ca97d36e0df4459a7d | 7332cd86a16ce1a8b89f085618d20e9d18176e60 | refs/heads/master | 2023-02-17T01:21:50.515905 | 2021-01-16T21:08:37 | 2021-01-16T21:08:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,050 | swift | //
// Post1.swift
// test
//
// Created by Mohammed on 1/15/21.
//
import SwiftUI
struct Post1: View {
var edges = UIApplication.shared.windows.first?.safeAreaInsets
@StateObject var postData = PostViewModel()
var body: some View {
VStack{
HStack{
Text("Posts")
.font(.largeTitle)
.fontWeight(.heavy)
.foregroundColor(Color("Liver"))
Spacer(minLength: 0)
Button(action: {postData.newPost.toggle()}) {
Image(systemName: "square.and.pencil")
.font(.title)
.foregroundColor(Color("Liver"))
}
}
.padding()
.padding(.top,edges!.top)
// Top Shadow Effect...
.background(Color("Tan"))
.shadow(color: Color.white.opacity(0.06), radius: 5, x: 0, y: 5)
if postData.posts.isEmpty{
Spacer(minLength: 0)
if postData.noPosts{
Text("No Posts !!!")
}
else{
ProgressView()
}
Spacer(minLength: 0)
}
else{
ScrollView{
VStack(spacing: 15){
ForEach(postData.posts){post in
PostRow(post: post,postData: postData)
}
}
.padding()
.padding(.bottom,55)
}
}
}
.fullScreenCover(isPresented: $postData.newPost) {
NewPost(updateId : $postData.updateId)
}
}
}
| [
-1
] |
656900e7877560e58a9f54e98b318de605d7565d | baf752a2dec2dc610b000815c6eb17b13bc0cd44 | /Lantern/RegisterViewController.swift | 9fd9fdc438f6463277676a7b3c194af396f87301 | [] | no_license | JacobCho/Lantern | de1ec17bb85a0fe68bc360cb3edd51d367178b3b | d941c4e4b2d2c1252590d5ddfb81c60fde09445e | refs/heads/master | 2016-09-05T19:22:15.000311 | 2014-12-04T05:11:03 | 2014-12-04T05:11:03 | 26,776,305 | 4 | 2 | null | null | null | null | UTF-8 | Swift | false | false | 7,375 | swift | //
// RegisterViewController.swift
// Lantern
//
// Created by Jacob Cho on 2014-11-17.
// Copyright (c) 2014 J & T. All rights reserved.
//
import Foundation
import UIKit
import Parse
class RegisterViewController: UIViewController, UITextFieldDelegate, UIActionSheetDelegate,UIImagePickerControllerDelegate, UINavigationControllerDelegate {
@IBOutlet weak var usernameTextField: UITextField!
@IBOutlet weak var emailTextField: UITextField!
@IBOutlet weak var passwordTextField: UITextField!
@IBOutlet weak var confirmPasswordTextField: UITextField!
@IBOutlet var pictureImageView: UIImageView!
@IBOutlet var teacher: UIButton!
var user:User = User()
var profileImageData:NSData?
override func viewDidLoad() {
super.viewDidLoad()
usernameTextField.delegate = self;
emailTextField.delegate = self;
passwordTextField.delegate = self;
confirmPasswordTextField.delegate = self;
teacher.hidden = true
pictureImageView.layer.cornerRadius = pictureImageView.frame.width/2
pictureImageView.clipsToBounds = true
// User default set (user is a iOS Student)
user.isIosStudent = true
user.isIosTA = false
user.isWebStudent = false
user.isWebTA = false
// user.room = RoomNames.None
}
@IBAction func registerButtonPressed(sender: UIButton) {
self.checkFieldsComplete()
}
@IBAction func teacherGesture(sender: UILongPressGestureRecognizer) {
if sender.state == .Began {
self.teacher.hidden = false
if user.isIosStudent{
user.isWebTA = false
user.isIosStudent = false
user.isIosTA = true
user.isWebStudent = false;
} else if user.isWebStudent {
user.isWebTA = true
user.isIosStudent = false
user.isIosTA = false
user.isWebStudent = false;
}
}
}
@IBAction func photoWasTapped(sender: UITapGestureRecognizer) {
let photoPickerActionSheet:UIActionSheet = UIActionSheet(title: "Take new photo or use existing", delegate: self, cancelButtonTitle: "Cancel", destructiveButtonTitle: nil, otherButtonTitles: "Take new photo", "Use photo from library")
photoPickerActionSheet.showInView(self.view)
}
func actionSheet(actionSheet: UIActionSheet, didDismissWithButtonIndex buttonIndex: Int) {
println("user clicked button at index:\(buttonIndex)")
switch buttonIndex{
case 1:
let newPhotoPicker:UIImagePickerController = UIImagePickerController()
newPhotoPicker.delegate=self
newPhotoPicker.sourceType = .Camera
newPhotoPicker.allowsEditing = true
self.presentViewController(newPhotoPicker, animated: true, completion: { () -> Void in
println("opening user's camera")
})
case 2:
let oldPhotoPicker:UIImagePickerController = UIImagePickerController()
oldPhotoPicker.delegate = self
oldPhotoPicker.sourceType = .SavedPhotosAlbum
oldPhotoPicker.allowsEditing = true
self.presentViewController(oldPhotoPicker, animated: true, completion: { () -> Void in
println("opening user's saved photos")
})
default:()
}
}
func imagePickerController(picker: UIImagePickerController!, didFinishPickingImage image: UIImage!, editingInfo: [NSObject : AnyObject]!) {
self.dismissViewControllerAnimated(true, completion: { () -> Void in
println("THIS PHOTO")
})
profileImageData = UIImageJPEGRepresentation(image, 0.5)
pictureImageView.image = image
pictureImageView.alpha = 1.0
println("user picked a photo!")
}
func imagePickerControllerDidCancel(picker: UIImagePickerController) {
self.dismissViewControllerAnimated(true, completion: nil)
}
/* Register Helper Methods */
func checkFieldsComplete() {
// Check if textfields are empty
if self.usernameTextField.text.isEmpty || self.emailTextField.text.isEmpty || self.passwordTextField.text.isEmpty || self.confirmPasswordTextField.text.isEmpty || self.profileImageData == nil {
// Show Alert
var incompleteAlert = SCLAlertView()
incompleteAlert.showError(self, title: "Could Not Log In", subTitle: "Please fill out all textfields and add a profile picture", closeButtonTitle: "Ok", duration: 0)
} else {
self.checkPasswordsMatch()
}
}
func checkPasswordsMatch() {
if self.passwordTextField.text == self.confirmPasswordTextField.text {
self.registerUser()
}
else {
// Show Alert
var passwordsAlert = SCLAlertView()
passwordsAlert.showError(self, title: "Could Not Register", subTitle: "Your passwords do not match", closeButtonTitle: "Ok", duration: 0)
}
}
func registerUser() {
user.username = self.usernameTextField.text!
user.email = self.emailTextField.text!
user.password = self.passwordTextField.text
user.signUpInBackgroundWithBlock {
(succeeded: Bool!, error: NSError!) -> Void in
if error == nil {
self.dismissViewControllerAnimated(true, completion: nil)
var profileImageFile:PFFile = PFFile(data: self.profileImageData)
self.user.setObject(profileImageFile, forKey: "profileImage")
self.user.saveInBackgroundWithBlock({ (succeeded: Bool!, error: NSError!) -> Void in
if error == nil {
println("saved profile pic")
}
})
} else {
println(error)
}
}
}
@IBAction func studentTeacherControlChanged(sender: UISegmentedControl) {
if sender.selectedSegmentIndex == 0 {
user.isIosStudent = true
user.isIosTA = false
user.isWebStudent = false
user.isWebTA = false
} else if sender.selectedSegmentIndex == 1 {
user.isIosTA = false
user.isIosStudent = false
user.isWebStudent = true
user.isWebTA = false
}
}
@IBAction func cancelButtonPressed(sender: UIButton) {
self.dismissViewControllerAnimated(true, completion: nil)
}
func textFieldDidBeginEditing(textField: UITextField) {
if self.profileImageData == nil {
pictureImageView.alpha = 0.6
}
}
/* UITextFieldDelegate method */
func textFieldShouldReturn(textField: UITextField) -> Bool {
textField.resignFirstResponder()
switch textField{
case self.usernameTextField:
self.emailTextField.becomeFirstResponder()
case self.emailTextField:
self.passwordTextField.becomeFirstResponder()
case self.passwordTextField:
self.confirmPasswordTextField.becomeFirstResponder()
default:()
}
return true
}
}
| [
-1
] |
010661fc33c1ec9ef7d672240bf0869bb055befd | b8be88eb19687807647099838bcdf7faa0a942b2 | /bakoWorkflowTests/bakoWorkflowTests.swift | b1d3f1b7502926e0ccf7ba3c64822004774493e8 | [] | no_license | bakoba66/workflowTesting | 8764304af9234dd6663c87d7e08559f6d0109dad | 5c72167a9a44f8898140bdf59f8494cdb6199564 | refs/heads/main | 2023-07-14T21:45:41.380073 | 2021-08-27T17:09:59 | 2021-08-27T17:09:59 | 400,494,583 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 701 | swift | //
// bakoWorkflowTests.swift
// bakoWorkflowTests
//
// Created by bako on 27/08/2021.
//
import XCTest
@testable import bakoWorkflow
class bakoWorkflowTests: 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.
}
}
| [
359737,
292085,
125684,
365989
] |
b9eb0257d7b1f0273ec730f42471b3e27b736fe7 | 1f408c2da103797ee1a908600c70ad1686ee2c4e | /Spotlight/Log.swift | 69715eb0e2a65fa9a71e3ac5b1247aa2b51a84a3 | [] | no_license | JonMercer/Spotlight | 5958bb716a0d8d6398971e22d8004dc3675b0593 | 4c216c1471f5e2a3122ad1a6538a07de3eb7f408 | refs/heads/master | 2021-04-30T22:18:48.683633 | 2017-06-04T01:14:43 | 2017-06-04T01:14:43 | 62,004,764 | 3 | 1 | null | 2017-06-04T01:14:43 | 2016-06-26T19:25:52 | Swift | UTF-8 | Swift | false | false | 5,449 | swift | //
// Log.swift
// Spotlight
//
// Created by Odin on 2016-07-14.
// Copyright © 2016 SpotlightTeam. All rights reserved.
//
import Foundation
class Log {
/**
Used for when you're doing tests. Testing log should be removed before commiting
How to use: Log.test("this is my message")
Output: 13:51:38.487 TEST @@@@ in InputNameViewController.swift:addContainerToVC():77:: this is test
To change the log level, visit the LogLevel enum
- Parameter logMessage: The message to show
- Parameter classPath: automatically generated based on the class that called this function
- Parameter functionName: automatically generated based on the function that called this function
- Parameter lineNumber: automatically generated based on the line that called this function
*/
static func test(logMessage: String, classPath: String = #file, functionName: String = #function, lineNumber: Int = #line) {
let fileName = URLUtil.getNameFromStringPath(classPath)
if LogLevel.lvl <= LogLevelChoices.TEST {
print("\(NSDate().timeStamp()) TEST @@@@ in \(fileName):\(functionName):\(lineNumber):: \(logMessage)")
}
}
/**
Used when something catastrophic just happened. Like app about to crash, app state is inconsistent, or possible data corruption
How to use: Log.error("this is error")
Output: 13:51:38.487 ERROR #### in InputNameViewController.swift:addContainerToVC():76:: this is error
To change the log level, visit the LogLevel enum
- Parameter logMessage: The message to show
- Parameter classPath: automatically generated based on the class that called this function
- Parameter functionName: automatically generated based on the function that called this function
- Parameter lineNumber: automatically generated based on the line that called this function
*/
static func error(logMessage: String, classPath: String = #file, functionName: String = #function, lineNumber: Int = #line) {
let fileName = URLUtil.getNameFromStringPath(classPath)
if LogLevel.lvl <= LogLevelChoices.ERROR {
print("\(NSDate().timeStamp()) ERROR #### in \(fileName):\(functionName):\(lineNumber):: \(logMessage)")
}
}
/**
Used when something went wrong, but the app can still function
How to use: Log.warn("this is warn")
Output: 13:51:38.487 WARN ### in InputNameViewController.swift:addContainerToVC():75:: this is warn
To change the log level, visit the LogLevel enum
- Parameter logMessage: The message to show
- Parameter classPath: automatically generated based on the class that called this function
- Parameter functionName: automatically generated based on the function that called this function
- Parameter lineNumber: automatically generated based on the line that called this function
*/
static func warn(logMessage: String, classPath: String = #file, functionName: String = #function, lineNumber: Int = #line) {
let fileName = URLUtil.getNameFromStringPath(classPath)
if LogLevel.lvl <= LogLevelChoices.WARN {
print("\(NSDate().timeStamp()) WARN ### in \(fileName):\(functionName):\(lineNumber):: \(logMessage)")
}
}
/**
Used when you want to show information like username or question asked
How to use: Log.info("this is info")
Output: 13:51:38.486 INFO ## in InputNameViewController.swift:addContainerToVC():74:: this is info
To change the log level, visit the LogLevel enum
- Parameter logMessage: The message to show
- Parameter classPath: automatically generated based on the class that called this function
- Parameter functionName: automatically generated based on the function that called this function
- Parameter lineNumber: automatically generated based on the line that called this function
*/
static func info(logMessage: String, classPath: String = #file, functionName: String = #function, lineNumber: Int = #line) {
let fileName = URLUtil.getNameFromStringPath(classPath)
if LogLevel.lvl <= LogLevelChoices.INFO {
print("\(NSDate().timeStamp()) INFO ## in \(fileName):\(functionName):\(lineNumber):: \(logMessage)")
}
}
/**
Used for when you're debugging and you want to follow what's happening.
How to use: Log.debug("this is debug")
Output: 13:51:38.485 DEBUG # in InputNameViewController.swift:addContainerToVC():73:: this is debug
To change the log level, visit the LogLevel enum
- Parameter logMessage: The message to show
- Parameter classPath: automatically generated based on the class that called this function
- Parameter functionName: automatically generated based on the function that called this function
- Parameter lineNumber: automatically generated based on the line that called this function
*/
static func debug(logMessage: String, classPath: String = #file, functionName: String = #function, lineNumber: Int = #line) {
let fileName = URLUtil.getNameFromStringPath(classPath)
if LogLevel.lvl <= LogLevelChoices.DEBUG {
print("\(NSDate().timeStamp()) DEBUG # in \(fileName):\(functionName):\(lineNumber):: \(logMessage)")
}
}
} | [
-1
] |
e810713dc3858f80224729d06f0e1feb856927bf | ee85aacecffc8af31e11b707964f5e906f96fa0e | /FlappyDragon/GameScene.swift | d5fc5fd87f828da62aff882dc7c42c604c6dd626 | [] | no_license | pessini/FlappyDragon | cbbd49fdb9c8bb602e9f7bf271786728110c3786 | 70a9ca5a6661523981df4c776a9daa5d0e8b0551 | refs/heads/master | 2021-01-24T23:58:06.843923 | 2018-02-28T13:05:50 | 2018-02-28T13:05:50 | 123,285,992 | 1 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 9,273 | swift | //
// GameScene.swift
// FlappyDragon
//
// Created by Leandro Pessini on 31/01/2018.
// Copyright © 2018 Leandro Pessini. All rights reserved.
//
import SpriteKit
import GameplayKit
class GameScene: SKScene {
var floor: SKSpriteNode!
var intro: SKSpriteNode!
var player: SKSpriteNode!
var gameArea: CGFloat = 410.0
var velocity: Double = 100.0
var gameFinished = false
var gameStarted = false
var restart = false
var scoreLabel: SKLabelNode!
var score: Int = 0
var flyForce: CGFloat = 25.0
var playerCategory: UInt32 = 1
var enemyCategory: UInt32 = 2
var scoreCategory: UInt32 = 4
var timer: Timer!
weak var gameViewController: GameViewController?
let scoreSound = SKAction.playSoundFileNamed("score.mp3", waitForCompletion: false)
let gameOverSound = SKAction.playSoundFileNamed("hit.mp3", waitForCompletion: false)
override func didMove(to view: SKView) {
physicsWorld.contactDelegate = self
addBackground()
addFloor()
addIntro()
addPlayer()
moveFloor()
}
func addBackground() {
let background = SKSpriteNode(imageNamed: "background")
background.position = CGPoint(x: self.size.width/2, y: self.size.height/2)
background.zPosition = 0 // mais afastada
addChild(background)
}
func addFloor() {
floor = SKSpriteNode(imageNamed: "floor")
floor.zPosition = 2
floor.position = CGPoint(x: floor.size.width/2, y: size.height - gameArea - floor.size.height/2)
addChild(floor)
let invisibleFloor = SKNode()
invisibleFloor.physicsBody = SKPhysicsBody(rectangleOf: CGSize(width: size.width, height: 1))
invisibleFloor.physicsBody?.isDynamic = false
invisibleFloor.position = CGPoint(x: size.width/2, y: size.height - gameArea)
invisibleFloor.zPosition = 2
invisibleFloor.physicsBody?.categoryBitMask = enemyCategory
invisibleFloor.physicsBody?.contactTestBitMask = playerCategory
addChild(invisibleFloor)
let invisibleRoof = SKNode()
invisibleRoof.physicsBody = SKPhysicsBody(rectangleOf: CGSize(width: size.width, height: 1))
invisibleRoof.physicsBody?.isDynamic = false
invisibleRoof.position = CGPoint(x: size.width/2, y: size.height)
invisibleRoof.zPosition = 2
addChild(invisibleRoof)
}
func addIntro() {
intro = SKSpriteNode(imageNamed: "intro")
intro.zPosition = 3
intro.position = CGPoint(x: size.width/2, y: size.height - gameArea/2)
addChild(intro)
}
func addPlayer() {
player = SKSpriteNode(imageNamed: "player1")
player.zPosition = 4
player.position = CGPoint(x: 60, y: size.height - gameArea/2)
var playerTextures = [SKTexture]()
for i in 1...4 {
playerTextures.append(SKTexture(imageNamed: "player\(i)"))
}
let animationAction = SKAction.animate(with: playerTextures, timePerFrame: 0.09)
let repeatAction = SKAction.repeatForever(animationAction)
player.run(repeatAction)
addChild(player)
}
func moveFloor() {
// espaço sobre tempo?
let duration = Double(floor.size.width/2) / velocity
// é - pq quero que ele vá para a esquerda
let moveFloorAction = SKAction.moveBy(x: -floor.size.width/2, y: 0, duration: duration)
let resetXAction = SKAction.moveBy(x: floor.size.width/2, y: 0, duration: 0)
let sequenceAction = SKAction.sequence([moveFloorAction, resetXAction])
let repeatAction = SKAction.repeatForever(sequenceAction)
floor.run(repeatAction)
}
func addScore() {
scoreLabel = SKLabelNode(fontNamed: "Chalkduster")
scoreLabel.fontSize = 94
scoreLabel.text = "\(score)"
scoreLabel.zPosition = 5
scoreLabel.position = CGPoint(x: size.width/2, y: size.height - 100)
scoreLabel.alpha = 0.8 // por padrão a cor é branca
addChild(scoreLabel)
}
func spawnEnemies() {
let initialPosition = CGFloat(arc4random_uniform(132) + 74)
let enemyNumber = Int(arc4random_uniform(4) + 1)
let enemiesDistance = self.player.size.height * 2.5
let enemyTop = SKSpriteNode(imageNamed: "enemytop\(enemyNumber)")
let enemyWidth = enemyTop.size.width
let enemyHeight = enemyTop.size.height
enemyTop.position = CGPoint(x: size.width + enemyWidth/2, y: size.height - initialPosition + enemyHeight/2)
enemyTop.zPosition = 1
enemyTop.physicsBody = SKPhysicsBody(rectangleOf: enemyTop.size)
enemyTop.physicsBody?.isDynamic = false
enemyTop.physicsBody?.categoryBitMask = enemyCategory
enemyTop.physicsBody?.contactTestBitMask = playerCategory
let enemyBottom = SKSpriteNode(imageNamed: "enemybottom\(enemyNumber)")
enemyBottom.position = CGPoint(x: size.width + enemyWidth/2, y: enemyTop.position.y - enemyTop.size.height - enemiesDistance)
enemyBottom.zPosition = 1
enemyBottom.physicsBody = SKPhysicsBody(rectangleOf: enemyBottom.size)
enemyBottom.physicsBody?.isDynamic = false
enemyBottom.physicsBody?.categoryBitMask = enemyCategory
enemyBottom.physicsBody?.contactTestBitMask = playerCategory
let laser = SKNode()
laser.position = CGPoint(x: enemyTop.position.x + enemyWidth/2, y: enemyTop.position.y - enemyTop.size.height/2 - enemiesDistance/2)
laser.physicsBody = SKPhysicsBody(rectangleOf: CGSize(width: 1, height: enemiesDistance))
laser.physicsBody?.isDynamic = false
laser.physicsBody?.categoryBitMask = scoreCategory
let distance = size.width + enemyHeight
let duration = Double(distance)/velocity
let moveAction = SKAction.moveBy(x: -distance, y: 0, duration: duration)
let removeAction = SKAction.removeFromParent()
let sequenceAction = SKAction.sequence([moveAction, removeAction])
enemyTop.run(sequenceAction)
enemyBottom.run(sequenceAction)
laser.run(sequenceAction)
addChild(enemyTop)
addChild(enemyBottom)
addChild(laser)
}
func gameOver() {
timer.invalidate()
player.zRotation = 0
player.texture = SKTexture(imageNamed: "playerDead")
for node in self.children {
node.removeAllActions()
}
player.physicsBody?.isDynamic = false
gameFinished = true
gameStarted = false
Timer.scheduledTimer(withTimeInterval: 2.0, repeats: false) { (timer) in
let gameOverLabel = SKLabelNode(fontNamed: "Chalkduster")
gameOverLabel.fontColor = .red
gameOverLabel.fontSize = 40
gameOverLabel.numberOfLines = 0
gameOverLabel.preferredMaxLayoutWidth = self.size.width
gameOverLabel.lineBreakMode = .byWordWrapping
gameOverLabel.text = "Caraio! Game Over"
gameOverLabel.position = CGPoint(x: self.size.width/2, y: self.size.height/2)
gameOverLabel.zPosition = 5
self.addChild(gameOverLabel)
self.restart = true
}
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
if !gameFinished {
if !gameStarted {
intro.removeFromParent()
addScore()
player.physicsBody = SKPhysicsBody(circleOfRadius: player.size.width/2 - 10)
player.physicsBody?.isDynamic = true
player.physicsBody?.allowsRotation = true
player.physicsBody?.applyImpulse(CGVector(dx: 0, dy: flyForce))
player.physicsBody?.categoryBitMask = playerCategory
player.physicsBody?.contactTestBitMask = scoreCategory
player.physicsBody?.collisionBitMask = enemyCategory
gameStarted = true
timer = Timer.scheduledTimer(withTimeInterval: 2.5, repeats: true, block: { (timer) in
self.spawnEnemies()
})
} else {
player.physicsBody?.velocity = CGVector.zero
player.physicsBody?.applyImpulse(CGVector(dx: 0, dy: flyForce))
}
} else {
if restart {
restart = false
gameViewController?.presentScene()
}
}
}
override func update(_ currentTime: TimeInterval) {
if gameStarted {
let yVelocity = player.physicsBody!.velocity.dy * 0.001 as CGFloat
player.zRotation = yVelocity
}
}
}
extension GameScene: SKPhysicsContactDelegate {
func didBegin(_ contact: SKPhysicsContact) {
if gameStarted {
if contact.bodyA.categoryBitMask == scoreCategory || contact.bodyB.categoryBitMask == scoreCategory {
score += 1
scoreLabel.text = "\(score)"
run(scoreSound)
} else if contact.bodyA.categoryBitMask == enemyCategory || contact.bodyB.categoryBitMask == enemyCategory {
gameOver()
run(gameOverSound)
}
}
}
}
| [
-1
] |
9333c60063d56b435633bc9767b56be2b82b34e2 | 38e226eaef33f599ef834173a96c517d7b4ad1ff | /CalorieTracker/CalorieNote+CoreDataProperties.swift | 2834f7bb4a05163c3ea9adefcf4d6041fd578281 | [] | no_license | jdkouris/ios-sprint-challenge-calorie-tracker | eca14c78f17415ecd7de71e9db7174bb8c425f88 | f3b834b7de2388c35c32f489e6596ef3b0d9d15a | refs/heads/master | 2020-11-24T08:42:14.642937 | 2019-12-14T19:53:33 | 2019-12-14T19:53:33 | 228,057,709 | 0 | 0 | null | 2019-12-14T17:00:45 | 2019-12-14T17:00:45 | null | UTF-8 | Swift | false | false | 475 | swift | //
// CalorieNote+CoreDataProperties.swift
// CalorieTracker
//
// Created by John Kouris on 12/14/19.
// Copyright © 2019 John Kouris. All rights reserved.
//
//
import Foundation
import CoreData
extension CalorieNote {
@nonobjc public class func createFetchRequest() -> NSFetchRequest<CalorieNote> {
return NSFetchRequest<CalorieNote>(entityName: "CalorieNote")
}
@NSManaged public var date: Date
@NSManaged public var calories: String
}
| [
-1
] |
95a5dcfc27fb08a5fc65b247cfa85a9fe49a3754 | ba91a810972c80d8ebc228f9c169e6b49e37c4bc | /WeatherApp/Controller/WeatherViewController.swift | 67b72e127a933c55112f61985d287aac9681b997 | [] | no_license | mdoli17/WeatherAppProj | 484e6b1db5d0df08f1b860093a0a4cb414c3ecc6 | 5147d4dd8e3c11e13e7290d6cb392a1636301e99 | refs/heads/main | 2023-01-31T08:07:44.372357 | 2020-12-15T11:38:56 | 2020-12-15T11:38:56 | 321,655,236 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,197 | swift | //
// WeatherViewController.swift
// WeatherApp
//
// Created by Matt Dolidze on 15.12.20.
//
import UIKit
import CoreLocation
class WeatherViewController: UIViewController {
@IBOutlet weak var locationButton: UIButton!
@IBOutlet weak var conditionImageView: UIImageView!
@IBOutlet weak var temperatureLabel: UILabel!
@IBOutlet weak var cityLabel: UILabel!
@IBOutlet weak var textfield: UITextField!
var weatherManager = WeatherManager()
let locationManager = CLLocationManager()
override func viewDidLoad() {
super.viewDidLoad()
self.setupHideKeyboardOnTap()
locationManager.requestWhenInUseAuthorization()
weatherManager.delegate = self
textfield.delegate = self
locationManager.delegate = self
}
@IBAction func onLocationPressed(_ sender: Any) {
locationManager.requestLocation()
}
}
//MARK: - UITextFieldDelegate
extension WeatherViewController : UITextFieldDelegate
{
func textFieldDidEndEditing(_ textField: UITextField) {
if let cityname = textField.text
{
weatherManager.fetchWeather(cityName: cityname)
}
textfield.text = ""
textField.placeholder = "Search"
}
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
if textfield.text != ""
{
textfield.endEditing(true)
return true
}
textField.placeholder = "Please enter a city name"
return false
}
}
//MARK: - WeatherDelegate
extension WeatherViewController: WeatherDelegate
{
func didUpdateWeather(weather: WeatherModel) {
DispatchQueue.main.async {
self.temperatureLabel.text = weather.temperatureString
self.cityLabel.text = weather.cityName
self.conditionImageView.image = UIImage(systemName: weather.conditionName)
}
}
func didFailWithError(error: Error) {
print(error)
}
}
extension WeatherViewController: CLLocationManagerDelegate {
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
if let location = locations.last {
let lat = location.coordinate.latitude
let lon = location.coordinate.longitude
weatherManager.fetchWeather(latitude: lat, longitude: lon)
}
}
func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {
print(error)
}
}
extension UIViewController {
/// Call this once to dismiss open keyboards by tapping anywhere in the view controller
func setupHideKeyboardOnTap() {
self.view.addGestureRecognizer(self.endEditingRecognizer())
self.navigationController?.navigationBar.addGestureRecognizer(self.endEditingRecognizer())
}
/// Dismisses the keyboard from self.view
private func endEditingRecognizer() -> UIGestureRecognizer {
let tap = UITapGestureRecognizer(target: self.view, action: #selector(self.view.endEditing(_:)))
tap.cancelsTouchesInView = false
return tap
}
}
| [
-1
] |
1ec8765458f3dc1328e8c7e7c037ef7895ad4555 | cf35f1e4a01d4ca3ebf99a7d5fbc3017600e0d58 | /4 Build a watchOS News App with SwiftUI and NewsAPI/Completed/XCANews/XCANewsShared/ViewModels/ArticleNewsViewModel.swift | 3ed678c07a46721322f2cb4ec90f691821e20740 | [
"MIT"
] | permissive | jixiangcn/NewsAppSwiftUI | 497d186ae39a60848a53ee2476600fe590757d31 | 2b1ff24700fec9b68a3851e6c87cea668d6909c4 | refs/heads/main | 2023-08-22T23:13:51.510995 | 2021-10-22T23:58:35 | 2021-10-22T23:58:35 | 537,828,703 | 1 | 0 | null | 2022-09-17T14:12:00 | 2022-09-17T14:12:00 | null | UTF-8 | Swift | false | false | 1,757 | swift | //
// ArticleNewsViewModel.swift
// XCANews
//
// Created by Alfian Losari on 6/27/21.
//
import SwiftUI
enum DataFetchPhase<T> {
case empty
case success(T)
case failure(Error)
}
struct FetchTaskToken: Equatable {
var category: Category
var token: Date
}
fileprivate let dateFormatter = DateFormatter()
@MainActor
class ArticleNewsViewModel: ObservableObject {
@Published var phase = DataFetchPhase<[Article]>.empty
@Published var fetchTaskToken: FetchTaskToken {
didSet {
if oldValue.category != fetchTaskToken.category {
selectedMenuItemId = MenuItem.category(fetchTaskToken.category).id
}
}
}
@AppStorage("item_selection") private var selectedMenuItemId: MenuItem.ID?
private let newsAPI = NewsAPI.shared
var lastRefreshedDateText: String {
dateFormatter.timeStyle = .short
return "Last refreshed at: \(dateFormatter.string(from: fetchTaskToken.token))"
}
init(articles: [Article]? = nil, selectedCategory: Category = .general) {
if let articles = articles {
self.phase = .success(articles)
} else {
self.phase = .empty
}
self.fetchTaskToken = FetchTaskToken(category: selectedCategory, token: Date())
}
func loadArticles() async {
if Task.isCancelled { return }
phase = .empty
do {
let articles = try await newsAPI.fetch(from: fetchTaskToken.category)
if Task.isCancelled { return }
phase = .success(articles)
} catch {
if Task.isCancelled { return }
print(error.localizedDescription)
phase = .failure(error)
}
}
}
| [
-1
] |
637c53da0488b68ff942fb52154da8710a0429af | 078b1db2bd79630b86f9c5492213cf0db86e7d55 | /Tests/Mocks/MockUserProvider.swift | 4b25be40c73ce96e8690ae114ff5309431fdaf32 | [
"MIT"
] | permissive | chadpav/SkeletonKey | 30014f91f393c74287c3891a5656c46d06598af7 | db0980100072800cafdf517d137c09d3d6e39201 | refs/heads/master | 2021-07-13T10:07:58.022488 | 2020-06-11T14:32:09 | 2020-06-11T14:32:09 | 187,701,866 | 0 | 0 | MIT | 2019-06-21T14:19:10 | 2019-05-20T19:34:16 | Swift | UTF-8 | Swift | false | false | 481 | swift | //
// MockUserProvider.swift
// SkeletonKey
//
// Created by Chad Pavliska on 5/16/19.
// Copyright © 2019 Chad Pavliska. All rights reserved.
//
import Foundation
import SkeletonKey
class MockUserProvider: IUserProvider {
let appUser = AppUser(uid: "1234", displayName: "Display Name", userName: "username", password: "pass1234")
public init() { }
func provideUser(completion: @escaping (AppUser?, Error?) -> Void) {
completion(appUser, nil)
}
}
| [
-1
] |
c8e8cf36d06aa591251ea21b3e3f7bb9fe82d713 | 702bdf50c53d69b87af15554f115e3af4f62818b | /MovieAppP10Entrainement/NetworkError.swift | 03bd8c903e208efff4cab45b03a37519f705087a | [] | no_license | damsobaba/movies | 589b8251360c61d61642f1ee9da3d5a3ca4a1877 | 9d065b9ddcabc975d8b469c6e877f2175c1c23a2 | refs/heads/master | 2023-02-20T03:54:25.178628 | 2021-01-24T17:38:04 | 2021-01-24T17:38:04 | 332,512,565 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 524 | swift | //
// NetworkError.swift
// MovieAppP10Entrainement
//
// Created by Adam Mabrouki on 21/11/2020.
//
import Foundation
enum NetworkError: Error, CustomStringConvertible {
case noData
case noResponse
case undecodableData
var description: String {
switch self {
case .noData:
return "There is no data !"
case .noResponse:
return "Response status is incorrect !"
case .undecodableData:
return "Data can't be decoded !"
}
}
}
| [
-1
] |
0caba1f1f673187400ecfca5587acda742505d03 | 4878993585fa3f698d837e4f3f27a71df0b687d3 | /UICollectionViewCompositionalLayout/Finished Project/rwotos/Albums/AlbumsViewController.swift | 20898e07a25fdb72454de71fba0e4d4baa54e286 | [
"MIT"
] | permissive | SinoLee/RwlTutorials | f73dffc7ce5d3eb98beb7d6b051962152dffd942 | 7a02514fb11ab31f50f058dc6ad3f5c222c23dda | refs/heads/master | 2021-05-25T14:05:00.539192 | 2020-08-20T01:23:20 | 2020-08-20T01:23:20 | 253,783,516 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 11,238 | 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.
import UIKit
class AlbumsViewController: UIViewController {
static let sectionHeaderElementKind = "section-header-element-kind"
enum Section: String, CaseIterable {
case featuredAlbums = "Featured Albums"
case sharedAlbums = "Shared Albums"
case myAlbums = "My Albums"
}
var dataSource: UICollectionViewDiffableDataSource<Section, AlbumItem>! = nil
var albumsCollectionView: UICollectionView! = nil
var baseURL: URL?
convenience init(withAlbumsFromDirectory directory: URL) {
self.init()
baseURL = directory
}
override func viewDidLoad() {
super.viewDidLoad()
navigationItem.title = "Your Albums"
configureCollectionView()
configureDataSource()
}
}
extension AlbumsViewController {
func configureCollectionView() {
let collectionView = UICollectionView(frame: view.bounds, collectionViewLayout: generateLayout())
view.addSubview(collectionView)
collectionView.autoresizingMask = [.flexibleHeight, .flexibleWidth]
collectionView.backgroundColor = .systemBackground
collectionView.delegate = self
collectionView.register(AlbumItemCell.self, forCellWithReuseIdentifier: AlbumItemCell.reuseIdentifer)
collectionView.register(FeaturedAlbumItemCell.self, forCellWithReuseIdentifier: FeaturedAlbumItemCell.reuseIdentifer)
collectionView.register(SharedAlbumItemCell.self, forCellWithReuseIdentifier: SharedAlbumItemCell.reuseIdentifer)
collectionView.register(
HeaderView.self,
forSupplementaryViewOfKind: AlbumsViewController.sectionHeaderElementKind,
withReuseIdentifier: HeaderView.reuseIdentifier)
albumsCollectionView = collectionView
}
func configureDataSource() {
dataSource = UICollectionViewDiffableDataSource
<Section, AlbumItem>(collectionView: albumsCollectionView) {
(collectionView: UICollectionView, indexPath: IndexPath, albumItem: AlbumItem) -> UICollectionViewCell? in
let sectionType = Section.allCases[indexPath.section]
switch sectionType {
case .featuredAlbums:
guard let cell = collectionView.dequeueReusableCell(
withReuseIdentifier: FeaturedAlbumItemCell.reuseIdentifer,
for: indexPath) as? FeaturedAlbumItemCell else { fatalError("Could not create new cell") }
cell.featuredPhotoURL = albumItem.imageItems[0].thumbnailURL
cell.title = albumItem.albumTitle
cell.totalNumberOfImages = albumItem.imageItems.count
return cell
case .sharedAlbums:
guard let cell = collectionView.dequeueReusableCell(
withReuseIdentifier: SharedAlbumItemCell.reuseIdentifer,
for: indexPath) as? SharedAlbumItemCell else { fatalError("Could not create new cell") }
cell.featuredPhotoURL = albumItem.imageItems[0].thumbnailURL
cell.title = albumItem.albumTitle
return cell
case .myAlbums:
guard let cell = collectionView.dequeueReusableCell(
withReuseIdentifier: AlbumItemCell.reuseIdentifer,
for: indexPath) as? AlbumItemCell else { fatalError("Could not create new cell") }
cell.featuredPhotoURL = albumItem.imageItems[0].thumbnailURL
cell.title = albumItem.albumTitle
return cell
}
}
dataSource.supplementaryViewProvider = { (
collectionView: UICollectionView,
kind: String,
indexPath: IndexPath) -> UICollectionReusableView? in
guard let supplementaryView = collectionView.dequeueReusableSupplementaryView(
ofKind: kind,
withReuseIdentifier: HeaderView.reuseIdentifier,
for: indexPath) as? HeaderView else { fatalError("Cannot create header view") }
supplementaryView.label.text = Section.allCases[indexPath.section].rawValue
return supplementaryView
}
let snapshot = snapshotForCurrentState()
dataSource.apply(snapshot, animatingDifferences: false)
}
func generateLayout() -> UICollectionViewLayout {
let layout = UICollectionViewCompositionalLayout { (sectionIndex: Int,
layoutEnvironment: NSCollectionLayoutEnvironment) -> NSCollectionLayoutSection? in
let isWideView = layoutEnvironment.container.effectiveContentSize.width > 500
let sectionLayoutKind = Section.allCases[sectionIndex]
switch (sectionLayoutKind) {
case .featuredAlbums: return self.generateFeaturedAlbumsLayout(isWide: isWideView)
case .sharedAlbums: return self.generateSharedlbumsLayout()
case .myAlbums: return self.generateMyAlbumsLayout(isWide: isWideView)
}
}
return layout
}
func generateFeaturedAlbumsLayout(isWide: Bool) -> NSCollectionLayoutSection {
let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0),
heightDimension: .fractionalWidth(2/3))
let item = NSCollectionLayoutItem(layoutSize: itemSize)
// Show one item plus peek on narrow screens, two items plus peek on wider screens
let groupFractionalWidth = isWide ? 0.475 : 0.95
let groupFractionalHeight: Float = isWide ? 1/3 : 2/3
let groupSize = NSCollectionLayoutSize(
widthDimension: .fractionalWidth(CGFloat(groupFractionalWidth)),
heightDimension: .fractionalWidth(CGFloat(groupFractionalHeight)))
let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitem: item, count: 1)
group.contentInsets = NSDirectionalEdgeInsets(top: 5, leading: 5, bottom: 5, trailing: 5)
let headerSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0),
heightDimension: .estimated(44))
let sectionHeader = NSCollectionLayoutBoundarySupplementaryItem(
layoutSize: headerSize,
elementKind: AlbumsViewController.sectionHeaderElementKind, alignment: .top)
let section = NSCollectionLayoutSection(group: group)
section.boundarySupplementaryItems = [sectionHeader]
section.orthogonalScrollingBehavior = .groupPaging
return section
}
func generateSharedlbumsLayout() -> NSCollectionLayoutSection {
let itemSize = NSCollectionLayoutSize(
widthDimension: .fractionalWidth(1.0),
heightDimension: .fractionalWidth(1.0))
let item = NSCollectionLayoutItem(layoutSize: itemSize)
let groupSize = NSCollectionLayoutSize(
widthDimension: .absolute(140),
heightDimension: .absolute(186))
let group = NSCollectionLayoutGroup.vertical(layoutSize: groupSize, subitem: item, count: 1)
group.contentInsets = NSDirectionalEdgeInsets(top: 5, leading: 5, bottom: 5, trailing: 5)
let headerSize = NSCollectionLayoutSize(
widthDimension: .fractionalWidth(1.0),
heightDimension: .estimated(44))
let sectionHeader = NSCollectionLayoutBoundarySupplementaryItem(
layoutSize: headerSize,
elementKind: AlbumsViewController.sectionHeaderElementKind,
alignment: .top)
let section = NSCollectionLayoutSection(group: group)
section.boundarySupplementaryItems = [sectionHeader]
section.orthogonalScrollingBehavior = .groupPaging
return section
}
func generateMyAlbumsLayout(isWide: Bool) -> NSCollectionLayoutSection {
let itemSize = NSCollectionLayoutSize(
widthDimension: .fractionalWidth(1.0),
heightDimension: .fractionalHeight(1.0))
let item = NSCollectionLayoutItem(layoutSize: itemSize)
item.contentInsets = NSDirectionalEdgeInsets(top: 2, leading: 2, bottom: 2, trailing: 2)
let groupHeight = NSCollectionLayoutDimension.fractionalWidth(isWide ? 0.25 : 0.5)
let groupSize = NSCollectionLayoutSize(
widthDimension: .fractionalWidth(1.0),
heightDimension: groupHeight)
let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitem: item, count: isWide ? 4 : 2)
let headerSize = NSCollectionLayoutSize(
widthDimension: .fractionalWidth(1.0),
heightDimension: .estimated(44))
let sectionHeader = NSCollectionLayoutBoundarySupplementaryItem(
layoutSize: headerSize,
elementKind: AlbumsViewController.sectionHeaderElementKind,
alignment: .top)
let section = NSCollectionLayoutSection(group: group)
section.boundarySupplementaryItems = [sectionHeader]
return section
}
func snapshotForCurrentState() -> NSDiffableDataSourceSnapshot<Section, AlbumItem> {
let allAlbums = albumsInBaseDirectory()
let sharingSuggestions = Array(albumsInBaseDirectory().prefix(3))
let sharedAlbums = Array(albumsInBaseDirectory().suffix(3))
var snapshot = NSDiffableDataSourceSnapshot<Section, AlbumItem>()
snapshot.appendSections([Section.featuredAlbums])
snapshot.appendItems(sharingSuggestions)
snapshot.appendSections([Section.sharedAlbums])
snapshot.appendItems(sharedAlbums)
snapshot.appendSections([Section.myAlbums])
snapshot.appendItems(allAlbums)
return snapshot
}
func albumsInBaseDirectory() -> [AlbumItem] {
guard let baseURL = baseURL else { return [] }
let fileManager = FileManager.default
do {
return try fileManager.albumsAtURL(baseURL)
} catch {
print(error)
return []
}
}
}
extension AlbumsViewController: UICollectionViewDelegate {
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
guard let item = dataSource.itemIdentifier(for: indexPath) else { return }
let albumDetailVC = AlbumDetailViewController(withPhotosFromDirectory: item.albumURL)
navigationController?.pushViewController(albumDetailVC, animated: true)
}
}
| [
-1
] |
47361ee2b21bc01e26a226c3d4d8a86c2ca5839c | 3d06c6e5cbc35f671ddcbd71e481d65724f10e16 | /Sources/Redis/Application+Redis.swift | e01bb3becde5d962573d84a21ac8f9dc59402ca9 | [
"MIT"
] | permissive | danramteke/redis | 2b3e3d0774c67a21903465d190efa58c8ac7c428 | 510604865eef7f491d183941f75f92cc62bfa30c | refs/heads/master | 2021-06-16T03:41:44.016881 | 2021-01-27T06:10:28 | 2021-01-27T06:10:28 | 141,513,561 | 0 | 0 | MIT | 2018-07-19T02:21:51 | 2018-07-19T02:21:51 | null | UTF-8 | Swift | false | false | 2,723 | swift | import Vapor
extension Application {
public struct Redis {
func pool(for eventLoop: EventLoop) -> RedisConnectionPool {
self.application.redisStorage.pool(for: self.eventLoop.next(), id: self.id)
}
public let id: RedisID
let application: Application
init(application: Application, redisID: RedisID) {
self.application = application
self.id = redisID
}
}
}
extension Application.Redis: RedisClient {
public var eventLoop: EventLoop {
self.application.eventLoopGroup.next()
}
public func logging(to logger: Logger) -> RedisClient {
self.application.redis(self.id)
.pool(for: self.eventLoop)
.logging(to: logger)
}
public func send(command: String, with arguments: [RESPValue]) -> EventLoopFuture<RESPValue> {
self.application.redis(self.id)
.pool(for: self.eventLoop.next())
.logging(to: self.application.logger)
.send(command: command, with: arguments)
}
public func subscribe(
to channels: [RedisChannelName],
messageReceiver receiver: @escaping RedisSubscriptionMessageReceiver,
onSubscribe subscribeHandler: RedisSubscriptionChangeHandler?,
onUnsubscribe unsubscribeHandler: RedisSubscriptionChangeHandler?
) -> EventLoopFuture<Void> {
self.application.redis(self.id)
.pubsubClient
.logging(to: self.application.logger)
.subscribe(to: channels, messageReceiver: receiver, onSubscribe: subscribeHandler, onUnsubscribe: unsubscribeHandler)
}
public func unsubscribe(from channels: [RedisChannelName]) -> EventLoopFuture<Void> {
self.application.redis(self.id)
.pubsubClient
.logging(to: self.application.logger)
.unsubscribe(from: channels)
}
public func psubscribe(
to patterns: [String],
messageReceiver receiver: @escaping RedisSubscriptionMessageReceiver,
onSubscribe subscribeHandler: RedisSubscriptionChangeHandler?,
onUnsubscribe unsubscribeHandler: RedisSubscriptionChangeHandler?
) -> EventLoopFuture<Void> {
self.application.redis(self.id)
.pubsubClient
.logging(to: self.application.logger)
.psubscribe(to: patterns, messageReceiver: receiver, onSubscribe: subscribeHandler, onUnsubscribe: unsubscribeHandler)
}
public func punsubscribe(from patterns: [String]) -> EventLoopFuture<Void> {
self.application.redis(self.id)
.pubsubClient
.logging(to: self.application.logger)
.punsubscribe(from: patterns)
}
}
| [
-1
] |
2b5e5b690a54b1432a34de6a6463e08d63d2c59b | a4a280d1e62aa89304e996fde4919b754bad82ac | /SubwayMessenger/Source/View/Messenger/SendViewModel.swift | 5daf2fddc283f1767d94624495c06b80dcd51518 | [] | no_license | furabonos/SubwayMessenger | 0d46ce7ff8f1a9ca09a846a90ef8f011e1c48afb | d90ffb5b36013666f185679b3811fee497676d7d | refs/heads/master | 2023-01-01T13:04:13.875606 | 2020-10-20T07:30:58 | 2020-10-20T07:30:58 | 285,138,740 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,334 | swift | //
// SendViewModel.swift
// SubwayMessenger
//
// Created by Euijae Hong on 2020/09/17.
// Copyright © 2020 Taehyeong. All rights reserved.
//
import Foundation
class SendViewModel {
private let messengerService: MessengerServiceType = MessengerService()
var stationArr: [StationPoi] = []
var schedulrArr: [ScheduleInfo] = []
func findStation(lats: String, lons: String, completion: @escaping (String) -> Void) {
messengerService.findStation(lat: lats, lon: lons) { (result) in
switch result {
case .success(let value):
self.stationArr = value.searchPoiInfo.pois.poi
completion("success")
case .failure(let error):
completion("failure")
print("error messege = \(error)")
}
}
}
func findSchedule(stations: String, completion: @escaping (String) -> Void) {
messengerService.findSchedule(station: stations) { (result) in
switch result {
case .success(let value):
self.schedulrArr = value.realtimeArrivalList
completion("success")
case .failure(let error):
completion("failure")
print("error messege = \(error)")
}
}
}
}
| [
-1
] |
d822087e61dae3a8b979738b6b3e91991140d91d | 23f8f89c41037bf9ceab5b0afe2bad1d69db0843 | /DevtopiaIdleGame/DevtopiaIdleGame/Menus/ManagersMenu.swift | 57ebb4ed220a1ee940e04b281ebac9f93a8a6a41 | [] | no_license | LucasJusto/DevtopiaIdleGame | ef454d23771caf0ea0f8d7a60a90a7dbcd367781 | 9c5193aaf3f6d87bc3e246502a344c6787015649 | refs/heads/main | 2023-05-03T22:12:23.863296 | 2021-05-28T20:26:39 | 2021-05-28T20:26:39 | 364,033,623 | 9 | 1 | null | 2021-05-26T20:10:26 | 2021-05-03T19:07:05 | Swift | UTF-8 | Swift | false | false | 2,241 | swift | import Foundation
import SpriteKit
class ManagersMenu: SKSpriteNode {
var panelTwo: PanelButton
init(panel: PanelButton) {
self.panelTwo = panel
super.init(texture: nil, color: UIColor(named: "white")!, size: CGSize(width: UIScreen.main.bounds.width * 0.85, height: UIScreen.main.bounds.height * 0.5))
self.zPosition = 500
self.name = "managersMenu"
self.isUserInteractionEnabled = true
let blackRectangle: SKSpriteNode = SKSpriteNode(texture: nil, color: UIColor(named: "black")!, size: CGSize(width: self.size.width * 0.95, height: self.size.height * 0.95))
let newFeaturesLabel: SKLabelNode = SKLabelNode(text: "New features")
newFeaturesLabel.fontName = "Montserrat-SemiBold"
newFeaturesLabel.fontColor = UIColor(named: "white")
newFeaturesLabel.fontSize = self.size.height * 0.08
newFeaturesLabel.position = CGPoint(x: 0, y: self.size.height * 0.33)
let comingSoonLabel: SKLabelNode = SKLabelNode(text: "coming soon!")
comingSoonLabel.fontName = "Montserrat-SemiBold"
comingSoonLabel.fontColor = UIColor(named: "white")
comingSoonLabel.fontSize = self.size.height * 0.08
comingSoonLabel.position = CGPoint(x: 0, y: newFeaturesLabel.position.y - comingSoonLabel.fontSize)
let devImage: SKSpriteNode = SKSpriteNode(texture: SKTexture(imageNamed: "Designer_step_03"), color: UIColor(named: "white")!, size: CGSize(width: self.size.width * 0.75, height: self.size.height * 0.55))
devImage.position = CGPoint(x: 0, y: comingSoonLabel.position.y - devImage.size.height/2)
let closePanelButton = PanelClose(comingSoon: self, width: self.size.width * 0.75, height: UIScreen.main.bounds.height * 0.05)
closePanelButton.position = CGPoint(x: 0, y: devImage.position.y - devImage.size.height/2 - closePanelButton.size.height/2)
self.addChild(blackRectangle)
self.addChild(newFeaturesLabel)
self.addChild(comingSoonLabel)
self.addChild(devImage)
self.addChild(closePanelButton)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
| [
-1
] |
e332c614dd3aed43c28a7afd4eb944c37e05058e | e4f65cc8dec8a716fc171efc918b41735aa8cf10 | /dyskalkulie/ScorecardTableViewController.swift | b6b8028046ce908c09fccee3259b028daaaf4b0c | [] | no_license | sbkn/dyskalkulie | dda8d4a4e85c31acf3485f40a496f42dae0c47e8 | e1f4a3415ac61edfd9efbbb619e0f69c77896d11 | refs/heads/master | 2021-04-12T06:58:42.266717 | 2017-07-05T14:19:59 | 2017-07-05T14:19:59 | 95,695,312 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,421 | swift | //
// ScorecardTableViewController.swift
// dyskalkulie
//
// Created by Sergey Bakin on 05.07.17.
// Copyright © 2017 idleon. All rights reserved.
//
import UIKit
class ScorecardTableViewController: UITableViewController {
var connectivityHandler : ConnectivityHandler!
@IBOutlet var tableViewRef: UITableView!
var scoreData = [Int](repeating: 0, count: 36)
override func viewDidLoad() {
super.viewDidLoad()
self.connectivityHandler = (UIApplication.shared.delegate as? AppDelegate)?.connectivityHandler
self.connectivityHandler?.addObserver(self, forKeyPath: "messages", options: [], context: nil)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Table view data source
override func numberOfSections(in tableView: UITableView) -> Int {
// #warning Incomplete implementation, return the number of sections
return 2
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of rows
return 9
}
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
if keyPath == "messages" {
OperationQueue.main.addOperation {
self.updateMessages()
}
}
}
func updateMessages() {
scoreData = self.connectivityHandler.messages
print(self.connectivityHandler.messages[0].description)
tableViewRef.reloadData()
}
deinit {
self.connectivityHandler?.removeObserver(self, forKeyPath: "messages")
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "hole1", for: indexPath)
let holeNumber = indexPath.row + 1 + indexPath.section * 9
cell.textLabel?.text = "Hole \(holeNumber)\t|\t\(scoreData[holeNumber - 1])\t|\t\(scoreData[holeNumber - 1 + 18])"
return cell
}
override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return "Half \(section + 1)"
}
}
| [
-1
] |
378abf35620feea7013dd63761a8a080f691e13d | bc7a2f1cd61013a33fb83c0f0dd2404d65f2dfb9 | /HappyBirthdayApp/Common/UI/Padding.swift | c9582724bdeace76e484c7da865ca6b2d688b00f | [] | no_license | talbenasuli/HappyBirthdayApp | 45b839feda70d5acf4948bb53788026bff6dd0f6 | 9ac1da17c0bc8df60dbd32f084c4ab43013a5c13 | refs/heads/main | 2023-07-02T16:15:47.643974 | 2021-08-05T12:37:47 | 2021-08-05T12:37:47 | 382,839,771 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 258 | swift | //
// Padding.swift
// HappyBirthdayApp
//
// Created by Tal Ben Asuli MAC on 04/07/2021.
//
import Foundation
enum Padding: Int {
case tiny = 8
case small = 16
case medium = 24
case big = 32
case huge = 40
case veryHuge = 75
}
| [
-1
] |
729ede1d03da99560bd71cf44f28b4dccafc5814 | a3dca737f0f905b69c7cce9a0ec76299ac196902 | /NicoScreen/Views/Services/LoginService.swift | 1a6333453a547272aee31fb3a12e53dc79fdd4ec | [] | no_license | Kiuchi/NicoTV | 1d1a054345a1e3b641999a85d19cfda63a55333e | 3de3ac5e0b5df8138a8bc164fa27fd6464173bb2 | refs/heads/master | 2020-12-02T03:35:37.608318 | 2019-12-30T08:05:59 | 2019-12-30T08:05:59 | 230,873,696 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,863 | swift | //
// LoginService.swift
// NicoScreen
//
// Created by Yu Kiuchi on 2019/12/11.
// Copyright © 2019 mattyaphone. All rights reserved.
//
import Foundation
import Combine
import Alamofire
class LoginService {
enum RequestError : Error {
case sessionFailed(error: Error?)
case cookieNotFound
case other(error: Error)
}
static let url = URL(string: "https://secure.nicovideo.jp/secure/login?site=niconico")!
static func request(_ username: String, _ pass: String, _ movieid: String) -> AnyPublisher<String, RequestError> {
let publisher = PassthroughSubject<String, RequestError>()
let param = ["mail":username, "password":pass]
// Prevent to redirect
Alamofire.SessionManager.default.delegate.taskWillPerformHTTPRedirection = { (session, task, response, request) in
return nil
}
Alamofire.request(url, method: .post, parameters: param, encoding: URLEncoding.default, headers: [:]).responseData { response in
switch response.result {
case .success:
guard
let headers = response.response?.allHeaderFields as? [String : String],
let url = response.response?.url
else {
publisher.send(completion: .failure(RequestError.cookieNotFound))
return
}
let cookies = HTTPCookie.cookies(withResponseHeaderFields: headers, for: url)
let cookie = cookies.filter{ $0.name == "user_session" }.filter{ $0.value != "deleted" }.first
guard let cookieValue = cookie?.value else {
publisher.send(completion: .failure(RequestError.cookieNotFound))
return
}
publisher.send(cookieValue)
publisher.send(completion: .finished)
case .failure(let error):
publisher.send(completion: .failure(RequestError.sessionFailed(error: error)))
}
}
return publisher.eraseToAnyPublisher()
}
}
// [<NSHTTPCookie
// version:0
// name:user_session
// value:deleted
// expiresDate:'2019-12-12 15:49:18 +0000'
// created:'2019-12-12 15:49:18 +0000'
// sessionOnly:FALSE
// domain:secure.nicovideo.jp
// partition:none
// sameSite:none
// path:/
// isSecure:FALSE
// path:"/" isSecure:FALSE>, <NSHTTPCookie
// version:0
// name:user_session
// value:user_session_17325035_fef759fb91eb7b48108313e17273736d8685f53746886852fc9735c24b6bb476
// expiresDate:'2020-01-11 15:49:17 +0000'
// created:'2019-12-12 15:49:18 +0000'
// sessionOnly:FALSE
// domain:.nicovideo.jp
// partition:none
// sameSite:none
// path:/
// isSecure:FALSE
// path:"/" isSecure:FALSE>, <NSHTTPCookie
// version:0
// name:user_session_secure
// value:MTczMjUwMzU6SjNsblcwc2RucldHRGxJLmRPSkZBZ0VWa1htREk5ajV5V1NneFNMbUlEWQ
// expiresDate:'2020-01-11 15:49:17 +0000'
// created:'2019-12-12 15:49:18 +0000'
// sessionOnly:FALSE
// domain:.nicovideo.jp
// partition:none
// sameSite:none
// path:/
// isSecure:TRUE
// isHTTPOnly: YES
// path:"/" isSecure:TRUE isHTTPOnly: YES>, <NSHTTPCookie
// version:0
// name:registrationActionTrackId
// value:
// expiresDate:'2019-12-11 15:49:18 +0000'
// created:'2019-12-12 15:49:18 +0000'
// sessionOnly:FALSE
// domain:.nicovideo.jp
// partition:none
// sameSite:none
// path:/
// isSecure:TRUE
// isHTTPOnly: YES
// path:"/" isSecure:TRUE isHTTPOnly: YES>]
| [
-1
] |
f3f44ffcd6f45647d269bda3b7ed53f7275739e1 | ae1f8177ed1407193aacb5898224163a3ffbad84 | /pi-chan/Extensions/UIColor+DynamicColor+Extension.swift | 32e41c6a0f0827b7d9f7b899708ba28e59685141 | [
"MIT"
] | permissive | indiamela/pi-chan | f489b8b8ada63f7b07c0705bb210a32fe0b91dd0 | 3a673adcabfa6063140b5f4f0220c27fcfe0a08c | refs/heads/master | 2022-01-20T06:05:20.120001 | 2016-10-17T15:32:41 | 2016-10-17T15:32:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 587 | swift | //
// UIColor+Extension.swift
// pi-chan
//
// Created by Kensuke Hoshikawa on 2016/04/05.
// Copyright © 2016年 star__hoshi. All rights reserved.
//
import UIKit
import DynamicColor
extension UIColor {
class func esaGreen() -> UIColor {
return UIColor(hexString: "#0a9b94")
}
class func esaBrown() -> UIColor {
return UIColor(hexString: "#efede0")
}
class func esaFontBlue() -> UIColor {
return UIColor(hexString: "#3c4a60")
}
class func grayUITextFieldBorderColor() -> UIColor {
return UIColor(red: 0.9, green: 0.9, blue: 0.9, alpha: 1.0)
}
} | [
-1
] |
d70f9014ab29fc6c62cbee6dcb94273cdb7465cf | 35480c013137a354ca8bad7ce9f14a3364663fa0 | /SJJ/ESPackage/Designer/ESMyProject/Detail/View/ESDesProjectDetailView.swift | 50ce8668edc39f109840294f6d40b46f17184e09 | [] | no_license | Gonglishuai/ezhome | dac435a2226e16a677de80c6e6a123ef5c5b8d97 | 6b9cce41f1ec589c539cdeffdb25939e4febf924 | refs/heads/master | 2020-03-28T00:54:22.022321 | 2018-09-06T06:47:45 | 2018-09-06T06:47:45 | 147,459,514 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 6,830 | swift | //
// ESDesProjectDetailView.swift
// ESPackage
//
// Created by 焦旭 on 2017/12/21.
// Copyright © 2017年 EasyHome. All rights reserved.
//
import UIKit
import SnapKit
protocol ESDesProjectDetailViewDelegate: ESTableViewProtocol {
func matchERPBtnClick()
func getCell(tableView: UITableView, indexPath: IndexPath) -> UITableViewCell?
}
class ESDesProjectDetailView: UIView, UITableViewDelegate, UITableViewDataSource {
private weak var delegate: ESDesProjectDetailViewDelegate?
private lazy var tableView: UITableView = {
let tableView = UITableView(frame: CGRect.zero, style: .grouped)
tableView.backgroundColor = ESColor.color(hexColor: 0xF9F9F9, alpha: 1.0)
tableView.delegate = self
tableView.dataSource = self
tableView.register(ESDesProjectDetailHeader.self, forHeaderFooterViewReuseIdentifier: "ESDesProjectDetailHeader")
tableView.register(ESDesProjectOrderDetailCell.self, forCellReuseIdentifier: "ESDesProjectOrderDetailCell")
tableView.register(ESDesProjectCostInfoCell.self, forCellReuseIdentifier: "ESDesProjectCostInfoCell")
tableView.register(ESDesProjectContractCell.self, forCellReuseIdentifier: "ESDesProjectContractCell")
tableView.register(ESDesProjectPreviewCell.self, forCellReuseIdentifier: "ESDesProjectPreviewCell")
tableView.register(ESDesProjectQuoteInfoCell.self, forCellReuseIdentifier: "ESDesProjectQuoteInfoCell")
tableView.register(ESDesProjectDeliveryInfoCell.self, forCellReuseIdentifier: "ESDesProjectDeliveryInfoCell")
// tableView.estimatedRowHeight = 200.0
tableView.estimatedSectionHeaderHeight = 54
// tableView.estimatedSectionFooterHeight = 0
tableView.rowHeight = UITableViewAutomaticDimension
tableView.sectionHeaderHeight = UITableViewAutomaticDimension
tableView.separatorStyle = .none
return tableView
}()
private var tableViewBottom: Constraint?
init(delegate: ESDesProjectDetailViewDelegate?) {
super.init(frame: CGRect.zero)
self.delegate = delegate
setUpTableView()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func setUpTableView() {
self.addSubview(matchBtn)
self.addSubview(tableView)
self.addSubview(bottomAlertView)
matchBtn.snp.makeConstraints { (make) in
make.bottom.equalToSuperview()
make.left.equalToSuperview()
make.right.equalToSuperview()
let height = CGFloat(49)
make.height.equalTo(height.scalValue)
}
tableView.snp.makeConstraints { (make) in
make.left.right.top.equalToSuperview()
self.tableViewBottom = make.bottom.equalToSuperview().constraint
}
bottomAlertView.snp.makeConstraints { (make) in
make.left.right.bottom.equalToSuperview()
}
bottomAlertLabel.snp.makeConstraints { (make) in
make.top.left.right.equalToSuperview()
make.height.greaterThanOrEqualTo(38)
make.bottom.equalToSuperview().priority(800)
}
}
func updateView(matchERP: Bool, bottomAlert: (Bool, String?)) {
let height = CGFloat(49)
let bottom = matchERP ? -height.scalValue : 0
self.tableViewBottom?.update(offset: bottom)
bottomAlertView.isHidden = !bottomAlert.0
bottomAlertLabel.text = bottomAlert.1
tableView.reloadData()
}
@objc private func matchBtnClick(sender: UIButton) {
delegate?.matchERPBtnClick()
}
// MARK: UITableViewDelegate, UITableViewDataSource
func numberOfSections(in tableView: UITableView) -> Int {
return delegate?.getSectionNum!() ?? 0
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return delegate?.getItemNum(section: section) ?? 0
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = delegate?.getCell(tableView: tableView, indexPath: indexPath)
return cell ?? UITableViewCell()
}
func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section == 0 {
return 480.0
} else {
return 200.0
}
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
delegate?.selectItem?(index: indexPath.row, section: indexPath.section)
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return nil
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
if let num = delegate?.getSectionNum!() {
if num == section + 1 {
return 80.0
}
return 0.1
}
return 0.1
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let header = tableView.dequeueReusableHeaderFooterView(withIdentifier: "ESDesProjectDetailHeader") as! ESDesProjectDetailHeader
header.delegate = delegate as? ESDesProjectDetailHeaderDelegate
header.updateHeaderView(index: section)
return header
}
private lazy var matchBtn: UIButton = {
let button = UIButton()
button.backgroundColor = UIColor.clear
button.setTitle("关联ERP项目", for: .normal)
button.setTitleColor(UIColor.white, for: .normal)
let normal = ESColor.getImage(color: ESColor.color(sample: .buttonBlue))
let disabled = ESColor.getImage(color: ESColor.color(sample: .separatorLine))
button.setBackgroundImage(normal, for: .normal)
button.setBackgroundImage(normal, for: .highlighted)
button.setBackgroundImage(disabled, for: .disabled)
button.titleLabel?.font = ESFont.font(name: .regular, size: 13.0)
button.addTarget(self, action: #selector(ESDesProjectDetailView.matchBtnClick(sender:)), for: .touchUpInside)
return button
}()
private lazy var bottomAlertView: UIView = {
let view = UIView()
view.backgroundColor = ESColor.color(hexColor: 0xFFF5E5, alpha: 1.0)
view.isHidden = true
view.addSubview(bottomAlertLabel)
return view
}()
private lazy var bottomAlertLabel: UILabel = {
let label = UILabel()
label.textColor = ESColor.color(hexColor: 0xFF9A02, alpha: 1.0)
label.font = ESFont.font(name: .regular, size: 12.0)
label.textAlignment = .center
label.numberOfLines = 0
return label
}()
}
| [
-1
] |
d2d155e6927148ee309ce9207b650c14bd3721c4 | d29307a7514eaf0d1171a22ea55235531a0e620c | /BarChart/ViewController.swift | 078abcdb166eee8548e7ae8eafa6b77ad722f784 | [] | no_license | rahul95108/chart | cf694a29c91352649fe6082eff880dc9551c6049 | 3dbd3c91dbef95cbbeb5bc31d4796ec53e454d91 | refs/heads/master | 2021-08-24T10:38:11.474862 | 2017-12-09T07:59:53 | 2017-12-09T07:59:53 | 113,652,714 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,793 | swift |
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var scrlView: UIScrollView!
var data = [0]
// MARK: - UIView Life Cycle Methods -
override func viewDidLoad() {
super.viewDidLoad()
for _ in 0..<30{
let randomNo = Int(arc4random_uniform(100))
data.append(randomNo)
}
callDrawLine()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
// MARK: - Draw Bar Graph -
func callDrawLine(){
var x: CGFloat = 25.0
for val in data {
let original = CGFloat(val)*2
let start = CGPoint(x:x,y:self.view.frame.size.height - original)
let end = CGPoint(x:x,y:self.view.frame.size.height + original)
drawLine(startpoint: start, endpint: end,linecolor: UIColor.red.cgColor,linewidth: 20.0)
let label = UILabel(frame: CGRect(x: x - 18, y: self.view.frame.size.height - (original+30), width: 35, height: 21))
label.textAlignment = .center
label.text = String(val)
self.scrlView.addSubview(label)
x = x + 40.0
}
scrlView.contentSize = CGSize(width: x-10, height: self.view.frame.size.height)
}
func drawLine(startpoint start:CGPoint, endpint end:CGPoint, linecolor color: CGColor , linewidth widthline:CGFloat){
let path = UIBezierPath()
path.move(to: start)
path.addLine(to: end)
let shapeLayer = CAShapeLayer()
shapeLayer.path = path.cgPath
shapeLayer.strokeColor = color
shapeLayer.lineWidth = widthline
scrlView.layer.addSublayer(shapeLayer)
}
}
| [
-1
] |
c35b1626a5801b0908528426864e0502fa6427de | c6df89b94b397afcecd607577a92fa51d5f7690d | /ed2-ring/Controllers/HistoryController.swift | 8c2b545c1155220eb423b4ef816d3d4213f8f8b5 | [] | no_license | mgalluscio/ed2-ring | 4f368befb0142dd6622919ce5295b5c7b07888dd | f1912e114b9ffe596dccfbf6f1986c0421236d6b | refs/heads/master | 2020-08-03T11:55:30.424331 | 2019-10-21T02:49:12 | 2019-10-21T02:49:12 | 211,744,084 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,432 | swift | //
// HistoryController.swift
// ed2-ring
//
// Created by Mario Galluscio on 10/15/19.
// Copyright © 2019 Mario Galluscio. All rights reserved.
//
import UIKit
class HistoryController: UIViewController {
@IBOutlet weak var collectionView: UICollectionView!
var visitors = [Visitor]()
var images = [UIImage]()
var screenSize: CGRect!
var screenWidth: CGFloat!
var screenHeight: CGFloat!
func initializeData(visitors: [Visitor]) {
self.visitors = visitors
}
override func viewDidLoad() {
super.viewDidLoad()
collectionView?.delegate = self
collectionView?.dataSource = self
screenSize = UIScreen.main.bounds
screenWidth = screenSize.width
screenHeight = screenSize.height
let layout: UICollectionViewFlowLayout = UICollectionViewFlowLayout()
layout.sectionInset = UIEdgeInsets(top: 20, left: 0, bottom: 10, right: 0)
layout.itemSize = CGSize(width: screenWidth/3, height: screenWidth/3)
layout.minimumInteritemSpacing = 0
layout.minimumLineSpacing = 0
collectionView!.collectionViewLayout = layout
// Do any additional setup after loading the view.
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
retrieveImages()
self.collectionView.reloadData()
print("Visitors size: \(visitors.count)")
print("Images size: \(images.count)")
}
func getData(from url: URL, completion: @escaping (Data?, URLResponse?, Error?) -> ()) {
URLSession.shared.dataTask(with: url, completionHandler: completion).resume()
}
func downloadImage(from url: URL) {
print("Download Started")
getData(from: url) { data, response, error in
guard let data = data, error == nil else { return }
print(response?.suggestedFilename ?? url.lastPathComponent)
print("Download Finished")
DispatchQueue.main.async() {
print("Appendeding image to array")
self.images.append(UIImage(data: data)!)
self.collectionView.reloadData()
print("Appended")
print("Images array size after appending: \(self.images.count)")
}
}
}
func retrieveImages() {
for visitor in visitors {
let url = URL(string: visitor.image_url)!
downloadImage(from: url)
}
}
}
extension HistoryController: UICollectionViewDelegate, UICollectionViewDataSource {
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "imageCell", for: indexPath) as? ImageCell else { return UICollectionViewCell() }
let imageFromIndex = images[indexPath.row]
cell.configureCell(image: imageFromIndex)
return cell
}
func numberOfSections(in collectionView: UICollectionView) -> Int {
return 1
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
print("I should be getting four here: \(images.count)")
return images.count
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
}
}
| [
-1
] |
87cfcb84157d006f4937d959a448e29374ac48b0 | 1787041751bad46303191ddc315ac262f6d8bea0 | /FoodTalk/MapViewController.swift | 978b062a0ca58c08e2ec0ec3c4a35eaa0466a13e | [] | no_license | Luke-NZ/FoodTalk | 8f4b645c0abcba0ff6cffb29fdf0637718014e08 | 69fccc42cf17d94f86579cd284a1370c72d5c9e9 | refs/heads/master | 2020-08-30T16:55:12.829021 | 2016-09-01T23:29:54 | 2016-09-01T23:29:54 | 67,572,292 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,934 | swift | //
// MapViewController.swift
// FoodTalk
//
// Created by 李远 on 16/07/16.
// Copyright © 2016 Luke. All rights reserved.
//
import UIKit
import MapKit
class MapViewController: UIViewController,MKMapViewDelegate {
@IBOutlet weak var mapView: MKMapView!
var restaurant: Restaurant!
override func viewDidLoad() {
super.viewDidLoad()
mapView.showsTraffic = true
mapView.showsUserLocation = true
mapView.showsCompass = true
mapView.showsScale = true
mapView.showsBuildings = true
// 地址转换.
let geocoder = CLGeocoder()
geocoder.geocodeAddressString(restaurant.location) { (placemarks, error) in
if error != nil {
print(error)
return
}
if let placemarks = placemarks {
let placemark = placemarks[0]
let annotation = MKPointAnnotation()
annotation.title = self.restaurant.name
annotation.subtitle = self.restaurant.type
if let location = placemark.location {
annotation.coordinate = location.coordinate
self.mapView.showAnnotations([annotation], animated: true)
self.mapView.selectAnnotation(annotation, animated: true)
}
}
}
}
func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {
let id = "My Pin"
if annotation is MKUserLocation {
return nil
}
var annotationView = self.mapView.dequeueReusableAnnotationViewWithIdentifier(id) as? MKPinAnnotationView
if annotationView == nil {
annotationView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: id)
annotationView?.canShowCallout = true
}
let imageView = UIImageView(frame: CGRectMake(0, 0, 53, 53))
imageView.image = UIImage(data: restaurant.image!)
annotationView?.leftCalloutAccessoryView = imageView
annotationView?.pinTintColor = UIColor.greenColor()
return annotationView
}
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
] |
861409c6f7ac0f6f54ece65484738cc25ebf9953 | 6c3adb1bb36641564c76d4e3121f5dd65549fecb | /Sources/FileProviderKit/Providers/RemoteFileProvider.swift | 22dc4432553f71b69b079e8101cc9edde62231c9 | [] | no_license | diegostamigni/FileProviderKit | a86005160db639ee3da7f9ae1356240608e2b9bf | 6a043d29bdd7111d248e6fa5b525ae1a84ae7bd0 | refs/heads/main | 2023-01-29T18:38:03.161539 | 2020-12-15T16:15:52 | 2020-12-15T16:15:52 | 318,486,449 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 368 | swift | //
// RemoteFileProvider.swift
// FileProviderKit
//
// Created by Diego Stamigni
// Copyright © 2020 Diego Stamigni. All rights reserved.
//
import Foundation
protocol RemoteFileProvider : FileProvider {
associatedtype FType
var isLoading: Bool { get set }
func remoteList(completion: @escaping (_ items: [FType], _ error: Error?) -> Void)
}
| [
-1
] |
84d1a5177c2cb6fcd940d18bc228d8fc34687095 | 0e7d82b8e2650f63146dd11c073337a2ac141003 | /Qingwen/Qingwen/首页/QWFilterChannelView.swift | a46f6d9116b77afae0db60f71606f35745f2238a | [] | no_license | mdk1906/iQing | 407b6128b3c438cdb55559ea18469d73466ea50c | df4a832aacf96c62354899310c82c9631ef5eb6c | refs/heads/master | 2023-06-30T01:48:05.150630 | 2021-08-06T08:01:51 | 2021-08-06T08:01:51 | 393,302,210 | 1 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 998 | swift | //
// QWFilterChannelView.swift
// Qingwen
//
// Created by mumu on 17/3/29.
// Copyright © 2017年 iQing. All rights reserved.
//
import UIKit
protocol QWFilterChannelViewDelegate: NSObjectProtocol {
func onPressedChannelBtn(_ sender: UIButton)
}
class QWFilterChannelView: UIView {
@IBOutlet var channelButtons: [UIButton]!
@IBOutlet weak var currentButton: UIButton!
weak var delegate: QWFilterChannelViewDelegate?
override func awakeFromNib() {
super.awakeFromNib()
self.currentButton.selectedBackgroundColor = UIColor.colorEE()
}
@IBAction func onPressedChannelBtn(_ sender: UIButton) {
if self.currentButton == sender {
return
}
self.currentButton.isSelected = false
self.currentButton = sender
self.currentButton.isSelected = true
self.currentButton.selectedBackgroundColor = UIColor.colorEE()
delegate?.onPressedChannelBtn(sender)
}
}
| [
-1
] |
89c2242aa87310a71e8e7c30f3230278652d0231 | cffb326f4c3db8eecb480bebab1790fdc354165c | /Sources/CSII-ISP/GeneratePokemonDatabase.swift | d00303fd858187d42323c00f626c349c25d75dbf | [] | no_license | wh33lnax3l/CSII-ISP | 94f893123f89f1c4794fcb22bb86e3d821c1a39f | 4621a7fc99a2308101c577fb0b0b77e6b55be535 | refs/heads/master | 2023-05-05T11:15:56.008174 | 2021-05-06T14:20:55 | 2021-05-06T14:20:55 | 318,573,104 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 7,448 | swift | import Foundation
func generatePokemonDatabase(pokemon:inout PokemonDatabase, textStack:TextStack){
// The JSON file is constructed of many layered JSONs, in order to decode these each new dict must be its own struct that conforms to Decodable and is explicitly keyed
// ALL properties are optional, as parts of the JSON are families and not individual pokemon, and thus do not contain any needed properties. Easier to sort in code and will be better for long term use
struct PokemonEntry : Decodable{
let data : DataDictionary?
}
struct DataDictionary : Decodable{
let templateId : String?
let pokemon : PokemonDictionary?
}
struct PokemonDictionary : Decodable{
let uniqueId : String?
let type1 : String?
let type2 : String?
let stats : StatsDictionary?
let quickMoves : [String]?
let cinematicMoves : [String]?
}
struct StatsDictionary : Decodable{
let baseStamina : Int?
let baseAttack : Int?
let baseDefense : Int?
}
struct MoveEntry : Decodable{
let name : String
let idNumber : Int
let type : String
let power : Int
let duration : Int?
let accuracy : Int?
let critical : Int?
let energyChange : Int
}
let pokemonEntries : [PokemonEntry] = try! JSONDecoder().decode([PokemonEntry].self, from:rawJSONData)
for entry in pokemonEntries{
// For each entry, take the data as Pokemon Go formats it and make it conform to how it ought to be stored
var name : String
var dexNumber : Int
var primaryType : String
var secondaryType : String?
var baseStamina : Int
var baseAttack : Int
var baseDefense : Int
var quickMoves : String = ""
var chargeMoves : String = ""
if let dataDict = entry.data{
if let templateId = dataDict.templateId{
if !(templateId.count >= 5){
textStack.appendText("templateId \(templateId) was not greater than 5 characters, where the dex number is in the assumed format")
continue
}
if let num = Int(templateId[templateId.index(templateId.startIndex, offsetBy: 1)...templateId.index(templateId.startIndex, offsetBy: 4)]){
dexNumber = num
}else{
textStack.appendText("Dex Number from templateId \(templateId) did not conform to assumed format, and thus returned null when stripped and cast as an Int")
continue
}
}else{
textStack.appendText("Could not find templateId")
continue
}
if let pokemonDict = dataDict.pokemon{
if let uniqueId = pokemonDict.uniqueId{
name = uniqueId
}else{
textStack.appendText("Could not find name")
continue
}
if let type1 = pokemonDict.type1{
if !(type1.count >= 14){
textStack.appendText("Type string \(type1) of length \(type1.count) not of expected length of at least 14 characters")
continue
}
if String(type1[type1.startIndex...type1.index(type1.startIndex, offsetBy:12)]) != "POKEMON_TYPE_"{
textStack.appendText("Primary type \(type1) does not follow assumed format")
continue
}
primaryType = String(type1[type1.index(type1.startIndex, offsetBy: 13)..<type1.endIndex])
}else{
textStack.appendText("Could not find primary type")
continue
}
if let type2 = pokemonDict.type2{
if !(type2.count >= 14){
textStack.appendText("Type string \(type2) of length \(type2.count) not of expected length of at least 14 characters")
continue
}
if String(type2[type2.startIndex...type2.index(type2.startIndex, offsetBy:12)]) != "POKEMON_TYPE_"{
textStack.appendText("Primary type \(type2) does not follow assumed format")
continue
}
secondaryType = String(type2[type2.index(type2.startIndex, offsetBy: 13)..<type2.endIndex])
}
if let statsDict = pokemonDict.stats{
// Using `if let` statements would write over variable in this scope
if statsDict.baseStamina != nil{
baseStamina = statsDict.baseStamina!
}else{
textStack.appendText("Could not find base stamina")
continue
}
if statsDict.baseAttack != nil{
baseAttack = statsDict.baseAttack!
}else{
textStack.appendText("Could not find base attack")
continue
}
if statsDict.baseDefense != nil{
baseDefense = statsDict.baseDefense!
}else{
textStack.appendText("Could not find base defense")
continue
}
}else{
textStack.appendText("Could not find stats dictionary")
continue
}
if let quickMoveArray = pokemonDict.quickMoves{
for move in quickMoveArray{
quickMoves += "\(move),"
}
quickMoves.removeLast()
}else{
textStack.appendText("Could not find quick moves")
continue
}
if let chargeMoveArray = pokemonDict.cinematicMoves{
for move in chargeMoveArray{
chargeMoves += "\(move),"
}
chargeMoves.removeLast()
}else{
textStack.appendText("Could not find charge moves")
continue
}
}else{
textStack.appendText("Could not find pokemon dictionary")
continue
}
}else{
textStack.appendText("Could not find data dictionary")
continue
}
pokemon.insertData(name:name,
dexNumber:dexNumber,
primaryType:primaryType,
secondaryType:secondaryType,
baseStamina:baseStamina,
baseAttack:baseAttack,
baseDefense:baseDefense,
quickMoves:quickMoves,
chargeMoves:chargeMoves)
}
}
| [
-1
] |
259eed490d3652a8683dc47a508cac800157b59c | a07bbcdcdab169140b752a6e1c1f5d6bcfecd5b0 | /RocketMan/AppDelegate.swift | 356d33b45d0c3462d77067dc18a7ae5424c125d0 | [] | no_license | dancemonkey/RocketMan | 6ceced9167b1b891224afec4c2af46c0a1edb96a | 946cae052a779cc1a2efd454ad9a3b528156d548 | refs/heads/master | 2020-03-27T20:00:42.947260 | 2018-10-11T14:23:39 | 2018-10-11T14:23:39 | 147,030,796 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,113 | swift | //
// AppDelegate.swift
// RocketMan
//
// Created by Drew Lanning on 8/10/18.
// Copyright © 2018 Drew Lanning. 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,
311349,
286774,
286776,
319544,
286778,
204856,
229432,
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,
131264,
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,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
295220,
287032,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
172534,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
172552,
320007,
287238,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
213575,
172618,
303690,
33357,
287309,
303696,
279124,
172634,
262752,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
295538,
189039,
172660,
287349,
189040,
189044,
287355,
287360,
295553,
172675,
295557,
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,
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,
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,
303987,
328563,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
304007,
213895,
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,
132165,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
296044,
279661,
205934,
164973,
312432,
279669,
337018,
189562,
279679,
304258,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
238766,
165038,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
230679,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
230718,
296259,
378181,
296262,
230727,
238919,
296264,
320840,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
148843,
410987,
230763,
230768,
296305,
312692,
230773,
304505,
304506,
181626,
279929,
181631,
148865,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
337306,
288154,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
337335,
288185,
279991,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
288212,
222676,
288214,
280021,
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,
214535,
230923,
304651,
304653,
370187,
230940,
222752,
108066,
296486,
296488,
157229,
239152,
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,
190118,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
313027,
280260,
206536,
280264,
206539,
206541,
206543,
313044,
280276,
321239,
280283,
313052,
18140,
288478,
313055,
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,
337732,
304968,
280393,
280402,
173907,
313171,
313176,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
239586,
313320,
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,
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,
305464,
280891,
289087,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
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,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
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,
281179,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
182926,
133776,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
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,
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,
298365,
290174,
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,
28219,
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,
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,
241475,
298822,
148946,
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,
298901,
44948,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241640,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
299003,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
307211,
282639,
290835,
282645,
241693,
282654,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
176213,
307287,
307290,
217179,
315482,
192605,
315483,
233567,
299105,
200801,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
315524,
307338,
233613,
241813,
307352,
299164,
299167,
315552,
184479,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
299185,
323763,
184503,
176311,
299191,
307386,
258235,
307388,
307385,
307390,
176316,
299200,
184512,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
323854,
291089,
282906,
291104,
233766,
295583,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
276052,
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,
283095,
127447,
299481,
176605,
242143,
127457,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
127490,
283142,
127494,
127497,
233994,
135689,
127500,
291341,
233998,
127506,
234003,
127509,
234006,
127511,
152087,
283161,
242202,
234010,
135707,
135710,
242206,
242208,
291361,
242220,
291378,
152118,
234038,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
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,
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,
324490,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
226200,
234396,
234398,
291742,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
324522,
234410,
291756,
291754,
226220,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
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,
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,
308379,
234648,
300189,
324766,
119967,
234653,
324768,
283805,
234657,
242852,
300197,
234661,
283813,
234664,
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,
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,
349464,
283939,
259367,
283951,
292143,
300344,
226617,
243003,
283963,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
316768,
292192,
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,
227426,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
316917,
292343,
308727,
300537,
316933,
316947,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
292414,
284223,
284226,
284228,
292421,
226886,
284231,
128584,
243268,
284234,
366155,
317004,
276043,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
292433,
284247,
317015,
235097,
243290,
276053,
284249,
284251,
300638,
284253,
284255,
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,
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,
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,
284502,
317271,
178006,
276315,
292700,
317279,
284511,
227175,
292715,
300912,
292721,
284529,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
317332,
358292,
284564,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
284585,
276395,
292776,
292784,
276402,
358326,
161718,
358330,
276410,
276411,
276418,
276425,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276448,
276452,
292839,
276455,
292843,
276460,
292845,
276464,
178161,
227314,
276466,
325624,
276472,
317435,
276476,
276479,
276482,
276485,
317446,
276490,
292876,
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,
227440,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
284837,
153765,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
309450,
276685,
309455,
276689,
309462,
301272,
276699,
194780,
309468,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
309491,
227571,
309494,
243960,
276735,
227583,
227587,
276739,
211204,
276742,
227593,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
293227,
276843,
293232,
276848,
186744,
211324,
227709,
285061,
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,
293370,
317951,
309764,
301575,
121352,
293387,
236043,
342541,
317963,
113167,
55822,
309779,
317971,
309781,
277011,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
219714,
129603,
301636,
318020,
301639,
301643,
277071,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
309871,
121458,
277106,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
334488,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
293555,
318132,
342707,
154292,
277173,
285368,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
137946,
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,
276579,
293811,
293817,
293820,
203715,
326603,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
285690,
244731,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
293960,
310344,
277577,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
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,
245191,
64966,
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,
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,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286312,
40554,
286313,
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,
286420,
278227,
229076,
286425,
319194,
278235,
278238,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
188252,
237409,
229233,
294776,
360317,
294785,
327554,
40840,
40851,
294803,
188312,
294811,
237470,
319390,
40865,
319394,
294817,
294821,
311209,
180142,
343983,
294831,
188340,
40886,
319419,
294844,
294847,
237508,
393177,
294876,
294879,
294883,
294890,
311279,
278513,
237555,
311283,
278516,
278519,
237562
] |
8720c5ec0f0c8726dc8981e2a05d6be6f554f258 | ec6ab98e1af0dc4919f299620bfc9df3ec1be1eb | /FlexibleNetworkLayer/Models/IMGurImageInfo.swift | 6aa735a80d6351f7c365f7204e89d73ab2321a1e | [] | no_license | IsaAliev/FlexibleNetworkLayer | b9d953516eeae15a414e8d16294179b2a193f288 | 201f054ca8facf4f97934364b2bcc510472b8568 | refs/heads/master | 2021-03-24T10:05:16.378269 | 2019-01-15T08:52:31 | 2019-01-15T08:52:31 | 122,159,364 | 11 | 2 | null | null | null | null | UTF-8 | Swift | false | false | 290 | swift | //
// IMGurImageInfo.swift
// FlexibleNetworkLayer
//
// Created by Isa Aliev on 03.03.18.
// Copyright © 2018 IA. All rights reserved.
//
import Foundation
struct IMGurImageInfo: Decodable {
var link: URL
var views: Int
var title: String?
var description: String?
}
| [
-1
] |
c348dffda428e3c973c08e19eb8023437e936fd1 | 9c3bf212aa76ecbd573e574332b605f74cf3a0f1 | /MyPalette/Sources/Utils/MyPaletteNavigation.swift | 6aa97504bcf75c9a75c0b0b074afdec359bf533a | [] | no_license | leocoout/MyPalette | f44eae90a609bdb534f6c7d9480ed66032c6573c | f791b1fa187f7b00403467bbe5253b39783125d7 | refs/heads/master | 2023-02-11T05:48:57.962685 | 2021-01-11T05:27:08 | 2021-01-11T05:27:08 | 255,207,253 | 0 | 2 | null | null | null | null | UTF-8 | Swift | false | false | 1,183 | swift | //
// MyPaletteNavigation.swift
// MyPalette
//
// Created by Leonardo Santos on 10/01/21.
// Copyright © 2021 Leonardo Santos. All rights reserved.
//
import Foundation
import UIKit
class MyPaletteNavigation {
/// Use this method to create flows with navigation controllers, for example, show a modal navigation controller
/// - Parameter controller: a optional view controller
/// - Parameter title: set the title of the navigation controller
/// - Returns: returns a UINavigationController
/// ```
/// // Usage
/// // 1. let flow = MyPaletteNavigation.createFlow(using: customView)
/// // 2. present(flow, animated: true, completion: nil)
/// ```
static func createFlow(using controller: UIViewController?, title: String? = nil, navigationBarHidden: Bool = false) -> UINavigationController {
guard let controller = controller else { return UINavigationController() }
let nav = UINavigationController.init(rootViewController: controller)
nav.navigationBar.topItem?.title = title
nav.setNavigationBarHidden(navigationBarHidden, animated: true)
return nav
}
}
| [
-1
] |
67b2eaa506da23d46bfe66eadf938c9605cccf8d | f2c634bfedd5a90405a759ec8172c9c26f70ea85 | /submodules/TelegramCore/Sources/SecretChatOutgoingOperation.swift | 7baaa3bef08660c633a393e295e2ab8d79c31a4b | [] | no_license | TianXianBob/Telegram | 5a1e4cdf816a47bc603de9ac7c7ce3ceac4f8176 | f99588f65114129664a03b3291f42dee1918c164 | refs/heads/master | 2023-01-21T15:00:08.168173 | 2020-12-03T05:13:05 | 2020-12-03T05:13:05 | 317,711,982 | 1 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 1,388 | swift | import Foundation
import Postbox
import TelegramApi
import SyncCore
extension SecretChatOutgoingFileReference {
init?(_ apiFile: Api.InputEncryptedFile) {
switch apiFile {
case let .inputEncryptedFile(id, accessHash):
self = .remote(id: id, accessHash: accessHash)
case let .inputEncryptedFileBigUploaded(id, parts, keyFingerprint):
self = .uploadedLarge(id: id, partCount: parts, keyFingerprint: keyFingerprint)
case let .inputEncryptedFileUploaded(id, parts, md5Checksum, keyFingerprint):
self = .uploadedRegular(id: id, partCount: parts, md5Digest: md5Checksum, keyFingerprint: keyFingerprint)
case .inputEncryptedFileEmpty:
return nil
}
}
var apiInputFile: Api.InputEncryptedFile {
switch self {
case let .remote(id, accessHash):
return .inputEncryptedFile(id: id, accessHash: accessHash)
case let .uploadedRegular(id, partCount, md5Digest, keyFingerprint):
return .inputEncryptedFileUploaded(id: id, parts: partCount, md5Checksum: md5Digest, keyFingerprint: keyFingerprint)
case let .uploadedLarge(id, partCount, keyFingerprint):
return .inputEncryptedFileBigUploaded(id: id, parts: partCount, keyFingerprint: keyFingerprint)
}
}
}
| [
-1
] |
f2de8ef6acff1dc38bc042ce73792b6737d5f8ca | e531a164eabd17fb040f097d2141af347678df52 | /运行时-交换方法/testTests/testTests.swift | f7819f3cd6273e0958d309d2bf545b3050df84a1 | [
"MIT"
] | permissive | UniqueCe/someDemo | f7c7a39cc1d295e11c6149a9b067180815af4dec | 572906e1c1516171706b26ad61025a16f037e939 | refs/heads/master | 2020-03-17T13:19:55.841329 | 2019-09-07T00:37:03 | 2019-09-07T00:37:03 | 133,627,053 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 885 | swift | //
// testTests.swift
// testTests
//
// Created by iOS-UI on 2018/12/19.
// Copyright © 2018 lzhl_iOS. All rights reserved.
//
import XCTest
@testable import test
class testTests: XCTestCase {
override func setUp() {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}
| [
333828,
282633,
313357,
182296,
317467,
241692,
98333,
16419,
102437,
229413,
292902,
315432,
204840,
325674,
315434,
354345,
223274,
278570,
243759,
124975,
344107,
233517,
253999,
346162,
229424,
319542,
243767,
124984,
241720,
229430,
358456,
288828,
325694,
288833,
288834,
352326,
313416,
254027,
311372,
354385,
196691,
315476,
280661,
329814,
278615,
338007,
307289,
200794,
354393,
180311,
180312,
237663,
309345,
280675,
307299,
321637,
329829,
319591,
280677,
313447,
315498,
278634,
319598,
288879,
352368,
299121,
284788,
233589,
280694,
333940,
237689,
288889,
215164,
313469,
215166,
278655,
292992,
333955,
280712,
215178,
241808,
323729,
325776,
317587,
278677,
284826,
278685,
346271,
311458,
278691,
49316,
233636,
333991,
333992,
284842,
333996,
32941,
278704,
239793,
323762,
241843,
278708,
125109,
299187,
180408,
182456,
131256,
184505,
280762,
299198,
379071,
299203,
301251,
309444,
227524,
338119,
282831,
321745,
254170,
317664,
356576,
338150,
176362,
321772,
286958,
125169,
338164,
327929,
243962,
184570,
125183,
309503,
125188,
194820,
313608,
125193,
321800,
375051,
180493,
125198,
125199,
325905,
254226,
125203,
319763,
338197,
334103,
325912,
315673,
125208,
309529,
299293,
237856,
125217,
278816,
233762,
211235,
217380,
305440,
151847,
282919,
227616,
211238,
325931,
321840,
98610,
125235,
332083,
332085,
280887,
125240,
332089,
278842,
282939,
315706,
287041,
241986,
260418,
332101,
182598,
323916,
319821,
254286,
348492,
325968,
323920,
250192,
6481,
344401,
348500,
366929,
155990,
366930,
6489,
272729,
332123,
379225,
289110,
354655,
391520,
106847,
323935,
321894,
242023,
280939,
242029,
246127,
354676,
246136,
139640,
246137,
291192,
317820,
211326,
313727,
362881,
240002,
248194,
225670,
332167,
311691,
395659,
227725,
395661,
108944,
240016,
178582,
291224,
293274,
317852,
121245,
283038,
141728,
61857,
315810,
246178,
285090,
61859,
289189,
375207,
289194,
108972,
340398,
311727,
377264,
61873,
334260,
61880,
283064,
319930,
311738,
278970,
336317,
293310,
311745,
278978,
127427,
127428,
283075,
291267,
324039,
188871,
317901,
373197,
281040,
278993,
326100,
278999,
328152,
176601,
242139,
369116,
285150,
287198,
279008,
342498,
242148,
242149,
195045,
279013,
279018,
319981,
281072,
109042,
319987,
279029,
279032,
233978,
279039,
240131,
342536,
287241,
279050,
340490,
289304,
279065,
342553,
322078,
291358,
182817,
375333,
377386,
283184,
23092,
234036,
315960,
338490,
242237,
352829,
301638,
348742,
322120,
55881,
348749,
281166,
281171,
244310,
332378,
354911,
436832,
295519,
242277,
66150,
244327,
111208,
344680,
191082,
279146,
313966,
281199,
287346,
313971,
244347,
279164,
189057,
311941,
348806,
279177,
369289,
330379,
344715,
184973,
311949,
326287,
316049,
311954,
334481,
330387,
111253,
330388,
352917,
227990,
230040,
111258,
111259,
271000,
342682,
117397,
295576,
221852,
279206,
295590,
287404,
205487,
295599,
303793,
318130,
299699,
299700,
164533,
338613,
314040,
109241,
287417,
158394,
342713,
285373,
287422,
66242,
248517,
363211,
242386,
334547,
279252,
287452,
318173,
289502,
363230,
295652,
338662,
246503,
285415,
330474,
342763,
346858,
129773,
289518,
322291,
312052,
312053,
199414,
154359,
221948,
35583,
205568,
162561,
299776,
191235,
363263,
285444,
242433,
291585,
264968,
322316,
117517,
326414,
312079,
322319,
295697,
285458,
166676,
207640,
283419,
326429,
336671,
326433,
344865,
279336,
318250,
318252,
353069,
295724,
152365,
312108,
285487,
328499,
242485,
353078,
230199,
353079,
285497,
336702,
342847,
420677,
353094,
353095,
299849,
283467,
293711,
281427,
353109,
244568,
281433,
244570,
230234,
301918,
109409,
293730,
242529,
303972,
351077,
275303,
342887,
201577,
326505,
230248,
242541,
246641,
330609,
209783,
246648,
209785,
269178,
177019,
279417,
361337,
291712,
254850,
359298,
240518,
109447,
287622,
228233,
316298,
228234,
236428,
58253,
308107,
56208,
295824,
308112,
293781,
209817,
324506,
324507,
318364,
127902,
240544,
289698,
189348,
324517,
289703,
353195,
140204,
316333,
353197,
316343,
189374,
353216,
330689,
349121,
363458,
213960,
326601,
279498,
316364,
338899,
340955,
248796,
248797,
207838,
50143,
130016,
340961,
64485,
314342,
52200,
123881,
324586,
203757,
289774,
304110,
320494,
340974,
316405,
240630,
295927,
201720,
304122,
320507,
328700,
314362,
293886,
328706,
320516,
230410,
330763,
320527,
146448,
324625,
330772,
316437,
418837,
320536,
197657,
281626,
201755,
336929,
189474,
300068,
357414,
248872,
345132,
238639,
322612,
252980,
300084,
359478,
324666,
238651,
302139,
21569,
214086,
359495,
238664,
300111,
314448,
341073,
339030,
353367,
156764,
156765,
314467,
281700,
250981,
322663,
300136,
316520,
228458,
207979,
318572,
300135,
316526,
357486,
144496,
187506,
353397,
291959,
160891,
341115,
363644,
150657,
187521,
248961,
349316,
279685,
349318,
222343,
330888,
228491,
228493,
285838,
177296,
169104,
162961,
326804,
308372,
296086,
185493,
324760,
119962,
300187,
296092,
300188,
339102,
302240,
343203,
300201,
300202,
253099,
238765,
3246,
318639,
279728,
337077,
367799,
339130,
208058,
64700,
322749,
228542,
343234,
367810,
259268,
353479,
353480,
283847,
62665,
353481,
244940,
283853,
353482,
283852,
290000,
333011,
316627,
228563,
279765,
296153,
357595,
279774,
298212,
304356,
290022,
330984,
328940,
228588,
234733,
253167,
279792,
353523,
353524,
298228,
216315,
208124,
316669,
363771,
388349,
228609,
320770,
234755,
279814,
322824,
242954,
328971,
292107,
318733,
312587,
251153,
245019,
320796,
126237,
333090,
130338,
208164,
130343,
351537,
298291,
345396,
318775,
300343,
116026,
222524,
333117,
306494,
216386,
193859,
286018,
279875,
345415,
312648,
230729,
224586,
372043,
177484,
251213,
238927,
296273,
331090,
120148,
318805,
283991,
279920,
316765,
222559,
314720,
234850,
292195,
230756,
294243,
314726,
333160,
314728,
134506,
230765,
296303,
243056,
327024,
327025,
316787,
116084,
314741,
249205,
312689,
314739,
327031,
314751,
318848,
306559,
179587,
378244,
314758,
298374,
314760,
388487,
142729,
368011,
304524,
314766,
296335,
112017,
112018,
234898,
306579,
9619,
212375,
282007,
357786,
318875,
212382,
314783,
290207,
333220,
314789,
279974,
314791,
282024,
245161,
316842,
241066,
314798,
286129,
173491,
150965,
210358,
284089,
228795,
292283,
302529,
302531,
163268,
380357,
415171,
300487,
361927,
300489,
296392,
370123,
148940,
280013,
310732,
64975,
312782,
327121,
222675,
366037,
210390,
210391,
353750,
210393,
329173,
228827,
286172,
310757,
187878,
245223,
316902,
280041,
361963,
191981,
54765,
321009,
251378,
333300,
343542,
191990,
280055,
300536,
288249,
343543,
333303,
286205,
290301,
286202,
210433,
282114,
228867,
366083,
323080,
329225,
230921,
253452,
323087,
329232,
304656,
316946,
146964,
398869,
308756,
175639,
374296,
308764,
349726,
333343,
230943,
282146,
306723,
286244,
245287,
245292,
349741,
169518,
230959,
312880,
286254,
288309,
290358,
312889,
235070,
288318,
280130,
349763,
124485,
56902,
288326,
288327,
292425,
243274,
128587,
333388,
333393,
280147,
300630,
290390,
235095,
306776,
196187,
343647,
333408,
286306,
323172,
345700,
374372,
282213,
323178,
243307,
312940,
54893,
325231,
138863,
222832,
224883,
333430,
314998,
247416,
366203,
323196,
325245,
175741,
337535,
294529,
312965,
224901,
323207,
282245,
282246,
288392,
229001,
310923,
286343,
188048,
323217,
239250,
282259,
345752,
229020,
255649,
282273,
245412,
40613,
40614,
40615,
206504,
229029,
282280,
298661,
323236,
61101,
321199,
337591,
321207,
296632,
319162,
280251,
282303,
323264,
286399,
280257,
321219,
218819,
319177,
306890,
280267,
212685,
333517,
282318,
333520,
313041,
241361,
333523,
333521,
241365,
245457,
302802,
280278,
280280,
298712,
18138,
278234,
286423,
294622,
321247,
278240,
325346,
282339,
333542,
12010,
212716,
212717,
280300,
282348,
284401,
282358,
313081,
325371,
286459,
124669,
194303,
278272,
319233,
175873,
323331,
323332,
288512,
280329,
284429,
284431,
323346,
278291,
321302,
294678,
366360,
116505,
249626,
284442,
325404,
321310,
282400,
241441,
241442,
325410,
339745,
341796,
247590,
257830,
333610,
317232,
282417,
296755,
319288,
321337,
282427,
319292,
360252,
325439,
315202,
307011,
282434,
325445,
282438,
153415,
345929,
341836,
323406,
325457,
337747,
18262,
370522,
188251,
280410,
307039,
345951,
362337,
284514,
345955,
296806,
276327,
292712,
282474,
288619,
325484,
280430,
313199,
292720,
362352,
282480,
313203,
325492,
296814,
300918,
317304,
333688,
241528,
194429,
124798,
325503,
182144,
339841,
305026,
241540,
327557,
253829,
243591,
333701,
67463,
325515,
243597,
325518,
110480,
329622,
337815,
282518,
282519,
124824,
214937,
294807,
118685,
298909,
294809,
319392,
292771,
354212,
313254,
333735,
294823,
284587,
317360,
323507,
124852,
243637,
282549,
288697,
290746,
214977,
163781,
321480,
284619,
247757,
344013,
212946,
24532,
219101,
280541,
329695,
292836,
298980,
294886,
337895,
247785,
253929,
327661,
124911,
329712,
362480,
325619,
333817,
313339
] |
144ffbb3117ac42f17dd874d5076c8b5f16e2d2b | 1933894720f18f428b020a6c9d33f529ac0e2611 | /BTVN_Day12/AnalogClock/AnalogClock/DrawLine2.swift | 4e2c7eed397cc34723f5c2add32ea6dbdca92a1f | [] | no_license | thientung-243/Tung.BTVN | 47ae2026004777a0bc33fa50ee2b80f29fc3faa0 | 195ca0a24db1786759b2ae4dc9aa4b72ce5c8a01 | refs/heads/master | 2022-03-26T12:16:23.004125 | 2019-12-15T06:02:42 | 2019-12-15T06:02:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 834 | swift | //
// DrawLine.swift
// AnalogClock
//
// Created by Thiện Tùng on 11/15/19.
// Copyright © 2019 tung. All rights reserved.
//
import UIKit
class DrawLine2: UIView {
@IBInspectable var lineWidth: CGFloat = 3
@IBInspectable var fillColor: UIColor = UIColor.white
override func draw(_ rect: CGRect) {
// Drawing code
let path = UIBezierPath(ovalIn: rect)
fillColor.setFill()
path.fill()
let linePath = UIBezierPath()
linePath.lineWidth = lineWidth
// bắt đầu vẽ
linePath.move(to: CGPoint(x: bounds.width/2, y: bounds.height/2))
linePath.addLine(to: CGPoint(x: bounds.width/2, y: bounds.height/2 - 30))
UIColor.black.setStroke()
linePath.stroke()
}
}
| [
-1
] |
9a2b0d8bceb6154f5df8be6630a1d74a4f48aa8e | 9129f8b149456a01a5af667de491fba00afb0475 | /MyRoute/UploadImageViewController.swift | 0c6025ebaa7988e510f00629021a367179cf09e0 | [] | no_license | AngelGui/MyRoute | 3ae44226914ad9fa26a675691913dec475f87e1f | 653796acbfe77a05a88c72be64d588615727fb4a | refs/heads/master | 2021-01-02T09:19:34.589881 | 2015-04-11T06:47:34 | 2015-04-11T06:47:34 | 33,245,399 | 1 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 9,840 | swift | ////
//// UploadImageViewController.swift
//// MyRoute
////
//// Created by 陈桂 on 15/4/8.
//// Copyright (c) 2015年 AutoNavi. All rights reserved.
////
//
//import Foundation
//
//
//class UploadImageViewController: UIViewController, UIAlertViewDelegate,UIActionSheetDelegate,UINavigationControllerDelegate, UIImagePickerControllerDelegate
//{
//
// var _picker:UIImagePickerController!
//
// override func viewDidLoad()
// {
//
// super.viewDidLoad()
//
//
// var ossclient = OSSClient.sharedInstanceManage()
//
// var accessKey = "zwfTw8BrXxIXzBb0"
//
// var secretKey = "HrvqQQaYiAYk0LzFjYWaC1eVplFwz5"
//
//
// ossclient.generateToken(NSString(), NSString(), NSString(), NSString(), NSString(), NSString())
//
// {
// var signature = "test"
// var content = NSString(format:"%@\n%@\n%@\n%@\n%@%", method, md5, type, date, xoss, resource)
// signature = OSSTool(data:content,withKey:secretKey)
// signature = NSString(format:"OSS %@:%", accessKey, signature)
// println("here signature:%@", signature)
// return signature
// }
//
// ossclient.globalDefaultBucketHostId = "oss-cn-beijing.aliyuncs.com"
// ossclient.globalDefaultBucketAcl.value = 1
//
// accessKey = ""
// secretKey = ""
// }
//
// override func didReceiveMemoryWarning()
// {
//
// super.didReceiveMemoryWarning()
// // Dispose of any resources that can be recreated.
// }
//
//
// func showSelectImageMenus()
// {
//
// var actionSheet = UIActionSheet(
// title: "厕所照片",
// delegate: self,
// cancelButtonTitle: "取消",
// destructiveButtonTitle: "拍照",
// otherButtonTitles: "从相册中选择")
//
// actionSheet.showInView( self.view)
//
// }
//
// //将图片的二进制转换成String类型
// func stringWithImage(image: UIImage)->NSString
// {
//
// var imageData = UIImageJPEGRepresentation(image, 1)
// if (imageData.length >= 50000)
// {
// imageData = UIImageJPEGRepresentation(image, 0.1)
// }
//
// var testByte = imageData.bytes
//
// var str = NSMutableString()
// for i in 0...imageData.length
// {
// str.appendFormat("%d,",testByte[i])
// }
//
// var range:NSRange!
// range.location = str.length-1
// range.length = 1
// str.deleteCharactersInRange(range)
//
//
// return str
// }
//
// func updateloadImage(image:UIImage, imagetype:NSString)
// {
//
//
// var imageData = UIImageJPEGRepresentation(image, 1)
// if (imageData.length >= 50000)
// {
// imageData = UIImageJPEGRepresentation(image, 0.1)
// }
//
//
// var bucket = OSSBucket(bucket:"ddlsimage")
//
//
// bucket.acl.value = 1 // 指明该Bucket的访问权限
// bucket.ossHostId = "oss-cn-beijing.aliyuncs.com" // 指明该Bucket所在数据中心的域名
//
// var uuid = NSUUID() as NSString
// uuid.stringByReplacingOccurrencesOfString:"-",withString:""
// var uuid = [[NSUUID.UUID() UUIDString],stringByReplacingOccurrencesOfString:"-",withString:""
//
// var imageName = NSString(format:"%@.%",uuid,imagetype)
//
//
//
// var testFile = OSSData(bucket:bucket, withKey:imageName)
//
// uuid = nil
//
// testFile.setData(imageData, withType:imagetype)
//
// self.prepareUploadImages(imageData, imageName:imageName)
//
// imageName = nil
//
// println("%@",testFile.getResourceURL())
// testFile.uploadWithUploadCallback(isSuccess:Bool, error:NSError)
// {
// _picker.dismissViewController(animated:true,completion:nil)
//
//
// if (isSuccess) {
//
// self(completeBack:testFile.getResourceURL)()
//
// println("%@",testFile.getResourceURL())
//
// } else {
// self(errorBack:error)
// println("errorInfo_testFilePartsUpload:%@", error.userInfo())
// }
// } .withProgressCallback(progress:CGFloat) {
//
// println(__FUNCTION__,__LINE__)
//
// }
//}
//
///*
//*开始上传前的
//*/
//func prepareUploadImages(imageData:NSData, imageName:NSString)
//{
//
//
//}
//
///*
//*上传成功回调接口
//*/
// func uploadWithcompleteBack(url: NSString)
//{
//
//
//}
//
///*
//*上传出错回调接口
//*/
// func uploadWithErrorBack(error: NSError)
//{
//
//
//}
//
////MARK: --- UIActionSheetDelegate ---
//func actionSheet(actionSheet:UIActionSheet, buttonIndex:Int)
//{
//
// if (buttonIndex == 0) // 拍照
// {
// var type = UIImagePickerControllerSourceType.Camera
// _picker = UIImagePickerController()
// _picker.delegate = self
// _picker.allowsEditing = true // 设置可编辑
// _picker.sourceType = type
// self.presentViewController(_picker,animated:true,completion:nil)
//
//
// }
// else if (buttonIndex == 1) // 从相册选择
// {
// _picker = UIImagePickerController()
//
// if (UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.PhotoLibrary))
// {
// _picker.sourceType = UIImagePickerControllerSourceType.PhotoLibrary
// _picker.mediaTypes = UIImagePickerController.availableMediaTypesForSourceType( _picker.sourceType)!
//
// }
// _picker.delegate = self
// _picker.allowsEditing = true
// self.presentViewController(_picker,animated:true,completion:nil)
//
//
// }
// else if (buttonIndex == 2) // 取消
// {
//
// }
//}
//
////MARK: ---UIImagePickerControllerDelegate---
//
// func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: NSDictionary)
// {
// println(__FUNCTION__, __LINE__)
//
//
// var medicType: AnyObject? = info.objectForKey(UIImagePickerControllerMediaType)
//
// //判断选中的是不是图片
// if (medicType?.isEqualToString(kUTTypeImage) == true)
// {
// //得到选中的图片
// var image: AnyObject? = info.objectForKey(UIImagePickerControllerEditedImage)
//
// self.updateloadImage(image, imagetype: ".jpg")
// image = nil
//
//
// }
//
// LoadingClass.shared().showContent("请稍等", andCustomImage:nil)
//
// }
//
//
// func imagePickerControllerDidCancel(picker:UIImagePickerController)
// {
//
// println("imagePickerControllerDidCancel")
// picker.dismissViewControllerAnimated(true,completion:nil)
//
//
// }
//
// func updateload()
// {
//
//
//
// }
//
// //MARK: --- BsaeViewController ---
//// func startRequestDataWithPostValue(postValue:NSDictionary, url:NSString)
//// {
////
//// BFNetManager.sharedManager()
//// doPostWithPath:url params:postValue callback(isSuccessed:BOOL, id result) {
////
//// if(isSuccessed && result){
////
//// var tempDic:NSDictionary = result
//// switch (tempDic.objectForKey("code").intValue)
//// {
//// case RetCode_Success:
//// {
//// if(url.isEqualToString(RequestName_UploadUserHead))
//// {
//// println("头像修改成功")
//// self(postValue:[Users.sharedInstance) getTokenAndUserId() andUrl:RequestName_GetUserInfoByID]
////
//// _picker.dismissViewController(animated:true,completion:nil)
////
//// }
//// }
//// break
//// case RetCode_NotLogin:
//// {
//// if(url.isEqualToString(RequestName_UploadUserHead)
//// {
//// _picker.dismissViewController(animated:true,completion:nil)
////
//// }
//// LoadingClass.shared().showContent(tempDic.objectForKey("msg"),andCustomImage:nil)
//// Users.sharedInstance().logout
//// }
//// break
//// default:
//// if(url.isEqualToString(RequestName_UploadUserHead))
//// {
//// _picker.dismissViewController(animated:true,completion:nil)
////
//// }
//// LoadingClass.shared().showContent(tempDic.objectForKey("msg"),andCustomImage:nil)
//// break
//// }
//// }else {
//// if(url.isEqualToString(RequestName_UploadUserHead)){
//// _picker.dismissViewController(animated:true,completion:nil)
////
//// }
//// println("url%@ error%@,",url,result)
//// }
//// }
//// }
//} | [
-1
] |
ec7eeb4b17e58a5dcb348816d5ff054bd4cfb604 | 4688a9e29d3e03cfb08a7afd288ad4fc81829774 | /UseDesk/Classes/UDBaseArticlesView.swift | fe8231e0d1754ab1e16bfb3474dee34779f42a46 | [
"MIT"
] | permissive | usedesk/UseDeskSwift | 8c6329c943578ac78c3c263df74df72070c34497 | 9ef13c54bc949d0b158133503c0f987095ba5a0e | refs/heads/master | 2023-08-29T03:08:16.839974 | 2023-08-15T12:24:20 | 2023-08-15T12:24:20 | 172,743,953 | 8 | 20 | MIT | 2023-04-11T14:08:18 | 2019-02-26T16:02:50 | Swift | UTF-8 | Swift | false | false | 2,520 | swift | //
// UDBaseArticlesView.swift
import Foundation
import UIKit
class UDBaseArticlesView: UDListBaseKnowledgeVC {
var articles: [UDArticleTitle]? = nil
override func viewWillAppear(_ animated: Bool) {
articles == nil ? showErrorLoadView() : hideErrorLoadView()
super.viewWillAppear(animated)
}
override func viewDidLoad() {
super.viewDidLoad()
}
override func firstState() {
super.firstState()
if articles != nil {
articles = articles!
}
tableView.register(UINib(nibName: "UDBaseArticleViewCell", bundle: BundleId.thisBundle), forCellReuseIdentifier: "UDBaseArticleViewCell")
tableView.reloadData()
articles == nil ? showErrorLoadView() : hideErrorLoadView()
}
override func updateValues() {
if usedesk?.model.isLoadedKnowledgeBase ?? false && articles == nil {
articles = usedesk?.model.selectedKnowledgeBaseCategory?.articlesTitles
titleVC = usedesk?.model.selectedKnowledgeBaseCategory?.title ?? ""
}
}
override func backAction() {
if isShownNoInternet || (self.navigationController?.viewControllers.count ?? 0 < 2) {
super.backAction()
} else {
self.navigationController?.popViewController(animated: true)
self.removeFromParent()
}
}
// MARK: - TableView
override func countCell() -> Int {
return articles?.count ?? 0
}
override func getCell(indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "UDBaseArticleViewCell", for: indexPath) as! UDBaseArticleViewCell
cell.configurationStyle = usedesk?.configurationStyle ?? ConfigurationStyle()
if articles != nil {
cell.setCell(text: articles![indexPath.row].title)
}
return cell
}
override func selectRowAt(_ indexPath: IndexPath) {
guard usedesk?.reachability != nil else {return}
guard usedesk?.reachability?.connection != .unavailable else {
showAlertNoInternet()
return
}
guard usedesk != nil, articles != nil else {return}
showArticle(articleTitle: articles![indexPath.row], indexPath: indexPath)
if let cell = tableView.cellForRow(at: indexPath) as? UDBaseCategoriesCell {
cell.isSelected = false
cell.selectionStyle = .none
}
}
}
| [
-1
] |
6a2130f8cfea2e6211fe987967f3037ac6416a95 | 3be0ca5bb8f544b321fcf84ac155f09adf06ecf7 | /IrisCalendarApp/IrisCalendarApp/ViewController/AddScheduleMenubarVC.swift | 01adfcb85bfb722c1b777259670f081ac1c88ecb | [] | no_license | iriscalender/IrisCalendar-iOS | 0d2b0079e04210fe1456975feda3ec2e30a33d73 | d2a83cd6e67de4bddf90a1d02e55d9146e6ef139 | refs/heads/master | 2020-07-23T02:47:19.216651 | 2019-12-02T09:23:40 | 2019-12-02T09:23:40 | 207,423,911 | 3 | 2 | null | null | null | null | UTF-8 | Swift | false | false | 1,707 | swift | //
// AddScheduleMenubarVC.swift
// IrisCalendarApp
//
// Created by baby1234 on 01/10/2019.
// Copyright © 2019 baby1234. All rights reserved.
//
import UIKit
import RxSwift
import RxCocoa
import BubbleTransition
class AddScheduleMenubarVC: UIViewController {
@IBOutlet weak var addBtn: UIButton!
@IBOutlet weak var addFixScheduleBtn: UIButton!
@IBOutlet weak var addAutoScheduleBtn: UIButton!
weak var interactiveTransition: BubbleInteractiveTransition?
var delegate: MenubarDelegate?
private let disposeBag = DisposeBag()
override func viewDidLoad() {
super.viewDidLoad()
modalPresentationCapturesStatusBarAppearance = true
setUpUI()
}
private func setUpUI() {
addBtn.rx.tap.asObservable().subscribe { [weak self] (_) in
guard let strongSelf = self else { return }
strongSelf.dismiss(animated: true, completion: nil)
strongSelf.interactiveTransition?.finish()
}.disposed(by: disposeBag)
addFixScheduleBtn.rx.tap.asObservable().subscribe { [weak self] (_) in
guard let strongSelf = self else { return }
strongSelf.delegate?.goWhere(destination: .FixScheduleVC)
strongSelf.dismiss(animated: true, completion: nil)
}.disposed(by: disposeBag)
addAutoScheduleBtn.rx.tap.asObservable().subscribe { [weak self] (_) in
guard let strongSelf = self else { return }
strongSelf.delegate?.goWhere(destination: .AutoScheduleVC)
strongSelf.dismiss(animated: true, completion: nil)
}.disposed(by: disposeBag)
}
override var prefersStatusBarHidden: Bool { return true }
}
| [
-1
] |
b14bb65d04e906ca0d925ff7244700be9797d168 | d78c4c8b2dfcb9c2ae3611c8d15c201923e513a3 | /Git test/AppDelegate.swift | 6d4b9c94ab8ef862e1e26e856c88314d606ea542 | [] | no_license | IMCodeWizard/git_test | 2feb24a3152414f63699bd8ffbaa918a95af4a9f | 36dcd0c6701af0d2cc98178002258a97884d71e8 | refs/heads/master | 2023-04-17T19:54:17.369367 | 2018-05-05T14:22:42 | 2018-05-05T14:22:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,167 | swift | //
// AppDelegate.swift
// Git test
//
// Created by Ninja on 05/05/2018.
// Copyright © 2018 iOS Ninja. 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,
327695,
229391,
278545,
229394,
278548,
229397,
229399,
229402,
352284,
229405,
278556,
278559,
229408,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
311349,
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,
131264,
286916,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
303347,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
295220,
287032,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
172534,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
172552,
320007,
287238,
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,
189040,
172660,
287349,
189044,
189039,
287355,
287360,
295553,
172675,
295557,
311942,
303751,
287365,
352905,
311946,
287371,
279178,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
287390,
303773,
172705,
287394,
172707,
303780,
164509,
287398,
205479,
287400,
279208,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
279231,
287427,
312005,
312006,
107208,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
312035,
279267,
295654,
279272,
230128,
312048,
312050,
230131,
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,
303987,
328563,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
304007,
304009,
213895,
304011,
230284,
304013,
295822,
189325,
213902,
189329,
295825,
304019,
189331,
279438,
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,
197645,
295949,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
132165,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
296044,
164973,
205934,
279661,
312432,
279669,
337018,
189562,
279679,
304258,
279683,
222340,
66690,
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,
230679,
320792,
230681,
296215,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
230718,
296259,
378181,
296262,
230727,
238919,
296264,
320840,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
148843,
410987,
230763,
230768,
296305,
312692,
230773,
304505,
304506,
181626,
279929,
181631,
148865,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
288154,
337306,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
337335,
288185,
279991,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
148946,
370130,
222676,
288210,
288212,
288214,
239064,
329177,
288217,
288218,
280027,
288220,
239070,
288224,
370146,
280034,
288226,
288229,
280036,
280038,
288232,
288230,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
148990,
296450,
206336,
230916,
230919,
214535,
230923,
304651,
304653,
370187,
402969,
230940,
222752,
108066,
296486,
296488,
157229,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
181854,
239202,
370279,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
419489,
190118,
198310,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
419522,
313027,
280260,
419525,
206536,
280264,
206539,
206541,
206543,
263888,
313044,
280276,
321239,
280283,
313052,
18140,
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,
337732,
280388,
304968,
280393,
280402,
173907,
313171,
313176,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
354265,
354270,
239586,
313320,
354281,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
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,
288909,
141455,
275606,
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,
280819,
157940,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
305464,
280891,
289087,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
248153,
215387,
354653,
354656,
313700,
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,
436684,
281045,
281047,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
330244,
240132,
223752,
150025,
338440,
281095,
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,
182926,
133776,
182929,
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,
338823,
322440,
314249,
240519,
183184,
289687,
240535,
224151,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
420829,
281567,
289762,
322534,
297961,
183277,
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,
298365,
290174,
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,
28219,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282255,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
282295,
323260,
282300,
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,
282481,
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,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
290739,
241588,
282547,
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,
299191,
307385,
307386,
258235,
307388,
176311,
307390,
176316,
299200,
184512,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
323854,
291089,
282906,
291104,
233766,
295583,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
282947,
323917,
282957,
110926,
233808,
323921,
315733,
323926,
233815,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
291226,
242075,
283033,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
291254,
283062,
127417,
291260,
127421,
127424,
299457,
127429,
127431,
127434,
315856,
127440,
176592,
315860,
176597,
283095,
127447,
299481,
127449,
176605,
242143,
127455,
127457,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
127490,
127494,
283142,
127497,
233994,
135689,
127500,
291341,
233998,
127506,
234003,
127509,
234006,
127511,
152087,
283161,
242202,
234010,
135707,
135710,
242206,
242208,
291361,
242220,
291378,
152118,
234038,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
299740,
242396,
201444,
299750,
283368,
234219,
283372,
185074,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
234246,
226056,
291593,
234248,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
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,
226182,
234375,
308105,
226185,
234379,
201603,
324490,
234384,
234388,
234390,
226200,
234393,
209818,
308123,
234396,
324508,
291742,
324504,
234398,
234401,
291747,
291748,
234405,
291750,
324518,
324520,
234407,
324522,
234410,
291756,
291754,
226220,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
324536,
275384,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
234437,
226239,
226245,
234439,
234443,
291788,
234446,
193486,
193488,
234449,
316370,
275406,
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,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
234585,
275545,
242777,
234590,
234593,
234595,
234597,
300133,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
324757,
234647,
226453,
234648,
234650,
308379,
275608,
300189,
324766,
119967,
234653,
324768,
283805,
234657,
242852,
300197,
234661,
283813,
234664,
177318,
275626,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
283844,
300234,
283850,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
349451,
177424,
275725,
283917,
349464,
415009,
283939,
259367,
292143,
283951,
300344,
226617,
243003,
283963,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
316768,
292192,
218464,
292197,
316774,
243046,
218473,
284010,
136562,
324978,
333178,
275834,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
300436,
226709,
357783,
316824,
316826,
300448,
144807,
144810,
144812,
284076,
144814,
227426,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
316917,
292343,
308727,
300537,
316933,
316947,
308757,
308762,
284191,
316959,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
292414,
284223,
284226,
284228,
243268,
292421,
284231,
226886,
128584,
284234,
366155,
317004,
276043,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
292433,
284247,
317015,
235097,
243290,
284249,
276052,
276053,
300638,
284251,
284253,
284255,
284258,
243293,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
292479,
284288,
292481,
284290,
325250,
284292,
292485,
325251,
276095,
276098,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
284354,
358083,
284358,
276166,
358089,
284362,
276170,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
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,
284502,
317271,
178006,
276315,
292700,
317279,
284511,
227175,
292715,
300912,
292721,
284529,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
317332,
358292,
284564,
399252,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
284585,
276395,
292776,
292784,
276402,
358326,
161718,
358330,
276411,
276418,
276425,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276448,
276452,
292839,
276455,
350186,
292843,
276460,
178161,
227314,
276466,
325624,
350200,
276472,
317435,
276476,
276479,
350210,
276482,
178181,
317446,
276485,
350218,
276490,
292876,
350222,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
178224,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
243779,
325700,
284739,
292934,
276553,
243785,
350293,
350295,
309337,
227418,
350299,
194649,
350302,
194654,
350304,
178273,
309346,
227423,
194660,
350308,
309350,
309348,
292968,
309352,
309354,
301163,
350313,
350316,
227430,
301167,
276583,
350321,
276590,
284786,
276595,
350325,
252022,
227440,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
153765,
284837,
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,
227583,
276735,
227587,
276739,
211204,
276742,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
293227,
276843,
293232,
276848,
186744,
211324,
227709,
285061,
366983,
317833,
178572,
285070,
285077,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
129486,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
293346,
227810,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
293387,
236043,
342541,
317963,
113167,
55822,
309779,
317971,
309781,
277011,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
219714,
129603,
301636,
318020,
301639,
301643,
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,
318132,
342707,
154292,
277173,
285368,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
342745,
137946,
342747,
342749,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
56045,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
293696,
310080,
277317,
293706,
277322,
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,
276579,
293817,
293820,
203715,
326603,
342994,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
351217,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
244731,
285690,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
293960,
310344,
277577,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
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,
228592,
294132,
138485,
228601,
204026,
228606,
204031,
64768,
310531,
138505,
228617,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
384302,
285999,
277804,
113969,
277807,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
294221,
146765,
294223,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
146784,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
228776,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
310727,
245191,
64966,
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,
310780,
40448,
228864,
286214,
228871,
302603,
302614,
302617,
286233,
302621,
286240,
146977,
187936,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
245288,
310831,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286312,
40554,
286313,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
302764,
278188,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
286420,
278227,
229076,
286425,
319194,
278235,
229086,
278238,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
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,
237508,
393177,
294876,
294879,
294883,
393190,
294890,
311279,
278513,
237555,
311283,
278516,
278519,
237562
] |
93a7170434d1fc60225a8aca699c19e4e1184fd2 | 241b6af374fe138de4965c647eb979a303a3dd1d | /Blocky/Call Blocking/BlockedListTableViewCell.swift | d2a81da37d5423f6dd95c37feac39fc3dcb86f9f | [] | no_license | M-I-N/Blocky | 3962877f09f144904b2001d2e4ddef8bf926fd3a | 3cc2eca539dc3f117fd629d797e8b61afebbc8f3 | refs/heads/master | 2020-03-17T19:00:55.867336 | 2018-05-20T06:20:05 | 2018-05-20T06:20:05 | 133,842,983 | 2 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,104 | swift | //
// BlockedListTableViewCell.swift
// Blocky
//
// Created by Nayem on 5/15/18.
// Copyright © 2018 Mufakkharul Islam Nayem. All rights reserved.
//
import UIKit
class BlockedListTableViewCell: UITableViewCell {
var viewModel: ViewModel? {
didSet {
guard let viewModel = viewModel else { return }
self.textLabel?.text = viewModel.name
self.detailTextLabel?.text = viewModel.phoneNumber.internationallyFormattedNumber ?? "Phone Number Malformed"
}
}
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
}
}
extension BlockedListTableViewCell {
struct ViewModel {
let name: String
let phoneNumber: String
}
}
extension BlockedListTableViewCell.ViewModel {
init(callBlock: CallBlock) {
name = callBlock.name
phoneNumber = String(callBlock.phoneNumber)
}
}
| [
-1
] |
adb99dadc4ba835ba36f5488b5f1c398887b8a36 | a00f19947bb7c70f121a1e37b3fddbba98c52042 | /CollectionManager/CollectionViewManagerKit/CollectionViewManager/CollectionViewManager+ScrollViewDelegate.swift | ce9aafd4ccf1c51d723c93b958686371f865fbed | [] | no_license | DavidKmn/CollectionViewManagerKit | 9cea9e107c22dc53c839d3b76a302637a5cf06ba | 29073f4f829f3b68d251e31b7aed816f6b3471a4 | refs/heads/master | 2020-04-08T03:33:58.158205 | 2018-12-13T11:44:49 | 2018-12-13T11:44:49 | 158,981,097 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,949 | swift | //
// CollectionViewManager+ScrollViewDelegate.swift
// CollectionManager
//
// Created by David on 11/11/2018.
// Copyright © 2018 David. All rights reserved.
//
import UIKit
extension CollectionViewManager {
func scrollViewDidZoom(_ scrollView: UIScrollView) {
if let handler = self.onScroll?.didZoom {
handler(scrollView)
}
}
public func viewForZooming(in scrollView: UIScrollView) -> UIView? {
if let handler = self.onScroll?.viewForZooming {
return handler(scrollView)
}
return nil
}
public func scrollViewWillBeginZooming(_ scrollView: UIScrollView, with view: UIView?) {
if let handler = self.onScroll?.willBeginZooming {
handler(scrollView,view)
}
}
public func scrollViewDidEndZooming(_ scrollView: UIScrollView, with view: UIView?, atScale scale: CGFloat) {
if let handler = self.onScroll?.endZooming {
handler(scrollView,view,scale)
}
}
func scrollViewDidScroll(_ scrollView: UIScrollView) {
if let handler = self.onScroll?.didScroll {
handler(scrollView)
}
}
func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
if let handler = self.onScroll?.willBeginDragging {
handler(scrollView)
}
}
func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
if let handler = self.onScroll?.willEndDragging {
handler(scrollView, velocity, targetContentOffset)
}
}
func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
if let handler = self.onScroll?.endDragging {
handler(scrollView, decelerate)
}
}
func scrollViewShouldScrollToTop(_ scrollView: UIScrollView) -> Bool {
if let handler = self.onScroll?.shouldScrollToTop {
return handler(scrollView)
}
return true
}
func scrollViewDidScrollToTop(_ scrollView: UIScrollView) {
if let handler = self.onScroll?.didScrollToTop {
handler(scrollView)
}
}
func scrollViewWillBeginDecelerating(_ scrollView: UIScrollView) {
if let handler = self.onScroll?.willBeginDecelerating {
handler(scrollView)
}
}
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
if let handler = self.onScroll?.endDecelerating {
handler(scrollView)
}
}
public func scrollViewDidEndScrollingAnimation(_ scrollView: UIScrollView) {
self.onScroll?.endScrollingAnimation?(scrollView)
}
public func scrollViewDidChangeAdjustedContentInset(_ scrollView: UIScrollView) {
self.onScroll?.didChangeAdjustedContentInset?(scrollView)
}
}
| [
-1
] |
60a2f7fc6e8ee9b3cf6b70a2bd21d0aa9d270f21 | 4003f3bd274195258cec177229d0c5a816baa6a5 | /Sources/NISLRequestPackages/NISLRequestPackages.swift | ca6b8a90c29db55ca40906a5e7ebbbd87bfb94c3 | [] | no_license | DhavalUmraliya/dhuStruct | 3a75b98120235ef8479a2c0c3bc26ab02e93aad8 | e00344c45c6eb4280fe98c5bd79314a0c209149a | refs/heads/master | 2023-03-31T14:02:29.769123 | 2021-04-03T10:58:18 | 2021-04-03T10:58:18 | 354,267,565 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 48 | swift | //
// Created by Harjeet Singh on 05/09/20.
//
| [
-1
] |
1053409fbf5d459821209612a985d3451ed5c214 | 5a9f988de749d7861df3bab077b999adb16c70f8 | /WonderCounter/Core/models/PlayerScore.swift | 14782fd945e26107cb80d6afa0ac5a07c4f52309 | [
"MIT"
] | permissive | gifton/WonderCounter | 24258f5a2469745fe5cd8ccf065df31256f8754f | 3bf67c643710660ba2bbea61a8d20a287373247f | refs/heads/master | 2021-03-22T09:22:48.378830 | 2020-03-15T06:37:33 | 2020-03-15T06:37:33 | 247,352,364 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 569 | swift |
import UIKit
import CoreData
@objc(PlayerScore)
class PlayerScore: NSManagedObject {
@NSManaged public var war: Int16
@NSManaged public var coin: Int16
@NSManaged public var wonder: Int16
@NSManaged public var civilian: Int16
@NSManaged public var commercial: Int16
@NSManaged public var guild: Int16
@NSManaged public var science: Int16
@NSManaged public var player: Player
}
extension PlayerScore {
var totoalScore: Int {
return Int(war + coin + wonder + civilian + commercial + guild + science)
}
}
| [
-1
] |
8cf1f3e54028f68decae2615737a6bd425375492 | 6c0b43a282355bb7b2851c6f6935c1431c6d7f67 | /E Customs Admin/Scenes/Home/Home/HomeVC.swift | 8a6ad8fa893ef32767845b8c26fb6a50075852be | [] | no_license | Hansaanuradha93/E-Customs-Admin | 673dedf9535b8f4b01a535102dc249ada0caa675 | d8300e02c4f108391d25d3eb1c8fc38b24f23c85 | refs/heads/master | 2023-05-29T23:55:53.482610 | 2021-06-20T13:38:03 | 2021-06-20T13:38:03 | 294,420,846 | 0 | 0 | null | 2021-06-20T13:38:03 | 2020-09-10T13:39:35 | Swift | UTF-8 | Swift | false | false | 2,688 | swift | import UIKit
import Firebase
class HomeVC: UITableViewController {
// MARK: Properties
let viewModel = HomeVM()
private var listener: ListenerRegistration?
// MARK: View Controller
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
fetchProducts()
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
if isMovingFromParent { listener?.remove() }
}
}
// MARK: - UITableView
extension HomeVC {
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return viewModel.products.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: ProductCell.reuseID, for: indexPath) as! ProductCell
if viewModel.products.count > 0 {
cell.set(product: viewModel.products[indexPath.row])
}
return cell
}
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 445
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let controller = ProductDetailsVC(viewModel: ProductDetialsVM(product: viewModel.products[indexPath.row]))
self.navigationController?.pushViewController(controller, animated: true)
}
}
// MARK: - Fileprivate Methods
private extension HomeVC {
func fetchProducts() {
listener = viewModel.fetchProducts { (status) in
if status {
self.updateUI()
}
}
}
func updateUI() {
if self.viewModel.products.isEmpty {
DispatchQueue.main.async { self.tableView.backgroundView = ECEmptyStateView(emptyStateType: .home) }
} else {
DispatchQueue.main.async { self.tableView.backgroundView = nil }
}
DispatchQueue.main.async { self.tableView.reloadData() }
}
func setupUI() {
navigationController?.navigationBar.barTintColor = UIColor.white
navigationController?.navigationBar.prefersLargeTitles = true
view.backgroundColor = .white
title = Strings.home
tabBarItem.title = Strings.empty
tableView.separatorStyle = .none
tableView.contentInset.top = 24
tableView.register(ProductCell.self, forCellReuseIdentifier: ProductCell.reuseID)
}
}
| [
-1
] |
c534d7ca1b79c22ba3cefebdc9a93fa8a4d90195 | fb7098e1a4ec61a72a07162c3b249554771e197d | /swift/looker/sdk/streams.swift | 233db84e1fa250558440993f338ab8d5abd6e414 | [
"MIT"
] | permissive | bindukodwaneyBF/sdk-codegen | 6bcf23bce65be266d2962628670858bb4e5d5a34 | eb1a427d3c90bec44b2aac542783c3cda4810c0e | refs/heads/main | 2023-04-18T00:01:21.491713 | 2021-05-06T18:04:15 | 2021-05-06T18:04:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 396,788 | swift | /**
MIT License
Copyright (c) 2021 Looker Data Sciences, Inc.
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.
*/
/**
* 412 API methods
*/
/// NOTE: Do not edit this file generated by Looker SDK Codegen for API 4.0
import Foundation
@available(OSX 10.15, *)
open class LookerSDKStream: APIMethods {
// MARK ApiAuth: API Authentication
/**
* ### Present client credentials to obtain an authorization token
*
* Looker API implements the OAuth2 [Resource Owner Password Credentials Grant](https://looker.com/docs/r/api/outh2_resource_owner_pc) pattern.
* The client credentials required for this login must be obtained by creating an API3 key on a user account
* in the Looker Admin console. The API3 key consists of a public `client_id` and a private `client_secret`.
*
* The access token returned by `login` must be used in the HTTP Authorization header of subsequent
* API requests, like this:
* ```
* Authorization: token 4QDkCyCtZzYgj4C2p2cj3csJH7zqS5RzKs2kTnG4
* ```
* Replace "4QDkCy..." with the `access_token` value returned by `login`.
* The word `token` is a string literal and must be included exactly as shown.
*
* This function can accept `client_id` and `client_secret` parameters as URL query params or as www-form-urlencoded params in the body of the HTTP request. Since there is a small risk that URL parameters may be visible to intermediate nodes on the network route (proxies, routers, etc), passing credentials in the body of the request is considered more secure than URL params.
*
* Example of passing credentials in the HTTP request body:
* ````
* POST HTTP /login
* Content-Type: application/x-www-form-urlencoded
*
* client_id=CGc9B7v7J48dQSJvxxx&client_secret=nNVS9cSS3xNpSC9JdsBvvvvv
* ````
*
* ### Best Practice:
* Always pass credentials in body params. Pass credentials in URL query params **only** when you cannot pass body params due to application, tool, or other limitations.
*
* For more information and detailed examples of Looker API authorization, see [How to Authenticate to Looker API3](https://github.com/looker/looker-sdk-ruby/blob/master/authentication.md).
*
* POST /login -> AccessToken
*/
public func login(
/**
* @param {String} client_id client_id part of API3 Key.
*/
client_id: String? = nil,
/**
* @param {String} client_secret client_secret part of API3 Key.
*/
client_secret: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/login",
["client_id": client_id, "client_secret": client_secret], nil, options)
return result
}
/**
* ### Create an access token that runs as a given user.
*
* This can only be called by an authenticated admin user. It allows that admin to generate a new
* authentication token for the user with the given user id. That token can then be used for subsequent
* API calls - which are then performed *as* that target user.
*
* The target user does *not* need to have a pre-existing API client_id/client_secret pair. And, no such
* credentials are created by this call.
*
* This allows for building systems where api user authentication for an arbitrary number of users is done
* outside of Looker and funneled through a single 'service account' with admin permissions. Note that a
* new access token is generated on each call. If target users are going to be making numerous API
* calls in a short period then it is wise to cache this authentication token rather than call this before
* each of those API calls.
*
* See 'login' for more detail on the access token and how to use it.
*
* POST /login/{user_id} -> AccessToken
*/
public func login_user(
/**
* @param {Int64} user_id Id of user.
*/
_ user_id: Int64,
/**
* @param {Bool} associative When true (default), API calls using the returned access_token are attributed to the admin user who created the access_token. When false, API activity is attributed to the user the access_token runs as. False requires a looker license.
*/
associative: Bool? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let result: SDKResponse<Data, SDKError> = self.post("/login/\(path_user_id)",
["associative": associative as Any?], nil, options)
return result
}
/**
* ### Logout of the API and invalidate the current access token.
*
* DELETE /logout -> String
*/
public func logout(
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.delete("/logout", nil, nil, options)
return result
}
// MARK Auth: Manage User Authentication Configuration
/**
* ### Create SSO Embed URL
*
* Creates an SSO embed URL and cryptographically signs it with an embed secret.
* This signed URL can then be used to instantiate a Looker embed session in a PBL web application.
* Do not make any modifications to this URL - any change may invalidate the signature and
* cause the URL to fail to load a Looker embed session.
*
* A signed SSO embed URL can only be used once. After it has been used to request a page from the
* Looker server, the URL is invalid. Future requests using the same URL will fail. This is to prevent
* 'replay attacks'.
*
* The `target_url` property must be a complete URL of a Looker UI page - scheme, hostname, path and query params.
* To load a dashboard with id 56 and with a filter of `Date=1 years`, the looker URL would look like `https:/myname.looker.com/dashboards/56?Date=1%20years`.
* The best way to obtain this target_url is to navigate to the desired Looker page in your web browser,
* copy the URL shown in the browser address bar and paste it into the `target_url` property as a quoted string value in this API request.
*
* Permissions for the embed user are defined by the groups in which the embed user is a member (group_ids property)
* and the lists of models and permissions assigned to the embed user.
* At a minimum, you must provide values for either the group_ids property, or both the models and permissions properties.
* These properties are additive; an embed user can be a member of certain groups AND be granted access to models and permissions.
*
* The embed user's access is the union of permissions granted by the group_ids, models, and permissions properties.
*
* This function does not strictly require all group_ids, user attribute names, or model names to exist at the moment the
* SSO embed url is created. Unknown group_id, user attribute names or model names will be passed through to the output URL.
* To diagnose potential problems with an SSO embed URL, you can copy the signed URL into the Embed URI Validator text box in `<your looker instance>/admin/embed`.
*
* The `secret_id` parameter is optional. If specified, its value must be the id of an active secret defined in the Looker instance.
* if not specified, the URL will be signed using the newest active secret defined in the Looker instance.
*
* #### Security Note
* Protect this signed URL as you would an access token or password credentials - do not write
* it to disk, do not pass it to a third party, and only pass it through a secure HTTPS
* encrypted transport.
*
* POST /embed/sso_url -> EmbedUrlResponse
*/
public func create_sso_embed_url(
/**
* @param {EmbedSsoParams} body
*/
_ body: EmbedSsoParams,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/embed/sso_url", nil, try! self.encode(body), options)
return result
}
/**
* ### Create an Embed URL
*
* Creates an embed URL that runs as the Looker user making this API call. ("Embed as me")
* This embed URL can then be used to instantiate a Looker embed session in a
* "Powered by Looker" (PBL) web application.
*
* This is similar to Private Embedding (https://docs.looker.com/r/admin/embed/private-embed). Instead of
* of logging into the Web UI to authenticate, the user has already authenticated against the API to be able to
* make this call. However, unlike Private Embed where the user has access to any other part of the Looker UI,
* the embed web session created by requesting the EmbedUrlResponse.url in a browser only has access to
* content visible under the `/embed` context.
*
* An embed URL can only be used once, and must be used within 5 minutes of being created. After it
* has been used to request a page from the Looker server, the URL is invalid. Future requests using
* the same URL will fail. This is to prevent 'replay attacks'.
*
* The `target_url` property must be a complete URL of a Looker Embedded UI page - scheme, hostname, path starting with "/embed" and query params.
* To load a dashboard with id 56 and with a filter of `Date=1 years`, the looker Embed URL would look like `https://myname.looker.com/embed/dashboards/56?Date=1%20years`.
* The best way to obtain this target_url is to navigate to the desired Looker page in your web browser,
* copy the URL shown in the browser address bar, insert "/embed" after the host/port, and paste it into the `target_url` property as a quoted string value in this API request.
*
* #### Security Note
* Protect this embed URL as you would an access token or password credentials - do not write
* it to disk, do not pass it to a third party, and only pass it through a secure HTTPS
* encrypted transport.
*
* POST /embed/token_url/me -> EmbedUrlResponse
*/
public func create_embed_url_as_me(
/**
* @param {EmbedParams} body
*/
_ body: EmbedParams,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/embed/token_url/me", nil, try! self.encode(body), options)
return result
}
/**
* ### Get the LDAP configuration.
*
* Looker can be optionally configured to authenticate users against an Active Directory or other LDAP directory server.
* LDAP setup requires coordination with an administrator of that directory server.
*
* Only Looker administrators can read and update the LDAP configuration.
*
* Configuring LDAP impacts authentication for all users. This configuration should be done carefully.
*
* Looker maintains a single LDAP configuration. It can be read and updated. Updates only succeed if the new state will be valid (in the sense that all required fields are populated); it is up to you to ensure that the configuration is appropriate and correct).
*
* LDAP is enabled or disabled for Looker using the **enabled** field.
*
* Looker will never return an **auth_password** field. That value can be set, but never retrieved.
*
* See the [Looker LDAP docs](https://www.looker.com/docs/r/api/ldap_setup) for additional information.
*
* GET /ldap_config -> LDAPConfig
*/
public func ldap_config(
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/ldap_config", nil, nil, options)
return result
}
/**
* ### Update the LDAP configuration.
*
* Configuring LDAP impacts authentication for all users. This configuration should be done carefully.
*
* Only Looker administrators can read and update the LDAP configuration.
*
* LDAP is enabled or disabled for Looker using the **enabled** field.
*
* It is **highly** recommended that any LDAP setting changes be tested using the APIs below before being set globally.
*
* See the [Looker LDAP docs](https://www.looker.com/docs/r/api/ldap_setup) for additional information.
*
* PATCH /ldap_config -> LDAPConfig
*/
public func update_ldap_config(
/**
* @param {WriteLDAPConfig} body
*/
_ body: WriteLDAPConfig,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.patch("/ldap_config", nil, try! self.encode(body), options)
return result
}
/**
* ### Test the connection settings for an LDAP configuration.
*
* This tests that the connection is possible given a connection_host and connection_port.
*
* **connection_host** and **connection_port** are required. **connection_tls** is optional.
*
* Example:
* ```json
* {
* "connection_host": "ldap.example.com",
* "connection_port": "636",
* "connection_tls": true
* }
* ```
*
* No authentication to the LDAP server is attempted.
*
* The active LDAP settings are not modified.
*
* PUT /ldap_config/test_connection -> LDAPConfigTestResult
*/
public func test_ldap_config_connection(
/**
* @param {WriteLDAPConfig} body
*/
_ body: WriteLDAPConfig,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.put("/ldap_config/test_connection", nil, try! self.encode(body), options)
return result
}
/**
* ### Test the connection authentication settings for an LDAP configuration.
*
* This tests that the connection is possible and that a 'server' account to be used by Looker can authenticate to the LDAP server given connection and authentication information.
*
* **connection_host**, **connection_port**, and **auth_username**, are required. **connection_tls** and **auth_password** are optional.
*
* Example:
* ```json
* {
* "connection_host": "ldap.example.com",
* "connection_port": "636",
* "connection_tls": true,
* "auth_username": "cn=looker,dc=example,dc=com",
* "auth_password": "secret"
* }
* ```
*
* Looker will never return an **auth_password**. If this request omits the **auth_password** field, then the **auth_password** value from the active config (if present) will be used for the test.
*
* The active LDAP settings are not modified.
*
* PUT /ldap_config/test_auth -> LDAPConfigTestResult
*/
public func test_ldap_config_auth(
/**
* @param {WriteLDAPConfig} body
*/
_ body: WriteLDAPConfig,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.put("/ldap_config/test_auth", nil, try! self.encode(body), options)
return result
}
/**
* ### Test the user authentication settings for an LDAP configuration without authenticating the user.
*
* This test will let you easily test the mapping for user properties and roles for any user without needing to authenticate as that user.
*
* This test accepts a full LDAP configuration along with a username and attempts to find the full info for the user from the LDAP server without actually authenticating the user. So, user password is not required.The configuration is validated before attempting to contact the server.
*
* **test_ldap_user** is required.
*
* The active LDAP settings are not modified.
*
* PUT /ldap_config/test_user_info -> LDAPConfigTestResult
*/
public func test_ldap_config_user_info(
/**
* @param {WriteLDAPConfig} body
*/
_ body: WriteLDAPConfig,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.put("/ldap_config/test_user_info", nil, try! self.encode(body), options)
return result
}
/**
* ### Test the user authentication settings for an LDAP configuration.
*
* This test accepts a full LDAP configuration along with a username/password pair and attempts to authenticate the user with the LDAP server. The configuration is validated before attempting the authentication.
*
* Looker will never return an **auth_password**. If this request omits the **auth_password** field, then the **auth_password** value from the active config (if present) will be used for the test.
*
* **test_ldap_user** and **test_ldap_password** are required.
*
* The active LDAP settings are not modified.
*
* PUT /ldap_config/test_user_auth -> LDAPConfigTestResult
*/
public func test_ldap_config_user_auth(
/**
* @param {WriteLDAPConfig} body
*/
_ body: WriteLDAPConfig,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.put("/ldap_config/test_user_auth", nil, try! self.encode(body), options)
return result
}
/**
* ### List All OAuth Client Apps
*
* Lists all applications registered to use OAuth2 login with this Looker instance, including
* enabled and disabled apps.
*
* Results are filtered to include only the apps that the caller (current user)
* has permission to see.
*
* GET /oauth_client_apps -> [OauthClientApp]
*/
public func all_oauth_client_apps(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/oauth_client_apps",
["fields": fields], nil, options)
return result
}
/**
* ### Get Oauth Client App
*
* Returns the registered app client with matching client_guid.
*
* GET /oauth_client_apps/{client_guid} -> OauthClientApp
*/
public func oauth_client_app(
/**
* @param {String} client_guid The unique id of this application
*/
_ client_guid: String,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_client_guid = encodeParam(client_guid)
let result: SDKResponse<Data, SDKError> = self.get("/oauth_client_apps/\(path_client_guid)",
["fields": fields], nil, options)
return result
}
/**
* ### Register an OAuth2 Client App
*
* Registers details identifying an external web app or native app as an OAuth2 login client of the Looker instance.
* The app registration must provide a unique client_guid and redirect_uri that the app will present
* in OAuth login requests. If the client_guid and redirect_uri parameters in the login request do not match
* the app details registered with the Looker instance, the request is assumed to be a forgery and is rejected.
*
* POST /oauth_client_apps/{client_guid} -> OauthClientApp
*/
public func register_oauth_client_app(
/**
* @param {String} client_guid The unique id of this application
*/
_ client_guid: String,
/**
* @param {WriteOauthClientApp} body
*/
_ body: WriteOauthClientApp,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_client_guid = encodeParam(client_guid)
let result: SDKResponse<Data, SDKError> = self.post("/oauth_client_apps/\(path_client_guid)",
["fields": fields], try! self.encode(body), options)
return result
}
/**
* ### Update OAuth2 Client App Details
*
* Modifies the details a previously registered OAuth2 login client app.
*
* PATCH /oauth_client_apps/{client_guid} -> OauthClientApp
*/
public func update_oauth_client_app(
/**
* @param {String} client_guid The unique id of this application
*/
_ client_guid: String,
/**
* @param {WriteOauthClientApp} body
*/
_ body: WriteOauthClientApp,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_client_guid = encodeParam(client_guid)
let result: SDKResponse<Data, SDKError> = self.patch("/oauth_client_apps/\(path_client_guid)",
["fields": fields], try! self.encode(body), options)
return result
}
/**
* ### Delete OAuth Client App
*
* Deletes the registration info of the app with the matching client_guid.
* All active sessions and tokens issued for this app will immediately become invalid.
*
* ### Note: this deletion cannot be undone.
*
* DELETE /oauth_client_apps/{client_guid} -> String
*/
public func delete_oauth_client_app(
/**
* @param {String} client_guid The unique id of this application
*/
_ client_guid: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_client_guid = encodeParam(client_guid)
let result: SDKResponse<Data, SDKError> = self.delete("/oauth_client_apps/\(path_client_guid)", nil, nil, options)
return result
}
/**
* ### Invalidate All Issued Tokens
*
* Immediately invalidates all auth codes, sessions, access tokens and refresh tokens issued for
* this app for ALL USERS of this app.
*
* DELETE /oauth_client_apps/{client_guid}/tokens -> String
*/
public func invalidate_tokens(
/**
* @param {String} client_guid The unique id of the application
*/
_ client_guid: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_client_guid = encodeParam(client_guid)
let result: SDKResponse<Data, SDKError> = self.delete("/oauth_client_apps/\(path_client_guid)/tokens", nil, nil, options)
return result
}
/**
* ### Activate an app for a user
*
* Activates a user for a given oauth client app. This indicates the user has been informed that
* the app will have access to the user's looker data, and that the user has accepted and allowed
* the app to use their Looker account.
*
* Activating a user for an app that the user is already activated with returns a success response.
*
* POST /oauth_client_apps/{client_guid}/users/{user_id} -> String
*/
public func activate_app_user(
/**
* @param {String} client_guid The unique id of this application
*/
_ client_guid: String,
/**
* @param {Int64} user_id The id of the user to enable use of this app
*/
_ user_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_client_guid = encodeParam(client_guid)
let path_user_id = encodeParam(user_id)
let result: SDKResponse<Data, SDKError> = self.post("/oauth_client_apps/\(path_client_guid)/users/\(path_user_id)",
["fields": fields], nil, options)
return result
}
/**
* ### Deactivate an app for a user
*
* Deactivate a user for a given oauth client app. All tokens issued to the app for
* this user will be invalid immediately. Before the user can use the app with their
* Looker account, the user will have to read and accept an account use disclosure statement for the app.
*
* Admin users can deactivate other users, but non-admin users can only deactivate themselves.
*
* As with most REST DELETE operations, this endpoint does not return an error if the indicated
* resource (app or user) does not exist or has already been deactivated.
*
* DELETE /oauth_client_apps/{client_guid}/users/{user_id} -> String
*/
public func deactivate_app_user(
/**
* @param {String} client_guid The unique id of this application
*/
_ client_guid: String,
/**
* @param {Int64} user_id The id of the user to enable use of this app
*/
_ user_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_client_guid = encodeParam(client_guid)
let path_user_id = encodeParam(user_id)
let result: SDKResponse<Data, SDKError> = self.delete("/oauth_client_apps/\(path_client_guid)/users/\(path_user_id)",
["fields": fields], nil, options)
return result
}
/**
* ### Get the OIDC configuration.
*
* Looker can be optionally configured to authenticate users against an OpenID Connect (OIDC)
* authentication server. OIDC setup requires coordination with an administrator of that server.
*
* Only Looker administrators can read and update the OIDC configuration.
*
* Configuring OIDC impacts authentication for all users. This configuration should be done carefully.
*
* Looker maintains a single OIDC configuation. It can be read and updated. Updates only succeed if the new state will be valid (in the sense that all required fields are populated); it is up to you to ensure that the configuration is appropriate and correct).
*
* OIDC is enabled or disabled for Looker using the **enabled** field.
*
* GET /oidc_config -> OIDCConfig
*/
public func oidc_config(
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/oidc_config", nil, nil, options)
return result
}
/**
* ### Update the OIDC configuration.
*
* Configuring OIDC impacts authentication for all users. This configuration should be done carefully.
*
* Only Looker administrators can read and update the OIDC configuration.
*
* OIDC is enabled or disabled for Looker using the **enabled** field.
*
* It is **highly** recommended that any OIDC setting changes be tested using the APIs below before being set globally.
*
* PATCH /oidc_config -> OIDCConfig
*/
public func update_oidc_config(
/**
* @param {WriteOIDCConfig} body
*/
_ body: WriteOIDCConfig,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.patch("/oidc_config", nil, try! self.encode(body), options)
return result
}
/**
* ### Get a OIDC test configuration by test_slug.
*
* GET /oidc_test_configs/{test_slug} -> OIDCConfig
*/
public func oidc_test_config(
/**
* @param {String} test_slug Slug of test config
*/
_ test_slug: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_test_slug = encodeParam(test_slug)
let result: SDKResponse<Data, SDKError> = self.get("/oidc_test_configs/\(path_test_slug)", nil, nil, options)
return result
}
/**
* ### Delete a OIDC test configuration.
*
* DELETE /oidc_test_configs/{test_slug} -> String
*/
public func delete_oidc_test_config(
/**
* @param {String} test_slug Slug of test config
*/
_ test_slug: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_test_slug = encodeParam(test_slug)
let result: SDKResponse<Data, SDKError> = self.delete("/oidc_test_configs/\(path_test_slug)", nil, nil, options)
return result
}
/**
* ### Create a OIDC test configuration.
*
* POST /oidc_test_configs -> OIDCConfig
*/
public func create_oidc_test_config(
/**
* @param {WriteOIDCConfig} body
*/
_ body: WriteOIDCConfig,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/oidc_test_configs", nil, try! self.encode(body), options)
return result
}
/**
* ### Get password config.
*
* GET /password_config -> PasswordConfig
*/
public func password_config(
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/password_config", nil, nil, options)
return result
}
/**
* ### Update password config.
*
* PATCH /password_config -> PasswordConfig
*/
public func update_password_config(
/**
* @param {WritePasswordConfig} body
*/
_ body: WritePasswordConfig,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.patch("/password_config", nil, try! self.encode(body), options)
return result
}
/**
* ### Force all credentials_email users to reset their login passwords upon their next login.
*
* PUT /password_config/force_password_reset_at_next_login_for_all_users -> String
*/
public func force_password_reset_at_next_login_for_all_users(
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.put("/password_config/force_password_reset_at_next_login_for_all_users", nil, nil, options)
return result
}
/**
* ### Get the SAML configuration.
*
* Looker can be optionally configured to authenticate users against a SAML authentication server.
* SAML setup requires coordination with an administrator of that server.
*
* Only Looker administrators can read and update the SAML configuration.
*
* Configuring SAML impacts authentication for all users. This configuration should be done carefully.
*
* Looker maintains a single SAML configuation. It can be read and updated. Updates only succeed if the new state will be valid (in the sense that all required fields are populated); it is up to you to ensure that the configuration is appropriate and correct).
*
* SAML is enabled or disabled for Looker using the **enabled** field.
*
* GET /saml_config -> SamlConfig
*/
public func saml_config(
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/saml_config", nil, nil, options)
return result
}
/**
* ### Update the SAML configuration.
*
* Configuring SAML impacts authentication for all users. This configuration should be done carefully.
*
* Only Looker administrators can read and update the SAML configuration.
*
* SAML is enabled or disabled for Looker using the **enabled** field.
*
* It is **highly** recommended that any SAML setting changes be tested using the APIs below before being set globally.
*
* PATCH /saml_config -> SamlConfig
*/
public func update_saml_config(
/**
* @param {WriteSamlConfig} body
*/
_ body: WriteSamlConfig,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.patch("/saml_config", nil, try! self.encode(body), options)
return result
}
/**
* ### Get a SAML test configuration by test_slug.
*
* GET /saml_test_configs/{test_slug} -> SamlConfig
*/
public func saml_test_config(
/**
* @param {String} test_slug Slug of test config
*/
_ test_slug: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_test_slug = encodeParam(test_slug)
let result: SDKResponse<Data, SDKError> = self.get("/saml_test_configs/\(path_test_slug)", nil, nil, options)
return result
}
/**
* ### Delete a SAML test configuration.
*
* DELETE /saml_test_configs/{test_slug} -> String
*/
public func delete_saml_test_config(
/**
* @param {String} test_slug Slug of test config
*/
_ test_slug: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_test_slug = encodeParam(test_slug)
let result: SDKResponse<Data, SDKError> = self.delete("/saml_test_configs/\(path_test_slug)", nil, nil, options)
return result
}
/**
* ### Create a SAML test configuration.
*
* POST /saml_test_configs -> SamlConfig
*/
public func create_saml_test_config(
/**
* @param {WriteSamlConfig} body
*/
_ body: WriteSamlConfig,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/saml_test_configs", nil, try! self.encode(body), options)
return result
}
/**
* ### Parse the given xml as a SAML IdP metadata document and return the result.
*
* POST /parse_saml_idp_metadata -> SamlMetadataParseResult
*/
public func parse_saml_idp_metadata(
/**
* @param {String} body
*/
_ body: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/parse_saml_idp_metadata", nil, try! self.encode(body), options)
return result
}
/**
* ### Fetch the given url and parse it as a SAML IdP metadata document and return the result.
* Note that this requires that the url be public or at least at a location where the Looker instance
* can fetch it without requiring any special authentication.
*
* POST /fetch_and_parse_saml_idp_metadata -> SamlMetadataParseResult
*/
public func fetch_and_parse_saml_idp_metadata(
/**
* @param {String} body
*/
_ body: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/fetch_and_parse_saml_idp_metadata", nil, try! self.encode(body), options)
return result
}
/**
* ### Get session config.
*
* GET /session_config -> SessionConfig
*/
public func session_config(
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/session_config", nil, nil, options)
return result
}
/**
* ### Update session config.
*
* PATCH /session_config -> SessionConfig
*/
public func update_session_config(
/**
* @param {WriteSessionConfig} body
*/
_ body: WriteSessionConfig,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.patch("/session_config", nil, try! self.encode(body), options)
return result
}
/**
* ### Get currently locked-out users.
*
* GET /user_login_lockouts -> [UserLoginLockout]
*/
public func all_user_login_lockouts(
/**
* @param {String} fields Include only these fields in the response
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/user_login_lockouts",
["fields": fields], nil, options)
return result
}
/**
* ### Search currently locked-out users.
*
* GET /user_login_lockouts/search -> [UserLoginLockout]
*/
public func search_user_login_lockouts(
/**
* @param {String} fields Include only these fields in the response
*/
fields: String? = nil,
/**
* @param {Int64} page Return only page N of paginated results
*/
page: Int64? = nil,
/**
* @param {Int64} per_page Return N rows of data per page
*/
per_page: Int64? = nil,
/**
* @param {String} sorts Fields to sort by.
*/
sorts: String? = nil,
/**
* @param {String} auth_type Auth type user is locked out for (email, ldap, totp, api)
*/
auth_type: String? = nil,
/**
* @param {String} full_name Match name
*/
full_name: String? = nil,
/**
* @param {String} email Match email
*/
email: String? = nil,
/**
* @param {String} remote_id Match remote LDAP ID
*/
remote_id: String? = nil,
/**
* @param {Bool} filter_or Combine given search criteria in a boolean OR expression
*/
filter_or: Bool? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/user_login_lockouts/search",
["fields": fields, "page": page, "per_page": per_page, "sorts": sorts, "auth_type": auth_type, "full_name": full_name, "email": email, "remote_id": remote_id, "filter_or": filter_or as Any?], nil, options)
return result
}
/**
* ### Removes login lockout for the associated user.
*
* DELETE /user_login_lockout/{key} -> String
*/
public func delete_user_login_lockout(
/**
* @param {String} key The key associated with the locked user
*/
_ key: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_key = encodeParam(key)
let result: SDKResponse<Data, SDKError> = self.delete("/user_login_lockout/\(path_key)", nil, nil, options)
return result
}
// MARK Board: Manage Boards
/**
* ### Get information about all boards.
*
* GET /boards -> [Board]
*/
public func all_boards(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/boards",
["fields": fields], nil, options)
return result
}
/**
* ### Create a new board.
*
* POST /boards -> Board
*/
public func create_board(
/**
* @param {WriteBoard} body
*/
_ body: WriteBoard,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/boards",
["fields": fields], try! self.encode(body), options)
return result
}
/**
* ### Search Boards
*
* If multiple search params are given and `filter_or` is FALSE or not specified,
* search params are combined in a logical AND operation.
* Only rows that match *all* search param criteria will be returned.
*
* If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
* Results will include rows that match **any** of the search criteria.
*
* String search params use case-insensitive matching.
* String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
* example="dan%" will match "danger" and "Danzig" but not "David"
* example="D_m%" will match "Damage" and "dump"
*
* Integer search params can accept a single value or a comma separated list of values. The multiple
* values will be combined under a logical OR operation - results will match at least one of
* the given values.
*
* Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
* or exclude (respectively) rows where the column is null.
*
* Boolean search params accept only "true" and "false" as values.
*
* GET /boards/search -> [Board]
*/
public func search_boards(
/**
* @param {String} title Matches board title.
*/
title: String? = nil,
/**
* @param {String} created_at Matches the timestamp for when the board was created.
*/
created_at: String? = nil,
/**
* @param {String} first_name The first name of the user who created this board.
*/
first_name: String? = nil,
/**
* @param {String} last_name The last name of the user who created this board.
*/
last_name: String? = nil,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
/**
* @param {Bool} favorited Return favorited boards when true.
*/
favorited: Bool? = nil,
/**
* @param {String} creator_id Filter on boards created by a particular user.
*/
creator_id: String? = nil,
/**
* @param {String} sorts The fields to sort the results by
*/
sorts: String? = nil,
/**
* @param {Int64} page The page to return.
*/
page: Int64? = nil,
/**
* @param {Int64} per_page The number of items in the returned page.
*/
per_page: Int64? = nil,
/**
* @param {Int64} offset The number of items to skip before returning any. (used with limit and takes priority over page and per_page)
*/
offset: Int64? = nil,
/**
* @param {Int64} limit The maximum number of items to return. (used with offset and takes priority over page and per_page)
*/
limit: Int64? = nil,
/**
* @param {Bool} filter_or Combine given search criteria in a boolean OR expression
*/
filter_or: Bool? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/boards/search",
["title": title, "created_at": created_at, "first_name": first_name, "last_name": last_name, "fields": fields, "favorited": favorited as Any?, "creator_id": creator_id, "sorts": sorts, "page": page, "per_page": per_page, "offset": offset, "limit": limit, "filter_or": filter_or as Any?], nil, options)
return result
}
/**
* ### Get information about a board.
*
* GET /boards/{board_id} -> Board
*/
public func board(
/**
* @param {Int64} board_id Id of board
*/
_ board_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_board_id = encodeParam(board_id)
let result: SDKResponse<Data, SDKError> = self.get("/boards/\(path_board_id)",
["fields": fields], nil, options)
return result
}
/**
* ### Update a board definition.
*
* PATCH /boards/{board_id} -> Board
*/
public func update_board(
/**
* @param {Int64} board_id Id of board
*/
_ board_id: Int64,
/**
* @param {WriteBoard} body
*/
_ body: WriteBoard,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_board_id = encodeParam(board_id)
let result: SDKResponse<Data, SDKError> = self.patch("/boards/\(path_board_id)",
["fields": fields], try! self.encode(body), options)
return result
}
/**
* ### Delete a board.
*
* DELETE /boards/{board_id} -> String
*/
public func delete_board(
/**
* @param {Int64} board_id Id of board
*/
_ board_id: Int64,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_board_id = encodeParam(board_id)
let result: SDKResponse<Data, SDKError> = self.delete("/boards/\(path_board_id)", nil, nil, options)
return result
}
/**
* ### Get information about all board items.
*
* GET /board_items -> [BoardItem]
*/
public func all_board_items(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
/**
* @param {String} sorts Fields to sort by.
*/
sorts: String? = nil,
/**
* @param {String} board_section_id Filter to a specific board section
*/
board_section_id: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/board_items",
["fields": fields, "sorts": sorts, "board_section_id": board_section_id], nil, options)
return result
}
/**
* ### Create a new board item.
*
* POST /board_items -> BoardItem
*/
public func create_board_item(
/**
* @param {WriteBoardItem} body
*/
_ body: WriteBoardItem,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/board_items",
["fields": fields], try! self.encode(body), options)
return result
}
/**
* ### Get information about a board item.
*
* GET /board_items/{board_item_id} -> BoardItem
*/
public func board_item(
/**
* @param {Int64} board_item_id Id of board item
*/
_ board_item_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_board_item_id = encodeParam(board_item_id)
let result: SDKResponse<Data, SDKError> = self.get("/board_items/\(path_board_item_id)",
["fields": fields], nil, options)
return result
}
/**
* ### Update a board item definition.
*
* PATCH /board_items/{board_item_id} -> BoardItem
*/
public func update_board_item(
/**
* @param {Int64} board_item_id Id of board item
*/
_ board_item_id: Int64,
/**
* @param {WriteBoardItem} body
*/
_ body: WriteBoardItem,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_board_item_id = encodeParam(board_item_id)
let result: SDKResponse<Data, SDKError> = self.patch("/board_items/\(path_board_item_id)",
["fields": fields], try! self.encode(body), options)
return result
}
/**
* ### Delete a board item.
*
* DELETE /board_items/{board_item_id} -> String
*/
public func delete_board_item(
/**
* @param {Int64} board_item_id Id of board_item
*/
_ board_item_id: Int64,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_board_item_id = encodeParam(board_item_id)
let result: SDKResponse<Data, SDKError> = self.delete("/board_items/\(path_board_item_id)", nil, nil, options)
return result
}
/**
* ### Get information about all board sections.
*
* GET /board_sections -> [BoardSection]
*/
public func all_board_sections(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
/**
* @param {String} sorts Fields to sort by.
*/
sorts: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/board_sections",
["fields": fields, "sorts": sorts], nil, options)
return result
}
/**
* ### Create a new board section.
*
* POST /board_sections -> BoardSection
*/
public func create_board_section(
/**
* @param {WriteBoardSection} body
*/
_ body: WriteBoardSection,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/board_sections",
["fields": fields], try! self.encode(body), options)
return result
}
/**
* ### Get information about a board section.
*
* GET /board_sections/{board_section_id} -> BoardSection
*/
public func board_section(
/**
* @param {Int64} board_section_id Id of board section
*/
_ board_section_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_board_section_id = encodeParam(board_section_id)
let result: SDKResponse<Data, SDKError> = self.get("/board_sections/\(path_board_section_id)",
["fields": fields], nil, options)
return result
}
/**
* ### Update a board section definition.
*
* PATCH /board_sections/{board_section_id} -> BoardSection
*/
public func update_board_section(
/**
* @param {Int64} board_section_id Id of board section
*/
_ board_section_id: Int64,
/**
* @param {WriteBoardSection} body
*/
_ body: WriteBoardSection,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_board_section_id = encodeParam(board_section_id)
let result: SDKResponse<Data, SDKError> = self.patch("/board_sections/\(path_board_section_id)",
["fields": fields], try! self.encode(body), options)
return result
}
/**
* ### Delete a board section.
*
* DELETE /board_sections/{board_section_id} -> String
*/
public func delete_board_section(
/**
* @param {Int64} board_section_id Id of board section
*/
_ board_section_id: Int64,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_board_section_id = encodeParam(board_section_id)
let result: SDKResponse<Data, SDKError> = self.delete("/board_sections/\(path_board_section_id)", nil, nil, options)
return result
}
// MARK ColorCollection: Manage Color Collections
/**
* ### Get an array of all existing Color Collections
* Get a **single** color collection by id with [ColorCollection](#!/ColorCollection/color_collection)
*
* Get all **standard** color collections with [ColorCollection](#!/ColorCollection/color_collections_standard)
*
* Get all **custom** color collections with [ColorCollection](#!/ColorCollection/color_collections_custom)
*
* **Note**: Only an API user with the Admin role can call this endpoint. Unauthorized requests will return `Not Found` (404) errors.
*
* GET /color_collections -> [ColorCollection]
*/
public func all_color_collections(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/color_collections",
["fields": fields], nil, options)
return result
}
/**
* ### Create a custom color collection with the specified information
*
* Creates a new custom color collection object, returning the details, including the created id.
*
* **Update** an existing color collection with [Update Color Collection](#!/ColorCollection/update_color_collection)
*
* **Permanently delete** an existing custom color collection with [Delete Color Collection](#!/ColorCollection/delete_color_collection)
*
* **Note**: Only an API user with the Admin role can call this endpoint. Unauthorized requests will return `Not Found` (404) errors.
*
* POST /color_collections -> ColorCollection
*/
public func create_color_collection(
/**
* @param {WriteColorCollection} body
*/
_ body: WriteColorCollection,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/color_collections", nil, try! self.encode(body), options)
return result
}
/**
* ### Get an array of all existing **Custom** Color Collections
* Get a **single** color collection by id with [ColorCollection](#!/ColorCollection/color_collection)
*
* Get all **standard** color collections with [ColorCollection](#!/ColorCollection/color_collections_standard)
*
* **Note**: Only an API user with the Admin role can call this endpoint. Unauthorized requests will return `Not Found` (404) errors.
*
* GET /color_collections/custom -> [ColorCollection]
*/
public func color_collections_custom(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/color_collections/custom",
["fields": fields], nil, options)
return result
}
/**
* ### Get an array of all existing **Standard** Color Collections
* Get a **single** color collection by id with [ColorCollection](#!/ColorCollection/color_collection)
*
* Get all **custom** color collections with [ColorCollection](#!/ColorCollection/color_collections_custom)
*
* **Note**: Only an API user with the Admin role can call this endpoint. Unauthorized requests will return `Not Found` (404) errors.
*
* GET /color_collections/standard -> [ColorCollection]
*/
public func color_collections_standard(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/color_collections/standard",
["fields": fields], nil, options)
return result
}
/**
* ### Get the default color collection
*
* Use this to retrieve the default Color Collection.
*
* Set the default color collection with [ColorCollection](#!/ColorCollection/set_default_color_collection)
*
* GET /color_collections/default -> ColorCollection
*/
public func default_color_collection(
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/color_collections/default", nil, nil, options)
return result
}
/**
* ### Set the global default Color Collection by ID
*
* Returns the new specified default Color Collection object.
* **Note**: Only an API user with the Admin role can call this endpoint. Unauthorized requests will return `Not Found` (404) errors.
*
* PUT /color_collections/default -> ColorCollection
*/
public func set_default_color_collection(
/**
* @param {String} collection_id ID of color collection to set as default
*/
_ collection_id: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.put("/color_collections/default",
["collection_id": collection_id], nil, options)
return result
}
/**
* ### Get a Color Collection by ID
*
* Use this to retrieve a specific Color Collection.
* Get a **single** color collection by id with [ColorCollection](#!/ColorCollection/color_collection)
*
* Get all **standard** color collections with [ColorCollection](#!/ColorCollection/color_collections_standard)
*
* Get all **custom** color collections with [ColorCollection](#!/ColorCollection/color_collections_custom)
*
* **Note**: Only an API user with the Admin role can call this endpoint. Unauthorized requests will return `Not Found` (404) errors.
*
* GET /color_collections/{collection_id} -> ColorCollection
*/
public func color_collection(
/**
* @param {String} collection_id Id of Color Collection
*/
_ collection_id: String,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_collection_id = encodeParam(collection_id)
let result: SDKResponse<Data, SDKError> = self.get("/color_collections/\(path_collection_id)",
["fields": fields], nil, options)
return result
}
/**
* ### Update a custom color collection by id.
* **Note**: Only an API user with the Admin role can call this endpoint. Unauthorized requests will return `Not Found` (404) errors.
*
* PATCH /color_collections/{collection_id} -> ColorCollection
*/
public func update_color_collection(
/**
* @param {String} collection_id Id of Custom Color Collection
*/
_ collection_id: String,
/**
* @param {WriteColorCollection} body
*/
_ body: WriteColorCollection,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_collection_id = encodeParam(collection_id)
let result: SDKResponse<Data, SDKError> = self.patch("/color_collections/\(path_collection_id)", nil, try! self.encode(body), options)
return result
}
/**
* ### Delete a custom color collection by id
*
* This operation permanently deletes the identified **Custom** color collection.
*
* **Standard** color collections cannot be deleted
*
* Because multiple color collections can have the same label, they must be deleted by ID, not name.
* **Note**: Only an API user with the Admin role can call this endpoint. Unauthorized requests will return `Not Found` (404) errors.
*
* DELETE /color_collections/{collection_id} -> String
*/
public func delete_color_collection(
/**
* @param {String} collection_id Id of Color Collection
*/
_ collection_id: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_collection_id = encodeParam(collection_id)
let result: SDKResponse<Data, SDKError> = self.delete("/color_collections/\(path_collection_id)", nil, nil, options)
return result
}
// MARK Command: Manage Commands
/**
* ### Get All Commands.
*
* GET /commands -> [Command]
*/
public func get_all_commands(
/**
* @param {String} content_id Id of the associated content. This must be accompanied with content_type.
*/
content_id: String? = nil,
/**
* @param {String} content_type Type of the associated content. This must be accompanied with content_id.
*/
content_type: String? = nil,
/**
* @param {Int64} limit Number of results to return.
*/
limit: Int64? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/commands",
["content_id": content_id, "content_type": content_type, "limit": limit], nil, options)
return result
}
/**
* ### Create a new command.
* # Required fields: [:name, :linked_content_id, :linked_content_type]
* # `linked_content_type` must be one of ["dashboard", "lookml_dashboard"]
* #
*
* POST /commands -> Command
*/
public func create_command(
/**
* @param {WriteCommand} body
*/
_ body: WriteCommand,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/commands", nil, try! self.encode(body), options)
return result
}
/**
* ### Update an existing custom command.
* # Optional fields: ['name', 'description']
* #
*
* PATCH /commands/{command_id} -> Command
*/
public func update_command(
/**
* @param {Int64} command_id ID of a command
*/
_ command_id: Int64,
/**
* @param {UpdateCommand} body
*/
_ body: UpdateCommand,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_command_id = encodeParam(command_id)
let result: SDKResponse<Data, SDKError> = self.patch("/commands/\(path_command_id)", nil, try! self.encode(body), options)
return result
}
/**
* ### Delete an existing custom command.
*
* DELETE /commands/{command_id} -> Voidable
*/
public func delete_command(
/**
* @param {Int64} command_id ID of a command
*/
_ command_id: Int64,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_command_id = encodeParam(command_id)
let result: SDKResponse<Data, SDKError> = self.delete("/commands/\(path_command_id)", nil, nil, options)
return result
}
// MARK Config: Manage General Configuration
/**
* Get the current Cloud Storage Configuration.
*
* GET /cloud_storage -> BackupConfiguration
*/
public func cloud_storage_configuration(
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/cloud_storage", nil, nil, options)
return result
}
/**
* Update the current Cloud Storage Configuration.
*
* PATCH /cloud_storage -> BackupConfiguration
*/
public func update_cloud_storage_configuration(
/**
* @param {WriteBackupConfiguration} body
*/
_ body: WriteBackupConfiguration,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.patch("/cloud_storage", nil, try! self.encode(body), options)
return result
}
/**
* ### Get the current status and content of custom welcome emails
*
* GET /custom_welcome_email -> CustomWelcomeEmail
*/
public func custom_welcome_email(
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/custom_welcome_email", nil, nil, options)
return result
}
/**
* Update custom welcome email setting and values. Optionally send a test email with the new content to the currently logged in user.
*
* PATCH /custom_welcome_email -> CustomWelcomeEmail
*/
public func update_custom_welcome_email(
/**
* @param {WriteCustomWelcomeEmail} body
*/
_ body: WriteCustomWelcomeEmail,
/**
* @param {Bool} send_test_welcome_email If true a test email with the content from the request will be sent to the current user after saving
*/
send_test_welcome_email: Bool? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.patch("/custom_welcome_email",
["send_test_welcome_email": send_test_welcome_email as Any?], try! self.encode(body), options)
return result
}
/**
* Requests to this endpoint will send a welcome email with the custom content provided in the body to the currently logged in user.
*
* PUT /custom_welcome_email_test -> WelcomeEmailTest
*/
public func update_custom_welcome_email_test(
/**
* @param {WelcomeEmailTest} body
*/
_ body: WelcomeEmailTest,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.put("/custom_welcome_email_test", nil, try! self.encode(body), options)
return result
}
/**
* ### Retrieve the value for whether or not digest emails is enabled
*
* GET /digest_emails_enabled -> DigestEmails
*/
public func digest_emails_enabled(
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/digest_emails_enabled", nil, nil, options)
return result
}
/**
* ### Update the setting for enabling/disabling digest emails
*
* PATCH /digest_emails_enabled -> DigestEmails
*/
public func update_digest_emails_enabled(
/**
* @param {DigestEmails} body
*/
_ body: DigestEmails,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.patch("/digest_emails_enabled", nil, try! self.encode(body), options)
return result
}
/**
* ### Trigger the generation of digest email records and send them to Looker's internal system. This does not send
* any actual emails, it generates records containing content which may be of interest for users who have become inactive.
* Emails will be sent at a later time from Looker's internal system if the Digest Emails feature is enabled in settings.
*
* POST /digest_email_send -> DigestEmailSend
*/
public func create_digest_email_send(
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/digest_email_send", nil, nil, options)
return result
}
/**
* ### Set the menu item name and content for internal help resources
*
* GET /internal_help_resources_content -> InternalHelpResourcesContent
*/
public func internal_help_resources_content(
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/internal_help_resources_content", nil, nil, options)
return result
}
/**
* Update internal help resources content
*
* PATCH /internal_help_resources_content -> InternalHelpResourcesContent
*/
public func update_internal_help_resources_content(
/**
* @param {WriteInternalHelpResourcesContent} body
*/
_ body: WriteInternalHelpResourcesContent,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.patch("/internal_help_resources_content", nil, try! self.encode(body), options)
return result
}
/**
* ### Get and set the options for internal help resources
*
* GET /internal_help_resources_enabled -> InternalHelpResources
*/
public func internal_help_resources(
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/internal_help_resources_enabled", nil, nil, options)
return result
}
/**
* Update internal help resources settings
*
* PATCH /internal_help_resources -> InternalHelpResources
*/
public func update_internal_help_resources(
/**
* @param {WriteInternalHelpResources} body
*/
_ body: WriteInternalHelpResources,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.patch("/internal_help_resources", nil, try! self.encode(body), options)
return result
}
/**
* ### Get all legacy features.
*
* GET /legacy_features -> [LegacyFeature]
*/
public func all_legacy_features(
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/legacy_features", nil, nil, options)
return result
}
/**
* ### Get information about the legacy feature with a specific id.
*
* GET /legacy_features/{legacy_feature_id} -> LegacyFeature
*/
public func legacy_feature(
/**
* @param {String} legacy_feature_id id of legacy feature
*/
_ legacy_feature_id: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_legacy_feature_id = encodeParam(legacy_feature_id)
let result: SDKResponse<Data, SDKError> = self.get("/legacy_features/\(path_legacy_feature_id)", nil, nil, options)
return result
}
/**
* ### Update information about the legacy feature with a specific id.
*
* PATCH /legacy_features/{legacy_feature_id} -> LegacyFeature
*/
public func update_legacy_feature(
/**
* @param {String} legacy_feature_id id of legacy feature
*/
_ legacy_feature_id: String,
/**
* @param {WriteLegacyFeature} body
*/
_ body: WriteLegacyFeature,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_legacy_feature_id = encodeParam(legacy_feature_id)
let result: SDKResponse<Data, SDKError> = self.patch("/legacy_features/\(path_legacy_feature_id)", nil, try! self.encode(body), options)
return result
}
/**
* ### Get a list of locales that Looker supports.
*
* GET /locales -> [LkLocale]
*/
public func all_locales(
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/locales", nil, nil, options)
return result
}
/**
* ### Get all mobile settings.
*
* GET /mobile/settings -> MobileSettings
*/
public func mobile_settings(
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/mobile/settings", nil, nil, options)
return result
}
/**
* ### Get a list of timezones that Looker supports (e.g. useful for scheduling tasks).
*
* GET /timezones -> [Timezone]
*/
public func all_timezones(
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/timezones", nil, nil, options)
return result
}
/**
* ### Get information about all API versions supported by this Looker instance.
*
* GET /versions -> ApiVersion
*/
public func versions(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/versions",
["fields": fields], nil, options)
return result
}
/**
* ### Get an API specification for this Looker instance.
*
* **Note**: Although the API specification is in JSON format, the return type is temporarily `text/plain`, so the response should be treated as standard JSON to consume it.
*
* GET /api_spec/{api_version}/{specification} -> String
*/
public func api_spec(
/**
* @param {String} api_version API version
*/
_ api_version: String,
/**
* @param {String} specification Specification name. Typically, this is "swagger.json"
*/
_ specification: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_api_version = encodeParam(api_version)
let path_specification = encodeParam(specification)
let result: SDKResponse<Data, SDKError> = self.get("/api_spec/\(path_api_version)/\(path_specification)", nil, nil, options)
return result
}
/**
* ### This feature is enabled only by special license.
* ### Gets the whitelabel configuration, which includes hiding documentation links, custom favicon uploading, etc.
*
* GET /whitelabel_configuration -> WhitelabelConfiguration
*/
public func whitelabel_configuration(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/whitelabel_configuration",
["fields": fields], nil, options)
return result
}
/**
* ### Update the whitelabel configuration
*
* PUT /whitelabel_configuration -> WhitelabelConfiguration
*/
public func update_whitelabel_configuration(
/**
* @param {WriteWhitelabelConfiguration} body
*/
_ body: WriteWhitelabelConfiguration,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.put("/whitelabel_configuration", nil, try! self.encode(body), options)
return result
}
// MARK Connection: Manage Database Connections
/**
* ### Get information about all connections.
*
* GET /connections -> [DBConnection]
*/
public func all_connections(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/connections",
["fields": fields], nil, options)
return result
}
/**
* ### Create a connection using the specified configuration.
*
* POST /connections -> DBConnection
*/
public func create_connection(
/**
* @param {WriteDBConnection} body
*/
_ body: WriteDBConnection,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/connections", nil, try! self.encode(body), options)
return result
}
/**
* ### Get information about a connection.
*
* GET /connections/{connection_name} -> DBConnection
*/
public func connection(
/**
* @param {String} connection_name Name of connection
*/
_ connection_name: String,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_connection_name = encodeParam(connection_name)
let result: SDKResponse<Data, SDKError> = self.get("/connections/\(path_connection_name)",
["fields": fields], nil, options)
return result
}
/**
* ### Update a connection using the specified configuration.
*
* PATCH /connections/{connection_name} -> DBConnection
*/
public func update_connection(
/**
* @param {String} connection_name Name of connection
*/
_ connection_name: String,
/**
* @param {WriteDBConnection} body
*/
_ body: WriteDBConnection,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_connection_name = encodeParam(connection_name)
let result: SDKResponse<Data, SDKError> = self.patch("/connections/\(path_connection_name)", nil, try! self.encode(body), options)
return result
}
/**
* ### Delete a connection.
*
* DELETE /connections/{connection_name} -> String
*/
public func delete_connection(
/**
* @param {String} connection_name Name of connection
*/
_ connection_name: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_connection_name = encodeParam(connection_name)
let result: SDKResponse<Data, SDKError> = self.delete("/connections/\(path_connection_name)", nil, nil, options)
return result
}
/**
* ### Delete a connection override.
*
* DELETE /connections/{connection_name}/connection_override/{override_context} -> String
*/
public func delete_connection_override(
/**
* @param {String} connection_name Name of connection
*/
_ connection_name: String,
/**
* @param {String} override_context Context of connection override
*/
_ override_context: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_connection_name = encodeParam(connection_name)
let path_override_context = encodeParam(override_context)
let result: SDKResponse<Data, SDKError> = self.delete("/connections/\(path_connection_name)/connection_override/\(path_override_context)", nil, nil, options)
return result
}
/**
* ### Test an existing connection.
*
* Note that a connection's 'dialect' property has a 'connection_tests' property that lists the
* specific types of tests that the connection supports.
*
* This API is rate limited.
*
* Unsupported tests in the request will be ignored.
*
* PUT /connections/{connection_name}/test -> [DBConnectionTestResult]
*/
public func test_connection(
/**
* @param {String} connection_name Name of connection
*/
_ connection_name: String,
/**
* @param {DelimArray<String>} tests Array of names of tests to run
*/
tests: DelimArray<String>? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_connection_name = encodeParam(connection_name)
let result: SDKResponse<Data, SDKError> = self.put("/connections/\(path_connection_name)/test",
["tests": tests as Any?], nil, options)
return result
}
/**
* ### Test a connection configuration.
*
* Note that a connection's 'dialect' property has a 'connection_tests' property that lists the
* specific types of tests that the connection supports.
*
* This API is rate limited.
*
* Unsupported tests in the request will be ignored.
*
* PUT /connections/test -> [DBConnectionTestResult]
*/
public func test_connection_config(
/**
* @param {WriteDBConnection} body
*/
_ body: WriteDBConnection,
/**
* @param {DelimArray<String>} tests Array of names of tests to run
*/
tests: DelimArray<String>? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.put("/connections/test",
["tests": tests as Any?], try! self.encode(body), options)
return result
}
/**
* ### Get information about all dialects.
*
* GET /dialect_info -> [DialectInfo]
*/
public func all_dialect_infos(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/dialect_info",
["fields": fields], nil, options)
return result
}
/**
* ### Get all External OAuth Applications.
*
* GET /external_oauth_applications -> [ExternalOauthApplication]
*/
public func all_external_oauth_applications(
/**
* @param {String} name Application name
*/
name: String? = nil,
/**
* @param {String} client_id Application Client ID
*/
client_id: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/external_oauth_applications",
["name": name, "client_id": client_id], nil, options)
return result
}
/**
* ### Create an OAuth Application using the specified configuration.
*
* POST /external_oauth_applications -> ExternalOauthApplication
*/
public func create_external_oauth_application(
/**
* @param {WriteExternalOauthApplication} body
*/
_ body: WriteExternalOauthApplication,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/external_oauth_applications", nil, try! self.encode(body), options)
return result
}
/**
* ### Create OAuth User state.
*
* POST /external_oauth_applications/user_state -> CreateOAuthApplicationUserStateResponse
*/
public func create_oauth_application_user_state(
/**
* @param {CreateOAuthApplicationUserStateRequest} body
*/
_ body: CreateOAuthApplicationUserStateRequest,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/external_oauth_applications/user_state", nil, try! self.encode(body), options)
return result
}
/**
* ### Get information about all SSH Servers.
*
* GET /ssh_servers -> [SshServer]
*/
public func all_ssh_servers(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/ssh_servers",
["fields": fields], nil, options)
return result
}
/**
* ### Create an SSH Server.
*
* POST /ssh_servers -> SshServer
*/
public func create_ssh_server(
/**
* @param {WriteSshServer} body
*/
_ body: WriteSshServer,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/ssh_servers", nil, try! self.encode(body), options)
return result
}
/**
* ### Get information about an SSH Server.
*
* GET /ssh_server/{ssh_server_id} -> SshServer
*/
public func ssh_server(
/**
* @param {String} ssh_server_id Id of SSH Server
*/
_ ssh_server_id: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_ssh_server_id = encodeParam(ssh_server_id)
let result: SDKResponse<Data, SDKError> = self.get("/ssh_server/\(path_ssh_server_id)", nil, nil, options)
return result
}
/**
* ### Update an SSH Server.
*
* PATCH /ssh_server/{ssh_server_id} -> SshServer
*/
public func update_ssh_server(
/**
* @param {String} ssh_server_id Id of SSH Server
*/
_ ssh_server_id: String,
/**
* @param {WriteSshServer} body
*/
_ body: WriteSshServer,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_ssh_server_id = encodeParam(ssh_server_id)
let result: SDKResponse<Data, SDKError> = self.patch("/ssh_server/\(path_ssh_server_id)", nil, try! self.encode(body), options)
return result
}
/**
* ### Delete an SSH Server.
*
* DELETE /ssh_server/{ssh_server_id} -> String
*/
public func delete_ssh_server(
/**
* @param {String} ssh_server_id Id of SSH Server
*/
_ ssh_server_id: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_ssh_server_id = encodeParam(ssh_server_id)
let result: SDKResponse<Data, SDKError> = self.delete("/ssh_server/\(path_ssh_server_id)", nil, nil, options)
return result
}
/**
* ### Test the SSH Server
*
* GET /ssh_server/{ssh_server_id}/test -> SshServer
*/
public func test_ssh_server(
/**
* @param {String} ssh_server_id Id of SSH Server
*/
_ ssh_server_id: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_ssh_server_id = encodeParam(ssh_server_id)
let result: SDKResponse<Data, SDKError> = self.get("/ssh_server/\(path_ssh_server_id)/test", nil, nil, options)
return result
}
/**
* ### Get information about all SSH Tunnels.
*
* GET /ssh_tunnels -> [SshTunnel]
*/
public func all_ssh_tunnels(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/ssh_tunnels",
["fields": fields], nil, options)
return result
}
/**
* ### Create an SSH Tunnel
*
* POST /ssh_tunnels -> SshTunnel
*/
public func create_ssh_tunnel(
/**
* @param {WriteSshTunnel} body
*/
_ body: WriteSshTunnel,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/ssh_tunnels", nil, try! self.encode(body), options)
return result
}
/**
* ### Get information about an SSH Tunnel.
*
* GET /ssh_tunnel/{ssh_tunnel_id} -> SshTunnel
*/
public func ssh_tunnel(
/**
* @param {String} ssh_tunnel_id Id of SSH Tunnel
*/
_ ssh_tunnel_id: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_ssh_tunnel_id = encodeParam(ssh_tunnel_id)
let result: SDKResponse<Data, SDKError> = self.get("/ssh_tunnel/\(path_ssh_tunnel_id)", nil, nil, options)
return result
}
/**
* ### Update an SSH Tunnel
*
* PATCH /ssh_tunnel/{ssh_tunnel_id} -> SshTunnel
*/
public func update_ssh_tunnel(
/**
* @param {String} ssh_tunnel_id Id of SSH Tunnel
*/
_ ssh_tunnel_id: String,
/**
* @param {WriteSshTunnel} body
*/
_ body: WriteSshTunnel,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_ssh_tunnel_id = encodeParam(ssh_tunnel_id)
let result: SDKResponse<Data, SDKError> = self.patch("/ssh_tunnel/\(path_ssh_tunnel_id)", nil, try! self.encode(body), options)
return result
}
/**
* ### Delete an SSH Tunnel
*
* DELETE /ssh_tunnel/{ssh_tunnel_id} -> String
*/
public func delete_ssh_tunnel(
/**
* @param {String} ssh_tunnel_id Id of SSH Tunnel
*/
_ ssh_tunnel_id: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_ssh_tunnel_id = encodeParam(ssh_tunnel_id)
let result: SDKResponse<Data, SDKError> = self.delete("/ssh_tunnel/\(path_ssh_tunnel_id)", nil, nil, options)
return result
}
/**
* ### Test the SSH Tunnel
*
* GET /ssh_tunnel/{ssh_tunnel_id}/test -> SshTunnel
*/
public func test_ssh_tunnel(
/**
* @param {String} ssh_tunnel_id Id of SSH Tunnel
*/
_ ssh_tunnel_id: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_ssh_tunnel_id = encodeParam(ssh_tunnel_id)
let result: SDKResponse<Data, SDKError> = self.get("/ssh_tunnel/\(path_ssh_tunnel_id)/test", nil, nil, options)
return result
}
/**
* ### Get the SSH public key
*
* Get the public key created for this instance to identify itself to a remote SSH server.
*
* GET /ssh_public_key -> SshPublicKey
*/
public func ssh_public_key(
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/ssh_public_key", nil, nil, options)
return result
}
// MARK Content: Manage Content
/**
* ### Search Favorite Content
*
* If multiple search params are given and `filter_or` is FALSE or not specified,
* search params are combined in a logical AND operation.
* Only rows that match *all* search param criteria will be returned.
*
* If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
* Results will include rows that match **any** of the search criteria.
*
* String search params use case-insensitive matching.
* String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
* example="dan%" will match "danger" and "Danzig" but not "David"
* example="D_m%" will match "Damage" and "dump"
*
* Integer search params can accept a single value or a comma separated list of values. The multiple
* values will be combined under a logical OR operation - results will match at least one of
* the given values.
*
* Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
* or exclude (respectively) rows where the column is null.
*
* Boolean search params accept only "true" and "false" as values.
*
* GET /content_favorite/search -> [ContentFavorite]
*/
public func search_content_favorites(
/**
* @param {Int64} id Match content favorite id(s)
*/
id: Int64? = nil,
/**
* @param {String} user_id Match user id(s).To create a list of multiple ids, use commas as separators
*/
user_id: String? = nil,
/**
* @param {String} content_metadata_id Match content metadata id(s).To create a list of multiple ids, use commas as separators
*/
content_metadata_id: String? = nil,
/**
* @param {String} dashboard_id Match dashboard id(s).To create a list of multiple ids, use commas as separators
*/
dashboard_id: String? = nil,
/**
* @param {String} look_id Match look id(s).To create a list of multiple ids, use commas as separators
*/
look_id: String? = nil,
/**
* @param {String} board_id Match board id(s).To create a list of multiple ids, use commas as separators
*/
board_id: String? = nil,
/**
* @param {Int64} limit Number of results to return. (used with offset)
*/
limit: Int64? = nil,
/**
* @param {Int64} offset Number of results to skip before returning any. (used with limit)
*/
offset: Int64? = nil,
/**
* @param {String} sorts Fields to sort by.
*/
sorts: String? = nil,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
/**
* @param {Bool} filter_or Combine given search criteria in a boolean OR expression
*/
filter_or: Bool? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/content_favorite/search",
["id": id, "user_id": user_id, "content_metadata_id": content_metadata_id, "dashboard_id": dashboard_id, "look_id": look_id, "board_id": board_id, "limit": limit, "offset": offset, "sorts": sorts, "fields": fields, "filter_or": filter_or as Any?], nil, options)
return result
}
/**
* ### Get favorite content by its id
*
* GET /content_favorite/{content_favorite_id} -> ContentFavorite
*/
public func content_favorite(
/**
* @param {Int64} content_favorite_id Id of favorite content
*/
_ content_favorite_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_content_favorite_id = encodeParam(content_favorite_id)
let result: SDKResponse<Data, SDKError> = self.get("/content_favorite/\(path_content_favorite_id)",
["fields": fields], nil, options)
return result
}
/**
* ### Delete favorite content
*
* DELETE /content_favorite/{content_favorite_id} -> String
*/
public func delete_content_favorite(
/**
* @param {Int64} content_favorite_id Id of favorite content
*/
_ content_favorite_id: Int64,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_content_favorite_id = encodeParam(content_favorite_id)
let result: SDKResponse<Data, SDKError> = self.delete("/content_favorite/\(path_content_favorite_id)", nil, nil, options)
return result
}
/**
* ### Create favorite content
*
* POST /content_favorite -> ContentFavorite
*/
public func create_content_favorite(
/**
* @param {WriteContentFavorite} body
*/
_ body: WriteContentFavorite,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/content_favorite", nil, try! self.encode(body), options)
return result
}
/**
* ### Get information about all content metadata in a space.
*
* GET /content_metadata -> [ContentMeta]
*/
public func all_content_metadatas(
/**
* @param {Int64} parent_id Parent space of content.
*/
_ parent_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/content_metadata",
["parent_id": parent_id, "fields": fields], nil, options)
return result
}
/**
* ### Get information about an individual content metadata record.
*
* GET /content_metadata/{content_metadata_id} -> ContentMeta
*/
public func content_metadata(
/**
* @param {Int64} content_metadata_id Id of content metadata
*/
_ content_metadata_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_content_metadata_id = encodeParam(content_metadata_id)
let result: SDKResponse<Data, SDKError> = self.get("/content_metadata/\(path_content_metadata_id)",
["fields": fields], nil, options)
return result
}
/**
* ### Move a piece of content.
*
* PATCH /content_metadata/{content_metadata_id} -> ContentMeta
*/
public func update_content_metadata(
/**
* @param {Int64} content_metadata_id Id of content metadata
*/
_ content_metadata_id: Int64,
/**
* @param {WriteContentMeta} body
*/
_ body: WriteContentMeta,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_content_metadata_id = encodeParam(content_metadata_id)
let result: SDKResponse<Data, SDKError> = self.patch("/content_metadata/\(path_content_metadata_id)", nil, try! self.encode(body), options)
return result
}
/**
* ### All content metadata access records for a content metadata item.
*
* GET /content_metadata_access -> [ContentMetaGroupUser]
*/
public func all_content_metadata_accesses(
/**
* @param {Int64} content_metadata_id Id of content metadata
*/
_ content_metadata_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/content_metadata_access",
["content_metadata_id": content_metadata_id, "fields": fields], nil, options)
return result
}
/**
* ### Create content metadata access.
*
* POST /content_metadata_access -> ContentMetaGroupUser
*/
public func create_content_metadata_access(
/**
* @param {ContentMetaGroupUser} body
*/
_ body: ContentMetaGroupUser,
/**
* @param {Bool} send_boards_notification_email Optionally sends notification email when granting access to a board.
*/
send_boards_notification_email: Bool? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/content_metadata_access",
["send_boards_notification_email": send_boards_notification_email as Any?], try! self.encode(body), options)
return result
}
/**
* ### Update type of access for content metadata.
*
* PUT /content_metadata_access/{content_metadata_access_id} -> ContentMetaGroupUser
*/
public func update_content_metadata_access(
/**
* @param {String} content_metadata_access_id Id of content metadata access
*/
_ content_metadata_access_id: String,
/**
* @param {ContentMetaGroupUser} body
*/
_ body: ContentMetaGroupUser,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_content_metadata_access_id = encodeParam(content_metadata_access_id)
let result: SDKResponse<Data, SDKError> = self.put("/content_metadata_access/\(path_content_metadata_access_id)", nil, try! self.encode(body), options)
return result
}
/**
* ### Remove content metadata access.
*
* DELETE /content_metadata_access/{content_metadata_access_id} -> String
*/
public func delete_content_metadata_access(
/**
* @param {Int64} content_metadata_access_id Id of content metadata access
*/
_ content_metadata_access_id: Int64,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_content_metadata_access_id = encodeParam(content_metadata_access_id)
let result: SDKResponse<Data, SDKError> = self.delete("/content_metadata_access/\(path_content_metadata_access_id)", nil, nil, options)
return result
}
/**
* ### Get an image representing the contents of a dashboard or look.
*
* The returned thumbnail is an abstract representation of the contents of a dashbord or look and does not
* reflect the actual data displayed in the respective visualizations.
*
* GET /content_thumbnail/{type}/{resource_id} -> String
*
* **Note**: Binary content may be returned by this method.
*/
public func content_thumbnail(
/**
* @param {String} type Either dashboard or look
*/
_ type: String,
/**
* @param {String} resource_id ID of the dashboard or look to render
*/
_ resource_id: String,
/**
* @param {String} reload Whether or not to refresh the rendered image with the latest content
*/
reload: String? = nil,
/**
* @param {String} format A value of png produces a thumbnail in PNG format instead of SVG (default)
*/
format: String? = nil,
/**
* @param {Int64} width The width of the image if format is supplied
*/
width: Int64? = nil,
/**
* @param {Int64} height The height of the image if format is supplied
*/
height: Int64? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_type = encodeParam(type)
let path_resource_id = encodeParam(resource_id)
let result: SDKResponse<Data, SDKError> = self.get("/content_thumbnail/\(path_type)/\(path_resource_id)",
["reload": reload, "format": format, "width": width, "height": height], nil, options)
return result
}
/**
* ### Validate All Content
*
* Performs validation of all looks and dashboards
* Returns a list of errors found as well as metadata about the content validation run.
*
* GET /content_validation -> ContentValidation
*/
public func content_validation(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/content_validation",
["fields": fields], nil, options)
return result
}
/**
* ### Search Content Views
*
* If multiple search params are given and `filter_or` is FALSE or not specified,
* search params are combined in a logical AND operation.
* Only rows that match *all* search param criteria will be returned.
*
* If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
* Results will include rows that match **any** of the search criteria.
*
* String search params use case-insensitive matching.
* String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
* example="dan%" will match "danger" and "Danzig" but not "David"
* example="D_m%" will match "Damage" and "dump"
*
* Integer search params can accept a single value or a comma separated list of values. The multiple
* values will be combined under a logical OR operation - results will match at least one of
* the given values.
*
* Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
* or exclude (respectively) rows where the column is null.
*
* Boolean search params accept only "true" and "false" as values.
*
* GET /content_view/search -> [ContentView]
*/
public func search_content_views(
/**
* @param {String} view_count Match view count
*/
view_count: String? = nil,
/**
* @param {String} group_id Match Group Id
*/
group_id: String? = nil,
/**
* @param {String} look_id Match look_id
*/
look_id: String? = nil,
/**
* @param {String} dashboard_id Match dashboard_id
*/
dashboard_id: String? = nil,
/**
* @param {String} content_metadata_id Match content metadata id
*/
content_metadata_id: String? = nil,
/**
* @param {String} start_of_week_date Match start of week date (format is "YYYY-MM-DD")
*/
start_of_week_date: String? = nil,
/**
* @param {Bool} all_time True if only all time view records should be returned
*/
all_time: Bool? = nil,
/**
* @param {String} user_id Match user id
*/
user_id: String? = nil,
/**
* @param {String} fields Requested fields
*/
fields: String? = nil,
/**
* @param {Int64} limit Number of results to return. Use with `offset` to manage pagination of results
*/
limit: Int64? = nil,
/**
* @param {Int64} offset Number of results to skip before returning data
*/
offset: Int64? = nil,
/**
* @param {String} sorts Fields to sort by
*/
sorts: String? = nil,
/**
* @param {Bool} filter_or Combine given search criteria in a boolean OR expression
*/
filter_or: Bool? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/content_view/search",
["view_count": view_count, "group_id": group_id, "look_id": look_id, "dashboard_id": dashboard_id, "content_metadata_id": content_metadata_id, "start_of_week_date": start_of_week_date, "all_time": all_time as Any?, "user_id": user_id, "fields": fields, "limit": limit, "offset": offset, "sorts": sorts, "filter_or": filter_or as Any?], nil, options)
return result
}
/**
* ### Get a vector image representing the contents of a dashboard or look.
*
* # DEPRECATED: Use [content_thumbnail()](#!/Content/content_thumbnail)
*
* The returned thumbnail is an abstract representation of the contents of a dashbord or look and does not
* reflect the actual data displayed in the respective visualizations.
*
* GET /vector_thumbnail/{type}/{resource_id} -> String
*/
public func vector_thumbnail(
/**
* @param {String} type Either dashboard or look
*/
_ type: String,
/**
* @param {String} resource_id ID of the dashboard or look to render
*/
_ resource_id: String,
/**
* @param {String} reload Whether or not to refresh the rendered image with the latest content
*/
reload: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_type = encodeParam(type)
let path_resource_id = encodeParam(resource_id)
let result: SDKResponse<Data, SDKError> = self.get("/vector_thumbnail/\(path_type)/\(path_resource_id)",
["reload": reload], nil, options)
return result
}
// MARK Dashboard: Manage Dashboards
/**
* ### Get information about all active dashboards.
*
* Returns an array of **abbreviated dashboard objects**. Dashboards marked as deleted are excluded from this list.
*
* Get the **full details** of a specific dashboard by id with [dashboard()](#!/Dashboard/dashboard)
*
* Find **deleted dashboards** with [search_dashboards()](#!/Dashboard/search_dashboards)
*
* GET /dashboards -> [DashboardBase]
*/
public func all_dashboards(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/dashboards",
["fields": fields], nil, options)
return result
}
/**
* ### Create a new dashboard
*
* Creates a new dashboard object and returns the details of the newly created dashboard.
*
* `Title`, `user_id`, and `space_id` are all required fields.
* `Space_id` and `user_id` must contain the id of an existing space or user, respectively.
* A dashboard's `title` must be unique within the space in which it resides.
*
* If you receive a 422 error response when creating a dashboard, be sure to look at the
* response body for information about exactly which fields are missing or contain invalid data.
*
* You can **update** an existing dashboard with [update_dashboard()](#!/Dashboard/update_dashboard)
*
* You can **permanently delete** an existing dashboard with [delete_dashboard()](#!/Dashboard/delete_dashboard)
*
* POST /dashboards -> Dashboard
*/
public func create_dashboard(
/**
* @param {WriteDashboard} body
*/
_ body: WriteDashboard,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/dashboards", nil, try! self.encode(body), options)
return result
}
/**
* ### Search Dashboards
*
* Returns an **array of dashboard objects** that match the specified search criteria.
*
* If multiple search params are given and `filter_or` is FALSE or not specified,
* search params are combined in a logical AND operation.
* Only rows that match *all* search param criteria will be returned.
*
* If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
* Results will include rows that match **any** of the search criteria.
*
* String search params use case-insensitive matching.
* String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
* example="dan%" will match "danger" and "Danzig" but not "David"
* example="D_m%" will match "Damage" and "dump"
*
* Integer search params can accept a single value or a comma separated list of values. The multiple
* values will be combined under a logical OR operation - results will match at least one of
* the given values.
*
* Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
* or exclude (respectively) rows where the column is null.
*
* Boolean search params accept only "true" and "false" as values.
*
*
* The parameters `limit`, and `offset` are recommended for fetching results in page-size chunks.
*
* Get a **single dashboard** by id with [dashboard()](#!/Dashboard/dashboard)
*
* GET /dashboards/search -> [Dashboard]
*/
public func search_dashboards(
/**
* @param {String} id Match dashboard id.
*/
id: String? = nil,
/**
* @param {String} slug Match dashboard slug.
*/
slug: String? = nil,
/**
* @param {String} title Match Dashboard title.
*/
title: String? = nil,
/**
* @param {String} description Match Dashboard description.
*/
description: String? = nil,
/**
* @param {String} content_favorite_id Filter on a content favorite id.
*/
content_favorite_id: String? = nil,
/**
* @param {String} folder_id Filter on a particular space.
*/
folder_id: String? = nil,
/**
* @param {String} deleted Filter on dashboards deleted status.
*/
deleted: String? = nil,
/**
* @param {String} user_id Filter on dashboards created by a particular user.
*/
user_id: String? = nil,
/**
* @param {String} view_count Filter on a particular value of view_count
*/
view_count: String? = nil,
/**
* @param {String} content_metadata_id Filter on a content favorite id.
*/
content_metadata_id: String? = nil,
/**
* @param {Bool} curate Exclude items that exist only in personal spaces other than the users
*/
curate: Bool? = nil,
/**
* @param {String} last_viewed_at Select dashboards based on when they were last viewed
*/
last_viewed_at: String? = nil,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
/**
* @param {Int64} page Requested page.
*/
page: Int64? = nil,
/**
* @param {Int64} per_page Results per page.
*/
per_page: Int64? = nil,
/**
* @param {Int64} limit Number of results to return. (used with offset and takes priority over page and per_page)
*/
limit: Int64? = nil,
/**
* @param {Int64} offset Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
*/
offset: Int64? = nil,
/**
* @param {String} sorts One or more fields to sort by. Sortable fields: [:title, :user_id, :id, :created_at, :space_id, :folder_id, :description, :view_count, :favorite_count, :slug, :content_favorite_id, :content_metadata_id, :deleted, :deleted_at, :last_viewed_at, :last_accessed_at]
*/
sorts: String? = nil,
/**
* @param {Bool} filter_or Combine given search criteria in a boolean OR expression
*/
filter_or: Bool? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/dashboards/search",
["id": id, "slug": slug, "title": title, "description": description, "content_favorite_id": content_favorite_id, "folder_id": folder_id, "deleted": deleted, "user_id": user_id, "view_count": view_count, "content_metadata_id": content_metadata_id, "curate": curate as Any?, "last_viewed_at": last_viewed_at, "fields": fields, "page": page, "per_page": per_page, "limit": limit, "offset": offset, "sorts": sorts, "filter_or": filter_or as Any?], nil, options)
return result
}
/**
* ### Import a LookML dashboard to a space as a UDD
* Creates a UDD (a dashboard which exists in the Looker database rather than as a LookML file) from the LookML dashboard
* and places it in the space specified. The created UDD will have a lookml_link_id which links to the original LookML dashboard.
*
* To give the imported dashboard specify a (e.g. title: "my title") in the body of your request, otherwise the imported
* dashboard will have the same title as the original LookML dashboard.
*
* For this operation to succeed the user must have permission to see the LookML dashboard in question, and have permission to
* create content in the space the dashboard is being imported to.
*
* **Sync** a linked UDD with [sync_lookml_dashboard()](#!/Dashboard/sync_lookml_dashboard)
* **Unlink** a linked UDD by setting lookml_link_id to null with [update_dashboard()](#!/Dashboard/update_dashboard)
*
* POST /dashboards/{lookml_dashboard_id}/import/{space_id} -> Dashboard
*/
public func import_lookml_dashboard(
/**
* @param {String} lookml_dashboard_id Id of LookML dashboard
*/
_ lookml_dashboard_id: String,
/**
* @param {String} space_id Id of space to import the dashboard to
*/
_ space_id: String,
/**
* @param {WriteDashboard} body
*/
body: WriteDashboard?,
/**
* @param {Bool} raw_locale If true, and this dashboard is localized, export it with the raw keys, not localized.
*/
raw_locale: Bool? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_lookml_dashboard_id = encodeParam(lookml_dashboard_id)
let path_space_id = encodeParam(space_id)
let result: SDKResponse<Data, SDKError> = self.post("/dashboards/\(path_lookml_dashboard_id)/import/\(path_space_id)",
["raw_locale": raw_locale as Any?], try! self.encode(body), options)
return result
}
/**
* ### Update all linked dashboards to match the specified LookML dashboard.
*
* Any UDD (a dashboard which exists in the Looker database rather than as a LookML file) which has a `lookml_link_id`
* property value referring to a LookML dashboard's id (model::dashboardname) will be updated so that it matches the current state of the LookML dashboard.
*
* For this operation to succeed the user must have permission to view the LookML dashboard, and only linked dashboards
* that the user has permission to update will be synced.
*
* To **link** or **unlink** a UDD set the `lookml_link_id` property with [update_dashboard()](#!/Dashboard/update_dashboard)
*
* PATCH /dashboards/{lookml_dashboard_id}/sync -> [Int64]
*/
public func sync_lookml_dashboard(
/**
* @param {String} lookml_dashboard_id Id of LookML dashboard, in the form 'model::dashboardname'
*/
_ lookml_dashboard_id: String,
/**
* @param {WriteDashboard} body
*/
_ body: WriteDashboard,
/**
* @param {Bool} raw_locale If true, and this dashboard is localized, export it with the raw keys, not localized.
*/
raw_locale: Bool? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_lookml_dashboard_id = encodeParam(lookml_dashboard_id)
let result: SDKResponse<Data, SDKError> = self.patch("/dashboards/\(path_lookml_dashboard_id)/sync",
["raw_locale": raw_locale as Any?], try! self.encode(body), options)
return result
}
/**
* ### Get information about a dashboard
*
* Returns the full details of the identified dashboard object
*
* Get a **summary list** of all active dashboards with [all_dashboards()](#!/Dashboard/all_dashboards)
*
* You can **Search** for dashboards with [search_dashboards()](#!/Dashboard/search_dashboards)
*
* GET /dashboards/{dashboard_id} -> Dashboard
*/
public func dashboard(
/**
* @param {String} dashboard_id Id of dashboard
*/
_ dashboard_id: String,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_dashboard_id = encodeParam(dashboard_id)
let result: SDKResponse<Data, SDKError> = self.get("/dashboards/\(path_dashboard_id)",
["fields": fields], nil, options)
return result
}
/**
* ### Update a dashboard
*
* You can use this function to change the string and integer properties of
* a dashboard. Nested objects such as filters, dashboard elements, or dashboard layout components
* cannot be modified by this function - use the update functions for the respective
* nested object types (like [update_dashboard_filter()](#!/3.1/Dashboard/update_dashboard_filter) to change a filter)
* to modify nested objects referenced by a dashboard.
*
* If you receive a 422 error response when updating a dashboard, be sure to look at the
* response body for information about exactly which fields are missing or contain invalid data.
*
* PATCH /dashboards/{dashboard_id} -> Dashboard
*/
public func update_dashboard(
/**
* @param {String} dashboard_id Id of dashboard
*/
_ dashboard_id: String,
/**
* @param {WriteDashboard} body
*/
_ body: WriteDashboard,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_dashboard_id = encodeParam(dashboard_id)
let result: SDKResponse<Data, SDKError> = self.patch("/dashboards/\(path_dashboard_id)", nil, try! self.encode(body), options)
return result
}
/**
* ### Delete the dashboard with the specified id
*
* Permanently **deletes** a dashboard. (The dashboard cannot be recovered after this operation.)
*
* "Soft" delete or hide a dashboard by setting its `deleted` status to `True` with [update_dashboard()](#!/Dashboard/update_dashboard).
*
* Note: When a dashboard is deleted in the UI, it is soft deleted. Use this API call to permanently remove it, if desired.
*
* DELETE /dashboards/{dashboard_id} -> String
*/
public func delete_dashboard(
/**
* @param {String} dashboard_id Id of dashboard
*/
_ dashboard_id: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_dashboard_id = encodeParam(dashboard_id)
let result: SDKResponse<Data, SDKError> = self.delete("/dashboards/\(path_dashboard_id)", nil, nil, options)
return result
}
/**
* ### Get Aggregate Table LookML for Each Query on a Dahboard
*
* Returns a JSON object that contains the dashboard id and Aggregate Table lookml
*
* GET /dashboards/aggregate_table_lookml/{dashboard_id} -> DashboardAggregateTableLookml
*/
public func dashboard_aggregate_table_lookml(
/**
* @param {String} dashboard_id Id of dashboard
*/
_ dashboard_id: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_dashboard_id = encodeParam(dashboard_id)
let result: SDKResponse<Data, SDKError> = self.get("/dashboards/aggregate_table_lookml/\(path_dashboard_id)", nil, nil, options)
return result
}
/**
* ### Get lookml of a UDD
*
* Returns a JSON object that contains the dashboard id and the full lookml
*
* GET /dashboards/lookml/{dashboard_id} -> DashboardLookml
*/
public func dashboard_lookml(
/**
* @param {String} dashboard_id Id of dashboard
*/
_ dashboard_id: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_dashboard_id = encodeParam(dashboard_id)
let result: SDKResponse<Data, SDKError> = self.get("/dashboards/lookml/\(path_dashboard_id)", nil, nil, options)
return result
}
/**
* ### Copy an existing dashboard
*
* Creates a copy of an existing dashboard, in a specified folder, and returns the copied dashboard.
*
* `dashboard_id` is required, `dashboard_id` and `folder_id` must already exist if specified.
* `folder_id` will default to the existing folder.
*
* If a dashboard with the same title already exists in the target folder, the copy will have '(copy)'
* or '(copy <# of copies>)' appended.
*
* POST /dashboards/{dashboard_id}/copy -> Dashboard
*/
public func copy_dashboard(
/**
* @param {String} dashboard_id Dashboard id to copy.
*/
_ dashboard_id: String,
/**
* @param {String} folder_id Folder id to copy to.
*/
folder_id: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_dashboard_id = encodeParam(dashboard_id)
let result: SDKResponse<Data, SDKError> = self.post("/dashboards/\(path_dashboard_id)/copy",
["folder_id": folder_id], nil, options)
return result
}
/**
* ### Move an existing dashboard
*
* Moves a dashboard to a specified folder, and returns the moved dashboard.
*
* `dashboard_id` and `folder_id` are required.
* `dashboard_id` and `folder_id` must already exist, and `folder_id` must be different from the current `folder_id` of the dashboard.
*
* PATCH /dashboards/{dashboard_id}/move -> Dashboard
*/
public func move_dashboard(
/**
* @param {String} dashboard_id Dashboard id to move.
*/
_ dashboard_id: String,
/**
* @param {String} folder_id Folder id to move to.
*/
_ folder_id: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_dashboard_id = encodeParam(dashboard_id)
let result: SDKResponse<Data, SDKError> = self.patch("/dashboards/\(path_dashboard_id)/move",
["folder_id": folder_id], nil, options)
return result
}
/**
* ### Search Dashboard Elements
*
* Returns an **array of DashboardElement objects** that match the specified search criteria.
*
* If multiple search params are given and `filter_or` is FALSE or not specified,
* search params are combined in a logical AND operation.
* Only rows that match *all* search param criteria will be returned.
*
* If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
* Results will include rows that match **any** of the search criteria.
*
* String search params use case-insensitive matching.
* String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
* example="dan%" will match "danger" and "Danzig" but not "David"
* example="D_m%" will match "Damage" and "dump"
*
* Integer search params can accept a single value or a comma separated list of values. The multiple
* values will be combined under a logical OR operation - results will match at least one of
* the given values.
*
* Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
* or exclude (respectively) rows where the column is null.
*
* Boolean search params accept only "true" and "false" as values.
*
* GET /dashboard_elements/search -> [DashboardElement]
*/
public func search_dashboard_elements(
/**
* @param {Int64} dashboard_id Select elements that refer to a given dashboard id
*/
dashboard_id: Int64? = nil,
/**
* @param {Int64} look_id Select elements that refer to a given look id
*/
look_id: Int64? = nil,
/**
* @param {String} title Match the title of element
*/
title: String? = nil,
/**
* @param {Bool} deleted Select soft-deleted dashboard elements
*/
deleted: Bool? = nil,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
/**
* @param {Bool} filter_or Combine given search criteria in a boolean OR expression
*/
filter_or: Bool? = nil,
/**
* @param {String} sorts Fields to sort by. Sortable fields: [:look_id, :dashboard_id, :deleted, :title]
*/
sorts: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/dashboard_elements/search",
["dashboard_id": dashboard_id, "look_id": look_id, "title": title, "deleted": deleted as Any?, "fields": fields, "filter_or": filter_or as Any?, "sorts": sorts], nil, options)
return result
}
/**
* ### Get information about the dashboard element with a specific id.
*
* GET /dashboard_elements/{dashboard_element_id} -> DashboardElement
*/
public func dashboard_element(
/**
* @param {String} dashboard_element_id Id of dashboard element
*/
_ dashboard_element_id: String,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_dashboard_element_id = encodeParam(dashboard_element_id)
let result: SDKResponse<Data, SDKError> = self.get("/dashboard_elements/\(path_dashboard_element_id)",
["fields": fields], nil, options)
return result
}
/**
* ### Update the dashboard element with a specific id.
*
* PATCH /dashboard_elements/{dashboard_element_id} -> DashboardElement
*/
public func update_dashboard_element(
/**
* @param {String} dashboard_element_id Id of dashboard element
*/
_ dashboard_element_id: String,
/**
* @param {WriteDashboardElement} body
*/
_ body: WriteDashboardElement,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_dashboard_element_id = encodeParam(dashboard_element_id)
let result: SDKResponse<Data, SDKError> = self.patch("/dashboard_elements/\(path_dashboard_element_id)",
["fields": fields], try! self.encode(body), options)
return result
}
/**
* ### Delete a dashboard element with a specific id.
*
* DELETE /dashboard_elements/{dashboard_element_id} -> String
*/
public func delete_dashboard_element(
/**
* @param {String} dashboard_element_id Id of dashboard element
*/
_ dashboard_element_id: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_dashboard_element_id = encodeParam(dashboard_element_id)
let result: SDKResponse<Data, SDKError> = self.delete("/dashboard_elements/\(path_dashboard_element_id)", nil, nil, options)
return result
}
/**
* ### Get information about all the dashboard elements on a dashboard with a specific id.
*
* GET /dashboards/{dashboard_id}/dashboard_elements -> [DashboardElement]
*/
public func dashboard_dashboard_elements(
/**
* @param {String} dashboard_id Id of dashboard
*/
_ dashboard_id: String,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_dashboard_id = encodeParam(dashboard_id)
let result: SDKResponse<Data, SDKError> = self.get("/dashboards/\(path_dashboard_id)/dashboard_elements",
["fields": fields], nil, options)
return result
}
/**
* ### Create a dashboard element on the dashboard with a specific id.
*
* POST /dashboard_elements -> DashboardElement
*/
public func create_dashboard_element(
/**
* @param {WriteDashboardElement} body
*/
_ body: WriteDashboardElement,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/dashboard_elements",
["fields": fields], try! self.encode(body), options)
return result
}
/**
* ### Get information about the dashboard filters with a specific id.
*
* GET /dashboard_filters/{dashboard_filter_id} -> DashboardFilter
*/
public func dashboard_filter(
/**
* @param {String} dashboard_filter_id Id of dashboard filters
*/
_ dashboard_filter_id: String,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_dashboard_filter_id = encodeParam(dashboard_filter_id)
let result: SDKResponse<Data, SDKError> = self.get("/dashboard_filters/\(path_dashboard_filter_id)",
["fields": fields], nil, options)
return result
}
/**
* ### Update the dashboard filter with a specific id.
*
* PATCH /dashboard_filters/{dashboard_filter_id} -> DashboardFilter
*/
public func update_dashboard_filter(
/**
* @param {String} dashboard_filter_id Id of dashboard filter
*/
_ dashboard_filter_id: String,
/**
* @param {WriteDashboardFilter} body
*/
_ body: WriteDashboardFilter,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_dashboard_filter_id = encodeParam(dashboard_filter_id)
let result: SDKResponse<Data, SDKError> = self.patch("/dashboard_filters/\(path_dashboard_filter_id)",
["fields": fields], try! self.encode(body), options)
return result
}
/**
* ### Delete a dashboard filter with a specific id.
*
* DELETE /dashboard_filters/{dashboard_filter_id} -> String
*/
public func delete_dashboard_filter(
/**
* @param {String} dashboard_filter_id Id of dashboard filter
*/
_ dashboard_filter_id: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_dashboard_filter_id = encodeParam(dashboard_filter_id)
let result: SDKResponse<Data, SDKError> = self.delete("/dashboard_filters/\(path_dashboard_filter_id)", nil, nil, options)
return result
}
/**
* ### Get information about all the dashboard filters on a dashboard with a specific id.
*
* GET /dashboards/{dashboard_id}/dashboard_filters -> [DashboardFilter]
*/
public func dashboard_dashboard_filters(
/**
* @param {String} dashboard_id Id of dashboard
*/
_ dashboard_id: String,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_dashboard_id = encodeParam(dashboard_id)
let result: SDKResponse<Data, SDKError> = self.get("/dashboards/\(path_dashboard_id)/dashboard_filters",
["fields": fields], nil, options)
return result
}
/**
* ### Create a dashboard filter on the dashboard with a specific id.
*
* POST /dashboard_filters -> DashboardFilter
*/
public func create_dashboard_filter(
/**
* @param {WriteCreateDashboardFilter} body
*/
_ body: WriteCreateDashboardFilter,
/**
* @param {String} fields Requested fields
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/dashboard_filters",
["fields": fields], try! self.encode(body), options)
return result
}
/**
* ### Get information about the dashboard elements with a specific id.
*
* GET /dashboard_layout_components/{dashboard_layout_component_id} -> DashboardLayoutComponent
*/
public func dashboard_layout_component(
/**
* @param {String} dashboard_layout_component_id Id of dashboard layout component
*/
_ dashboard_layout_component_id: String,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_dashboard_layout_component_id = encodeParam(dashboard_layout_component_id)
let result: SDKResponse<Data, SDKError> = self.get("/dashboard_layout_components/\(path_dashboard_layout_component_id)",
["fields": fields], nil, options)
return result
}
/**
* ### Update the dashboard element with a specific id.
*
* PATCH /dashboard_layout_components/{dashboard_layout_component_id} -> DashboardLayoutComponent
*/
public func update_dashboard_layout_component(
/**
* @param {String} dashboard_layout_component_id Id of dashboard layout component
*/
_ dashboard_layout_component_id: String,
/**
* @param {WriteDashboardLayoutComponent} body
*/
_ body: WriteDashboardLayoutComponent,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_dashboard_layout_component_id = encodeParam(dashboard_layout_component_id)
let result: SDKResponse<Data, SDKError> = self.patch("/dashboard_layout_components/\(path_dashboard_layout_component_id)",
["fields": fields], try! self.encode(body), options)
return result
}
/**
* ### Get information about all the dashboard layout components for a dashboard layout with a specific id.
*
* GET /dashboard_layouts/{dashboard_layout_id}/dashboard_layout_components -> [DashboardLayoutComponent]
*/
public func dashboard_layout_dashboard_layout_components(
/**
* @param {String} dashboard_layout_id Id of dashboard layout component
*/
_ dashboard_layout_id: String,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_dashboard_layout_id = encodeParam(dashboard_layout_id)
let result: SDKResponse<Data, SDKError> = self.get("/dashboard_layouts/\(path_dashboard_layout_id)/dashboard_layout_components",
["fields": fields], nil, options)
return result
}
/**
* ### Get information about the dashboard layouts with a specific id.
*
* GET /dashboard_layouts/{dashboard_layout_id} -> DashboardLayout
*/
public func dashboard_layout(
/**
* @param {String} dashboard_layout_id Id of dashboard layouts
*/
_ dashboard_layout_id: String,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_dashboard_layout_id = encodeParam(dashboard_layout_id)
let result: SDKResponse<Data, SDKError> = self.get("/dashboard_layouts/\(path_dashboard_layout_id)",
["fields": fields], nil, options)
return result
}
/**
* ### Update the dashboard layout with a specific id.
*
* PATCH /dashboard_layouts/{dashboard_layout_id} -> DashboardLayout
*/
public func update_dashboard_layout(
/**
* @param {String} dashboard_layout_id Id of dashboard layout
*/
_ dashboard_layout_id: String,
/**
* @param {WriteDashboardLayout} body
*/
_ body: WriteDashboardLayout,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_dashboard_layout_id = encodeParam(dashboard_layout_id)
let result: SDKResponse<Data, SDKError> = self.patch("/dashboard_layouts/\(path_dashboard_layout_id)",
["fields": fields], try! self.encode(body), options)
return result
}
/**
* ### Delete a dashboard layout with a specific id.
*
* DELETE /dashboard_layouts/{dashboard_layout_id} -> String
*/
public func delete_dashboard_layout(
/**
* @param {String} dashboard_layout_id Id of dashboard layout
*/
_ dashboard_layout_id: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_dashboard_layout_id = encodeParam(dashboard_layout_id)
let result: SDKResponse<Data, SDKError> = self.delete("/dashboard_layouts/\(path_dashboard_layout_id)", nil, nil, options)
return result
}
/**
* ### Get information about all the dashboard elements on a dashboard with a specific id.
*
* GET /dashboards/{dashboard_id}/dashboard_layouts -> [DashboardLayout]
*/
public func dashboard_dashboard_layouts(
/**
* @param {String} dashboard_id Id of dashboard
*/
_ dashboard_id: String,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_dashboard_id = encodeParam(dashboard_id)
let result: SDKResponse<Data, SDKError> = self.get("/dashboards/\(path_dashboard_id)/dashboard_layouts",
["fields": fields], nil, options)
return result
}
/**
* ### Create a dashboard layout on the dashboard with a specific id.
*
* POST /dashboard_layouts -> DashboardLayout
*/
public func create_dashboard_layout(
/**
* @param {WriteDashboardLayout} body
*/
_ body: WriteDashboardLayout,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/dashboard_layouts",
["fields": fields], try! self.encode(body), options)
return result
}
// MARK DataAction: Run Data Actions
/**
* Perform a data action. The data action object can be obtained from query results, and used to perform an arbitrary action.
*
* POST /data_actions -> DataActionResponse
*/
public func perform_data_action(
/**
* @param {DataActionRequest} body
*/
_ body: DataActionRequest,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/data_actions", nil, try! self.encode(body), options)
return result
}
/**
* For some data actions, the remote server may supply a form requesting further user input. This endpoint takes a data action, asks the remote server to generate a form for it, and returns that form to you for presentation to the user.
*
* POST /data_actions/form -> DataActionForm
*/
public func fetch_remote_data_action_form(
/**
* @param {StringDictionary<AnyCodable>} body
*/
_ body: StringDictionary<AnyCodable>,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/data_actions/form", nil, try! self.encode(body), options)
return result
}
// MARK Datagroup: Manage Datagroups
/**
* ### Get information about all datagroups.
*
* GET /datagroups -> [Datagroup]
*/
public func all_datagroups(
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/datagroups", nil, nil, options)
return result
}
/**
* ### Get information about a datagroup.
*
* GET /datagroups/{datagroup_id} -> Datagroup
*/
public func datagroup(
/**
* @param {Int64} datagroup_id ID of datagroup.
*/
_ datagroup_id: Int64,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_datagroup_id = encodeParam(datagroup_id)
let result: SDKResponse<Data, SDKError> = self.get("/datagroups/\(path_datagroup_id)", nil, nil, options)
return result
}
/**
* ### Update a datagroup using the specified params.
*
* PATCH /datagroups/{datagroup_id} -> Datagroup
*/
public func update_datagroup(
/**
* @param {Int64} datagroup_id ID of datagroup.
*/
_ datagroup_id: Int64,
/**
* @param {WriteDatagroup} body
*/
_ body: WriteDatagroup,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_datagroup_id = encodeParam(datagroup_id)
let result: SDKResponse<Data, SDKError> = self.patch("/datagroups/\(path_datagroup_id)", nil, try! self.encode(body), options)
return result
}
// MARK Folder: Manage Folders
/**
* Search for folders by creator id, parent id, name, etc
*
* GET /folders/search -> [Folder]
*/
public func search_folders(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
/**
* @param {Int64} page Requested page.
*/
page: Int64? = nil,
/**
* @param {Int64} per_page Results per page.
*/
per_page: Int64? = nil,
/**
* @param {Int64} limit Number of results to return. (used with offset and takes priority over page and per_page)
*/
limit: Int64? = nil,
/**
* @param {Int64} offset Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
*/
offset: Int64? = nil,
/**
* @param {String} sorts Fields to sort by.
*/
sorts: String? = nil,
/**
* @param {String} name Match Space title.
*/
name: String? = nil,
/**
* @param {Int64} id Match Space id
*/
id: Int64? = nil,
/**
* @param {String} parent_id Filter on a children of a particular folder.
*/
parent_id: String? = nil,
/**
* @param {String} creator_id Filter on folder created by a particular user.
*/
creator_id: String? = nil,
/**
* @param {Bool} filter_or Combine given search criteria in a boolean OR expression
*/
filter_or: Bool? = nil,
/**
* @param {Bool} is_shared_root Match is shared root
*/
is_shared_root: Bool? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/folders/search",
["fields": fields, "page": page, "per_page": per_page, "limit": limit, "offset": offset, "sorts": sorts, "name": name, "id": id, "parent_id": parent_id, "creator_id": creator_id, "filter_or": filter_or as Any?, "is_shared_root": is_shared_root as Any?], nil, options)
return result
}
/**
* ### Get information about the folder with a specific id.
*
* GET /folders/{folder_id} -> Folder
*/
public func folder(
/**
* @param {String} folder_id Id of folder
*/
_ folder_id: String,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_folder_id = encodeParam(folder_id)
let result: SDKResponse<Data, SDKError> = self.get("/folders/\(path_folder_id)",
["fields": fields], nil, options)
return result
}
/**
* ### Update the folder with a specific id.
*
* PATCH /folders/{folder_id} -> Folder
*/
public func update_folder(
/**
* @param {String} folder_id Id of folder
*/
_ folder_id: String,
/**
* @param {UpdateFolder} body
*/
_ body: UpdateFolder,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_folder_id = encodeParam(folder_id)
let result: SDKResponse<Data, SDKError> = self.patch("/folders/\(path_folder_id)", nil, try! self.encode(body), options)
return result
}
/**
* ### Delete the folder with a specific id including any children folders.
* **DANGER** this will delete all looks and dashboards in the folder.
*
* DELETE /folders/{folder_id} -> String
*/
public func delete_folder(
/**
* @param {String} folder_id Id of folder
*/
_ folder_id: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_folder_id = encodeParam(folder_id)
let result: SDKResponse<Data, SDKError> = self.delete("/folders/\(path_folder_id)", nil, nil, options)
return result
}
/**
* ### Get information about all folders.
*
* In API 3.x, this will not return empty personal folders, unless they belong to the calling user.
* In API 4.0+, all personal folders will be returned.
*
* GET /folders -> [Folder]
*/
public func all_folders(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/folders",
["fields": fields], nil, options)
return result
}
/**
* ### Create a folder with specified information.
*
* Caller must have permission to edit the parent folder and to create folders, otherwise the request
* returns 404 Not Found.
*
* POST /folders -> Folder
*/
public func create_folder(
/**
* @param {CreateFolder} body
*/
_ body: CreateFolder,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/folders", nil, try! self.encode(body), options)
return result
}
/**
* ### Get the children of a folder.
*
* GET /folders/{folder_id}/children -> [Folder]
*/
public func folder_children(
/**
* @param {String} folder_id Id of folder
*/
_ folder_id: String,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
/**
* @param {Int64} page Requested page.
*/
page: Int64? = nil,
/**
* @param {Int64} per_page Results per page.
*/
per_page: Int64? = nil,
/**
* @param {String} sorts Fields to sort by.
*/
sorts: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_folder_id = encodeParam(folder_id)
let result: SDKResponse<Data, SDKError> = self.get("/folders/\(path_folder_id)/children",
["fields": fields, "page": page, "per_page": per_page, "sorts": sorts], nil, options)
return result
}
/**
* ### Search the children of a folder
*
* GET /folders/{folder_id}/children/search -> [Folder]
*/
public func folder_children_search(
/**
* @param {String} folder_id Id of folder
*/
_ folder_id: String,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
/**
* @param {String} sorts Fields to sort by.
*/
sorts: String? = nil,
/**
* @param {String} name Match folder name.
*/
name: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_folder_id = encodeParam(folder_id)
let result: SDKResponse<Data, SDKError> = self.get("/folders/\(path_folder_id)/children/search",
["fields": fields, "sorts": sorts, "name": name], nil, options)
return result
}
/**
* ### Get the parent of a folder
*
* GET /folders/{folder_id}/parent -> Folder
*/
public func folder_parent(
/**
* @param {String} folder_id Id of folder
*/
_ folder_id: String,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_folder_id = encodeParam(folder_id)
let result: SDKResponse<Data, SDKError> = self.get("/folders/\(path_folder_id)/parent",
["fields": fields], nil, options)
return result
}
/**
* ### Get the ancestors of a folder
*
* GET /folders/{folder_id}/ancestors -> [Folder]
*/
public func folder_ancestors(
/**
* @param {String} folder_id Id of folder
*/
_ folder_id: String,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_folder_id = encodeParam(folder_id)
let result: SDKResponse<Data, SDKError> = self.get("/folders/\(path_folder_id)/ancestors",
["fields": fields], nil, options)
return result
}
/**
* ### Get all looks in a folder.
* In API 3.x, this will return all looks in a folder, including looks in the trash.
* In API 4.0+, all looks in a folder will be returned, excluding looks in the trash.
*
* GET /folders/{folder_id}/looks -> [LookWithQuery]
*/
public func folder_looks(
/**
* @param {String} folder_id Id of folder
*/
_ folder_id: String,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_folder_id = encodeParam(folder_id)
let result: SDKResponse<Data, SDKError> = self.get("/folders/\(path_folder_id)/looks",
["fields": fields], nil, options)
return result
}
/**
* ### Get the dashboards in a folder
*
* GET /folders/{folder_id}/dashboards -> [Dashboard]
*/
public func folder_dashboards(
/**
* @param {String} folder_id Id of folder
*/
_ folder_id: String,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_folder_id = encodeParam(folder_id)
let result: SDKResponse<Data, SDKError> = self.get("/folders/\(path_folder_id)/dashboards",
["fields": fields], nil, options)
return result
}
// MARK Group: Manage Groups
/**
* ### Get information about all groups.
*
* GET /groups -> [LkGroup]
*/
public func all_groups(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
/**
* @param {Int64} page Requested page.
*/
page: Int64? = nil,
/**
* @param {Int64} per_page Results per page.
*/
per_page: Int64? = nil,
/**
* @param {String} sorts Fields to sort by.
*/
sorts: String? = nil,
/**
* @param {DelimArray<Int64>} ids Optional of ids to get specific groups.
*/
ids: DelimArray<Int64>? = nil,
/**
* @param {Int64} content_metadata_id Id of content metadata to which groups must have access.
*/
content_metadata_id: Int64? = nil,
/**
* @param {Bool} can_add_to_content_metadata Select only groups that either can/cannot be given access to content.
*/
can_add_to_content_metadata: Bool? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/groups",
["fields": fields, "page": page, "per_page": per_page, "sorts": sorts, "ids": ids as Any?, "content_metadata_id": content_metadata_id, "can_add_to_content_metadata": can_add_to_content_metadata as Any?], nil, options)
return result
}
/**
* ### Creates a new group (admin only).
*
* POST /groups -> LkGroup
*/
public func create_group(
/**
* @param {WriteGroup} body
*/
_ body: WriteGroup,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/groups",
["fields": fields], try! self.encode(body), options)
return result
}
/**
* ### Search groups
*
* Returns all group records that match the given search criteria.
*
* If multiple search params are given and `filter_or` is FALSE or not specified,
* search params are combined in a logical AND operation.
* Only rows that match *all* search param criteria will be returned.
*
* If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
* Results will include rows that match **any** of the search criteria.
*
* String search params use case-insensitive matching.
* String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
* example="dan%" will match "danger" and "Danzig" but not "David"
* example="D_m%" will match "Damage" and "dump"
*
* Integer search params can accept a single value or a comma separated list of values. The multiple
* values will be combined under a logical OR operation - results will match at least one of
* the given values.
*
* Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
* or exclude (respectively) rows where the column is null.
*
* Boolean search params accept only "true" and "false" as values.
*
* GET /groups/search -> [LkGroup]
*/
public func search_groups(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
/**
* @param {Int64} limit Number of results to return (used with `offset`).
*/
limit: Int64? = nil,
/**
* @param {Int64} offset Number of results to skip before returning any (used with `limit`).
*/
offset: Int64? = nil,
/**
* @param {String} sorts Fields to sort by.
*/
sorts: String? = nil,
/**
* @param {Bool} filter_or Combine given search criteria in a boolean OR expression
*/
filter_or: Bool? = nil,
/**
* @param {Int64} id Match group id.
*/
id: Int64? = nil,
/**
* @param {String} name Match group name.
*/
name: String? = nil,
/**
* @param {String} external_group_id Match group external_group_id.
*/
external_group_id: String? = nil,
/**
* @param {Bool} externally_managed Match group externally_managed.
*/
externally_managed: Bool? = nil,
/**
* @param {Bool} externally_orphaned Match group externally_orphaned.
*/
externally_orphaned: Bool? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/groups/search",
["fields": fields, "limit": limit, "offset": offset, "sorts": sorts, "filter_or": filter_or as Any?, "id": id, "name": name, "external_group_id": external_group_id, "externally_managed": externally_managed as Any?, "externally_orphaned": externally_orphaned as Any?], nil, options)
return result
}
/**
* ### Search groups include roles
*
* Returns all group records that match the given search criteria, and attaches any associated roles.
*
* If multiple search params are given and `filter_or` is FALSE or not specified,
* search params are combined in a logical AND operation.
* Only rows that match *all* search param criteria will be returned.
*
* If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
* Results will include rows that match **any** of the search criteria.
*
* String search params use case-insensitive matching.
* String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
* example="dan%" will match "danger" and "Danzig" but not "David"
* example="D_m%" will match "Damage" and "dump"
*
* Integer search params can accept a single value or a comma separated list of values. The multiple
* values will be combined under a logical OR operation - results will match at least one of
* the given values.
*
* Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
* or exclude (respectively) rows where the column is null.
*
* Boolean search params accept only "true" and "false" as values.
*
* GET /groups/search/with_roles -> [GroupSearch]
*/
public func search_groups_with_roles(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
/**
* @param {Int64} limit Number of results to return (used with `offset`).
*/
limit: Int64? = nil,
/**
* @param {Int64} offset Number of results to skip before returning any (used with `limit`).
*/
offset: Int64? = nil,
/**
* @param {String} sorts Fields to sort by.
*/
sorts: String? = nil,
/**
* @param {Bool} filter_or Combine given search criteria in a boolean OR expression
*/
filter_or: Bool? = nil,
/**
* @param {Int64} id Match group id.
*/
id: Int64? = nil,
/**
* @param {String} name Match group name.
*/
name: String? = nil,
/**
* @param {String} external_group_id Match group external_group_id.
*/
external_group_id: String? = nil,
/**
* @param {Bool} externally_managed Match group externally_managed.
*/
externally_managed: Bool? = nil,
/**
* @param {Bool} externally_orphaned Match group externally_orphaned.
*/
externally_orphaned: Bool? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/groups/search/with_roles",
["fields": fields, "limit": limit, "offset": offset, "sorts": sorts, "filter_or": filter_or as Any?, "id": id, "name": name, "external_group_id": external_group_id, "externally_managed": externally_managed as Any?, "externally_orphaned": externally_orphaned as Any?], nil, options)
return result
}
/**
* ### Search groups include hierarchy
*
* Returns all group records that match the given search criteria, and attaches
* associated role_ids and parent group_ids.
*
* If multiple search params are given and `filter_or` is FALSE or not specified,
* search params are combined in a logical AND operation.
* Only rows that match *all* search param criteria will be returned.
*
* If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
* Results will include rows that match **any** of the search criteria.
*
* String search params use case-insensitive matching.
* String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
* example="dan%" will match "danger" and "Danzig" but not "David"
* example="D_m%" will match "Damage" and "dump"
*
* Integer search params can accept a single value or a comma separated list of values. The multiple
* values will be combined under a logical OR operation - results will match at least one of
* the given values.
*
* Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
* or exclude (respectively) rows where the column is null.
*
* Boolean search params accept only "true" and "false" as values.
*
* GET /groups/search/with_hierarchy -> [GroupHierarchy]
*/
public func search_groups_with_hierarchy(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
/**
* @param {Int64} limit Number of results to return (used with `offset`).
*/
limit: Int64? = nil,
/**
* @param {Int64} offset Number of results to skip before returning any (used with `limit`).
*/
offset: Int64? = nil,
/**
* @param {String} sorts Fields to sort by.
*/
sorts: String? = nil,
/**
* @param {Bool} filter_or Combine given search criteria in a boolean OR expression
*/
filter_or: Bool? = nil,
/**
* @param {Int64} id Match group id.
*/
id: Int64? = nil,
/**
* @param {String} name Match group name.
*/
name: String? = nil,
/**
* @param {String} external_group_id Match group external_group_id.
*/
external_group_id: String? = nil,
/**
* @param {Bool} externally_managed Match group externally_managed.
*/
externally_managed: Bool? = nil,
/**
* @param {Bool} externally_orphaned Match group externally_orphaned.
*/
externally_orphaned: Bool? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/groups/search/with_hierarchy",
["fields": fields, "limit": limit, "offset": offset, "sorts": sorts, "filter_or": filter_or as Any?, "id": id, "name": name, "external_group_id": external_group_id, "externally_managed": externally_managed as Any?, "externally_orphaned": externally_orphaned as Any?], nil, options)
return result
}
/**
* ### Get information about a group.
*
* GET /groups/{group_id} -> LkGroup
*/
public func group(
/**
* @param {Int64} group_id Id of group
*/
_ group_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_group_id = encodeParam(group_id)
let result: SDKResponse<Data, SDKError> = self.get("/groups/\(path_group_id)",
["fields": fields], nil, options)
return result
}
/**
* ### Updates the a group (admin only).
*
* PATCH /groups/{group_id} -> LkGroup
*/
public func update_group(
/**
* @param {Int64} group_id Id of group
*/
_ group_id: Int64,
/**
* @param {WriteGroup} body
*/
_ body: WriteGroup,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_group_id = encodeParam(group_id)
let result: SDKResponse<Data, SDKError> = self.patch("/groups/\(path_group_id)",
["fields": fields], try! self.encode(body), options)
return result
}
/**
* ### Deletes a group (admin only).
*
* DELETE /groups/{group_id} -> String
*/
public func delete_group(
/**
* @param {Int64} group_id Id of group
*/
_ group_id: Int64,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_group_id = encodeParam(group_id)
let result: SDKResponse<Data, SDKError> = self.delete("/groups/\(path_group_id)", nil, nil, options)
return result
}
/**
* ### Get information about all the groups in a group
*
* GET /groups/{group_id}/groups -> [LkGroup]
*/
public func all_group_groups(
/**
* @param {Int64} group_id Id of group
*/
_ group_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_group_id = encodeParam(group_id)
let result: SDKResponse<Data, SDKError> = self.get("/groups/\(path_group_id)/groups",
["fields": fields], nil, options)
return result
}
/**
* ### Adds a new group to a group.
*
* POST /groups/{group_id}/groups -> LkGroup
*/
public func add_group_group(
/**
* @param {Int64} group_id Id of group
*/
_ group_id: Int64,
/**
* @param {GroupIdForGroupInclusion} body
*/
_ body: GroupIdForGroupInclusion,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_group_id = encodeParam(group_id)
let result: SDKResponse<Data, SDKError> = self.post("/groups/\(path_group_id)/groups", nil, try! self.encode(body), options)
return result
}
/**
* ### Get information about all the users directly included in a group.
*
* GET /groups/{group_id}/users -> [User]
*/
public func all_group_users(
/**
* @param {Int64} group_id Id of group
*/
_ group_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
/**
* @param {Int64} page Requested page.
*/
page: Int64? = nil,
/**
* @param {Int64} per_page Results per page.
*/
per_page: Int64? = nil,
/**
* @param {String} sorts Fields to sort by.
*/
sorts: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_group_id = encodeParam(group_id)
let result: SDKResponse<Data, SDKError> = self.get("/groups/\(path_group_id)/users",
["fields": fields, "page": page, "per_page": per_page, "sorts": sorts], nil, options)
return result
}
/**
* ### Adds a new user to a group.
*
* POST /groups/{group_id}/users -> User
*/
public func add_group_user(
/**
* @param {Int64} group_id Id of group
*/
_ group_id: Int64,
/**
* @param {GroupIdForGroupUserInclusion} body
*/
_ body: GroupIdForGroupUserInclusion,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_group_id = encodeParam(group_id)
let result: SDKResponse<Data, SDKError> = self.post("/groups/\(path_group_id)/users", nil, try! self.encode(body), options)
return result
}
/**
* ### Removes a user from a group.
*
* DELETE /groups/{group_id}/users/{user_id} -> Voidable
*/
public func delete_group_user(
/**
* @param {Int64} group_id Id of group
*/
_ group_id: Int64,
/**
* @param {Int64} user_id Id of user to remove from group
*/
_ user_id: Int64,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_group_id = encodeParam(group_id)
let path_user_id = encodeParam(user_id)
let result: SDKResponse<Data, SDKError> = self.delete("/groups/\(path_group_id)/users/\(path_user_id)", nil, nil, options)
return result
}
/**
* ### Removes a group from a group.
*
* DELETE /groups/{group_id}/groups/{deleting_group_id} -> Voidable
*/
public func delete_group_from_group(
/**
* @param {Int64} group_id Id of group
*/
_ group_id: Int64,
/**
* @param {Int64} deleting_group_id Id of group to delete
*/
_ deleting_group_id: Int64,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_group_id = encodeParam(group_id)
let path_deleting_group_id = encodeParam(deleting_group_id)
let result: SDKResponse<Data, SDKError> = self.delete("/groups/\(path_group_id)/groups/\(path_deleting_group_id)", nil, nil, options)
return result
}
/**
* ### Set the value of a user attribute for a group.
*
* For information about how user attribute values are calculated, see [Set User Attribute Group Values](#!/UserAttribute/set_user_attribute_group_values).
*
* PATCH /groups/{group_id}/attribute_values/{user_attribute_id} -> UserAttributeGroupValue
*/
public func update_user_attribute_group_value(
/**
* @param {Int64} group_id Id of group
*/
_ group_id: Int64,
/**
* @param {Int64} user_attribute_id Id of user attribute
*/
_ user_attribute_id: Int64,
/**
* @param {UserAttributeGroupValue} body
*/
_ body: UserAttributeGroupValue,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_group_id = encodeParam(group_id)
let path_user_attribute_id = encodeParam(user_attribute_id)
let result: SDKResponse<Data, SDKError> = self.patch("/groups/\(path_group_id)/attribute_values/\(path_user_attribute_id)", nil, try! self.encode(body), options)
return result
}
/**
* ### Remove a user attribute value from a group.
*
* DELETE /groups/{group_id}/attribute_values/{user_attribute_id} -> Voidable
*/
public func delete_user_attribute_group_value(
/**
* @param {Int64} group_id Id of group
*/
_ group_id: Int64,
/**
* @param {Int64} user_attribute_id Id of user attribute
*/
_ user_attribute_id: Int64,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_group_id = encodeParam(group_id)
let path_user_attribute_id = encodeParam(user_attribute_id)
let result: SDKResponse<Data, SDKError> = self.delete("/groups/\(path_group_id)/attribute_values/\(path_user_attribute_id)", nil, nil, options)
return result
}
// MARK Homepage: Manage Homepage
/**
* ### Get information about the primary homepage's sections.
*
* GET /primary_homepage_sections -> [HomepageSection]
*/
public func all_primary_homepage_sections(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/primary_homepage_sections",
["fields": fields], nil, options)
return result
}
// MARK Integration: Manage Integrations
/**
* ### Get information about all Integration Hubs.
*
* GET /integration_hubs -> [IntegrationHub]
*/
public func all_integration_hubs(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/integration_hubs",
["fields": fields], nil, options)
return result
}
/**
* ### Create a new Integration Hub.
*
* This API is rate limited to prevent it from being used for SSRF attacks
*
* POST /integration_hubs -> IntegrationHub
*/
public func create_integration_hub(
/**
* @param {WriteIntegrationHub} body
*/
_ body: WriteIntegrationHub,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/integration_hubs",
["fields": fields], try! self.encode(body), options)
return result
}
/**
* ### Get information about a Integration Hub.
*
* GET /integration_hubs/{integration_hub_id} -> IntegrationHub
*/
public func integration_hub(
/**
* @param {Int64} integration_hub_id Id of Integration Hub
*/
_ integration_hub_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_integration_hub_id = encodeParam(integration_hub_id)
let result: SDKResponse<Data, SDKError> = self.get("/integration_hubs/\(path_integration_hub_id)",
["fields": fields], nil, options)
return result
}
/**
* ### Update a Integration Hub definition.
*
* This API is rate limited to prevent it from being used for SSRF attacks
*
* PATCH /integration_hubs/{integration_hub_id} -> IntegrationHub
*/
public func update_integration_hub(
/**
* @param {Int64} integration_hub_id Id of Integration Hub
*/
_ integration_hub_id: Int64,
/**
* @param {WriteIntegrationHub} body
*/
_ body: WriteIntegrationHub,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_integration_hub_id = encodeParam(integration_hub_id)
let result: SDKResponse<Data, SDKError> = self.patch("/integration_hubs/\(path_integration_hub_id)",
["fields": fields], try! self.encode(body), options)
return result
}
/**
* ### Delete a Integration Hub.
*
* DELETE /integration_hubs/{integration_hub_id} -> String
*/
public func delete_integration_hub(
/**
* @param {Int64} integration_hub_id Id of integration_hub
*/
_ integration_hub_id: Int64,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_integration_hub_id = encodeParam(integration_hub_id)
let result: SDKResponse<Data, SDKError> = self.delete("/integration_hubs/\(path_integration_hub_id)", nil, nil, options)
return result
}
/**
* Accepts the legal agreement for a given integration hub. This only works for integration hubs that have legal_agreement_required set to true and legal_agreement_signed set to false.
*
* POST /integration_hubs/{integration_hub_id}/accept_legal_agreement -> IntegrationHub
*/
public func accept_integration_hub_legal_agreement(
/**
* @param {Int64} integration_hub_id Id of integration_hub
*/
_ integration_hub_id: Int64,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_integration_hub_id = encodeParam(integration_hub_id)
let result: SDKResponse<Data, SDKError> = self.post("/integration_hubs/\(path_integration_hub_id)/accept_legal_agreement", nil, nil, options)
return result
}
/**
* ### Get information about all Integrations.
*
* GET /integrations -> [Integration]
*/
public func all_integrations(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
/**
* @param {String} integration_hub_id Filter to a specific provider
*/
integration_hub_id: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/integrations",
["fields": fields, "integration_hub_id": integration_hub_id], nil, options)
return result
}
/**
* ### Get information about a Integration.
*
* GET /integrations/{integration_id} -> Integration
*/
public func integration(
/**
* @param {String} integration_id Id of integration
*/
_ integration_id: String,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_integration_id = encodeParam(integration_id)
let result: SDKResponse<Data, SDKError> = self.get("/integrations/\(path_integration_id)",
["fields": fields], nil, options)
return result
}
/**
* ### Update parameters on a Integration.
*
* PATCH /integrations/{integration_id} -> Integration
*/
public func update_integration(
/**
* @param {String} integration_id Id of integration
*/
_ integration_id: String,
/**
* @param {WriteIntegration} body
*/
_ body: WriteIntegration,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_integration_id = encodeParam(integration_id)
let result: SDKResponse<Data, SDKError> = self.patch("/integrations/\(path_integration_id)",
["fields": fields], try! self.encode(body), options)
return result
}
/**
* Returns the Integration form for presentation to the user.
*
* POST /integrations/{integration_id}/form -> DataActionForm
*/
public func fetch_integration_form(
/**
* @param {String} integration_id Id of integration
*/
_ integration_id: String,
/**
* @param {StringDictionary<AnyCodable>} body
*/
body: StringDictionary<AnyCodable>? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_integration_id = encodeParam(integration_id)
let result: SDKResponse<Data, SDKError> = self.post("/integrations/\(path_integration_id)/form", nil, try! self.encode(body), options)
return result
}
/**
* Tests the integration to make sure all the settings are working.
*
* POST /integrations/{integration_id}/test -> IntegrationTestResult
*/
public func test_integration(
/**
* @param {String} integration_id Id of integration
*/
_ integration_id: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_integration_id = encodeParam(integration_id)
let result: SDKResponse<Data, SDKError> = self.post("/integrations/\(path_integration_id)/test", nil, nil, options)
return result
}
// MARK Look: Run and Manage Looks
/**
* ### Get information about all active Looks
*
* Returns an array of **abbreviated Look objects** describing all the looks that the caller has access to. Soft-deleted Looks are **not** included.
*
* Get the **full details** of a specific look by id with [look(id)](#!/Look/look)
*
* Find **soft-deleted looks** with [search_looks()](#!/Look/search_looks)
*
* GET /looks -> [Look]
*/
public func all_looks(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/looks",
["fields": fields], nil, options)
return result
}
/**
* ### Create a Look
*
* To create a look to display query data, first create the query with [create_query()](#!/Query/create_query)
* then assign the query's id to the `query_id` property in the call to `create_look()`.
*
* To place the look into a particular space, assign the space's id to the `space_id` property
* in the call to `create_look()`.
*
* POST /looks -> LookWithQuery
*/
public func create_look(
/**
* @param {WriteLookWithQuery} body
*/
_ body: WriteLookWithQuery,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/looks",
["fields": fields], try! self.encode(body), options)
return result
}
/**
* ### Search Looks
*
* Returns an **array of Look objects** that match the specified search criteria.
*
* If multiple search params are given and `filter_or` is FALSE or not specified,
* search params are combined in a logical AND operation.
* Only rows that match *all* search param criteria will be returned.
*
* If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
* Results will include rows that match **any** of the search criteria.
*
* String search params use case-insensitive matching.
* String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
* example="dan%" will match "danger" and "Danzig" but not "David"
* example="D_m%" will match "Damage" and "dump"
*
* Integer search params can accept a single value or a comma separated list of values. The multiple
* values will be combined under a logical OR operation - results will match at least one of
* the given values.
*
* Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
* or exclude (respectively) rows where the column is null.
*
* Boolean search params accept only "true" and "false" as values.
*
*
* Get a **single look** by id with [look(id)](#!/Look/look)
*
* GET /looks/search -> [Look]
*/
public func search_looks(
/**
* @param {String} id Match look id.
*/
id: String? = nil,
/**
* @param {String} title Match Look title.
*/
title: String? = nil,
/**
* @param {String} description Match Look description.
*/
description: String? = nil,
/**
* @param {String} content_favorite_id Select looks with a particular content favorite id
*/
content_favorite_id: String? = nil,
/**
* @param {String} folder_id Select looks in a particular folder.
*/
folder_id: String? = nil,
/**
* @param {String} user_id Select looks created by a particular user.
*/
user_id: String? = nil,
/**
* @param {String} view_count Select looks with particular view_count value
*/
view_count: String? = nil,
/**
* @param {Bool} deleted Select soft-deleted looks
*/
deleted: Bool? = nil,
/**
* @param {Int64} query_id Select looks that reference a particular query by query_id
*/
query_id: Int64? = nil,
/**
* @param {Bool} curate Exclude items that exist only in personal spaces other than the users
*/
curate: Bool? = nil,
/**
* @param {String} last_viewed_at Select looks based on when they were last viewed
*/
last_viewed_at: String? = nil,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
/**
* @param {Int64} page Requested page.
*/
page: Int64? = nil,
/**
* @param {Int64} per_page Results per page.
*/
per_page: Int64? = nil,
/**
* @param {Int64} limit Number of results to return. (used with offset and takes priority over page and per_page)
*/
limit: Int64? = nil,
/**
* @param {Int64} offset Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
*/
offset: Int64? = nil,
/**
* @param {String} sorts One or more fields to sort results by. Sortable fields: [:title, :user_id, :id, :created_at, :space_id, :folder_id, :description, :updated_at, :last_updater_id, :view_count, :favorite_count, :content_favorite_id, :deleted, :deleted_at, :last_viewed_at, :last_accessed_at, :query_id]
*/
sorts: String? = nil,
/**
* @param {Bool} filter_or Combine given search criteria in a boolean OR expression
*/
filter_or: Bool? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/looks/search",
["id": id, "title": title, "description": description, "content_favorite_id": content_favorite_id, "folder_id": folder_id, "user_id": user_id, "view_count": view_count, "deleted": deleted as Any?, "query_id": query_id, "curate": curate as Any?, "last_viewed_at": last_viewed_at, "fields": fields, "page": page, "per_page": per_page, "limit": limit, "offset": offset, "sorts": sorts, "filter_or": filter_or as Any?], nil, options)
return result
}
/**
* ### Get a Look.
*
* Returns detailed information about a Look and its associated Query.
*
* GET /looks/{look_id} -> LookWithQuery
*/
public func look(
/**
* @param {Int64} look_id Id of look
*/
_ look_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_look_id = encodeParam(look_id)
let result: SDKResponse<Data, SDKError> = self.get("/looks/\(path_look_id)",
["fields": fields], nil, options)
return result
}
/**
* ### Modify a Look
*
* Use this function to modify parts of a look. Property values given in a call to `update_look` are
* applied to the existing look, so there's no need to include properties whose values are not changing.
* It's best to specify only the properties you want to change and leave everything else out
* of your `update_look` call. **Look properties marked 'read-only' will be ignored.**
*
* When a user deletes a look in the Looker UI, the look data remains in the database but is
* marked with a deleted flag ("soft-deleted"). Soft-deleted looks can be undeleted (by an admin)
* if the delete was in error.
*
* To soft-delete a look via the API, use [update_look()](#!/Look/update_look) to change the look's `deleted` property to `true`.
* You can undelete a look by calling `update_look` to change the look's `deleted` property to `false`.
*
* Soft-deleted looks are excluded from the results of [all_looks()](#!/Look/all_looks) and [search_looks()](#!/Look/search_looks), so they
* essentially disappear from view even though they still reside in the db.
* In API 3.1 and later, you can pass `deleted: true` as a parameter to [search_looks()](#!/3.1/Look/search_looks) to list soft-deleted looks.
*
* NOTE: [delete_look()](#!/Look/delete_look) performs a "hard delete" - the look data is removed from the Looker
* database and destroyed. There is no "undo" for `delete_look()`.
*
* PATCH /looks/{look_id} -> LookWithQuery
*/
public func update_look(
/**
* @param {Int64} look_id Id of look
*/
_ look_id: Int64,
/**
* @param {WriteLookWithQuery} body
*/
_ body: WriteLookWithQuery,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_look_id = encodeParam(look_id)
let result: SDKResponse<Data, SDKError> = self.patch("/looks/\(path_look_id)",
["fields": fields], try! self.encode(body), options)
return result
}
/**
* ### Permanently Delete a Look
*
* This operation **permanently** removes a look from the Looker database.
*
* NOTE: There is no "undo" for this kind of delete.
*
* For information about soft-delete (which can be undone) see [update_look()](#!/Look/update_look).
*
* DELETE /looks/{look_id} -> String
*/
public func delete_look(
/**
* @param {Int64} look_id Id of look
*/
_ look_id: Int64,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_look_id = encodeParam(look_id)
let result: SDKResponse<Data, SDKError> = self.delete("/looks/\(path_look_id)", nil, nil, options)
return result
}
/**
* ### Run a Look
*
* Runs a given look's query and returns the results in the requested format.
*
* Supported formats:
*
* | result_format | Description
* | :-----------: | :--- |
* | json | Plain json
* | json_detail | Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
* | csv | Comma separated values with a header
* | txt | Tab separated values with a header
* | html | Simple html
* | md | Simple markdown
* | xlsx | MS Excel spreadsheet
* | sql | Returns the generated SQL rather than running the query
* | png | A PNG image of the visualization of the query
* | jpg | A JPG image of the visualization of the query
*
* GET /looks/{look_id}/run/{result_format} -> String
*
* **Note**: Binary content may be returned by this method.
*/
public func run_look(
/**
* @param {Int64} look_id Id of look
*/
_ look_id: Int64,
/**
* @param {String} result_format Format of result
*/
_ result_format: String,
/**
* @param {Int64} limit Row limit (may override the limit in the saved query).
*/
limit: Int64? = nil,
/**
* @param {Bool} apply_formatting Apply model-specified formatting to each result.
*/
apply_formatting: Bool? = nil,
/**
* @param {Bool} apply_vis Apply visualization options to results.
*/
apply_vis: Bool? = nil,
/**
* @param {Bool} cache Get results from cache if available.
*/
cache: Bool? = nil,
/**
* @param {Int64} image_width Render width for image formats.
*/
image_width: Int64? = nil,
/**
* @param {Int64} image_height Render height for image formats.
*/
image_height: Int64? = nil,
/**
* @param {Bool} generate_drill_links Generate drill links (only applicable to 'json_detail' format.
*/
generate_drill_links: Bool? = nil,
/**
* @param {Bool} force_production Force use of production models even if the user is in development mode.
*/
force_production: Bool? = nil,
/**
* @param {Bool} cache_only Retrieve any results from cache even if the results have expired.
*/
cache_only: Bool? = nil,
/**
* @param {String} path_prefix Prefix to use for drill links (url encoded).
*/
path_prefix: String? = nil,
/**
* @param {Bool} rebuild_pdts Rebuild PDTS used in query.
*/
rebuild_pdts: Bool? = nil,
/**
* @param {Bool} server_table_calcs Perform table calculations on query results
*/
server_table_calcs: Bool? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_look_id = encodeParam(look_id)
let path_result_format = encodeParam(result_format)
let result: SDKResponse<Data, SDKError> = self.get("/looks/\(path_look_id)/run/\(path_result_format)",
["limit": limit, "apply_formatting": apply_formatting as Any?, "apply_vis": apply_vis as Any?, "cache": cache as Any?, "image_width": image_width, "image_height": image_height, "generate_drill_links": generate_drill_links as Any?, "force_production": force_production as Any?, "cache_only": cache_only as Any?, "path_prefix": path_prefix, "rebuild_pdts": rebuild_pdts as Any?, "server_table_calcs": server_table_calcs as Any?], nil, options)
return result
}
/**
* ### Copy an existing look
*
* Creates a copy of an existing look, in a specified folder, and returns the copied look.
*
* `look_id` and `folder_id` are required.
*
* `look_id` and `folder_id` must already exist, and `folder_id` must be different from the current `folder_id` of the dashboard.
*
* POST /looks/{look_id}/copy -> LookWithQuery
*/
public func copy_look(
/**
* @param {Int64} look_id Look id to copy.
*/
_ look_id: Int64,
/**
* @param {Int64} folder_id Folder id to copy to.
*/
folder_id: Int64? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_look_id = encodeParam(look_id)
let result: SDKResponse<Data, SDKError> = self.post("/looks/\(path_look_id)/copy",
["folder_id": folder_id], nil, options)
return result
}
/**
* ### Move an existing look
*
* Moves a look to a specified folder, and returns the moved look.
*
* `look_id` and `folder_id` are required.
* `look_id` and `folder_id` must already exist, and `folder_id` must be different from the current `folder_id` of the dashboard.
*
* PATCH /looks/{look_id}/move -> LookWithQuery
*/
public func move_look(
/**
* @param {Int64} look_id Look id to move.
*/
_ look_id: Int64,
/**
* @param {Int64} folder_id Folder id to move to.
*/
_ folder_id: Int64,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_look_id = encodeParam(look_id)
let result: SDKResponse<Data, SDKError> = self.patch("/looks/\(path_look_id)/move",
["folder_id": folder_id], nil, options)
return result
}
// MARK LookmlModel: Manage LookML Models
/**
* ### Discover information about derived tables
*
* GET /derived_table/graph/model/{model} -> DependencyGraph
*/
public func graph_derived_tables_for_model(
/**
* @param {String} model The name of the Lookml model.
*/
_ model: String,
/**
* @param {String} format The format of the graph. Valid values are [dot]. Default is `dot`
*/
format: String? = nil,
/**
* @param {String} color Color denoting the build status of the graph. Grey = not built, green = built, yellow = building, red = error.
*/
color: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_model = encodeParam(model)
let result: SDKResponse<Data, SDKError> = self.get("/derived_table/graph/model/\(path_model)",
["format": format, "color": color], nil, options)
return result
}
/**
* ### Get information about all lookml models.
*
* GET /lookml_models -> [LookmlModel]
*/
public func all_lookml_models(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/lookml_models",
["fields": fields], nil, options)
return result
}
/**
* ### Create a lookml model using the specified configuration.
*
* POST /lookml_models -> LookmlModel
*/
public func create_lookml_model(
/**
* @param {WriteLookmlModel} body
*/
_ body: WriteLookmlModel,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/lookml_models", nil, try! self.encode(body), options)
return result
}
/**
* ### Get information about a lookml model.
*
* GET /lookml_models/{lookml_model_name} -> LookmlModel
*/
public func lookml_model(
/**
* @param {String} lookml_model_name Name of lookml model.
*/
_ lookml_model_name: String,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_lookml_model_name = encodeParam(lookml_model_name)
let result: SDKResponse<Data, SDKError> = self.get("/lookml_models/\(path_lookml_model_name)",
["fields": fields], nil, options)
return result
}
/**
* ### Update a lookml model using the specified configuration.
*
* PATCH /lookml_models/{lookml_model_name} -> LookmlModel
*/
public func update_lookml_model(
/**
* @param {String} lookml_model_name Name of lookml model.
*/
_ lookml_model_name: String,
/**
* @param {WriteLookmlModel} body
*/
_ body: WriteLookmlModel,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_lookml_model_name = encodeParam(lookml_model_name)
let result: SDKResponse<Data, SDKError> = self.patch("/lookml_models/\(path_lookml_model_name)", nil, try! self.encode(body), options)
return result
}
/**
* ### Delete a lookml model.
*
* DELETE /lookml_models/{lookml_model_name} -> String
*/
public func delete_lookml_model(
/**
* @param {String} lookml_model_name Name of lookml model.
*/
_ lookml_model_name: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_lookml_model_name = encodeParam(lookml_model_name)
let result: SDKResponse<Data, SDKError> = self.delete("/lookml_models/\(path_lookml_model_name)", nil, nil, options)
return result
}
/**
* ### Get information about a lookml model explore.
*
* GET /lookml_models/{lookml_model_name}/explores/{explore_name} -> LookmlModelExplore
*/
public func lookml_model_explore(
/**
* @param {String} lookml_model_name Name of lookml model.
*/
_ lookml_model_name: String,
/**
* @param {String} explore_name Name of explore.
*/
_ explore_name: String,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_lookml_model_name = encodeParam(lookml_model_name)
let path_explore_name = encodeParam(explore_name)
let result: SDKResponse<Data, SDKError> = self.get("/lookml_models/\(path_lookml_model_name)/explores/\(path_explore_name)",
["fields": fields], nil, options)
return result
}
// MARK Metadata: Connection Metadata Features
/**
* ### Field name suggestions for a model and view
*
* GET /models/{model_name}/views/{view_name}/fields/{field_name}/suggestions -> ModelFieldSuggestions
*/
public func model_fieldname_suggestions(
/**
* @param {String} model_name Name of model
*/
_ model_name: String,
/**
* @param {String} view_name Name of view
*/
_ view_name: String,
/**
* @param {String} field_name Name of field to use for suggestions
*/
_ field_name: String,
/**
* @param {String} term Search term
*/
term: String? = nil,
/**
* @param {String} filters Suggestion filters
*/
filters: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_model_name = encodeParam(model_name)
let path_view_name = encodeParam(view_name)
let path_field_name = encodeParam(field_name)
let result: SDKResponse<Data, SDKError> = self.get("/models/\(path_model_name)/views/\(path_view_name)/fields/\(path_field_name)/suggestions",
["term": term, "filters": filters], nil, options)
return result
}
/**
* ### Get a single model
*
* GET /models/{model_name} -> Model
*/
public func get_model(
/**
* @param {String} model_name Name of model
*/
_ model_name: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_model_name = encodeParam(model_name)
let result: SDKResponse<Data, SDKError> = self.get("/models/\(path_model_name)", nil, nil, options)
return result
}
/**
* ### List databases available to this connection
*
* Certain dialects can support multiple databases per single connection.
* If this connection supports multiple databases, the database names will be returned in an array.
*
* Connections using dialects that do not support multiple databases will return an empty array.
*
* **Note**: [Connection Features](#!/Metadata/connection_features) can be used to determine if a connection supports
* multiple databases.
*
* GET /connections/{connection_name}/databases -> [String]
*/
public func connection_databases(
/**
* @param {String} connection_name Name of connection
*/
_ connection_name: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_connection_name = encodeParam(connection_name)
let result: SDKResponse<Data, SDKError> = self.get("/connections/\(path_connection_name)/databases", nil, nil, options)
return result
}
/**
* ### Retrieve metadata features for this connection
*
* Returns a list of feature names with `true` (available) or `false` (not available)
*
* GET /connections/{connection_name}/features -> ConnectionFeatures
*/
public func connection_features(
/**
* @param {String} connection_name Name of connection
*/
_ connection_name: String,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_connection_name = encodeParam(connection_name)
let result: SDKResponse<Data, SDKError> = self.get("/connections/\(path_connection_name)/features",
["fields": fields], nil, options)
return result
}
/**
* ### Get the list of schemas and tables for a connection
*
* GET /connections/{connection_name}/schemas -> [Schema]
*/
public func connection_schemas(
/**
* @param {String} connection_name Name of connection
*/
_ connection_name: String,
/**
* @param {String} database For dialects that support multiple databases, optionally identify which to use
*/
database: String? = nil,
/**
* @param {Bool} cache True to use fetch from cache, false to load fresh
*/
cache: Bool? = nil,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_connection_name = encodeParam(connection_name)
let result: SDKResponse<Data, SDKError> = self.get("/connections/\(path_connection_name)/schemas",
["database": database, "cache": cache as Any?, "fields": fields], nil, options)
return result
}
/**
* ### Get the list of tables for a schema
*
* For dialects that support multiple databases, optionally identify which to use. If not provided, the default
* database for the connection will be used.
*
* For dialects that do **not** support multiple databases, **do not use** the database parameter
*
* GET /connections/{connection_name}/tables -> [SchemaTables]
*/
public func connection_tables(
/**
* @param {String} connection_name Name of connection
*/
_ connection_name: String,
/**
* @param {String} database Optional. Name of database to use for the query, only if applicable
*/
database: String? = nil,
/**
* @param {String} schema_name Optional. Return only tables for this schema
*/
schema_name: String? = nil,
/**
* @param {Bool} cache True to fetch from cache, false to load fresh
*/
cache: Bool? = nil,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_connection_name = encodeParam(connection_name)
let result: SDKResponse<Data, SDKError> = self.get("/connections/\(path_connection_name)/tables",
["database": database, "schema_name": schema_name, "cache": cache as Any?, "fields": fields], nil, options)
return result
}
/**
* ### Get the columns (and therefore also the tables) in a specific schema
*
* GET /connections/{connection_name}/columns -> [SchemaColumns]
*/
public func connection_columns(
/**
* @param {String} connection_name Name of connection
*/
_ connection_name: String,
/**
* @param {String} database For dialects that support multiple databases, optionally identify which to use
*/
database: String? = nil,
/**
* @param {String} schema_name Name of schema to use.
*/
schema_name: String? = nil,
/**
* @param {Bool} cache True to fetch from cache, false to load fresh
*/
cache: Bool? = nil,
/**
* @param {Int64} table_limit limits the tables per schema returned
*/
table_limit: Int64? = nil,
/**
* @param {String} table_names only fetch columns for a given (comma-separated) list of tables
*/
table_names: String? = nil,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_connection_name = encodeParam(connection_name)
let result: SDKResponse<Data, SDKError> = self.get("/connections/\(path_connection_name)/columns",
["database": database, "schema_name": schema_name, "cache": cache as Any?, "table_limit": table_limit, "table_names": table_names, "fields": fields], nil, options)
return result
}
/**
* ### Search a connection for columns matching the specified name
*
* **Note**: `column_name` must be a valid column name. It is not a search pattern.
*
* GET /connections/{connection_name}/search_columns -> [ColumnSearch]
*/
public func connection_search_columns(
/**
* @param {String} connection_name Name of connection
*/
_ connection_name: String,
/**
* @param {String} column_name Column name to find
*/
column_name: String? = nil,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_connection_name = encodeParam(connection_name)
let result: SDKResponse<Data, SDKError> = self.get("/connections/\(path_connection_name)/search_columns",
["column_name": column_name, "fields": fields], nil, options)
return result
}
/**
* ### Connection cost estimating
*
* Assign a `sql` statement to the body of the request. e.g., for Ruby, `{sql: 'select * from users'}`
*
* **Note**: If the connection's dialect has no support for cost estimates, an error will be returned
*
* POST /connections/{connection_name}/cost_estimate -> CostEstimate
*/
public func connection_cost_estimate(
/**
* @param {String} connection_name Name of connection
*/
_ connection_name: String,
/**
* @param {CreateCostEstimate} body
*/
_ body: CreateCostEstimate,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_connection_name = encodeParam(connection_name)
let result: SDKResponse<Data, SDKError> = self.post("/connections/\(path_connection_name)/cost_estimate",
["fields": fields], try! self.encode(body), options)
return result
}
// MARK Project: Manage Projects
/**
* ### Generate Lockfile for All LookML Dependencies
*
* Git must have been configured, must be in dev mode and deploy permission required
*
* Install_all is a two step process
* 1. For each remote_dependency in a project the dependency manager will resolve any ambiguous ref.
* 2. The project will then write out a lockfile including each remote_dependency with its resolved ref.
*
* POST /projects/{project_id}/manifest/lock_all -> String
*/
public func lock_all(
/**
* @param {String} project_id Id of project
*/
_ project_id: String,
/**
* @param {String} fields Requested fields
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_project_id = encodeParam(project_id)
let result: SDKResponse<Data, SDKError> = self.post("/projects/\(path_project_id)/manifest/lock_all",
["fields": fields], nil, options)
return result
}
/**
* ### Get All Git Branches
*
* Returns a list of git branches in the project repository
*
* GET /projects/{project_id}/git_branches -> [GitBranch]
*/
public func all_git_branches(
/**
* @param {String} project_id Project Id
*/
_ project_id: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_project_id = encodeParam(project_id)
let result: SDKResponse<Data, SDKError> = self.get("/projects/\(path_project_id)/git_branches", nil, nil, options)
return result
}
/**
* ### Get the Current Git Branch
*
* Returns the git branch currently checked out in the given project repository
*
* GET /projects/{project_id}/git_branch -> GitBranch
*/
public func git_branch(
/**
* @param {String} project_id Project Id
*/
_ project_id: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_project_id = encodeParam(project_id)
let result: SDKResponse<Data, SDKError> = self.get("/projects/\(path_project_id)/git_branch", nil, nil, options)
return result
}
/**
* ### Checkout and/or reset --hard an existing Git Branch
*
* Only allowed in development mode
* - Call `update_session` to select the 'dev' workspace.
*
* Checkout an existing branch if name field is different from the name of the currently checked out branch.
*
* Optionally specify a branch name, tag name or commit SHA to which the branch should be reset.
* **DANGER** hard reset will be force pushed to the remote. Unsaved changes and commits may be permanently lost.
*
* PUT /projects/{project_id}/git_branch -> GitBranch
*/
public func update_git_branch(
/**
* @param {String} project_id Project Id
*/
_ project_id: String,
/**
* @param {WriteGitBranch} body
*/
_ body: WriteGitBranch,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_project_id = encodeParam(project_id)
let result: SDKResponse<Data, SDKError> = self.put("/projects/\(path_project_id)/git_branch", nil, try! self.encode(body), options)
return result
}
/**
* ### Create and Checkout a Git Branch
*
* Creates and checks out a new branch in the given project repository
* Only allowed in development mode
* - Call `update_session` to select the 'dev' workspace.
*
* Optionally specify a branch name, tag name or commit SHA as the start point in the ref field.
* If no ref is specified, HEAD of the current branch will be used as the start point for the new branch.
*
* POST /projects/{project_id}/git_branch -> GitBranch
*/
public func create_git_branch(
/**
* @param {String} project_id Project Id
*/
_ project_id: String,
/**
* @param {WriteGitBranch} body
*/
_ body: WriteGitBranch,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_project_id = encodeParam(project_id)
let result: SDKResponse<Data, SDKError> = self.post("/projects/\(path_project_id)/git_branch", nil, try! self.encode(body), options)
return result
}
/**
* ### Get the specified Git Branch
*
* Returns the git branch specified in branch_name path param if it exists in the given project repository
*
* GET /projects/{project_id}/git_branch/{branch_name} -> GitBranch
*/
public func find_git_branch(
/**
* @param {String} project_id Project Id
*/
_ project_id: String,
/**
* @param {String} branch_name Branch Name
*/
_ branch_name: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_project_id = encodeParam(project_id)
let path_branch_name = encodeParam(branch_name)
let result: SDKResponse<Data, SDKError> = self.get("/projects/\(path_project_id)/git_branch/\(path_branch_name)", nil, nil, options)
return result
}
/**
* ### Delete the specified Git Branch
*
* Delete git branch specified in branch_name path param from local and remote of specified project repository
*
* DELETE /projects/{project_id}/git_branch/{branch_name} -> String
*/
public func delete_git_branch(
/**
* @param {String} project_id Project Id
*/
_ project_id: String,
/**
* @param {String} branch_name Branch Name
*/
_ branch_name: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_project_id = encodeParam(project_id)
let path_branch_name = encodeParam(branch_name)
let result: SDKResponse<Data, SDKError> = self.delete("/projects/\(path_project_id)/git_branch/\(path_branch_name)", nil, nil, options)
return result
}
/**
* ### Deploy a Remote Branch or Ref to Production
*
* Git must have been configured and deploy permission required.
*
* Deploy is a one/two step process
* 1. If this is the first deploy of this project, create the production project with git repository.
* 2. Pull the branch or ref into the production project.
*
* Can only specify either a branch or a ref.
*
* POST /projects/{project_id}/deploy_ref_to_production -> String
*/
public func deploy_ref_to_production(
/**
* @param {String} project_id Id of project
*/
_ project_id: String,
/**
* @param {String} branch Branch to deploy to production
*/
branch: String? = nil,
/**
* @param {String} ref Ref to deploy to production
*/
ref: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_project_id = encodeParam(project_id)
let result: SDKResponse<Data, SDKError> = self.post("/projects/\(path_project_id)/deploy_ref_to_production",
["branch": branch, "ref": ref], nil, options)
return result
}
/**
* ### Deploy LookML from this Development Mode Project to Production
*
* Git must have been configured, must be in dev mode and deploy permission required
*
* Deploy is a two / three step process:
*
* 1. Push commits in current branch of dev mode project to the production branch (origin/master).
* Note a. This step is skipped in read-only projects.
* Note b. If this step is unsuccessful for any reason (e.g. rejected non-fastforward because production branch has
* commits not in current branch), subsequent steps will be skipped.
* 2. If this is the first deploy of this project, create the production project with git repository.
* 3. Pull the production branch into the production project.
*
* POST /projects/{project_id}/deploy_to_production -> String
*/
public func deploy_to_production(
/**
* @param {String} project_id Id of project
*/
_ project_id: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_project_id = encodeParam(project_id)
let result: SDKResponse<Data, SDKError> = self.post("/projects/\(path_project_id)/deploy_to_production", nil, nil, options)
return result
}
/**
* ### Reset a project to the revision of the project that is in production.
*
* **DANGER** this will delete any changes that have not been pushed to a remote repository.
*
* POST /projects/{project_id}/reset_to_production -> String
*/
public func reset_project_to_production(
/**
* @param {String} project_id Id of project
*/
_ project_id: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_project_id = encodeParam(project_id)
let result: SDKResponse<Data, SDKError> = self.post("/projects/\(path_project_id)/reset_to_production", nil, nil, options)
return result
}
/**
* ### Reset a project development branch to the revision of the project that is on the remote.
*
* **DANGER** this will delete any changes that have not been pushed to a remote repository.
*
* POST /projects/{project_id}/reset_to_remote -> String
*/
public func reset_project_to_remote(
/**
* @param {String} project_id Id of project
*/
_ project_id: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_project_id = encodeParam(project_id)
let result: SDKResponse<Data, SDKError> = self.post("/projects/\(path_project_id)/reset_to_remote", nil, nil, options)
return result
}
/**
* ### Get All Projects
*
* Returns all projects visible to the current user
*
* GET /projects -> [Project]
*/
public func all_projects(
/**
* @param {String} fields Requested fields
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/projects",
["fields": fields], nil, options)
return result
}
/**
* ### Create A Project
*
* dev mode required.
* - Call `update_session` to select the 'dev' workspace.
*
* `name` is required.
* `git_remote_url` is not allowed. To configure Git for the newly created project, follow the instructions in `update_project`.
*
* POST /projects -> Project
*/
public func create_project(
/**
* @param {WriteProject} body
*/
_ body: WriteProject,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/projects", nil, try! self.encode(body), options)
return result
}
/**
* ### Get A Project
*
* Returns the project with the given project id
*
* GET /projects/{project_id} -> Project
*/
public func project(
/**
* @param {String} project_id Project Id
*/
_ project_id: String,
/**
* @param {String} fields Requested fields
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_project_id = encodeParam(project_id)
let result: SDKResponse<Data, SDKError> = self.get("/projects/\(path_project_id)",
["fields": fields], nil, options)
return result
}
/**
* ### Update Project Configuration
*
* Apply changes to a project's configuration.
*
*
* #### Configuring Git for a Project
*
* To set up a Looker project with a remote git repository, follow these steps:
*
* 1. Call `update_session` to select the 'dev' workspace.
* 1. Call `create_git_deploy_key` to create a new deploy key for the project
* 1. Copy the deploy key text into the remote git repository's ssh key configuration
* 1. Call `update_project` to set project's `git_remote_url` ()and `git_service_name`, if necessary).
*
* When you modify a project's `git_remote_url`, Looker connects to the remote repository to fetch
* metadata. The remote git repository MUST be configured with the Looker-generated deploy
* key for this project prior to setting the project's `git_remote_url`.
*
* To set up a Looker project with a git repository residing on the Looker server (a 'bare' git repo):
*
* 1. Call `update_session` to select the 'dev' workspace.
* 1. Call `update_project` setting `git_remote_url` to null and `git_service_name` to "bare".
*
* PATCH /projects/{project_id} -> Project
*/
public func update_project(
/**
* @param {String} project_id Project Id
*/
_ project_id: String,
/**
* @param {WriteProject} body
*/
_ body: WriteProject,
/**
* @param {String} fields Requested fields
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_project_id = encodeParam(project_id)
let result: SDKResponse<Data, SDKError> = self.patch("/projects/\(path_project_id)",
["fields": fields], try! self.encode(body), options)
return result
}
/**
* ### Get A Projects Manifest object
*
* Returns the project with the given project id
*
* GET /projects/{project_id}/manifest -> Manifest
*/
public func manifest(
/**
* @param {String} project_id Project Id
*/
_ project_id: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_project_id = encodeParam(project_id)
let result: SDKResponse<Data, SDKError> = self.get("/projects/\(path_project_id)/manifest", nil, nil, options)
return result
}
/**
* ### Git Deploy Key
*
* Returns the ssh public key previously created for a project's git repository.
*
* GET /projects/{project_id}/git/deploy_key -> String
*/
public func git_deploy_key(
/**
* @param {String} project_id Project Id
*/
_ project_id: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_project_id = encodeParam(project_id)
let result: SDKResponse<Data, SDKError> = self.get("/projects/\(path_project_id)/git/deploy_key", nil, nil, options)
return result
}
/**
* ### Create Git Deploy Key
*
* Create a public/private key pair for authenticating ssh git requests from Looker to a remote git repository
* for a particular Looker project.
*
* Returns the public key of the generated ssh key pair.
*
* Copy this public key to your remote git repository's ssh keys configuration so that the remote git service can
* validate and accept git requests from the Looker server.
*
* POST /projects/{project_id}/git/deploy_key -> String
*/
public func create_git_deploy_key(
/**
* @param {String} project_id Project Id
*/
_ project_id: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_project_id = encodeParam(project_id)
let result: SDKResponse<Data, SDKError> = self.post("/projects/\(path_project_id)/git/deploy_key", nil, nil, options)
return result
}
/**
* ### Get Cached Project Validation Results
*
* Returns the cached results of a previous project validation calculation, if any.
* Returns http status 204 No Content if no validation results exist.
*
* Validating the content of all the files in a project can be computationally intensive
* for large projects. Use this API to simply fetch the results of the most recent
* project validation rather than revalidating the entire project from scratch.
*
* A value of `"stale": true` in the response indicates that the project has changed since
* the cached validation results were computed. The cached validation results may no longer
* reflect the current state of the project.
*
* GET /projects/{project_id}/validate -> ProjectValidationCache
*/
public func project_validation_results(
/**
* @param {String} project_id Project Id
*/
_ project_id: String,
/**
* @param {String} fields Requested fields
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_project_id = encodeParam(project_id)
let result: SDKResponse<Data, SDKError> = self.get("/projects/\(path_project_id)/validate",
["fields": fields], nil, options)
return result
}
/**
* ### Validate Project
*
* Performs lint validation of all lookml files in the project.
* Returns a list of errors found, if any.
*
* Validating the content of all the files in a project can be computationally intensive
* for large projects. For best performance, call `validate_project(project_id)` only
* when you really want to recompute project validation. To quickly display the results of
* the most recent project validation (without recomputing), use `project_validation_results(project_id)`
*
* POST /projects/{project_id}/validate -> ProjectValidation
*/
public func validate_project(
/**
* @param {String} project_id Project Id
*/
_ project_id: String,
/**
* @param {String} fields Requested fields
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_project_id = encodeParam(project_id)
let result: SDKResponse<Data, SDKError> = self.post("/projects/\(path_project_id)/validate",
["fields": fields], nil, options)
return result
}
/**
* ### Get Project Workspace
*
* Returns information about the state of the project files in the currently selected workspace
*
* GET /projects/{project_id}/current_workspace -> ProjectWorkspace
*/
public func project_workspace(
/**
* @param {String} project_id Project Id
*/
_ project_id: String,
/**
* @param {String} fields Requested fields
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_project_id = encodeParam(project_id)
let result: SDKResponse<Data, SDKError> = self.get("/projects/\(path_project_id)/current_workspace",
["fields": fields], nil, options)
return result
}
/**
* ### Get All Project Files
*
* Returns a list of the files in the project
*
* GET /projects/{project_id}/files -> [ProjectFile]
*/
public func all_project_files(
/**
* @param {String} project_id Project Id
*/
_ project_id: String,
/**
* @param {String} fields Requested fields
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_project_id = encodeParam(project_id)
let result: SDKResponse<Data, SDKError> = self.get("/projects/\(path_project_id)/files",
["fields": fields], nil, options)
return result
}
/**
* ### Get Project File Info
*
* Returns information about a file in the project
*
* GET /projects/{project_id}/files/file -> ProjectFile
*/
public func project_file(
/**
* @param {String} project_id Project Id
*/
_ project_id: String,
/**
* @param {String} file_id File Id
*/
_ file_id: String,
/**
* @param {String} fields Requested fields
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_project_id = encodeParam(project_id)
let result: SDKResponse<Data, SDKError> = self.get("/projects/\(path_project_id)/files/file",
["file_id": file_id, "fields": fields], nil, options)
return result
}
/**
* ### Get All Git Connection Tests
*
* dev mode required.
* - Call `update_session` to select the 'dev' workspace.
*
* Returns a list of tests which can be run against a project's (or the dependency project for the provided remote_url) git connection. Call [Run Git Connection Test](#!/Project/run_git_connection_test) to execute each test in sequence.
*
* Tests are ordered by increasing specificity. Tests should be run in the order returned because later tests require functionality tested by tests earlier in the test list.
*
* For example, a late-stage test for write access is meaningless if connecting to the git server (an early test) is failing.
*
* GET /projects/{project_id}/git_connection_tests -> [GitConnectionTest]
*/
public func all_git_connection_tests(
/**
* @param {String} project_id Project Id
*/
_ project_id: String,
/**
* @param {String} remote_url (Optional: leave blank for root project) The remote url for remote dependency to test.
*/
remote_url: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_project_id = encodeParam(project_id)
let result: SDKResponse<Data, SDKError> = self.get("/projects/\(path_project_id)/git_connection_tests",
["remote_url": remote_url], nil, options)
return result
}
/**
* ### Run a git connection test
*
* Run the named test on the git service used by this project (or the dependency project for the provided remote_url) and return the result. This
* is intended to help debug git connections when things do not work properly, to give
* more helpful information about why a git url is not working with Looker.
*
* Tests should be run in the order they are returned by [Get All Git Connection Tests](#!/Project/all_git_connection_tests).
*
* GET /projects/{project_id}/git_connection_tests/{test_id} -> GitConnectionTestResult
*/
public func run_git_connection_test(
/**
* @param {String} project_id Project Id
*/
_ project_id: String,
/**
* @param {String} test_id Test Id
*/
_ test_id: String,
/**
* @param {String} remote_url (Optional: leave blank for root project) The remote url for remote dependency to test.
*/
remote_url: String? = nil,
/**
* @param {String} use_production (Optional: leave blank for dev credentials) Whether to use git production credentials.
*/
use_production: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_project_id = encodeParam(project_id)
let path_test_id = encodeParam(test_id)
let result: SDKResponse<Data, SDKError> = self.get("/projects/\(path_project_id)/git_connection_tests/\(path_test_id)",
["remote_url": remote_url, "use_production": use_production], nil, options)
return result
}
/**
* ### Get All LookML Tests
*
* Returns a list of tests which can be run to validate a project's LookML code and/or the underlying data,
* optionally filtered by the file id.
* Call [Run LookML Test](#!/Project/run_lookml_test) to execute tests.
*
* GET /projects/{project_id}/lookml_tests -> [LookmlTest]
*/
public func all_lookml_tests(
/**
* @param {String} project_id Project Id
*/
_ project_id: String,
/**
* @param {String} file_id File Id
*/
file_id: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_project_id = encodeParam(project_id)
let result: SDKResponse<Data, SDKError> = self.get("/projects/\(path_project_id)/lookml_tests",
["file_id": file_id], nil, options)
return result
}
/**
* ### Run LookML Tests
*
* Runs all tests in the project, optionally filtered by file, test, and/or model.
*
* GET /projects/{project_id}/lookml_tests/run -> [LookmlTestResult]
*/
public func run_lookml_test(
/**
* @param {String} project_id Project Id
*/
_ project_id: String,
/**
* @param {String} file_id File Name
*/
file_id: String? = nil,
/**
* @param {String} test Test Name
*/
test: String? = nil,
/**
* @param {String} model Model Name
*/
model: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_project_id = encodeParam(project_id)
let result: SDKResponse<Data, SDKError> = self.get("/projects/\(path_project_id)/lookml_tests/run",
["file_id": file_id, "test": test, "model": model], nil, options)
return result
}
/**
* ### Creates a tag for the most recent commit, or a specific ref is a SHA is provided
*
* This is an internal-only, undocumented route.
*
* POST /projects/{project_id}/tag -> Project
*/
public func tag_ref(
/**
* @param {String} project_id Project Id
*/
_ project_id: String,
/**
* @param {WriteProject} body
*/
_ body: WriteProject,
/**
* @param {String} commit_sha (Optional): Commit Sha to Tag
*/
commit_sha: String? = nil,
/**
* @param {String} tag_name Tag Name
*/
tag_name: String? = nil,
/**
* @param {String} tag_message (Optional): Tag Message
*/
tag_message: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_project_id = encodeParam(project_id)
let result: SDKResponse<Data, SDKError> = self.post("/projects/\(path_project_id)/tag",
["commit_sha": commit_sha, "tag_name": tag_name, "tag_message": tag_message], try! self.encode(body), options)
return result
}
/**
* ### Configure Repository Credential for a remote dependency
*
* Admin required.
*
* `root_project_id` is required.
* `credential_id` is required.
*
* PUT /projects/{root_project_id}/credential/{credential_id} -> RepositoryCredential
*/
public func update_repository_credential(
/**
* @param {String} root_project_id Root Project Id
*/
_ root_project_id: String,
/**
* @param {String} credential_id Credential Id
*/
_ credential_id: String,
/**
* @param {WriteRepositoryCredential} body
*/
_ body: WriteRepositoryCredential,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_root_project_id = encodeParam(root_project_id)
let path_credential_id = encodeParam(credential_id)
let result: SDKResponse<Data, SDKError> = self.put("/projects/\(path_root_project_id)/credential/\(path_credential_id)", nil, try! self.encode(body), options)
return result
}
/**
* ### Repository Credential for a remote dependency
*
* Admin required.
*
* `root_project_id` is required.
* `credential_id` is required.
*
* DELETE /projects/{root_project_id}/credential/{credential_id} -> String
*/
public func delete_repository_credential(
/**
* @param {String} root_project_id Root Project Id
*/
_ root_project_id: String,
/**
* @param {String} credential_id Credential Id
*/
_ credential_id: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_root_project_id = encodeParam(root_project_id)
let path_credential_id = encodeParam(credential_id)
let result: SDKResponse<Data, SDKError> = self.delete("/projects/\(path_root_project_id)/credential/\(path_credential_id)", nil, nil, options)
return result
}
/**
* ### Get all Repository Credentials for a project
*
* `root_project_id` is required.
*
* GET /projects/{root_project_id}/credentials -> [RepositoryCredential]
*/
public func get_all_repository_credentials(
/**
* @param {String} root_project_id Root Project Id
*/
_ root_project_id: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_root_project_id = encodeParam(root_project_id)
let result: SDKResponse<Data, SDKError> = self.get("/projects/\(path_root_project_id)/credentials", nil, nil, options)
return result
}
// MARK Query: Run and Manage Queries
/**
* ### Create an async query task
*
* Creates a query task (job) to run a previously created query asynchronously. Returns a Query Task ID.
*
* Use [query_task(query_task_id)](#!/Query/query_task) to check the execution status of the query task.
* After the query task status reaches "Complete", use [query_task_results(query_task_id)](#!/Query/query_task_results) to fetch the results of the query.
*
* POST /query_tasks -> QueryTask
*/
public func create_query_task(
/**
* @param {WriteCreateQueryTask} body
*/
_ body: WriteCreateQueryTask,
/**
* @param {Int64} limit Row limit (may override the limit in the saved query).
*/
limit: Int64? = nil,
/**
* @param {Bool} apply_formatting Apply model-specified formatting to each result.
*/
apply_formatting: Bool? = nil,
/**
* @param {Bool} apply_vis Apply visualization options to results.
*/
apply_vis: Bool? = nil,
/**
* @param {Bool} cache Get results from cache if available.
*/
cache: Bool? = nil,
/**
* @param {Int64} image_width Render width for image formats.
*/
image_width: Int64? = nil,
/**
* @param {Int64} image_height Render height for image formats.
*/
image_height: Int64? = nil,
/**
* @param {Bool} generate_drill_links Generate drill links (only applicable to 'json_detail' format.
*/
generate_drill_links: Bool? = nil,
/**
* @param {Bool} force_production Force use of production models even if the user is in development mode.
*/
force_production: Bool? = nil,
/**
* @param {Bool} cache_only Retrieve any results from cache even if the results have expired.
*/
cache_only: Bool? = nil,
/**
* @param {String} path_prefix Prefix to use for drill links (url encoded).
*/
path_prefix: String? = nil,
/**
* @param {Bool} rebuild_pdts Rebuild PDTS used in query.
*/
rebuild_pdts: Bool? = nil,
/**
* @param {Bool} server_table_calcs Perform table calculations on query results
*/
server_table_calcs: Bool? = nil,
/**
* @param {String} fields Requested fields
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/query_tasks",
["limit": limit, "apply_formatting": apply_formatting as Any?, "apply_vis": apply_vis as Any?, "cache": cache as Any?, "image_width": image_width, "image_height": image_height, "generate_drill_links": generate_drill_links as Any?, "force_production": force_production as Any?, "cache_only": cache_only as Any?, "path_prefix": path_prefix, "rebuild_pdts": rebuild_pdts as Any?, "server_table_calcs": server_table_calcs as Any?, "fields": fields], try! self.encode(body), options)
return result
}
/**
* ### Fetch results of multiple async queries
*
* Returns the results of multiple async queries in one request.
*
* For Query Tasks that are not completed, the response will include the execution status of the Query Task but will not include query results.
* Query Tasks whose results have expired will have a status of 'expired'.
* If the user making the API request does not have sufficient privileges to view a Query Task result, the result will have a status of 'missing'
*
* GET /query_tasks/multi_results -> StringDictionary<AnyCodable>
*/
public func query_task_multi_results(
/**
* @param {DelimArray<String>} query_task_ids List of Query Task IDs
*/
_ query_task_ids: DelimArray<String>,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/query_tasks/multi_results",
["query_task_ids": query_task_ids as Any?], nil, options)
return result
}
/**
* ### Get Query Task details
*
* Use this function to check the status of an async query task. After the status
* reaches "Complete", you can call [query_task_results(query_task_id)](#!/Query/query_task_results) to
* retrieve the results of the query.
*
* Use [create_query_task()](#!/Query/create_query_task) to create an async query task.
*
* GET /query_tasks/{query_task_id} -> QueryTask
*/
public func query_task(
/**
* @param {String} query_task_id ID of the Query Task
*/
_ query_task_id: String,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_query_task_id = encodeParam(query_task_id)
let result: SDKResponse<Data, SDKError> = self.get("/query_tasks/\(path_query_task_id)",
["fields": fields], nil, options)
return result
}
/**
* ### Get Async Query Results
*
* Returns the results of an async query task if the query has completed.
*
* If the query task is still running or waiting to run, this function returns 204 No Content.
*
* If the query task ID is invalid or the cached results of the query task have expired, this function returns 404 Not Found.
*
* Use [query_task(query_task_id)](#!/Query/query_task) to check the execution status of the query task
* Call query_task_results only after the query task status reaches "Complete".
*
* You can also use [query_task_multi_results()](#!/Query/query_task_multi_results) retrieve the
* results of multiple async query tasks at the same time.
*
* #### SQL Error Handling:
* If the query fails due to a SQL db error, how this is communicated depends on the result_format you requested in `create_query_task()`.
*
* For `json_detail` result_format: `query_task_results()` will respond with HTTP status '200 OK' and db SQL error info
* will be in the `errors` property of the response object. The 'data' property will be empty.
*
* For all other result formats: `query_task_results()` will respond with HTTP status `400 Bad Request` and some db SQL error info
* will be in the message of the 400 error response, but not as detailed as expressed in `json_detail.errors`.
* These data formats can only carry row data, and error info is not row data.
*
* GET /query_tasks/{query_task_id}/results -> String
*/
public func query_task_results(
/**
* @param {String} query_task_id ID of the Query Task
*/
_ query_task_id: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_query_task_id = encodeParam(query_task_id)
let result: SDKResponse<Data, SDKError> = self.get("/query_tasks/\(path_query_task_id)/results", nil, nil, options)
return result
}
/**
* ### Get a previously created query by id.
*
* A Looker query object includes the various parameters that define a database query that has been run or
* could be run in the future. These parameters include: model, view, fields, filters, pivots, etc.
* Query *results* are not part of the query object.
*
* Query objects are unique and immutable. Query objects are created automatically in Looker as users explore data.
* Looker does not delete them; they become part of the query history. When asked to create a query for
* any given set of parameters, Looker will first try to find an existing query object with matching
* parameters and will only create a new object when an appropriate object can not be found.
*
* This 'get' method is used to get the details about a query for a given id. See the other methods here
* to 'create' and 'run' queries.
*
* Note that some fields like 'filter_config' and 'vis_config' etc are specific to how the Looker UI
* builds queries and visualizations and are not generally useful for API use. They are not required when
* creating new queries and can usually just be ignored.
*
* GET /queries/{query_id} -> Query
*/
public func query(
/**
* @param {Int64} query_id Id of query
*/
_ query_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_query_id = encodeParam(query_id)
let result: SDKResponse<Data, SDKError> = self.get("/queries/\(path_query_id)",
["fields": fields], nil, options)
return result
}
/**
* ### Get the query for a given query slug.
*
* This returns the query for the 'slug' in a query share URL.
*
* The 'slug' is a randomly chosen short string that is used as an alternative to the query's id value
* for use in URLs etc. This method exists as a convenience to help you use the API to 'find' queries that
* have been created using the Looker UI.
*
* You can use the Looker explore page to build a query and then choose the 'Share' option to
* show the share url for the query. Share urls generally look something like 'https://looker.yourcompany/x/vwGSbfc'.
* The trailing 'vwGSbfc' is the share slug. You can pass that string to this api method to get details about the query.
* Those details include the 'id' that you can use to run the query. Or, you can copy the query body
* (perhaps with your own modification) and use that as the basis to make/run new queries.
*
* This will also work with slugs from Looker explore urls like
* 'https://looker.yourcompany/explore/ecommerce/orders?qid=aogBgL6o3cKK1jN3RoZl5s'. In this case
* 'aogBgL6o3cKK1jN3RoZl5s' is the slug.
*
* GET /queries/slug/{slug} -> Query
*/
public func query_for_slug(
/**
* @param {String} slug Slug of query
*/
_ slug: String,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_slug = encodeParam(slug)
let result: SDKResponse<Data, SDKError> = self.get("/queries/slug/\(path_slug)",
["fields": fields], nil, options)
return result
}
/**
* ### Create a query.
*
* This allows you to create a new query that you can later run. Looker queries are immutable once created
* and are not deleted. If you create a query that is exactly like an existing query then the existing query
* will be returned and no new query will be created. Whether a new query is created or not, you can use
* the 'id' in the returned query with the 'run' method.
*
* The query parameters are passed as json in the body of the request.
*
* POST /queries -> Query
*/
public func create_query(
/**
* @param {WriteQuery} body
*/
_ body: WriteQuery,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/queries",
["fields": fields], try! self.encode(body), options)
return result
}
/**
* ### Run a saved query.
*
* This runs a previously saved query. You can use this on a query that was generated in the Looker UI
* or one that you have explicitly created using the API. You can also use a query 'id' from a saved 'Look'.
*
* The 'result_format' parameter specifies the desired structure and format of the response.
*
* Supported formats:
*
* | result_format | Description
* | :-----------: | :--- |
* | json | Plain json
* | json_detail | Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
* | csv | Comma separated values with a header
* | txt | Tab separated values with a header
* | html | Simple html
* | md | Simple markdown
* | xlsx | MS Excel spreadsheet
* | sql | Returns the generated SQL rather than running the query
* | png | A PNG image of the visualization of the query
* | jpg | A JPG image of the visualization of the query
*
* GET /queries/{query_id}/run/{result_format} -> String
*
* **Note**: Binary content may be returned by this method.
*/
public func run_query(
/**
* @param {Int64} query_id Id of query
*/
_ query_id: Int64,
/**
* @param {String} result_format Format of result
*/
_ result_format: String,
/**
* @param {Int64} limit Row limit (may override the limit in the saved query).
*/
limit: Int64? = nil,
/**
* @param {Bool} apply_formatting Apply model-specified formatting to each result.
*/
apply_formatting: Bool? = nil,
/**
* @param {Bool} apply_vis Apply visualization options to results.
*/
apply_vis: Bool? = nil,
/**
* @param {Bool} cache Get results from cache if available.
*/
cache: Bool? = nil,
/**
* @param {Int64} image_width Render width for image formats.
*/
image_width: Int64? = nil,
/**
* @param {Int64} image_height Render height for image formats.
*/
image_height: Int64? = nil,
/**
* @param {Bool} generate_drill_links Generate drill links (only applicable to 'json_detail' format.
*/
generate_drill_links: Bool? = nil,
/**
* @param {Bool} force_production Force use of production models even if the user is in development mode.
*/
force_production: Bool? = nil,
/**
* @param {Bool} cache_only Retrieve any results from cache even if the results have expired.
*/
cache_only: Bool? = nil,
/**
* @param {String} path_prefix Prefix to use for drill links (url encoded).
*/
path_prefix: String? = nil,
/**
* @param {Bool} rebuild_pdts Rebuild PDTS used in query.
*/
rebuild_pdts: Bool? = nil,
/**
* @param {Bool} server_table_calcs Perform table calculations on query results
*/
server_table_calcs: Bool? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_query_id = encodeParam(query_id)
let path_result_format = encodeParam(result_format)
let result: SDKResponse<Data, SDKError> = self.get("/queries/\(path_query_id)/run/\(path_result_format)",
["limit": limit, "apply_formatting": apply_formatting as Any?, "apply_vis": apply_vis as Any?, "cache": cache as Any?, "image_width": image_width, "image_height": image_height, "generate_drill_links": generate_drill_links as Any?, "force_production": force_production as Any?, "cache_only": cache_only as Any?, "path_prefix": path_prefix, "rebuild_pdts": rebuild_pdts as Any?, "server_table_calcs": server_table_calcs as Any?], nil, options)
return result
}
/**
* ### Run the query that is specified inline in the posted body.
*
* This allows running a query as defined in json in the posted body. This combines
* the two actions of posting & running a query into one step.
*
* Here is an example body in json:
* ```
* {
* "model":"thelook",
* "view":"inventory_items",
* "fields":["category.name","inventory_items.days_in_inventory_tier","products.count"],
* "filters":{"category.name":"socks"},
* "sorts":["products.count desc 0"],
* "limit":"500",
* "query_timezone":"America/Los_Angeles"
* }
* ```
*
* When using the Ruby SDK this would be passed as a Ruby hash like:
* ```
* {
* :model=>"thelook",
* :view=>"inventory_items",
* :fields=>
* ["category.name",
* "inventory_items.days_in_inventory_tier",
* "products.count"],
* :filters=>{:"category.name"=>"socks"},
* :sorts=>["products.count desc 0"],
* :limit=>"500",
* :query_timezone=>"America/Los_Angeles",
* }
* ```
*
* This will return the result of running the query in the format specified by the 'result_format' parameter.
*
* Supported formats:
*
* | result_format | Description
* | :-----------: | :--- |
* | json | Plain json
* | json_detail | Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
* | csv | Comma separated values with a header
* | txt | Tab separated values with a header
* | html | Simple html
* | md | Simple markdown
* | xlsx | MS Excel spreadsheet
* | sql | Returns the generated SQL rather than running the query
* | png | A PNG image of the visualization of the query
* | jpg | A JPG image of the visualization of the query
*
* POST /queries/run/{result_format} -> String
*
* **Note**: Binary content may be returned by this method.
*/
public func run_inline_query(
/**
* @param {String} result_format Format of result
*/
_ result_format: String,
/**
* @param {WriteQuery} body
*/
_ body: WriteQuery,
/**
* @param {Int64} limit Row limit (may override the limit in the saved query).
*/
limit: Int64? = nil,
/**
* @param {Bool} apply_formatting Apply model-specified formatting to each result.
*/
apply_formatting: Bool? = nil,
/**
* @param {Bool} apply_vis Apply visualization options to results.
*/
apply_vis: Bool? = nil,
/**
* @param {Bool} cache Get results from cache if available.
*/
cache: Bool? = nil,
/**
* @param {Int64} image_width Render width for image formats.
*/
image_width: Int64? = nil,
/**
* @param {Int64} image_height Render height for image formats.
*/
image_height: Int64? = nil,
/**
* @param {Bool} generate_drill_links Generate drill links (only applicable to 'json_detail' format.
*/
generate_drill_links: Bool? = nil,
/**
* @param {Bool} force_production Force use of production models even if the user is in development mode.
*/
force_production: Bool? = nil,
/**
* @param {Bool} cache_only Retrieve any results from cache even if the results have expired.
*/
cache_only: Bool? = nil,
/**
* @param {String} path_prefix Prefix to use for drill links (url encoded).
*/
path_prefix: String? = nil,
/**
* @param {Bool} rebuild_pdts Rebuild PDTS used in query.
*/
rebuild_pdts: Bool? = nil,
/**
* @param {Bool} server_table_calcs Perform table calculations on query results
*/
server_table_calcs: Bool? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_result_format = encodeParam(result_format)
let result: SDKResponse<Data, SDKError> = self.post("/queries/run/\(path_result_format)",
["limit": limit, "apply_formatting": apply_formatting as Any?, "apply_vis": apply_vis as Any?, "cache": cache as Any?, "image_width": image_width, "image_height": image_height, "generate_drill_links": generate_drill_links as Any?, "force_production": force_production as Any?, "cache_only": cache_only as Any?, "path_prefix": path_prefix, "rebuild_pdts": rebuild_pdts as Any?, "server_table_calcs": server_table_calcs as Any?], try! self.encode(body), options)
return result
}
/**
* ### Run an URL encoded query.
*
* This requires the caller to encode the specifiers for the query into the URL query part using
* Looker-specific syntax as explained below.
*
* Generally, you would want to use one of the methods that takes the parameters as json in the POST body
* for creating and/or running queries. This method exists for cases where one really needs to encode the
* parameters into the URL of a single 'GET' request. This matches the way that the Looker UI formats
* 'explore' URLs etc.
*
* The parameters here are very similar to the json body formatting except that the filter syntax is
* tricky. Unfortunately, this format makes this method not currently callable via the 'Try it out!' button
* in this documentation page. But, this is callable when creating URLs manually or when using the Looker SDK.
*
* Here is an example inline query URL:
*
* ```
* https://looker.mycompany.com:19999/api/3.0/queries/models/thelook/views/inventory_items/run/json?fields=category.name,inventory_items.days_in_inventory_tier,products.count&f[category.name]=socks&sorts=products.count+desc+0&limit=500&query_timezone=America/Los_Angeles
* ```
*
* When invoking this endpoint with the Ruby SDK, pass the query parameter parts as a hash. The hash to match the above would look like:
*
* ```ruby
* query_params =
* {
* :fields => "category.name,inventory_items.days_in_inventory_tier,products.count",
* :"f[category.name]" => "socks",
* :sorts => "products.count desc 0",
* :limit => "500",
* :query_timezone => "America/Los_Angeles"
* }
* response = ruby_sdk.run_url_encoded_query('thelook','inventory_items','json', query_params)
*
* ```
*
* Again, it is generally easier to use the variant of this method that passes the full query in the POST body.
* This method is available for cases where other alternatives won't fit the need.
*
* Supported formats:
*
* | result_format | Description
* | :-----------: | :--- |
* | json | Plain json
* | json_detail | Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
* | csv | Comma separated values with a header
* | txt | Tab separated values with a header
* | html | Simple html
* | md | Simple markdown
* | xlsx | MS Excel spreadsheet
* | sql | Returns the generated SQL rather than running the query
* | png | A PNG image of the visualization of the query
* | jpg | A JPG image of the visualization of the query
*
* GET /queries/models/{model_name}/views/{view_name}/run/{result_format} -> String
*
* **Note**: Binary content may be returned by this method.
*/
public func run_url_encoded_query(
/**
* @param {String} model_name Model name
*/
_ model_name: String,
/**
* @param {String} view_name View name
*/
_ view_name: String,
/**
* @param {String} result_format Format of result
*/
_ result_format: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_model_name = encodeParam(model_name)
let path_view_name = encodeParam(view_name)
let path_result_format = encodeParam(result_format)
let result: SDKResponse<Data, SDKError> = self.get("/queries/models/\(path_model_name)/views/\(path_view_name)/run/\(path_result_format)", nil, nil, options)
return result
}
/**
* ### Get Merge Query
*
* Returns a merge query object given its id.
*
* GET /merge_queries/{merge_query_id} -> MergeQuery
*/
public func merge_query(
/**
* @param {String} merge_query_id Merge Query Id
*/
_ merge_query_id: String,
/**
* @param {String} fields Requested fields
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_merge_query_id = encodeParam(merge_query_id)
let result: SDKResponse<Data, SDKError> = self.get("/merge_queries/\(path_merge_query_id)",
["fields": fields], nil, options)
return result
}
/**
* ### Create Merge Query
*
* Creates a new merge query object.
*
* A merge query takes the results of one or more queries and combines (merges) the results
* according to field mapping definitions. The result is similar to a SQL left outer join.
*
* A merge query can merge results of queries from different SQL databases.
*
* The order that queries are defined in the source_queries array property is significant. The
* first query in the array defines the primary key into which the results of subsequent
* queries will be merged.
*
* Like model/view query objects, merge queries are immutable and have structural identity - if
* you make a request to create a new merge query that is identical to an existing merge query,
* the existing merge query will be returned instead of creating a duplicate. Conversely, any
* change to the contents of a merge query will produce a new object with a new id.
*
* POST /merge_queries -> MergeQuery
*/
public func create_merge_query(
/**
* @param {WriteMergeQuery} body
*/
body: WriteMergeQuery?,
/**
* @param {String} fields Requested fields
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/merge_queries",
["fields": fields], try! self.encode(body), options)
return result
}
/**
* Get information about all running queries.
*
* GET /running_queries -> [RunningQueries]
*/
public func all_running_queries(
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/running_queries", nil, nil, options)
return result
}
/**
* Kill a query with a specific query_task_id.
*
* DELETE /running_queries/{query_task_id} -> String
*/
public func kill_query(
/**
* @param {String} query_task_id Query task id.
*/
_ query_task_id: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_query_task_id = encodeParam(query_task_id)
let result: SDKResponse<Data, SDKError> = self.delete("/running_queries/\(path_query_task_id)", nil, nil, options)
return result
}
/**
* Get a SQL Runner query.
*
* GET /sql_queries/{slug} -> SqlQuery
*/
public func sql_query(
/**
* @param {String} slug slug of query
*/
_ slug: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_slug = encodeParam(slug)
let result: SDKResponse<Data, SDKError> = self.get("/sql_queries/\(path_slug)", nil, nil, options)
return result
}
/**
* ### Create a SQL Runner Query
*
* Either the `connection_name` or `model_name` parameter MUST be provided.
*
* POST /sql_queries -> SqlQuery
*/
public func create_sql_query(
/**
* @param {SqlQueryCreate} body
*/
_ body: SqlQueryCreate,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/sql_queries", nil, try! self.encode(body), options)
return result
}
/**
* Execute a SQL Runner query in a given result_format.
*
* POST /sql_queries/{slug}/run/{result_format} -> String
*
* **Note**: Binary content may be returned by this method.
*/
public func run_sql_query(
/**
* @param {String} slug slug of query
*/
_ slug: String,
/**
* @param {String} result_format Format of result, options are: ["inline_json", "json", "json_detail", "json_fe", "csv", "html", "md", "txt", "xlsx", "gsxml", "json_label"]
*/
_ result_format: String,
/**
* @param {String} download Defaults to false. If set to true, the HTTP response will have content-disposition and other headers set to make the HTTP response behave as a downloadable attachment instead of as inline content.
*/
download: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_slug = encodeParam(slug)
let path_result_format = encodeParam(result_format)
let result: SDKResponse<Data, SDKError> = self.post("/sql_queries/\(path_slug)/run/\(path_result_format)",
["download": download], nil, options)
return result
}
// MARK RenderTask: Manage Render Tasks
/**
* ### Create a new task to render a look to an image.
*
* Returns a render task object.
* To check the status of a render task, pass the render_task.id to [Get Render Task](#!/RenderTask/get_render_task).
* Once the render task is complete, you can download the resulting document or image using [Get Render Task Results](#!/RenderTask/get_render_task_results).
*
* POST /render_tasks/looks/{look_id}/{result_format} -> RenderTask
*/
public func create_look_render_task(
/**
* @param {Int64} look_id Id of look to render
*/
_ look_id: Int64,
/**
* @param {String} result_format Output type: png, or jpg
*/
_ result_format: String,
/**
* @param {Int64} width Output width in pixels
*/
_ width: Int64,
/**
* @param {Int64} height Output height in pixels
*/
_ height: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_look_id = encodeParam(look_id)
let path_result_format = encodeParam(result_format)
let result: SDKResponse<Data, SDKError> = self.post("/render_tasks/looks/\(path_look_id)/\(path_result_format)",
["width": width, "height": height, "fields": fields], nil, options)
return result
}
/**
* ### Create a new task to render an existing query to an image.
*
* Returns a render task object.
* To check the status of a render task, pass the render_task.id to [Get Render Task](#!/RenderTask/get_render_task).
* Once the render task is complete, you can download the resulting document or image using [Get Render Task Results](#!/RenderTask/get_render_task_results).
*
* POST /render_tasks/queries/{query_id}/{result_format} -> RenderTask
*/
public func create_query_render_task(
/**
* @param {Int64} query_id Id of the query to render
*/
_ query_id: Int64,
/**
* @param {String} result_format Output type: png or jpg
*/
_ result_format: String,
/**
* @param {Int64} width Output width in pixels
*/
_ width: Int64,
/**
* @param {Int64} height Output height in pixels
*/
_ height: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_query_id = encodeParam(query_id)
let path_result_format = encodeParam(result_format)
let result: SDKResponse<Data, SDKError> = self.post("/render_tasks/queries/\(path_query_id)/\(path_result_format)",
["width": width, "height": height, "fields": fields], nil, options)
return result
}
/**
* ### Create a new task to render a dashboard to a document or image.
*
* Returns a render task object.
* To check the status of a render task, pass the render_task.id to [Get Render Task](#!/RenderTask/get_render_task).
* Once the render task is complete, you can download the resulting document or image using [Get Render Task Results](#!/RenderTask/get_render_task_results).
*
* POST /render_tasks/dashboards/{dashboard_id}/{result_format} -> RenderTask
*/
public func create_dashboard_render_task(
/**
* @param {String} dashboard_id Id of dashboard to render. The ID can be a LookML dashboard also.
*/
_ dashboard_id: String,
/**
* @param {String} result_format Output type: pdf, png, or jpg
*/
_ result_format: String,
/**
* @param {CreateDashboardRenderTask} body
*/
_ body: CreateDashboardRenderTask,
/**
* @param {Int64} width Output width in pixels
*/
_ width: Int64,
/**
* @param {Int64} height Output height in pixels
*/
_ height: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
/**
* @param {String} pdf_paper_size Paper size for pdf. Value can be one of: ["letter","legal","tabloid","a0","a1","a2","a3","a4","a5"]
*/
pdf_paper_size: String? = nil,
/**
* @param {Bool} pdf_landscape Whether to render pdf in landscape paper orientation
*/
pdf_landscape: Bool? = nil,
/**
* @param {Bool} long_tables Whether or not to expand table vis to full length
*/
long_tables: Bool? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_dashboard_id = encodeParam(dashboard_id)
let path_result_format = encodeParam(result_format)
let result: SDKResponse<Data, SDKError> = self.post("/render_tasks/dashboards/\(path_dashboard_id)/\(path_result_format)",
["width": width, "height": height, "fields": fields, "pdf_paper_size": pdf_paper_size, "pdf_landscape": pdf_landscape as Any?, "long_tables": long_tables as Any?], try! self.encode(body), options)
return result
}
/**
* ### Get information about a render task.
*
* Returns a render task object.
* To check the status of a render task, pass the render_task.id to [Get Render Task](#!/RenderTask/get_render_task).
* Once the render task is complete, you can download the resulting document or image using [Get Render Task Results](#!/RenderTask/get_render_task_results).
*
* GET /render_tasks/{render_task_id} -> RenderTask
*/
public func render_task(
/**
* @param {String} render_task_id Id of render task
*/
_ render_task_id: String,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_render_task_id = encodeParam(render_task_id)
let result: SDKResponse<Data, SDKError> = self.get("/render_tasks/\(path_render_task_id)",
["fields": fields], nil, options)
return result
}
/**
* ### Get the document or image produced by a completed render task.
*
* Note that the PDF or image result will be a binary blob in the HTTP response, as indicated by the
* Content-Type in the response headers. This may require specialized (or at least different) handling than text
* responses such as JSON. You may need to tell your HTTP client that the response is binary so that it does not
* attempt to parse the binary data as text.
*
* If the render task exists but has not finished rendering the results, the response HTTP status will be
* **202 Accepted**, the response body will be empty, and the response will have a Retry-After header indicating
* that the caller should repeat the request at a later time.
*
* Returns 404 if the render task cannot be found, if the cached result has expired, or if the caller
* does not have permission to view the results.
*
* For detailed information about the status of the render task, use [Render Task](#!/RenderTask/render_task).
* Polling loops waiting for completion of a render task would be better served by polling **render_task(id)** until
* the task status reaches completion (or error) instead of polling **render_task_results(id)** alone.
*
* GET /render_tasks/{render_task_id}/results -> String
*
* **Note**: Binary content is returned by this method.
*/
public func render_task_results(
/**
* @param {String} render_task_id Id of render task
*/
_ render_task_id: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_render_task_id = encodeParam(render_task_id)
let result: SDKResponse<Data, SDKError> = self.get("/render_tasks/\(path_render_task_id)/results", nil, nil, options)
return result
}
// MARK Role: Manage Roles
/**
* ### Search model sets
* Returns all model set records that match the given search criteria.
* If multiple search params are given and `filter_or` is FALSE or not specified,
* search params are combined in a logical AND operation.
* Only rows that match *all* search param criteria will be returned.
*
* If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
* Results will include rows that match **any** of the search criteria.
*
* String search params use case-insensitive matching.
* String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
* example="dan%" will match "danger" and "Danzig" but not "David"
* example="D_m%" will match "Damage" and "dump"
*
* Integer search params can accept a single value or a comma separated list of values. The multiple
* values will be combined under a logical OR operation - results will match at least one of
* the given values.
*
* Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
* or exclude (respectively) rows where the column is null.
*
* Boolean search params accept only "true" and "false" as values.
*
* GET /model_sets/search -> [ModelSet]
*/
public func search_model_sets(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
/**
* @param {Int64} limit Number of results to return (used with `offset`).
*/
limit: Int64? = nil,
/**
* @param {Int64} offset Number of results to skip before returning any (used with `limit`).
*/
offset: Int64? = nil,
/**
* @param {String} sorts Fields to sort by.
*/
sorts: String? = nil,
/**
* @param {Int64} id Match model set id.
*/
id: Int64? = nil,
/**
* @param {String} name Match model set name.
*/
name: String? = nil,
/**
* @param {Bool} all_access Match model sets by all_access status.
*/
all_access: Bool? = nil,
/**
* @param {Bool} built_in Match model sets by built_in status.
*/
built_in: Bool? = nil,
/**
* @param {Bool} filter_or Combine given search criteria in a boolean OR expression.
*/
filter_or: Bool? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/model_sets/search",
["fields": fields, "limit": limit, "offset": offset, "sorts": sorts, "id": id, "name": name, "all_access": all_access as Any?, "built_in": built_in as Any?, "filter_or": filter_or as Any?], nil, options)
return result
}
/**
* ### Get information about the model set with a specific id.
*
* GET /model_sets/{model_set_id} -> ModelSet
*/
public func model_set(
/**
* @param {Int64} model_set_id Id of model set
*/
_ model_set_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_model_set_id = encodeParam(model_set_id)
let result: SDKResponse<Data, SDKError> = self.get("/model_sets/\(path_model_set_id)",
["fields": fields], nil, options)
return result
}
/**
* ### Update information about the model set with a specific id.
*
* PATCH /model_sets/{model_set_id} -> ModelSet
*/
public func update_model_set(
/**
* @param {Int64} model_set_id id of model set
*/
_ model_set_id: Int64,
/**
* @param {WriteModelSet} body
*/
_ body: WriteModelSet,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_model_set_id = encodeParam(model_set_id)
let result: SDKResponse<Data, SDKError> = self.patch("/model_sets/\(path_model_set_id)", nil, try! self.encode(body), options)
return result
}
/**
* ### Delete the model set with a specific id.
*
* DELETE /model_sets/{model_set_id} -> String
*/
public func delete_model_set(
/**
* @param {Int64} model_set_id id of model set
*/
_ model_set_id: Int64,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_model_set_id = encodeParam(model_set_id)
let result: SDKResponse<Data, SDKError> = self.delete("/model_sets/\(path_model_set_id)", nil, nil, options)
return result
}
/**
* ### Get information about all model sets.
*
* GET /model_sets -> [ModelSet]
*/
public func all_model_sets(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/model_sets",
["fields": fields], nil, options)
return result
}
/**
* ### Create a model set with the specified information. Model sets are used by Roles.
*
* POST /model_sets -> ModelSet
*/
public func create_model_set(
/**
* @param {WriteModelSet} body
*/
_ body: WriteModelSet,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/model_sets", nil, try! self.encode(body), options)
return result
}
/**
* ### Get all supported permissions.
*
* GET /permissions -> [Permission]
*/
public func all_permissions(
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/permissions", nil, nil, options)
return result
}
/**
* ### Search permission sets
* Returns all permission set records that match the given search criteria.
* If multiple search params are given and `filter_or` is FALSE or not specified,
* search params are combined in a logical AND operation.
* Only rows that match *all* search param criteria will be returned.
*
* If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
* Results will include rows that match **any** of the search criteria.
*
* String search params use case-insensitive matching.
* String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
* example="dan%" will match "danger" and "Danzig" but not "David"
* example="D_m%" will match "Damage" and "dump"
*
* Integer search params can accept a single value or a comma separated list of values. The multiple
* values will be combined under a logical OR operation - results will match at least one of
* the given values.
*
* Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
* or exclude (respectively) rows where the column is null.
*
* Boolean search params accept only "true" and "false" as values.
*
* GET /permission_sets/search -> [PermissionSet]
*/
public func search_permission_sets(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
/**
* @param {Int64} limit Number of results to return (used with `offset`).
*/
limit: Int64? = nil,
/**
* @param {Int64} offset Number of results to skip before returning any (used with `limit`).
*/
offset: Int64? = nil,
/**
* @param {String} sorts Fields to sort by.
*/
sorts: String? = nil,
/**
* @param {Int64} id Match permission set id.
*/
id: Int64? = nil,
/**
* @param {String} name Match permission set name.
*/
name: String? = nil,
/**
* @param {Bool} all_access Match permission sets by all_access status.
*/
all_access: Bool? = nil,
/**
* @param {Bool} built_in Match permission sets by built_in status.
*/
built_in: Bool? = nil,
/**
* @param {Bool} filter_or Combine given search criteria in a boolean OR expression.
*/
filter_or: Bool? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/permission_sets/search",
["fields": fields, "limit": limit, "offset": offset, "sorts": sorts, "id": id, "name": name, "all_access": all_access as Any?, "built_in": built_in as Any?, "filter_or": filter_or as Any?], nil, options)
return result
}
/**
* ### Get information about the permission set with a specific id.
*
* GET /permission_sets/{permission_set_id} -> PermissionSet
*/
public func permission_set(
/**
* @param {Int64} permission_set_id Id of permission set
*/
_ permission_set_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_permission_set_id = encodeParam(permission_set_id)
let result: SDKResponse<Data, SDKError> = self.get("/permission_sets/\(path_permission_set_id)",
["fields": fields], nil, options)
return result
}
/**
* ### Update information about the permission set with a specific id.
*
* PATCH /permission_sets/{permission_set_id} -> PermissionSet
*/
public func update_permission_set(
/**
* @param {Int64} permission_set_id id of permission set
*/
_ permission_set_id: Int64,
/**
* @param {WritePermissionSet} body
*/
_ body: WritePermissionSet,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_permission_set_id = encodeParam(permission_set_id)
let result: SDKResponse<Data, SDKError> = self.patch("/permission_sets/\(path_permission_set_id)", nil, try! self.encode(body), options)
return result
}
/**
* ### Delete the permission set with a specific id.
*
* DELETE /permission_sets/{permission_set_id} -> String
*/
public func delete_permission_set(
/**
* @param {Int64} permission_set_id Id of permission set
*/
_ permission_set_id: Int64,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_permission_set_id = encodeParam(permission_set_id)
let result: SDKResponse<Data, SDKError> = self.delete("/permission_sets/\(path_permission_set_id)", nil, nil, options)
return result
}
/**
* ### Get information about all permission sets.
*
* GET /permission_sets -> [PermissionSet]
*/
public func all_permission_sets(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/permission_sets",
["fields": fields], nil, options)
return result
}
/**
* ### Create a permission set with the specified information. Permission sets are used by Roles.
*
* POST /permission_sets -> PermissionSet
*/
public func create_permission_set(
/**
* @param {WritePermissionSet} body
*/
_ body: WritePermissionSet,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/permission_sets", nil, try! self.encode(body), options)
return result
}
/**
* ### Get information about all roles.
*
* GET /roles -> [Role]
*/
public func all_roles(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
/**
* @param {DelimArray<Int64>} ids Optional list of ids to get specific roles.
*/
ids: DelimArray<Int64>? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/roles",
["fields": fields, "ids": ids as Any?], nil, options)
return result
}
/**
* ### Create a role with the specified information.
*
* POST /roles -> Role
*/
public func create_role(
/**
* @param {WriteRole} body
*/
_ body: WriteRole,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/roles", nil, try! self.encode(body), options)
return result
}
/**
* ### Search roles
*
* Returns all role records that match the given search criteria.
*
* If multiple search params are given and `filter_or` is FALSE or not specified,
* search params are combined in a logical AND operation.
* Only rows that match *all* search param criteria will be returned.
*
* If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
* Results will include rows that match **any** of the search criteria.
*
* String search params use case-insensitive matching.
* String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
* example="dan%" will match "danger" and "Danzig" but not "David"
* example="D_m%" will match "Damage" and "dump"
*
* Integer search params can accept a single value or a comma separated list of values. The multiple
* values will be combined under a logical OR operation - results will match at least one of
* the given values.
*
* Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
* or exclude (respectively) rows where the column is null.
*
* Boolean search params accept only "true" and "false" as values.
*
* GET /roles/search -> [Role]
*/
public func search_roles(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
/**
* @param {Int64} limit Number of results to return (used with `offset`).
*/
limit: Int64? = nil,
/**
* @param {Int64} offset Number of results to skip before returning any (used with `limit`).
*/
offset: Int64? = nil,
/**
* @param {String} sorts Fields to sort by.
*/
sorts: String? = nil,
/**
* @param {Int64} id Match role id.
*/
id: Int64? = nil,
/**
* @param {String} name Match role name.
*/
name: String? = nil,
/**
* @param {Bool} built_in Match roles by built_in status.
*/
built_in: Bool? = nil,
/**
* @param {Bool} filter_or Combine given search criteria in a boolean OR expression.
*/
filter_or: Bool? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/roles/search",
["fields": fields, "limit": limit, "offset": offset, "sorts": sorts, "id": id, "name": name, "built_in": built_in as Any?, "filter_or": filter_or as Any?], nil, options)
return result
}
/**
* ### Get information about the role with a specific id.
*
* GET /roles/{role_id} -> Role
*/
public func role(
/**
* @param {Int64} role_id id of role
*/
_ role_id: Int64,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_role_id = encodeParam(role_id)
let result: SDKResponse<Data, SDKError> = self.get("/roles/\(path_role_id)", nil, nil, options)
return result
}
/**
* ### Update information about the role with a specific id.
*
* PATCH /roles/{role_id} -> Role
*/
public func update_role(
/**
* @param {Int64} role_id id of role
*/
_ role_id: Int64,
/**
* @param {WriteRole} body
*/
_ body: WriteRole,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_role_id = encodeParam(role_id)
let result: SDKResponse<Data, SDKError> = self.patch("/roles/\(path_role_id)", nil, try! self.encode(body), options)
return result
}
/**
* ### Delete the role with a specific id.
*
* DELETE /roles/{role_id} -> String
*/
public func delete_role(
/**
* @param {Int64} role_id id of role
*/
_ role_id: Int64,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_role_id = encodeParam(role_id)
let result: SDKResponse<Data, SDKError> = self.delete("/roles/\(path_role_id)", nil, nil, options)
return result
}
/**
* ### Get information about all the groups with the role that has a specific id.
*
* GET /roles/{role_id}/groups -> [LkGroup]
*/
public func role_groups(
/**
* @param {Int64} role_id id of role
*/
_ role_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_role_id = encodeParam(role_id)
let result: SDKResponse<Data, SDKError> = self.get("/roles/\(path_role_id)/groups",
["fields": fields], nil, options)
return result
}
/**
* ### Set all groups for a role, removing all existing group associations from that role.
*
* PUT /roles/{role_id}/groups -> [LkGroup]
*/
public func set_role_groups(
/**
* @param {Int64} role_id Id of Role
*/
_ role_id: Int64,
/**
* @param {[Int64]} body
*/
_ body: [Int64],
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_role_id = encodeParam(role_id)
let result: SDKResponse<Data, SDKError> = self.put("/roles/\(path_role_id)/groups", nil, try! self.encode(body), options)
return result
}
/**
* ### Get information about all the users with the role that has a specific id.
*
* GET /roles/{role_id}/users -> [User]
*/
public func role_users(
/**
* @param {Int64} role_id id of user
*/
_ role_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
/**
* @param {Bool} direct_association_only Get only users associated directly with the role: exclude those only associated through groups.
*/
direct_association_only: Bool? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_role_id = encodeParam(role_id)
let result: SDKResponse<Data, SDKError> = self.get("/roles/\(path_role_id)/users",
["fields": fields, "direct_association_only": direct_association_only as Any?], nil, options)
return result
}
/**
* ### Set all the users of the role with a specific id.
*
* PUT /roles/{role_id}/users -> [User]
*/
public func set_role_users(
/**
* @param {Int64} role_id id of role
*/
_ role_id: Int64,
/**
* @param {[Int64]} body
*/
_ body: [Int64],
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_role_id = encodeParam(role_id)
let result: SDKResponse<Data, SDKError> = self.put("/roles/\(path_role_id)/users", nil, try! self.encode(body), options)
return result
}
// MARK ScheduledPlan: Manage Scheduled Plans
/**
* ### Get Scheduled Plans for a Space
*
* Returns scheduled plans owned by the caller for a given space id.
*
* GET /scheduled_plans/space/{space_id} -> [ScheduledPlan]
*/
public func scheduled_plans_for_space(
/**
* @param {Int64} space_id Space Id
*/
_ space_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_space_id = encodeParam(space_id)
let result: SDKResponse<Data, SDKError> = self.get("/scheduled_plans/space/\(path_space_id)",
["fields": fields], nil, options)
return result
}
/**
* ### Get Information About a Scheduled Plan
*
* Admins can fetch information about other users' Scheduled Plans.
*
* GET /scheduled_plans/{scheduled_plan_id} -> ScheduledPlan
*/
public func scheduled_plan(
/**
* @param {Int64} scheduled_plan_id Scheduled Plan Id
*/
_ scheduled_plan_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_scheduled_plan_id = encodeParam(scheduled_plan_id)
let result: SDKResponse<Data, SDKError> = self.get("/scheduled_plans/\(path_scheduled_plan_id)",
["fields": fields], nil, options)
return result
}
/**
* ### Update a Scheduled Plan
*
* Admins can update other users' Scheduled Plans.
*
* Note: Any scheduled plan destinations specified in an update will **replace** all scheduled plan destinations
* currently defined for the scheduled plan.
*
* For Example: If a scheduled plan has destinations A, B, and C, and you call update on this scheduled plan
* specifying only B in the destinations, then destinations A and C will be deleted by the update.
*
* Updating a scheduled plan to assign null or an empty array to the scheduled_plan_destinations property is an error, as a scheduled plan must always have at least one destination.
*
* If you omit the scheduled_plan_destinations property from the object passed to update, then the destinations
* defined on the original scheduled plan will remain unchanged.
*
* #### Email Permissions:
*
* For details about permissions required to schedule delivery to email and the safeguards
* Looker offers to protect against sending to unauthorized email destinations, see [Email Domain Whitelist for Scheduled Looks](https://docs.looker.com/r/api/embed-permissions).
*
*
* #### Scheduled Plan Destination Formats
*
* Scheduled plan destinations must specify the data format to produce and send to the destination.
*
* Formats:
*
* | format | Description
* | :-----------: | :--- |
* | json | A JSON object containing a `data` property which contains an array of JSON objects, one per row. No metadata.
* | json_detail | Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
* | inline_json | Same as the JSON format, except that the `data` property is a string containing JSON-escaped row data. Additional properties describe the data operation. This format is primarily used to send data to web hooks so that the web hook doesn't have to re-encode the JSON row data in order to pass it on to its ultimate destination.
* | csv | Comma separated values with a header
* | txt | Tab separated values with a header
* | html | Simple html
* | xlsx | MS Excel spreadsheet
* | wysiwyg_pdf | Dashboard rendered in a tiled layout to produce a PDF document
* | assembled_pdf | Dashboard rendered in a single column layout to produce a PDF document
* | wysiwyg_png | Dashboard rendered in a tiled layout to produce a PNG image
* ||
*
* Valid formats vary by destination type and source object. `wysiwyg_pdf` is only valid for dashboards, for example.
*
* PATCH /scheduled_plans/{scheduled_plan_id} -> ScheduledPlan
*/
public func update_scheduled_plan(
/**
* @param {Int64} scheduled_plan_id Scheduled Plan Id
*/
_ scheduled_plan_id: Int64,
/**
* @param {WriteScheduledPlan} body
*/
_ body: WriteScheduledPlan,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_scheduled_plan_id = encodeParam(scheduled_plan_id)
let result: SDKResponse<Data, SDKError> = self.patch("/scheduled_plans/\(path_scheduled_plan_id)", nil, try! self.encode(body), options)
return result
}
/**
* ### Delete a Scheduled Plan
*
* Normal users can only delete their own scheduled plans.
* Admins can delete other users' scheduled plans.
* This delete cannot be undone.
*
* DELETE /scheduled_plans/{scheduled_plan_id} -> String
*/
public func delete_scheduled_plan(
/**
* @param {Int64} scheduled_plan_id Scheduled Plan Id
*/
_ scheduled_plan_id: Int64,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_scheduled_plan_id = encodeParam(scheduled_plan_id)
let result: SDKResponse<Data, SDKError> = self.delete("/scheduled_plans/\(path_scheduled_plan_id)", nil, nil, options)
return result
}
/**
* ### List All Scheduled Plans
*
* Returns all scheduled plans which belong to the caller or given user.
*
* If no user_id is provided, this function returns the scheduled plans owned by the caller.
*
*
* To list all schedules for all users, pass `all_users=true`.
*
*
* The caller must have `see_schedules` permission to see other users' scheduled plans.
*
* GET /scheduled_plans -> [ScheduledPlan]
*/
public func all_scheduled_plans(
/**
* @param {Int64} user_id Return scheduled plans belonging to this user_id. If not provided, returns scheduled plans owned by the caller.
*/
user_id: Int64? = nil,
/**
* @param {String} fields Comma delimited list of field names. If provided, only the fields specified will be included in the response
*/
fields: String? = nil,
/**
* @param {Bool} all_users Return scheduled plans belonging to all users (caller needs see_schedules permission)
*/
all_users: Bool? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/scheduled_plans",
["user_id": user_id, "fields": fields, "all_users": all_users as Any?], nil, options)
return result
}
/**
* ### Create a Scheduled Plan
*
* Create a scheduled plan to render a Look or Dashboard on a recurring schedule.
*
* To create a scheduled plan, you MUST provide values for the following fields:
* `name`
* and
* `look_id`, `dashboard_id`, `lookml_dashboard_id`, or `query_id`
* and
* `cron_tab` or `datagroup`
* and
* at least one scheduled_plan_destination
*
* A scheduled plan MUST have at least one scheduled_plan_destination defined.
*
* When `look_id` is set, `require_no_results`, `require_results`, and `require_change` are all required.
*
* If `create_scheduled_plan` fails with a 422 error, be sure to look at the error messages in the response which will explain exactly what fields are missing or values that are incompatible.
*
* The queries that provide the data for the look or dashboard are run in the context of user account that owns the scheduled plan.
*
* When `run_as_recipient` is `false` or not specified, the queries that provide the data for the
* look or dashboard are run in the context of user account that owns the scheduled plan.
*
* When `run_as_recipient` is `true` and all the email recipients are Looker user accounts, the
* queries are run in the context of each recipient, so different recipients may see different
* data from the same scheduled render of a look or dashboard. For more details, see [Run As Recipient](https://looker.com/docs/r/admin/run-as-recipient).
*
* Admins can create and modify scheduled plans on behalf of other users by specifying a user id.
* Non-admin users may not create or modify scheduled plans by or for other users.
*
* #### Email Permissions:
*
* For details about permissions required to schedule delivery to email and the safeguards
* Looker offers to protect against sending to unauthorized email destinations, see [Email Domain Whitelist for Scheduled Looks](https://docs.looker.com/r/api/embed-permissions).
*
*
* #### Scheduled Plan Destination Formats
*
* Scheduled plan destinations must specify the data format to produce and send to the destination.
*
* Formats:
*
* | format | Description
* | :-----------: | :--- |
* | json | A JSON object containing a `data` property which contains an array of JSON objects, one per row. No metadata.
* | json_detail | Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
* | inline_json | Same as the JSON format, except that the `data` property is a string containing JSON-escaped row data. Additional properties describe the data operation. This format is primarily used to send data to web hooks so that the web hook doesn't have to re-encode the JSON row data in order to pass it on to its ultimate destination.
* | csv | Comma separated values with a header
* | txt | Tab separated values with a header
* | html | Simple html
* | xlsx | MS Excel spreadsheet
* | wysiwyg_pdf | Dashboard rendered in a tiled layout to produce a PDF document
* | assembled_pdf | Dashboard rendered in a single column layout to produce a PDF document
* | wysiwyg_png | Dashboard rendered in a tiled layout to produce a PNG image
* ||
*
* Valid formats vary by destination type and source object. `wysiwyg_pdf` is only valid for dashboards, for example.
*
* POST /scheduled_plans -> ScheduledPlan
*/
public func create_scheduled_plan(
/**
* @param {WriteScheduledPlan} body
*/
_ body: WriteScheduledPlan,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/scheduled_plans", nil, try! self.encode(body), options)
return result
}
/**
* ### Run a Scheduled Plan Immediately
*
* Create a scheduled plan that runs only once, and immediately.
*
* This can be useful for testing a Scheduled Plan before committing to a production schedule.
*
* Admins can create scheduled plans on behalf of other users by specifying a user id.
*
* This API is rate limited to prevent it from being used for relay spam or DoS attacks
*
* #### Email Permissions:
*
* For details about permissions required to schedule delivery to email and the safeguards
* Looker offers to protect against sending to unauthorized email destinations, see [Email Domain Whitelist for Scheduled Looks](https://docs.looker.com/r/api/embed-permissions).
*
*
* #### Scheduled Plan Destination Formats
*
* Scheduled plan destinations must specify the data format to produce and send to the destination.
*
* Formats:
*
* | format | Description
* | :-----------: | :--- |
* | json | A JSON object containing a `data` property which contains an array of JSON objects, one per row. No metadata.
* | json_detail | Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
* | inline_json | Same as the JSON format, except that the `data` property is a string containing JSON-escaped row data. Additional properties describe the data operation. This format is primarily used to send data to web hooks so that the web hook doesn't have to re-encode the JSON row data in order to pass it on to its ultimate destination.
* | csv | Comma separated values with a header
* | txt | Tab separated values with a header
* | html | Simple html
* | xlsx | MS Excel spreadsheet
* | wysiwyg_pdf | Dashboard rendered in a tiled layout to produce a PDF document
* | assembled_pdf | Dashboard rendered in a single column layout to produce a PDF document
* | wysiwyg_png | Dashboard rendered in a tiled layout to produce a PNG image
* ||
*
* Valid formats vary by destination type and source object. `wysiwyg_pdf` is only valid for dashboards, for example.
*
* POST /scheduled_plans/run_once -> ScheduledPlan
*/
public func scheduled_plan_run_once(
/**
* @param {WriteScheduledPlan} body
*/
_ body: WriteScheduledPlan,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/scheduled_plans/run_once", nil, try! self.encode(body), options)
return result
}
/**
* ### Get Scheduled Plans for a Look
*
* Returns all scheduled plans for a look which belong to the caller or given user.
*
* If no user_id is provided, this function returns the scheduled plans owned by the caller.
*
*
* To list all schedules for all users, pass `all_users=true`.
*
*
* The caller must have `see_schedules` permission to see other users' scheduled plans.
*
* GET /scheduled_plans/look/{look_id} -> [ScheduledPlan]
*/
public func scheduled_plans_for_look(
/**
* @param {Int64} look_id Look Id
*/
_ look_id: Int64,
/**
* @param {Int64} user_id User Id (default is requesting user if not specified)
*/
user_id: Int64? = nil,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
/**
* @param {Bool} all_users Return scheduled plans belonging to all users for the look
*/
all_users: Bool? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_look_id = encodeParam(look_id)
let result: SDKResponse<Data, SDKError> = self.get("/scheduled_plans/look/\(path_look_id)",
["user_id": user_id, "fields": fields, "all_users": all_users as Any?], nil, options)
return result
}
/**
* ### Get Scheduled Plans for a Dashboard
*
* Returns all scheduled plans for a dashboard which belong to the caller or given user.
*
* If no user_id is provided, this function returns the scheduled plans owned by the caller.
*
*
* To list all schedules for all users, pass `all_users=true`.
*
*
* The caller must have `see_schedules` permission to see other users' scheduled plans.
*
* GET /scheduled_plans/dashboard/{dashboard_id} -> [ScheduledPlan]
*/
public func scheduled_plans_for_dashboard(
/**
* @param {Int64} dashboard_id Dashboard Id
*/
_ dashboard_id: Int64,
/**
* @param {Int64} user_id User Id (default is requesting user if not specified)
*/
user_id: Int64? = nil,
/**
* @param {Bool} all_users Return scheduled plans belonging to all users for the dashboard
*/
all_users: Bool? = nil,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_dashboard_id = encodeParam(dashboard_id)
let result: SDKResponse<Data, SDKError> = self.get("/scheduled_plans/dashboard/\(path_dashboard_id)",
["user_id": user_id, "all_users": all_users as Any?, "fields": fields], nil, options)
return result
}
/**
* ### Get Scheduled Plans for a LookML Dashboard
*
* Returns all scheduled plans for a LookML Dashboard which belong to the caller or given user.
*
* If no user_id is provided, this function returns the scheduled plans owned by the caller.
*
*
* To list all schedules for all users, pass `all_users=true`.
*
*
* The caller must have `see_schedules` permission to see other users' scheduled plans.
*
* GET /scheduled_plans/lookml_dashboard/{lookml_dashboard_id} -> [ScheduledPlan]
*/
public func scheduled_plans_for_lookml_dashboard(
/**
* @param {String} lookml_dashboard_id LookML Dashboard Id
*/
_ lookml_dashboard_id: String,
/**
* @param {Int64} user_id User Id (default is requesting user if not specified)
*/
user_id: Int64? = nil,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
/**
* @param {Bool} all_users Return scheduled plans belonging to all users for the dashboard
*/
all_users: Bool? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_lookml_dashboard_id = encodeParam(lookml_dashboard_id)
let result: SDKResponse<Data, SDKError> = self.get("/scheduled_plans/lookml_dashboard/\(path_lookml_dashboard_id)",
["user_id": user_id, "fields": fields, "all_users": all_users as Any?], nil, options)
return result
}
/**
* ### Run a Scheduled Plan By Id Immediately
* This function creates a run-once schedule plan based on an existing scheduled plan,
* applies modifications (if any) to the new scheduled plan, and runs the new schedule plan immediately.
* This can be useful for testing modifications to an existing scheduled plan before committing to a production schedule.
*
* This function internally performs the following operations:
*
* 1. Copies the properties of the existing scheduled plan into a new scheduled plan
* 2. Copies any properties passed in the JSON body of this request into the new scheduled plan (replacing the original values)
* 3. Creates the new scheduled plan
* 4. Runs the new scheduled plan
*
* The original scheduled plan is not modified by this operation.
* Admins can create, modify, and run scheduled plans on behalf of other users by specifying a user id.
* Non-admins can only create, modify, and run their own scheduled plans.
*
* #### Email Permissions:
*
* For details about permissions required to schedule delivery to email and the safeguards
* Looker offers to protect against sending to unauthorized email destinations, see [Email Domain Whitelist for Scheduled Looks](https://docs.looker.com/r/api/embed-permissions).
*
*
* #### Scheduled Plan Destination Formats
*
* Scheduled plan destinations must specify the data format to produce and send to the destination.
*
* Formats:
*
* | format | Description
* | :-----------: | :--- |
* | json | A JSON object containing a `data` property which contains an array of JSON objects, one per row. No metadata.
* | json_detail | Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
* | inline_json | Same as the JSON format, except that the `data` property is a string containing JSON-escaped row data. Additional properties describe the data operation. This format is primarily used to send data to web hooks so that the web hook doesn't have to re-encode the JSON row data in order to pass it on to its ultimate destination.
* | csv | Comma separated values with a header
* | txt | Tab separated values with a header
* | html | Simple html
* | xlsx | MS Excel spreadsheet
* | wysiwyg_pdf | Dashboard rendered in a tiled layout to produce a PDF document
* | assembled_pdf | Dashboard rendered in a single column layout to produce a PDF document
* | wysiwyg_png | Dashboard rendered in a tiled layout to produce a PNG image
* ||
*
* Valid formats vary by destination type and source object. `wysiwyg_pdf` is only valid for dashboards, for example.
*
*
*
* This API is rate limited to prevent it from being used for relay spam or DoS attacks
*
* POST /scheduled_plans/{scheduled_plan_id}/run_once -> ScheduledPlan
*/
public func scheduled_plan_run_once_by_id(
/**
* @param {Int64} scheduled_plan_id Id of schedule plan to copy and run
*/
_ scheduled_plan_id: Int64,
/**
* @param {WriteScheduledPlan} body
*/
body: WriteScheduledPlan?,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_scheduled_plan_id = encodeParam(scheduled_plan_id)
let result: SDKResponse<Data, SDKError> = self.post("/scheduled_plans/\(path_scheduled_plan_id)/run_once", nil, try! self.encode(body), options)
return result
}
// MARK Session: Session Information
/**
* ### Get API Session
*
* Returns information about the current API session, such as which workspace is selected for the session.
*
* GET /session -> ApiSession
*/
public func session(
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/session", nil, nil, options)
return result
}
/**
* ### Update API Session
*
* #### API Session Workspace
*
* You can use this endpoint to change the active workspace for the current API session.
*
* Only one workspace can be active in a session. The active workspace can be changed
* any number of times in a session.
*
* The default workspace for API sessions is the "production" workspace.
*
* All Looker APIs that use projects or lookml models (such as running queries) will
* use the version of project and model files defined by this workspace for the lifetime of the
* current API session or until the session workspace is changed again.
*
* An API session has the same lifetime as the access_token used to authenticate API requests. Each successful
* API login generates a new access_token and a new API session.
*
* If your Looker API client application needs to work in a dev workspace across multiple
* API sessions, be sure to select the dev workspace after each login.
*
* PATCH /session -> ApiSession
*/
public func update_session(
/**
* @param {WriteApiSession} body
*/
_ body: WriteApiSession,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.patch("/session", nil, try! self.encode(body), options)
return result
}
// MARK Theme: Manage Themes
/**
* ### Get an array of all existing themes
*
* Get a **single theme** by id with [Theme](#!/Theme/theme)
*
* This method returns an array of all existing themes. The active time for the theme is not considered.
*
* **Note**: Custom themes needs to be enabled by Looker. Unless custom themes are enabled, only the automatically generated default theme can be used. Please contact your Account Manager or help.looker.com to update your license for this feature.
*
* GET /themes -> [Theme]
*/
public func all_themes(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/themes",
["fields": fields], nil, options)
return result
}
/**
* ### Create a theme
*
* Creates a new theme object, returning the theme details, including the created id.
*
* If `settings` are not specified, the default theme settings will be copied into the new theme.
*
* The theme `name` can only contain alphanumeric characters or underscores. Theme names should not contain any confidential information, such as customer names.
*
* **Update** an existing theme with [Update Theme](#!/Theme/update_theme)
*
* **Permanently delete** an existing theme with [Delete Theme](#!/Theme/delete_theme)
*
* For more information, see [Creating and Applying Themes](https://looker.com/docs/r/admin/themes).
*
* **Note**: Custom themes needs to be enabled by Looker. Unless custom themes are enabled, only the automatically generated default theme can be used. Please contact your Account Manager or help.looker.com to update your license for this feature.
*
* POST /themes -> Theme
*/
public func create_theme(
/**
* @param {WriteTheme} body
*/
_ body: WriteTheme,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/themes", nil, try! self.encode(body), options)
return result
}
/**
* ### Search all themes for matching criteria.
*
* Returns an **array of theme objects** that match the specified search criteria.
*
* | Search Parameters | Description
* | :-------------------: | :------ |
* | `begin_at` only | Find themes active at or after `begin_at`
* | `end_at` only | Find themes active at or before `end_at`
* | both set | Find themes with an active inclusive period between `begin_at` and `end_at`
*
* Note: Range matching requires boolean AND logic.
* When using `begin_at` and `end_at` together, do not use `filter_or`=TRUE
*
* If multiple search params are given and `filter_or` is FALSE or not specified,
* search params are combined in a logical AND operation.
* Only rows that match *all* search param criteria will be returned.
*
* If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
* Results will include rows that match **any** of the search criteria.
*
* String search params use case-insensitive matching.
* String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
* example="dan%" will match "danger" and "Danzig" but not "David"
* example="D_m%" will match "Damage" and "dump"
*
* Integer search params can accept a single value or a comma separated list of values. The multiple
* values will be combined under a logical OR operation - results will match at least one of
* the given values.
*
* Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
* or exclude (respectively) rows where the column is null.
*
* Boolean search params accept only "true" and "false" as values.
*
*
* Get a **single theme** by id with [Theme](#!/Theme/theme)
*
* **Note**: Custom themes needs to be enabled by Looker. Unless custom themes are enabled, only the automatically generated default theme can be used. Please contact your Account Manager or help.looker.com to update your license for this feature.
*
* GET /themes/search -> [Theme]
*/
public func search_themes(
/**
* @param {Int64} id Match theme id.
*/
id: Int64? = nil,
/**
* @param {String} name Match theme name.
*/
name: String? = nil,
/**
* @param {Date} begin_at Timestamp for activation.
*/
begin_at: Date? = nil,
/**
* @param {Date} end_at Timestamp for expiration.
*/
end_at: Date? = nil,
/**
* @param {Int64} limit Number of results to return (used with `offset`).
*/
limit: Int64? = nil,
/**
* @param {Int64} offset Number of results to skip before returning any (used with `limit`).
*/
offset: Int64? = nil,
/**
* @param {String} sorts Fields to sort by.
*/
sorts: String? = nil,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
/**
* @param {Bool} filter_or Combine given search criteria in a boolean OR expression
*/
filter_or: Bool? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/themes/search",
["id": id, "name": name, "begin_at": begin_at as Any?, "end_at": end_at as Any?, "limit": limit, "offset": offset, "sorts": sorts, "fields": fields, "filter_or": filter_or as Any?], nil, options)
return result
}
/**
* ### Get the default theme
*
* Returns the active theme object set as the default.
*
* The **default** theme name can be set in the UI on the Admin|Theme UI page
*
* The optional `ts` parameter can specify a different timestamp than "now." If specified, it returns the default theme at the time indicated.
*
* GET /themes/default -> Theme
*/
public func default_theme(
/**
* @param {Date} ts Timestamp representing the target datetime for the active period. Defaults to 'now'
*/
ts: Date? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/themes/default",
["ts": ts as Any?], nil, options)
return result
}
/**
* ### Set the global default theme by theme name
*
* Only Admin users can call this function.
*
* Only an active theme with no expiration (`end_at` not set) can be assigned as the default theme. As long as a theme has an active record with no expiration, it can be set as the default.
*
* [Create Theme](#!/Theme/create) has detailed information on rules for default and active themes
*
* Returns the new specified default theme object.
*
* **Note**: Custom themes needs to be enabled by Looker. Unless custom themes are enabled, only the automatically generated default theme can be used. Please contact your Account Manager or help.looker.com to update your license for this feature.
*
* PUT /themes/default -> Theme
*/
public func set_default_theme(
/**
* @param {String} name Name of theme to set as default
*/
_ name: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.put("/themes/default",
["name": name], nil, options)
return result
}
/**
* ### Get active themes
*
* Returns an array of active themes.
*
* If the `name` parameter is specified, it will return an array with one theme if it's active and found.
*
* The optional `ts` parameter can specify a different timestamp than "now."
*
* **Note**: Custom themes needs to be enabled by Looker. Unless custom themes are enabled, only the automatically generated default theme can be used. Please contact your Account Manager or help.looker.com to update your license for this feature.
*
* GET /themes/active -> [Theme]
*/
public func active_themes(
/**
* @param {String} name Name of theme
*/
name: String? = nil,
/**
* @param {Date} ts Timestamp representing the target datetime for the active period. Defaults to 'now'
*/
ts: Date? = nil,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/themes/active",
["name": name, "ts": ts as Any?, "fields": fields], nil, options)
return result
}
/**
* ### Get the named theme if it's active. Otherwise, return the default theme
*
* The optional `ts` parameter can specify a different timestamp than "now."
* Note: API users with `show` ability can call this function
*
* **Note**: Custom themes needs to be enabled by Looker. Unless custom themes are enabled, only the automatically generated default theme can be used. Please contact your Account Manager or help.looker.com to update your license for this feature.
*
* GET /themes/theme_or_default -> Theme
*/
public func theme_or_default(
/**
* @param {String} name Name of theme
*/
_ name: String,
/**
* @param {Date} ts Timestamp representing the target datetime for the active period. Defaults to 'now'
*/
ts: Date? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/themes/theme_or_default",
["name": name, "ts": ts as Any?], nil, options)
return result
}
/**
* ### Validate a theme with the specified information
*
* Validates all values set for the theme, returning any errors encountered, or 200 OK if valid
*
* See [Create Theme](#!/Theme/create_theme) for constraints
*
* **Note**: Custom themes needs to be enabled by Looker. Unless custom themes are enabled, only the automatically generated default theme can be used. Please contact your Account Manager or help.looker.com to update your license for this feature.
*
* POST /themes/validate -> ValidationError
*/
public func validate_theme(
/**
* @param {WriteTheme} body
*/
_ body: WriteTheme,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/themes/validate", nil, try! self.encode(body), options)
return result
}
/**
* ### Get a theme by ID
*
* Use this to retrieve a specific theme, whether or not it's currently active.
*
* **Note**: Custom themes needs to be enabled by Looker. Unless custom themes are enabled, only the automatically generated default theme can be used. Please contact your Account Manager or help.looker.com to update your license for this feature.
*
* GET /themes/{theme_id} -> Theme
*/
public func theme(
/**
* @param {Int64} theme_id Id of theme
*/
_ theme_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_theme_id = encodeParam(theme_id)
let result: SDKResponse<Data, SDKError> = self.get("/themes/\(path_theme_id)",
["fields": fields], nil, options)
return result
}
/**
* ### Update the theme by id.
*
* **Note**: Custom themes needs to be enabled by Looker. Unless custom themes are enabled, only the automatically generated default theme can be used. Please contact your Account Manager or help.looker.com to update your license for this feature.
*
* PATCH /themes/{theme_id} -> Theme
*/
public func update_theme(
/**
* @param {Int64} theme_id Id of theme
*/
_ theme_id: Int64,
/**
* @param {WriteTheme} body
*/
_ body: WriteTheme,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_theme_id = encodeParam(theme_id)
let result: SDKResponse<Data, SDKError> = self.patch("/themes/\(path_theme_id)", nil, try! self.encode(body), options)
return result
}
/**
* ### Delete a specific theme by id
*
* This operation permanently deletes the identified theme from the database.
*
* Because multiple themes can have the same name (with different activation time spans) themes can only be deleted by ID.
*
* All IDs associated with a theme name can be retrieved by searching for the theme name with [Theme Search](#!/Theme/search).
*
* **Note**: Custom themes needs to be enabled by Looker. Unless custom themes are enabled, only the automatically generated default theme can be used. Please contact your Account Manager or help.looker.com to update your license for this feature.
*
* DELETE /themes/{theme_id} -> String
*/
public func delete_theme(
/**
* @param {String} theme_id Id of theme
*/
_ theme_id: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_theme_id = encodeParam(theme_id)
let result: SDKResponse<Data, SDKError> = self.delete("/themes/\(path_theme_id)", nil, nil, options)
return result
}
// MARK User: Manage Users
/**
* ### Get information about the current user; i.e. the user account currently calling the API.
*
* GET /user -> User
*/
public func me(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/user",
["fields": fields], nil, options)
return result
}
/**
* ### Get information about all users.
*
* GET /users -> [User]
*/
public func all_users(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
/**
* @param {Int64} page Requested page.
*/
page: Int64? = nil,
/**
* @param {Int64} per_page Results per page.
*/
per_page: Int64? = nil,
/**
* @param {String} sorts Fields to sort by.
*/
sorts: String? = nil,
/**
* @param {DelimArray<Int64>} ids Optional list of ids to get specific users.
*/
ids: DelimArray<Int64>? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/users",
["fields": fields, "page": page, "per_page": per_page, "sorts": sorts, "ids": ids as Any?], nil, options)
return result
}
/**
* ### Create a user with the specified information.
*
* POST /users -> User
*/
public func create_user(
/**
* @param {WriteUser} body
*/
body: WriteUser?,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/users",
["fields": fields], try! self.encode(body), options)
return result
}
/**
* ### Search users
*
* Returns all<sup>*</sup> user records that match the given search criteria.
*
* If multiple search params are given and `filter_or` is FALSE or not specified,
* search params are combined in a logical AND operation.
* Only rows that match *all* search param criteria will be returned.
*
* If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
* Results will include rows that match **any** of the search criteria.
*
* String search params use case-insensitive matching.
* String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
* example="dan%" will match "danger" and "Danzig" but not "David"
* example="D_m%" will match "Damage" and "dump"
*
* Integer search params can accept a single value or a comma separated list of values. The multiple
* values will be combined under a logical OR operation - results will match at least one of
* the given values.
*
* Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
* or exclude (respectively) rows where the column is null.
*
* Boolean search params accept only "true" and "false" as values.
*
*
* (<sup>*</sup>) Results are always filtered to the level of information the caller is permitted to view.
* Looker admins can see all user details; normal users in an open system can see
* names of other users but no details; normal users in a closed system can only see
* names of other users who are members of the same group as the user.
*
* GET /users/search -> [User]
*/
public func search_users(
/**
* @param {String} fields Include only these fields in the response
*/
fields: String? = nil,
/**
* @param {Int64} page Return only page N of paginated results
*/
page: Int64? = nil,
/**
* @param {Int64} per_page Return N rows of data per page
*/
per_page: Int64? = nil,
/**
* @param {String} sorts Fields to sort by.
*/
sorts: String? = nil,
/**
* @param {String} id Match User Id.
*/
id: String? = nil,
/**
* @param {String} first_name Match First name.
*/
first_name: String? = nil,
/**
* @param {String} last_name Match Last name.
*/
last_name: String? = nil,
/**
* @param {Bool} verified_looker_employee Search for user accounts associated with Looker employees
*/
verified_looker_employee: Bool? = nil,
/**
* @param {Bool} embed_user Search for only embed users
*/
embed_user: Bool? = nil,
/**
* @param {String} email Search for the user with this email address
*/
email: String? = nil,
/**
* @param {Bool} is_disabled Search for disabled user accounts
*/
is_disabled: Bool? = nil,
/**
* @param {Bool} filter_or Combine given search criteria in a boolean OR expression
*/
filter_or: Bool? = nil,
/**
* @param {String} content_metadata_id Search for users who have access to this content_metadata item
*/
content_metadata_id: String? = nil,
/**
* @param {String} group_id Search for users who are direct members of this group
*/
group_id: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/users/search",
["fields": fields, "page": page, "per_page": per_page, "sorts": sorts, "id": id, "first_name": first_name, "last_name": last_name, "verified_looker_employee": verified_looker_employee as Any?, "embed_user": embed_user as Any?, "email": email, "is_disabled": is_disabled as Any?, "filter_or": filter_or as Any?, "content_metadata_id": content_metadata_id, "group_id": group_id], nil, options)
return result
}
/**
* ### Search for user accounts by name
*
* Returns all user accounts where `first_name` OR `last_name` OR `email` field values match a pattern.
* The pattern can contain `%` and `_` wildcards as in SQL LIKE expressions.
*
* Any additional search params will be combined into a logical AND expression.
*
* GET /users/search/names/{pattern} -> [User]
*/
public func search_users_names(
/**
* @param {String} pattern Pattern to match
*/
_ pattern: String,
/**
* @param {String} fields Include only these fields in the response
*/
fields: String? = nil,
/**
* @param {Int64} page Return only page N of paginated results
*/
page: Int64? = nil,
/**
* @param {Int64} per_page Return N rows of data per page
*/
per_page: Int64? = nil,
/**
* @param {String} sorts Fields to sort by
*/
sorts: String? = nil,
/**
* @param {Int64} id Match User Id
*/
id: Int64? = nil,
/**
* @param {String} first_name Match First name
*/
first_name: String? = nil,
/**
* @param {String} last_name Match Last name
*/
last_name: String? = nil,
/**
* @param {Bool} verified_looker_employee Match Verified Looker employee
*/
verified_looker_employee: Bool? = nil,
/**
* @param {String} email Match Email Address
*/
email: String? = nil,
/**
* @param {Bool} is_disabled Include or exclude disabled accounts in the results
*/
is_disabled: Bool? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_pattern = encodeParam(pattern)
let result: SDKResponse<Data, SDKError> = self.get("/users/search/names/\(path_pattern)",
["fields": fields, "page": page, "per_page": per_page, "sorts": sorts, "id": id, "first_name": first_name, "last_name": last_name, "verified_looker_employee": verified_looker_employee as Any?, "email": email, "is_disabled": is_disabled as Any?], nil, options)
return result
}
/**
* ### Get information about the user with a specific id.
*
* If the caller is an admin or the caller is the user being specified, then full user information will
* be returned. Otherwise, a minimal 'public' variant of the user information will be returned. This contains
* The user name and avatar url, but no sensitive information.
*
* GET /users/{user_id} -> User
*/
public func user(
/**
* @param {Int64} user_id Id of user
*/
_ user_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let result: SDKResponse<Data, SDKError> = self.get("/users/\(path_user_id)",
["fields": fields], nil, options)
return result
}
/**
* ### Update information about the user with a specific id.
*
* PATCH /users/{user_id} -> User
*/
public func update_user(
/**
* @param {Int64} user_id Id of user
*/
_ user_id: Int64,
/**
* @param {WriteUser} body
*/
_ body: WriteUser,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let result: SDKResponse<Data, SDKError> = self.patch("/users/\(path_user_id)",
["fields": fields], try! self.encode(body), options)
return result
}
/**
* ### Delete the user with a specific id.
*
* **DANGER** this will delete the user and all looks and other information owned by the user.
*
* DELETE /users/{user_id} -> String
*/
public func delete_user(
/**
* @param {Int64} user_id Id of user
*/
_ user_id: Int64,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let result: SDKResponse<Data, SDKError> = self.delete("/users/\(path_user_id)", nil, nil, options)
return result
}
/**
* ### Get information about the user with a credential of given type with specific id.
*
* This is used to do things like find users by their embed external_user_id. Or, find the user with
* a given api3 client_id, etc. The 'credential_type' matches the 'type' name of the various credential
* types. It must be one of the values listed in the table below. The 'credential_id' is your unique Id
* for the user and is specific to each type of credential.
*
* An example using the Ruby sdk might look like:
*
* `sdk.user_for_credential('embed', 'customer-4959425')`
*
* This table shows the supported 'Credential Type' strings. The right column is for reference; it shows
* which field in the given credential type is actually searched when finding a user with the supplied
* 'credential_id'.
*
* | Credential Types | Id Field Matched |
* | ---------------- | ---------------- |
* | email | email |
* | google | google_user_id |
* | saml | saml_user_id |
* | oidc | oidc_user_id |
* | ldap | ldap_id |
* | api | token |
* | api3 | client_id |
* | embed | external_user_id |
* | looker_openid | email |
*
* **NOTE**: The 'api' credential type was only used with the legacy Looker query API and is no longer supported. The credential type for API you are currently looking at is 'api3'.
*
* GET /users/credential/{credential_type}/{credential_id} -> User
*/
public func user_for_credential(
/**
* @param {String} credential_type Type name of credential
*/
_ credential_type: String,
/**
* @param {String} credential_id Id of credential
*/
_ credential_id: String,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_credential_type = encodeParam(credential_type)
let path_credential_id = encodeParam(credential_id)
let result: SDKResponse<Data, SDKError> = self.get("/users/credential/\(path_credential_type)/\(path_credential_id)",
["fields": fields], nil, options)
return result
}
/**
* ### Email/password login information for the specified user.
*
* GET /users/{user_id}/credentials_email -> CredentialsEmail
*/
public func user_credentials_email(
/**
* @param {Int64} user_id id of user
*/
_ user_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let result: SDKResponse<Data, SDKError> = self.get("/users/\(path_user_id)/credentials_email",
["fields": fields], nil, options)
return result
}
/**
* ### Email/password login information for the specified user.
*
* POST /users/{user_id}/credentials_email -> CredentialsEmail
*/
public func create_user_credentials_email(
/**
* @param {Int64} user_id id of user
*/
_ user_id: Int64,
/**
* @param {WriteCredentialsEmail} body
*/
_ body: WriteCredentialsEmail,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let result: SDKResponse<Data, SDKError> = self.post("/users/\(path_user_id)/credentials_email",
["fields": fields], try! self.encode(body), options)
return result
}
/**
* ### Email/password login information for the specified user.
*
* PATCH /users/{user_id}/credentials_email -> CredentialsEmail
*/
public func update_user_credentials_email(
/**
* @param {Int64} user_id id of user
*/
_ user_id: Int64,
/**
* @param {WriteCredentialsEmail} body
*/
_ body: WriteCredentialsEmail,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let result: SDKResponse<Data, SDKError> = self.patch("/users/\(path_user_id)/credentials_email",
["fields": fields], try! self.encode(body), options)
return result
}
/**
* ### Email/password login information for the specified user.
*
* DELETE /users/{user_id}/credentials_email -> String
*/
public func delete_user_credentials_email(
/**
* @param {Int64} user_id id of user
*/
_ user_id: Int64,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let result: SDKResponse<Data, SDKError> = self.delete("/users/\(path_user_id)/credentials_email", nil, nil, options)
return result
}
/**
* ### Two-factor login information for the specified user.
*
* GET /users/{user_id}/credentials_totp -> CredentialsTotp
*/
public func user_credentials_totp(
/**
* @param {Int64} user_id id of user
*/
_ user_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let result: SDKResponse<Data, SDKError> = self.get("/users/\(path_user_id)/credentials_totp",
["fields": fields], nil, options)
return result
}
/**
* ### Two-factor login information for the specified user.
*
* POST /users/{user_id}/credentials_totp -> CredentialsTotp
*/
public func create_user_credentials_totp(
/**
* @param {Int64} user_id id of user
*/
_ user_id: Int64,
/**
* @param {CredentialsTotp} body
*/
body: CredentialsTotp?,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let result: SDKResponse<Data, SDKError> = self.post("/users/\(path_user_id)/credentials_totp",
["fields": fields], try! self.encode(body), options)
return result
}
/**
* ### Two-factor login information for the specified user.
*
* DELETE /users/{user_id}/credentials_totp -> String
*/
public func delete_user_credentials_totp(
/**
* @param {Int64} user_id id of user
*/
_ user_id: Int64,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let result: SDKResponse<Data, SDKError> = self.delete("/users/\(path_user_id)/credentials_totp", nil, nil, options)
return result
}
/**
* ### LDAP login information for the specified user.
*
* GET /users/{user_id}/credentials_ldap -> CredentialsLDAP
*/
public func user_credentials_ldap(
/**
* @param {Int64} user_id id of user
*/
_ user_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let result: SDKResponse<Data, SDKError> = self.get("/users/\(path_user_id)/credentials_ldap",
["fields": fields], nil, options)
return result
}
/**
* ### LDAP login information for the specified user.
*
* DELETE /users/{user_id}/credentials_ldap -> String
*/
public func delete_user_credentials_ldap(
/**
* @param {Int64} user_id id of user
*/
_ user_id: Int64,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let result: SDKResponse<Data, SDKError> = self.delete("/users/\(path_user_id)/credentials_ldap", nil, nil, options)
return result
}
/**
* ### Google authentication login information for the specified user.
*
* GET /users/{user_id}/credentials_google -> CredentialsGoogle
*/
public func user_credentials_google(
/**
* @param {Int64} user_id id of user
*/
_ user_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let result: SDKResponse<Data, SDKError> = self.get("/users/\(path_user_id)/credentials_google",
["fields": fields], nil, options)
return result
}
/**
* ### Google authentication login information for the specified user.
*
* DELETE /users/{user_id}/credentials_google -> String
*/
public func delete_user_credentials_google(
/**
* @param {Int64} user_id id of user
*/
_ user_id: Int64,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let result: SDKResponse<Data, SDKError> = self.delete("/users/\(path_user_id)/credentials_google", nil, nil, options)
return result
}
/**
* ### Saml authentication login information for the specified user.
*
* GET /users/{user_id}/credentials_saml -> CredentialsSaml
*/
public func user_credentials_saml(
/**
* @param {Int64} user_id id of user
*/
_ user_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let result: SDKResponse<Data, SDKError> = self.get("/users/\(path_user_id)/credentials_saml",
["fields": fields], nil, options)
return result
}
/**
* ### Saml authentication login information for the specified user.
*
* DELETE /users/{user_id}/credentials_saml -> String
*/
public func delete_user_credentials_saml(
/**
* @param {Int64} user_id id of user
*/
_ user_id: Int64,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let result: SDKResponse<Data, SDKError> = self.delete("/users/\(path_user_id)/credentials_saml", nil, nil, options)
return result
}
/**
* ### OpenID Connect (OIDC) authentication login information for the specified user.
*
* GET /users/{user_id}/credentials_oidc -> CredentialsOIDC
*/
public func user_credentials_oidc(
/**
* @param {Int64} user_id id of user
*/
_ user_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let result: SDKResponse<Data, SDKError> = self.get("/users/\(path_user_id)/credentials_oidc",
["fields": fields], nil, options)
return result
}
/**
* ### OpenID Connect (OIDC) authentication login information for the specified user.
*
* DELETE /users/{user_id}/credentials_oidc -> String
*/
public func delete_user_credentials_oidc(
/**
* @param {Int64} user_id id of user
*/
_ user_id: Int64,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let result: SDKResponse<Data, SDKError> = self.delete("/users/\(path_user_id)/credentials_oidc", nil, nil, options)
return result
}
/**
* ### API 3 login information for the specified user. This is for the newer API keys that can be added for any user.
*
* GET /users/{user_id}/credentials_api3/{credentials_api3_id} -> CredentialsApi3
*/
public func user_credentials_api3(
/**
* @param {Int64} user_id Id of user
*/
_ user_id: Int64,
/**
* @param {Int64} credentials_api3_id Id of API 3 Credential
*/
_ credentials_api3_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let path_credentials_api3_id = encodeParam(credentials_api3_id)
let result: SDKResponse<Data, SDKError> = self.get("/users/\(path_user_id)/credentials_api3/\(path_credentials_api3_id)",
["fields": fields], nil, options)
return result
}
/**
* ### API 3 login information for the specified user. This is for the newer API keys that can be added for any user.
*
* DELETE /users/{user_id}/credentials_api3/{credentials_api3_id} -> String
*/
public func delete_user_credentials_api3(
/**
* @param {Int64} user_id id of user
*/
_ user_id: Int64,
/**
* @param {Int64} credentials_api3_id id of API 3 Credential
*/
_ credentials_api3_id: Int64,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let path_credentials_api3_id = encodeParam(credentials_api3_id)
let result: SDKResponse<Data, SDKError> = self.delete("/users/\(path_user_id)/credentials_api3/\(path_credentials_api3_id)", nil, nil, options)
return result
}
/**
* ### API 3 login information for the specified user. This is for the newer API keys that can be added for any user.
*
* GET /users/{user_id}/credentials_api3 -> [CredentialsApi3]
*/
public func all_user_credentials_api3s(
/**
* @param {Int64} user_id id of user
*/
_ user_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let result: SDKResponse<Data, SDKError> = self.get("/users/\(path_user_id)/credentials_api3",
["fields": fields], nil, options)
return result
}
/**
* ### API 3 login information for the specified user. This is for the newer API keys that can be added for any user.
*
* POST /users/{user_id}/credentials_api3 -> CredentialsApi3
*/
public func create_user_credentials_api3(
/**
* @param {Int64} user_id id of user
*/
_ user_id: Int64,
/**
* @param {CredentialsApi3} body
*/
body: CredentialsApi3?,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let result: SDKResponse<Data, SDKError> = self.post("/users/\(path_user_id)/credentials_api3",
["fields": fields], try! self.encode(body), options)
return result
}
/**
* ### Embed login information for the specified user.
*
* GET /users/{user_id}/credentials_embed/{credentials_embed_id} -> CredentialsEmbed
*/
public func user_credentials_embed(
/**
* @param {Int64} user_id Id of user
*/
_ user_id: Int64,
/**
* @param {Int64} credentials_embed_id Id of Embedding Credential
*/
_ credentials_embed_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let path_credentials_embed_id = encodeParam(credentials_embed_id)
let result: SDKResponse<Data, SDKError> = self.get("/users/\(path_user_id)/credentials_embed/\(path_credentials_embed_id)",
["fields": fields], nil, options)
return result
}
/**
* ### Embed login information for the specified user.
*
* DELETE /users/{user_id}/credentials_embed/{credentials_embed_id} -> String
*/
public func delete_user_credentials_embed(
/**
* @param {Int64} user_id id of user
*/
_ user_id: Int64,
/**
* @param {Int64} credentials_embed_id id of Embedding Credential
*/
_ credentials_embed_id: Int64,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let path_credentials_embed_id = encodeParam(credentials_embed_id)
let result: SDKResponse<Data, SDKError> = self.delete("/users/\(path_user_id)/credentials_embed/\(path_credentials_embed_id)", nil, nil, options)
return result
}
/**
* ### Embed login information for the specified user.
*
* GET /users/{user_id}/credentials_embed -> [CredentialsEmbed]
*/
public func all_user_credentials_embeds(
/**
* @param {Int64} user_id id of user
*/
_ user_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let result: SDKResponse<Data, SDKError> = self.get("/users/\(path_user_id)/credentials_embed",
["fields": fields], nil, options)
return result
}
/**
* ### Looker Openid login information for the specified user. Used by Looker Analysts.
*
* GET /users/{user_id}/credentials_looker_openid -> CredentialsLookerOpenid
*/
public func user_credentials_looker_openid(
/**
* @param {Int64} user_id id of user
*/
_ user_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let result: SDKResponse<Data, SDKError> = self.get("/users/\(path_user_id)/credentials_looker_openid",
["fields": fields], nil, options)
return result
}
/**
* ### Looker Openid login information for the specified user. Used by Looker Analysts.
*
* DELETE /users/{user_id}/credentials_looker_openid -> String
*/
public func delete_user_credentials_looker_openid(
/**
* @param {Int64} user_id id of user
*/
_ user_id: Int64,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let result: SDKResponse<Data, SDKError> = self.delete("/users/\(path_user_id)/credentials_looker_openid", nil, nil, options)
return result
}
/**
* ### Web login session for the specified user.
*
* GET /users/{user_id}/sessions/{session_id} -> Session
*/
public func user_session(
/**
* @param {Int64} user_id Id of user
*/
_ user_id: Int64,
/**
* @param {Int64} session_id Id of Web Login Session
*/
_ session_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let path_session_id = encodeParam(session_id)
let result: SDKResponse<Data, SDKError> = self.get("/users/\(path_user_id)/sessions/\(path_session_id)",
["fields": fields], nil, options)
return result
}
/**
* ### Web login session for the specified user.
*
* DELETE /users/{user_id}/sessions/{session_id} -> String
*/
public func delete_user_session(
/**
* @param {Int64} user_id id of user
*/
_ user_id: Int64,
/**
* @param {Int64} session_id id of Web Login Session
*/
_ session_id: Int64,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let path_session_id = encodeParam(session_id)
let result: SDKResponse<Data, SDKError> = self.delete("/users/\(path_user_id)/sessions/\(path_session_id)", nil, nil, options)
return result
}
/**
* ### Web login session for the specified user.
*
* GET /users/{user_id}/sessions -> [Session]
*/
public func all_user_sessions(
/**
* @param {Int64} user_id id of user
*/
_ user_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let result: SDKResponse<Data, SDKError> = self.get("/users/\(path_user_id)/sessions",
["fields": fields], nil, options)
return result
}
/**
* ### Create a password reset token.
* This will create a cryptographically secure random password reset token for the user.
* If the user already has a password reset token then this invalidates the old token and creates a new one.
* The token is expressed as the 'password_reset_url' of the user's email/password credential object.
* This takes an optional 'expires' param to indicate if the new token should be an expiring token.
* Tokens that expire are typically used for self-service password resets for existing users.
* Invitation emails for new users typically are not set to expire.
* The expire period is always 60 minutes when expires is enabled.
* This method can be called with an empty body.
*
* POST /users/{user_id}/credentials_email/password_reset -> CredentialsEmail
*/
public func create_user_credentials_email_password_reset(
/**
* @param {Int64} user_id Id of user
*/
_ user_id: Int64,
/**
* @param {Bool} expires Expiring token.
*/
expires: Bool? = nil,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let result: SDKResponse<Data, SDKError> = self.post("/users/\(path_user_id)/credentials_email/password_reset",
["expires": expires as Any?, "fields": fields], nil, options)
return result
}
/**
* ### Get information about roles of a given user
*
* GET /users/{user_id}/roles -> [Role]
*/
public func user_roles(
/**
* @param {Int64} user_id id of user
*/
_ user_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
/**
* @param {Bool} direct_association_only Get only roles associated directly with the user: exclude those only associated through groups.
*/
direct_association_only: Bool? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let result: SDKResponse<Data, SDKError> = self.get("/users/\(path_user_id)/roles",
["fields": fields, "direct_association_only": direct_association_only as Any?], nil, options)
return result
}
/**
* ### Set roles of the user with a specific id.
*
* PUT /users/{user_id}/roles -> [Role]
*/
public func set_user_roles(
/**
* @param {Int64} user_id id of user
*/
_ user_id: Int64,
/**
* @param {[Int64]} body
*/
_ body: [Int64],
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let result: SDKResponse<Data, SDKError> = self.put("/users/\(path_user_id)/roles",
["fields": fields], try! self.encode(body), options)
return result
}
/**
* ### Get user attribute values for a given user.
*
* Returns the values of specified user attributes (or all user attributes) for a certain user.
*
* A value for each user attribute is searched for in the following locations, in this order:
*
* 1. in the user's account information
* 1. in groups that the user is a member of
* 1. the default value of the user attribute
*
* If more than one group has a value defined for a user attribute, the group with the lowest rank wins.
*
* The response will only include user attributes for which values were found. Use `include_unset=true` to include
* empty records for user attributes with no value.
*
* The value of all hidden user attributes will be blank.
*
* GET /users/{user_id}/attribute_values -> [UserAttributeWithValue]
*/
public func user_attribute_user_values(
/**
* @param {Int64} user_id Id of user
*/
_ user_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
/**
* @param {DelimArray<Int64>} user_attribute_ids Specific user attributes to request. Omit or leave blank to request all user attributes.
*/
user_attribute_ids: DelimArray<Int64>? = nil,
/**
* @param {Bool} all_values If true, returns all values in the search path instead of just the first value found. Useful for debugging group precedence.
*/
all_values: Bool? = nil,
/**
* @param {Bool} include_unset If true, returns an empty record for each requested attribute that has no user, group, or default value.
*/
include_unset: Bool? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let result: SDKResponse<Data, SDKError> = self.get("/users/\(path_user_id)/attribute_values",
["fields": fields, "user_attribute_ids": user_attribute_ids as Any?, "all_values": all_values as Any?, "include_unset": include_unset as Any?], nil, options)
return result
}
/**
* ### Store a custom value for a user attribute in a user's account settings.
*
* Per-user user attribute values take precedence over group or default values.
*
* PATCH /users/{user_id}/attribute_values/{user_attribute_id} -> UserAttributeWithValue
*/
public func set_user_attribute_user_value(
/**
* @param {Int64} user_id Id of user
*/
_ user_id: Int64,
/**
* @param {Int64} user_attribute_id Id of user attribute
*/
_ user_attribute_id: Int64,
/**
* @param {WriteUserAttributeWithValue} body
*/
_ body: WriteUserAttributeWithValue,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let path_user_attribute_id = encodeParam(user_attribute_id)
let result: SDKResponse<Data, SDKError> = self.patch("/users/\(path_user_id)/attribute_values/\(path_user_attribute_id)", nil, try! self.encode(body), options)
return result
}
/**
* ### Delete a user attribute value from a user's account settings.
*
* After the user attribute value is deleted from the user's account settings, subsequent requests
* for the user attribute value for this user will draw from the user's groups or the default
* value of the user attribute. See [Get User Attribute Values](#!/User/user_attribute_user_values) for more
* information about how user attribute values are resolved.
*
* DELETE /users/{user_id}/attribute_values/{user_attribute_id} -> Voidable
*/
public func delete_user_attribute_user_value(
/**
* @param {Int64} user_id Id of user
*/
_ user_id: Int64,
/**
* @param {Int64} user_attribute_id Id of user attribute
*/
_ user_attribute_id: Int64,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let path_user_attribute_id = encodeParam(user_attribute_id)
let result: SDKResponse<Data, SDKError> = self.delete("/users/\(path_user_id)/attribute_values/\(path_user_attribute_id)", nil, nil, options)
return result
}
/**
* ### Send a password reset token.
* This will send a password reset email to the user. If a password reset token does not already exist
* for this user, it will create one and then send it.
* If the user has not yet set up their account, it will send a setup email to the user.
* The URL sent in the email is expressed as the 'password_reset_url' of the user's email/password credential object.
* Password reset URLs will expire in 60 minutes.
* This method can be called with an empty body.
*
* POST /users/{user_id}/credentials_email/send_password_reset -> CredentialsEmail
*/
public func send_user_credentials_email_password_reset(
/**
* @param {Int64} user_id Id of user
*/
_ user_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_id = encodeParam(user_id)
let result: SDKResponse<Data, SDKError> = self.post("/users/\(path_user_id)/credentials_email/send_password_reset",
["fields": fields], nil, options)
return result
}
/**
* Create an embed user from an external user ID
*
* POST /users/embed_user -> UserPublic
*/
public func create_embed_user(
/**
* @param {CreateEmbedUserRequest} body
*/
_ body: CreateEmbedUserRequest,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/users/embed_user", nil, try! self.encode(body), options)
return result
}
// MARK UserAttribute: Manage User Attributes
/**
* ### Get information about all user attributes.
*
* GET /user_attributes -> [UserAttribute]
*/
public func all_user_attributes(
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
/**
* @param {String} sorts Fields to order the results by. Sortable fields include: name, label
*/
sorts: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/user_attributes",
["fields": fields, "sorts": sorts], nil, options)
return result
}
/**
* ### Create a new user attribute
*
* Permission information for a user attribute is conveyed through the `can` and `user_can_edit` fields.
* The `user_can_edit` field indicates whether an attribute is user-editable _anywhere_ in the application.
* The `can` field gives more granular access information, with the `set_value` child field indicating whether
* an attribute's value can be set by [Setting the User Attribute User Value](#!/User/set_user_attribute_user_value).
*
* Note: `name` and `label` fields must be unique across all user attributes in the Looker instance.
* Attempting to create a new user attribute with a name or label that duplicates an existing
* user attribute will fail with a 422 error.
*
* POST /user_attributes -> UserAttribute
*/
public func create_user_attribute(
/**
* @param {WriteUserAttribute} body
*/
_ body: WriteUserAttribute,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.post("/user_attributes",
["fields": fields], try! self.encode(body), options)
return result
}
/**
* ### Get information about a user attribute.
*
* GET /user_attributes/{user_attribute_id} -> UserAttribute
*/
public func user_attribute(
/**
* @param {Int64} user_attribute_id Id of user attribute
*/
_ user_attribute_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_attribute_id = encodeParam(user_attribute_id)
let result: SDKResponse<Data, SDKError> = self.get("/user_attributes/\(path_user_attribute_id)",
["fields": fields], nil, options)
return result
}
/**
* ### Update a user attribute definition.
*
* PATCH /user_attributes/{user_attribute_id} -> UserAttribute
*/
public func update_user_attribute(
/**
* @param {Int64} user_attribute_id Id of user attribute
*/
_ user_attribute_id: Int64,
/**
* @param {WriteUserAttribute} body
*/
_ body: WriteUserAttribute,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_attribute_id = encodeParam(user_attribute_id)
let result: SDKResponse<Data, SDKError> = self.patch("/user_attributes/\(path_user_attribute_id)",
["fields": fields], try! self.encode(body), options)
return result
}
/**
* ### Delete a user attribute (admin only).
*
* DELETE /user_attributes/{user_attribute_id} -> String
*/
public func delete_user_attribute(
/**
* @param {Int64} user_attribute_id Id of user_attribute
*/
_ user_attribute_id: Int64,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_attribute_id = encodeParam(user_attribute_id)
let result: SDKResponse<Data, SDKError> = self.delete("/user_attributes/\(path_user_attribute_id)", nil, nil, options)
return result
}
/**
* ### Returns all values of a user attribute defined by user groups, in precedence order.
*
* A user may be a member of multiple groups which define different values for a given user attribute.
* The order of group-values in the response determines precedence for selecting which group-value applies
* to a given user. For more information, see [Set User Attribute Group Values](#!/UserAttribute/set_user_attribute_group_values).
*
* Results will only include groups that the caller's user account has permission to see.
*
* GET /user_attributes/{user_attribute_id}/group_values -> [UserAttributeGroupValue]
*/
public func all_user_attribute_group_values(
/**
* @param {Int64} user_attribute_id Id of user attribute
*/
_ user_attribute_id: Int64,
/**
* @param {String} fields Requested fields.
*/
fields: String? = nil,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_attribute_id = encodeParam(user_attribute_id)
let result: SDKResponse<Data, SDKError> = self.get("/user_attributes/\(path_user_attribute_id)/group_values",
["fields": fields], nil, options)
return result
}
/**
* ### Define values for a user attribute across a set of groups, in priority order.
*
* This function defines all values for a user attribute defined by user groups. This is a global setting, potentially affecting
* all users in the system. This function replaces any existing group value definitions for the indicated user attribute.
*
* The value of a user attribute for a given user is determined by searching the following locations, in this order:
*
* 1. the user's account settings
* 2. the groups that the user is a member of
* 3. the default value of the user attribute, if any
*
* The user may be a member of multiple groups which define different values for that user attribute. The order of items in the group_values parameter
* determines which group takes priority for that user. Lowest array index wins.
*
* An alternate method to indicate the selection precedence of group-values is to assign numbers to the 'rank' property of each
* group-value object in the array. Lowest 'rank' value wins. If you use this technique, you must assign a
* rank value to every group-value object in the array.
*
* To set a user attribute value for a single user, see [Set User Attribute User Value](#!/User/set_user_attribute_user_value).
* To set a user attribute value for all members of a group, see [Set User Attribute Group Value](#!/Group/update_user_attribute_group_value).
*
* POST /user_attributes/{user_attribute_id}/group_values -> [UserAttributeGroupValue]
*/
public func set_user_attribute_group_values(
/**
* @param {Int64} user_attribute_id Id of user attribute
*/
_ user_attribute_id: Int64,
/**
* @param {[UserAttributeGroupValue]} body
*/
_ body: [UserAttributeGroupValue],
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_user_attribute_id = encodeParam(user_attribute_id)
let result: SDKResponse<Data, SDKError> = self.post("/user_attributes/\(path_user_attribute_id)/group_values", nil, try! self.encode(body), options)
return result
}
// MARK Workspace: Manage Workspaces
/**
* ### Get All Workspaces
*
* Returns all workspaces available to the calling user.
*
* GET /workspaces -> [Workspace]
*/
public func all_workspaces(
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let result: SDKResponse<Data, SDKError> = self.get("/workspaces", nil, nil, options)
return result
}
/**
* ### Get A Workspace
*
* Returns information about a workspace such as the git status and selected branches
* of all projects available to the caller's user account.
*
* A workspace defines which versions of project files will be used to evaluate expressions
* and operations that use model definitions - operations such as running queries or rendering dashboards.
* Each project has its own git repository, and each project in a workspace may be configured to reference
* particular branch or revision within their respective repositories.
*
* There are two predefined workspaces available: "production" and "dev".
*
* The production workspace is shared across all Looker users. Models in the production workspace are read-only.
* Changing files in production is accomplished by modifying files in a git branch and using Pull Requests
* to merge the changes from the dev branch into the production branch, and then telling
* Looker to sync with production.
*
* The dev workspace is local to each Looker user. Changes made to project/model files in the dev workspace only affect
* that user, and only when the dev workspace is selected as the active workspace for the API session.
* (See set_session_workspace()).
*
* The dev workspace is NOT unique to an API session. Two applications accessing the Looker API using
* the same user account will see the same files in the dev workspace. To avoid collisions between
* API clients it's best to have each client login with API3 credentials for a different user account.
*
* Changes made to files in a dev workspace are persistent across API sessions. It's a good
* idea to commit any changes you've made to the git repository, but not strictly required. Your modified files
* reside in a special user-specific directory on the Looker server and will still be there when you login in again
* later and use update_session(workspace_id: "dev") to select the dev workspace for the new API session.
*
* GET /workspaces/{workspace_id} -> Workspace
*/
public func workspace(
/**
* @param {String} workspace_id Id of the workspace
*/
_ workspace_id: String,
options: ITransportSettings? = nil
) -> SDKResponse<Data, SDKError> {
let path_workspace_id = encodeParam(workspace_id)
let result: SDKResponse<Data, SDKError> = self.get("/workspaces/\(path_workspace_id)", nil, nil, options)
return result
}
} | [
-1
] |
0af827c72b55b2b481b2d35aad759dd7120ac4b2 | 153fab8995ddc5ded77b3483323736eeb0e88896 | /SourceryTests/Parsing/FileParserSpec.swift | 777fbf33de7e039535ed7e1a4ae013df9aab5527 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | sheikharshad/Sourcery | b681a94be49718586609a3336f8b849004de1f87 | cef1a4df0628e5c5356af1dff697b3a2f2f741d2 | refs/heads/master | 2021-09-10T01:28:11.763653 | 2018-03-19T09:21:11 | 2018-03-19T09:21:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 34,975 | swift | import Quick
import Nimble
import PathKit
import SourceKittenFramework
@testable import Sourcery
@testable import SourceryRuntime
private func build(_ source: String) -> [String: SourceKitRepresentable]? {
return try? Structure(file: File(contents: source)).dictionary
}
class FileParserSpec: QuickSpec {
// swiftlint:disable function_body_length
override func spec() {
describe("Parser") {
describe("parse") {
func parse(_ code: String) -> [Type] {
guard let parserResult = try? FileParser(contents: code).parse() else { fail(); return [] }
return Composer().uniqueTypes(parserResult)
}
describe("regression files") {
it("doesnt crash on localized strings") {
let templatePath = Stubs.errorsDirectory + Path("localized-error.swift")
guard let content = try? templatePath.read(.utf8) else { return fail() }
_ = parse(content)
}
}
context("given it has sourcery annotations") {
it("extracts annotation block") {
let annotations = [
["skipEquality": NSNumber(value: true)],
["skipEquality": NSNumber(value: true), "extraAnnotation": NSNumber(value: Float(2))],
[:]
]
let expectedVariables = (1...3)
.map { Variable(name: "property\($0)", typeName: TypeName("Int"), annotations: annotations[$0 - 1], definedInTypeName: TypeName("Foo")) }
let expectedType = Class(name: "Foo", variables: expectedVariables, annotations: ["skipEquality": NSNumber(value: true)])
let result = parse("// sourcery:begin: skipEquality\n\n\n\n" +
"class Foo {\n" +
" var property1: Int\n\n\n" +
" // sourcery: extraAnnotation = 2\n" +
" var property2: Int\n\n" +
" // sourcery:end\n" +
" var property3: Int\n" +
"}")
expect(result).to(equal([expectedType]))
}
it("extracts file annotation block") {
let annotations: [[String: NSObject]] = [
["fileAnnotation": NSNumber(value: true), "skipEquality": NSNumber(value: true)],
["fileAnnotation": NSNumber(value: true), "skipEquality": NSNumber(value: true), "extraAnnotation": NSNumber(value: Float(2))],
["fileAnnotation": NSNumber(value: true)]
]
let expectedVariables = (1...3)
.map { Variable(name: "property\($0)", typeName: TypeName("Int"), annotations: annotations[$0 - 1], definedInTypeName: TypeName("Foo")) }
let expectedType = Class(name: "Foo", variables: expectedVariables, annotations: ["fileAnnotation": NSNumber(value: true), "skipEquality": NSNumber(value: true)])
let result = parse("// sourcery:file: fileAnnotation\n" +
"// sourcery:begin: skipEquality\n\n\n\n" +
"class Foo {\n" +
" var property1: Int\n\n\n" +
" // sourcery: extraAnnotation = 2\n" +
" var property2: Int\n\n" +
" // sourcery:end\n" +
" var property3: Int\n" +
"}")
expect(result).to(equal([expectedType]))
}
}
context("given struct") {
it("extracts properly") {
expect(parse("struct Foo { }"))
.to(equal([
Struct(name: "Foo", accessLevel: .internal, isExtension: false, variables: [])
]))
}
it("extracts generic struct properly") {
expect(parse("struct Foo<Something> { }"))
.to(equal([
Struct(name: "Foo", isGeneric: true)
]))
}
it("extracts instance variables properly") {
expect(parse("struct Foo { var x: Int }"))
.to(equal([
Struct(name: "Foo", accessLevel: .internal, isExtension: false, variables: [Variable(name: "x", typeName: TypeName("Int"), accessLevel: (read: .internal, write: .internal), isComputed: false, definedInTypeName: TypeName("Foo"))])
]))
}
it("extracts class variables properly") {
expect(parse("struct Foo { static var x: Int { return 2 }; class var y: Int = 0 }"))
.to(equal([
Struct(name: "Foo", accessLevel: .internal, isExtension: false, variables: [
Variable(name: "x", typeName: TypeName("Int"), accessLevel: (read: .internal, write: .none), isComputed: true, isStatic: true, definedInTypeName: TypeName("Foo")),
Variable(name: "y", typeName: TypeName("Int"), accessLevel: (read: .internal, write: .internal), isComputed: false, isStatic: true, defaultValue: "0", definedInTypeName: TypeName("Foo"))
])
]))
}
context("given nested struct") {
it("extracts properly from body") {
let innerType = Struct(name: "Bar", accessLevel: .internal, isExtension: false, variables: [])
expect(parse("public struct Foo { struct Bar { } }"))
.to(equal([
Struct(name: "Foo", accessLevel: .public, isExtension: false, variables: [], containedTypes: [innerType]),
innerType
]))
}
it("extracts properly from extension") {
let innerType = Struct(name: "Bar", accessLevel: .internal, isExtension: false, variables: [])
expect(parse("public struct Foo {} extension Foo { struct Bar { } }"))
.to(equal([
Struct(name: "Foo", accessLevel: .public, isExtension: false, variables: [], containedTypes: [innerType]),
innerType
]))
}
}
}
context("given class") {
it("extracts variables properly") {
expect(parse("class Foo { }; extension Foo { var x: Int }"))
.to(equal([
Class(name: "Foo", accessLevel: .internal, isExtension: false, variables: [Variable(name: "x", typeName: TypeName("Int"), accessLevel: (read: .internal, write: .internal), isComputed: false, definedInTypeName: TypeName("Foo"))])
]))
}
it("extracts inherited types properly") {
expect(parse("class Foo: TestProtocol { }; extension Foo: AnotherProtocol {}"))
.to(equal([
Class(name: "Foo", accessLevel: .internal, isExtension: false, variables: [], inheritedTypes: ["TestProtocol", "AnotherProtocol"])
]))
}
it("extracts annotations correctly") {
let expectedType = Class(name: "Foo", accessLevel: .public, isExtension: false, variables: [], inheritedTypes: ["TestProtocol"])
expectedType.annotations["firstLine"] = NSNumber(value: true)
expectedType.annotations["thirdLine"] = NSNumber(value: 4543)
expect(parse("// sourcery: thirdLine = 4543\n/// comment\n// sourcery: firstLine\npublic class Foo: TestProtocol { }"))
.to(equal([expectedType]))
}
}
context("given unknown type") {
it("extracts extensions properly") {
expect(parse("protocol Foo { }; extension Bar: Foo { var x: Int { return 0 } }"))
.to(equal([
Type(name: "Bar", accessLevel: .none, isExtension: true, variables: [Variable(name: "x", typeName: TypeName("Int"), accessLevel: (read: .internal, write: .none), isComputed: true, definedInTypeName: TypeName("Bar"))], inheritedTypes: ["Foo"]),
Protocol(name: "Foo")
]))
}
}
context("given typealias") {
func parse(_ code: String) -> FileParserResult {
guard let parserResult = try? FileParser(contents: code).parse() else { fail(); return FileParserResult(path: nil, module: nil, types: [], typealiases: []) }
return parserResult
}
context("given global typealias") {
it("extracts global typealiases properly") {
expect(parse("typealias GlobalAlias = Foo; class Foo { typealias FooAlias = Int; class Bar { typealias BarAlias = Int } }").typealiases)
.to(equal([
Typealias(aliasName: "GlobalAlias", typeName: TypeName("Foo"))
]))
}
it("extracts typealiases for inner types") {
expect(parse("typealias GlobalAlias = Foo.Bar;").typealiases)
.to(equal([
Typealias(aliasName: "GlobalAlias", typeName: TypeName("Foo.Bar"))
]))
}
it("extracts typealiases of other typealiases") {
expect(parse("typealias Foo = Int; typealias Bar = Foo").typealiases)
.to(contain([
Typealias(aliasName: "Foo", typeName: TypeName("Int")),
Typealias(aliasName: "Bar", typeName: TypeName("Foo"))
]))
}
it("extracts typealias for tuple") {
expect(parse("typealias GlobalAlias = (Foo, Bar)").typealiases)
.to(equal([
Typealias(aliasName: "GlobalAlias", typeName: TypeName("(Foo, Bar)"))
]))
}
it("extracts typealias for closure") {
expect(parse("typealias GlobalAlias = (Int) -> (String)").typealiases)
.to(equal([
Typealias(aliasName: "GlobalAlias", typeName: TypeName("(Int) -> (String)"))
]))
}
it("extracts typealias for void") {
expect(parse("typealias GlobalAlias = () -> ()").typealiases)
.to(equal([
Typealias(aliasName: "GlobalAlias", typeName: TypeName("(Void) -> (Void)"))
]))
}
}
context("given local typealias") {
it ("extracts local typealiases properly") {
let foo = Type(name: "Foo")
let bar = Type(name: "Bar", parent: foo)
let fooBar = Type(name: "FooBar", parent: bar)
let types = parse("class Foo { typealias FooAlias = String; struct Bar { typealias BarAlias = Int; struct FooBar { typealias FooBarAlias = Float } } }").types
let fooAliases = types.first?.typealiases
let barAliases = types.first?.containedTypes.first?.typealiases
let fooBarAliases = types.first?.containedTypes.first?.containedTypes.first?.typealiases
expect(fooAliases).to(equal(["FooAlias": Typealias(aliasName: "FooAlias", typeName: TypeName("String"), parent: foo)]))
expect(barAliases).to(equal(["BarAlias": Typealias(aliasName: "BarAlias", typeName: TypeName("Int"), parent: bar)]))
expect(fooBarAliases).to(equal(["FooBarAlias": Typealias(aliasName: "FooBarAlias", typeName: TypeName("Float"), parent: fooBar)]))
}
}
}
context("given enum") {
it("extracts empty enum properly") {
expect(parse("enum Foo { }"))
.to(equal([
Enum(name: "Foo", accessLevel: .internal, isExtension: false, inheritedTypes: [], cases: [])
]))
}
it("extracts cases properly") {
expect(parse("enum Foo { case optionA; case optionB }"))
.to(equal([
Enum(name: "Foo", accessLevel: .internal, isExtension: false, inheritedTypes: [], cases: [EnumCase(name: "optionA"), EnumCase(name: "optionB")])
]))
}
it("extracts cases with special names") {
expect(parse("enum Foo { case `default`; case `for`(something: Int, else: Float, `default`: Bool) }"))
.to(equal([
Enum(name: "Foo", accessLevel: .internal, isExtension: false, inheritedTypes: [], cases: [EnumCase(name: "`default`"), EnumCase(name: "`for`", associatedValues:
[
AssociatedValue(name: "something", typeName: TypeName("Int")),
AssociatedValue(name: "else", typeName: TypeName("Float")),
AssociatedValue(name: "`default`", typeName: TypeName("Bool"))
])])
]))
}
it("extracts multi-byte cases properly") {
expect(parse("enum JapaneseEnum {\ncase アイウエオ\n}"))
.to(equal([
Enum(name: "JapaneseEnum", cases: [EnumCase(name: "アイウエオ")])
]))
}
context("given enum cases annotations") {
it("extracts cases with annotations properly") {
expect(parse("enum Foo {\n //sourcery:begin: block\n// sourcery: first, second=\"value\"\n case optionA(/* sourcery: value */Int)\n // sourcery: third\n case optionB\n case optionC \n//sourcery:end}"))
.to(equal([
Enum(name: "Foo", cases: [
EnumCase(name: "optionA", associatedValues: [
AssociatedValue(name: nil, typeName: TypeName("Int"), annotations: ["value": NSNumber(value: true)])
], annotations: [
"block": NSNumber(value: true),
"first": NSNumber(value: true),
"second": "value" as NSString
]
),
EnumCase(name: "optionB", annotations: [
"block": NSNumber(value: true),
"third": NSNumber(value: true)
]
),
EnumCase(name: "optionC", annotations: [
"block": NSNumber(value: true)
])
])
]))
}
it("extracts cases with inline annotations properly") {
expect(parse("enum Foo {\n //sourcery:begin: block\n/* sourcery: first, second = \"value\" */ case optionA(/* sourcery: associatedValue */Int); /* sourcery: third */ case optionB\n case optionC \n//sourcery:end\n}"))
.to(equal([
Enum(name: "Foo", cases: [
EnumCase(name: "optionA", associatedValues: [
AssociatedValue(name: nil, typeName: TypeName("Int"), annotations: [
"associatedValue": NSNumber(value: true)
])
], annotations: [
"block": NSNumber(value: true),
"first": NSNumber(value: true),
"second": "value" as NSString
]),
EnumCase(name: "optionB", annotations: [
"block": NSNumber(value: true),
"third": NSNumber(value: true)
]),
EnumCase(name: "optionC", annotations: [
"block": NSNumber(value: true)
])
])
]))
}
it("extracts one line cases with inline annotations properly") {
expect(parse("enum Foo {\n //sourcery:begin: block\ncase /* sourcery: first, second = \"value\" */ optionA(Int), /* sourcery: third, fourth = \"value\" */ optionB, optionC \n//sourcery:end\n}"))
.to(equal([
Enum(name: "Foo", cases: [
EnumCase(name: "optionA", associatedValues: [
AssociatedValue(name: nil, typeName: TypeName("Int"))
], annotations: [
"block": NSNumber(value: true),
"first": NSNumber(value: true),
"second": "value" as NSString
]),
EnumCase(name: "optionB", annotations: [
"block": NSNumber(value: true),
"third": NSNumber(value: true),
"fourth": "value" as NSString
]),
EnumCase(name: "optionC", annotations: [
"block": NSNumber(value: true)
])
])
]))
}
it("extracts cases with annotations and computed variables properly") {
expect(parse("enum Foo {\n // sourcery: var\n var first: Int { return 0 }\n // sourcery: first, second=\"value\"\n case optionA(Int)\n // sourcery: var\n var second: Int { return 0 }\n // sourcery: third\n case optionB\n case optionC }"))
.to(equal([
Enum(name: "Foo", cases: [
EnumCase(name: "optionA", associatedValues: [
AssociatedValue(name: nil, typeName: TypeName("Int"))
], annotations: [
"first": NSNumber(value: true),
"second": "value" as NSString
]),
EnumCase(name: "optionB", annotations: [
"third": NSNumber(value: true)
]),
EnumCase(name: "optionC")
], variables: [
Variable(name: "first", typeName: TypeName("Int"), accessLevel: (.internal, .none), isComputed: true, annotations: [ "var": NSNumber(value: true) ], definedInTypeName: TypeName("Foo")),
Variable(name: "second", typeName: TypeName("Int"), accessLevel: (.internal, .none), isComputed: true, annotations: [ "var": NSNumber(value: true) ], definedInTypeName: TypeName("Foo"))
])
]))
}
}
it("extracts associated value annotations properly") {
let result = parse("enum Foo {\n case optionA(\n// sourcery: annotation\nInt)\n case optionB }")
expect(result)
.to(equal([
Enum(name: "Foo",
cases: [
EnumCase(name: "optionA", associatedValues: [
AssociatedValue(name: nil, typeName: TypeName("Int"), annotations: ["annotation": NSNumber(value: true)])
]),
EnumCase(name: "optionB")
])
]))
}
it("extracts associated value inline annotations properly") {
let result = parse("enum Foo {\n case optionA(/* sourcery: annotation*/Int)\n case optionB }")
expect(result)
.to(equal([
Enum(name: "Foo",
cases: [
EnumCase(name: "optionA", associatedValues: [
AssociatedValue(name: nil, typeName: TypeName("Int"), annotations: ["annotation": NSNumber(value: true)])
]),
EnumCase(name: "optionB")
])
]))
}
it("extracts variables properly") {
expect(parse("enum Foo { var x: Int { return 1 } }"))
.to(equal([
Enum(name: "Foo", accessLevel: .internal, isExtension: false, inheritedTypes: [], cases: [], variables: [Variable(name: "x", typeName: TypeName("Int"), accessLevel: (.internal, .none), isComputed: true, definedInTypeName: TypeName("Foo"))])
]))
}
context("given enum without rawType") {
it("extracts inherited types properly") {
expect(parse("enum Foo: SomeProtocol { case optionA }; protocol SomeProtocol {}"))
.to(equal([
Enum(name: "Foo", accessLevel: .internal, isExtension: false, inheritedTypes: ["SomeProtocol"], rawTypeName: nil, cases: [EnumCase(name: "optionA")]),
Protocol(name: "SomeProtocol")
]))
}
it("extracts types inherited in extension properly") {
expect(parse("enum Foo { case optionA }; extension Foo: SomeProtocol {}; protocol SomeProtocol {}"))
.to(equal([
Enum(name: "Foo", accessLevel: .internal, isExtension: false, inheritedTypes: ["SomeProtocol"], rawTypeName: nil, cases: [EnumCase(name: "optionA")]),
Protocol(name: "SomeProtocol")
]))
}
it("does not use extension to infer rawType") {
expect(parse("enum Foo { case one }; extension Foo: Equatable {}")).to(equal([
Enum(name: "Foo",
inheritedTypes: ["Equatable"],
cases: [EnumCase(name: "one")]
)
]))
}
}
it("extracts enums with custom values") {
expect(parse("enum Foo: String { case optionA = \"Value\" }"))
.to(equal([
Enum(name: "Foo", accessLevel: .internal, isExtension: false, rawTypeName: TypeName("String"), cases: [EnumCase(name: "optionA", rawValue: "Value")])
]))
}
it("extracts enums without rawType") {
let expectedEnum = Enum(name: "Foo", accessLevel: .internal, isExtension: false, inheritedTypes: [], cases: [EnumCase(name: "optionA")])
expect(parse("enum Foo { case optionA }")).to(equal([expectedEnum]))
}
it("extracts enums with associated types") {
expect(parse("enum Foo { case optionA(Observable<Int, Int>); case optionB(Int, named: Float, _: Int); case optionC(dict: [String: String]) }"))
.to(equal([
Enum(name: "Foo", accessLevel: .internal, isExtension: false, inheritedTypes: [], cases:
[
EnumCase(name: "optionA", associatedValues: [
AssociatedValue(localName: nil, externalName: nil, typeName: TypeName("Observable<Int, Int>", generic: GenericType(
name: "Observable", typeParameters: [
GenericTypeParameter(typeName: TypeName("Int")),
GenericTypeParameter(typeName: TypeName("Int"))
])))
]),
EnumCase(name: "optionB", associatedValues: [
AssociatedValue(localName: nil, externalName: "0", typeName: TypeName("Int")),
AssociatedValue(localName: "named", externalName: "named", typeName: TypeName("Float")),
AssociatedValue(localName: nil, externalName: "2", typeName: TypeName("Int"))
]),
EnumCase(name: "optionC", associatedValues: [
AssociatedValue(localName: "dict", externalName: nil, typeName: TypeName("[String: String]", dictionary: DictionaryType(name: "[String: String]", valueTypeName: TypeName("String"), keyTypeName: TypeName("String")), generic: GenericType(name: "[String: String]", typeParameters: [GenericTypeParameter(typeName: TypeName("String")), GenericTypeParameter(typeName: TypeName("String"))])))
])
])
]))
}
it("extracts enums with empty parenthesis as ones without associated type") {
expect(parse("enum Foo { case optionA(); case optionB() }"))
.to(equal([
Enum(name: "Foo", accessLevel: .internal, isExtension: false, inheritedTypes: [], cases:
[
EnumCase(name: "optionA", associatedValues: []),
EnumCase(name: "optionB", associatedValues: [])
])
]))
}
context("given associated value with its type existing") {
it("extracts associated value's type") {
let associatedValue = AssociatedValue(typeName: TypeName("Bar"), type: Class(name: "Bar", inheritedTypes: ["Baz"]))
let item = Enum(name: "Foo", cases: [EnumCase(name: "optionA", associatedValues: [associatedValue])])
let parsed = parse("protocol Baz {}; class Bar: Baz {}; enum Foo { case optionA(Bar) }")
let parsedItem = parsed.flatMap { $0 as? Enum }.first
expect(parsedItem).to(equal(item))
expect(associatedValue.type).to(equal(parsedItem?.cases.first?.associatedValues.first?.type))
}
it("extracts associated value's optional type") {
let associatedValue = AssociatedValue(typeName: TypeName("Bar?"), type: Class(name: "Bar", inheritedTypes: ["Baz"]))
let item = Enum(name: "Foo", cases: [EnumCase(name: "optionA", associatedValues: [associatedValue])])
let parsed = parse("protocol Baz {}; class Bar: Baz {}; enum Foo { case optionA(Bar?) }")
let parsedItem = parsed.flatMap { $0 as? Enum }.first
expect(parsedItem).to(equal(item))
expect(associatedValue.type).to(equal(parsedItem?.cases.first?.associatedValues.first?.type))
}
it("extracts associated value's typealias") {
let associatedValue = AssociatedValue(typeName: TypeName("Bar2"), type: Class(name: "Bar", inheritedTypes: ["Baz"]))
let item = Enum(name: "Foo", cases: [EnumCase(name: "optionA", associatedValues: [associatedValue])])
let parsed = parse("typealias Bar2 = Bar; protocol Baz {}; class Bar: Baz {}; enum Foo { case optionA(Bar2) }")
let parsedItem = parsed.flatMap { $0 as? Enum }.first
expect(parsedItem).to(equal(item))
expect(associatedValue.type).to(equal(parsedItem?.cases.first?.associatedValues.first?.type))
}
it("extracts associated value's same (indirect) enum type") {
let associatedValue = AssociatedValue(typeName: TypeName("Foo"))
let item = Enum(name: "Foo", inheritedTypes: ["Baz"], cases: [EnumCase(name: "optionA", associatedValues: [associatedValue])])
associatedValue.type = item
let parsed = parse("protocol Baz {}; indirect enum Foo: Baz { case optionA(Foo) }")
let parsedItem = parsed.flatMap { $0 as? Enum }.first
expect(parsedItem).to(equal(item))
expect(associatedValue.type).to(equal(parsedItem?.cases.first?.associatedValues.first?.type))
}
}
}
context("given protocol") {
it("extracts empty protocol properly") {
expect(parse("protocol Foo { }"))
.to(equal([
Protocol(name: "Foo")
]))
}
it("does not consider protocol variables as computed") {
expect(parse("protocol Foo { var some: Int { get } }"))
.to(equal([
Protocol(name: "Foo", variables: [Variable(name: "some", typeName: TypeName("Int"), accessLevel: (.internal, .none), isComputed: false, definedInTypeName: TypeName("Foo"))])
]))
}
it("does consider type variables as computed when they are, even if they adhere to protocol") {
expect(parse("protocol Foo { var some: Int { get } }\nclass Bar: Foo { var some: Int { return 2 } }").first)
.to(equal(
Class(name: "Bar", variables: [Variable(name: "some", typeName: TypeName("Int"), accessLevel: (.internal, .none), isComputed: true, definedInTypeName: TypeName("Bar"))], inheritedTypes: ["Foo"])
))
}
}
}
}
}
}
| [
-1
] |
119d06124ded4ba12f2d4805796d8ae1b903bedc | 59a45ad9945530fcc5f0bd280a6fe6ddfe270be1 | /testTests/testTests.swift | de6d7638bb1137684e6db2eed471650e97a5d09b | [] | no_license | breakdaiz/TestApp | 587efc264a81df9f1a4c500fe575d2784a5e34c6 | e61a8038fa7ad3dd7b4660b5910d275ec9a3a78e | refs/heads/master | 2021-06-13T05:05:51.980970 | 2017-02-27T02:52:48 | 2017-02-27T02:52:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 956 | swift | //
// testTests.swift
// testTests
//
// Created by BernardR on 9/14/16.
// Copyright © 2016 BernardR. All rights reserved.
//
import XCTest
@testable import test
class testTests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measureBlock {
// Put the code you want to measure the time of here.
}
}
}
| [
98333,
278558,
16419,
229413,
204840,
278570,
360491,
344107,
155694,
253999,
229424,
229430,
319542,
180280,
286788,
352326,
311372,
196691,
278615,
237663,
131178,
278634,
278638,
319598,
352368,
131189,
131191,
237689,
131198,
278655,
311435,
311438,
278670,
278677,
278685,
311458,
278691,
49316,
196773,
32941,
278704,
278708,
131256,
278714,
295098,
254170,
229597,
311519,
286958,
327929,
180493,
254226,
319763,
278810,
278816,
98610,
262450,
278842,
287041,
287043,
139589,
319813,
311621,
319821,
254286,
344401,
278869,
155990,
106847,
246127,
246136,
139640,
246137,
311681,
246178,
311727,
377264,
278961,
278965,
278970,
319930,
33211,
336317,
278978,
188871,
278989,
278993,
278999,
328152,
369116,
188894,
287198,
279008,
279013,
279018,
319981,
279022,
319987,
279029,
279032,
279039,
287241,
279050,
303631,
279057,
303636,
279062,
279065,
180771,
377386,
279094,
352829,
115270,
377418,
295519,
66150,
279144,
344680,
279146,
295536,
287346,
287352,
279164,
189057,
303746,
311941,
279177,
369289,
344715,
311949,
287374,
352917,
230040,
295576,
271000,
303771,
221852,
205471,
279206,
295590,
287404,
295599,
205487,
303793,
279217,
164533,
230072,
287417,
303803,
287422,
66242,
287433,
287439,
279252,
295652,
279269,
246503,
230125,
279280,
312052,
230134,
279294,
205568,
295682,
295697,
336671,
344865,
262951,
279336,
262954,
295724,
312108,
353069,
164656,
303920,
262962,
328499,
353078,
230199,
353079,
336702,
279362,
295746,
353094,
353095,
353109,
230234,
295776,
279392,
303972,
230248,
246641,
295798,
246648,
279417,
361337,
254850,
287622,
213894,
58253,
295824,
279456,
189348,
279464,
353195,
140204,
353197,
304051,
287677,
189374,
353216,
213960,
279498,
50143,
123881,
304110,
320494,
287731,
295927,
304122,
312314,
320507,
328700,
328706,
320516,
230410,
320527,
418837,
140310,
230423,
197657,
336929,
189474,
345132,
238639,
238651,
230463,
238664,
296019,
353367,
156764,
156765,
304222,
230499,
279660,
156785,
312434,
353397,
337017,
279685,
222343,
296086,
238743,
296092,
238765,
279728,
238769,
230588,
279747,
353479,
353481,
353482,
279760,
189652,
279765,
189653,
148696,
296153,
279774,
304351,
304356,
279785,
279792,
353523,
279814,
312587,
328971,
173334,
320796,
304421,
279854,
345396,
116026,
222524,
279875,
230729,
222541,
296270,
238927,
296273,
222559,
230756,
230765,
296303,
279920,
312689,
296307,
116084,
181625,
148867,
378244,
296335,
230799,
279974,
173491,
279989,
296375,
296387,
296391,
296392,
361927,
280010,
370123,
148940,
280013,
312782,
222675,
353750,
239068,
280032,
280041,
296425,
361963,
329197,
329200,
296433,
321009,
280055,
288249,
296448,
230913,
230921,
296461,
149007,
304656,
329232,
230959,
312880,
288309,
288318,
280130,
124485,
288326,
288327,
280147,
239198,
157281,
312940,
222832,
247416,
288378,
337535,
239237,
288392,
239250,
345752,
255649,
206504,
321199,
198324,
296628,
337591,
321207,
296632,
280251,
280257,
321219,
280267,
9936,
313041,
280278,
280280,
18138,
67292,
321247,
313065,
288491,
280300,
239341,
419569,
313081,
124669,
288512,
288516,
280327,
280329,
321295,
321302,
116505,
321310,
247590,
296755,
280372,
321337,
280380,
345919,
280392,
345929,
304977,
18262,
280410,
370522,
345951,
362337,
345955,
296806,
288619,
288620,
280430,
362352,
313203,
124798,
182144,
305026,
67463,
329622,
337815,
124824,
214937,
214938,
247712,
354212,
124852,
288697,
214977,
280514,
280519,
247757,
231375,
280541,
337895,
247785,
296941,
329712,
362480,
313339,
313357,
182296,
305179,
313375,
239650,
354343,
354345,
223274,
124975,
346162,
124984,
288833,
288834,
313416,
280649,
354385,
223316,
280661,
223318,
329814,
338007,
354393,
288857,
280675,
280677,
313447,
288879,
223350,
280694,
288889,
215164,
313469,
215166,
280712,
215178,
141450,
346271,
239793,
125109,
182456,
280762,
223419,
379071,
280768,
338119,
280778,
321745,
280795,
280802,
338150,
125169,
338164,
157944,
125183,
125188,
313608,
125193,
125198,
125203,
125208,
305440,
125217,
125235,
280887,
125240,
321860,
280902,
182598,
272729,
379225,
354655,
321894,
280939,
313713,
354676,
199029,
280961,
248194,
362881,
395659,
395661,
240016,
190871,
141728,
289189,
281037,
281040,
281072,
223767,
289304,
223769,
182817,
289332,
338490,
322120,
281166,
281171,
354911,
436832,
191082,
313966,
281199,
330379,
133774,
330387,
330388,
117397,
289434,
338613,
166582,
289462,
314040,
158394,
199366,
363211,
289502,
363230,
338662,
346858,
289518,
199414,
35583,
363263,
191235,
322313,
322316,
322319,
166676,
207640,
281377,
289576,
289598,
281408,
420677,
281427,
281433,
322395,
330609,
207732,
158593,
240518,
289698,
289703,
289727,
363458,
19399,
52172,
183248,
338899,
248797,
207838,
314342,
289774,
183279,
314355,
240630,
314362,
134150,
322570,
322582,
281625,
281626,
175132,
248872,
322612,
207938,
314448,
281697,
314467,
281700,
322663,
281706,
207979,
363644,
150657,
248961,
339102,
330913,
306338,
281771,
208058,
339130,
290000,
298208,
363744,
298212,
290022,
330984,
298221,
298228,
216315,
208124,
388349,
363771,
322824,
126237,
339234,
199971,
298291,
306494,
216386,
224586,
372043,
314709,
314710,
224606,
314720,
142689,
281957,
281962,
306542,
314739,
290173,
306559,
224640,
298374,
314758,
314760,
142729,
281992,
388487,
314766,
306579,
282007,
290207,
314783,
314789,
282022,
314791,
282024,
241066,
314798,
380357,
339398,
306631,
191981,
282096,
306673,
306677,
191990,
290300,
290301,
282114,
306692,
306693,
323080,
192010,
323087,
282129,
282136,
282141,
282146,
306723,
290358,
282183,
290390,
306776,
282213,
323178,
314998,
175741,
192131,
282245,
282246,
224901,
290443,
323217,
282259,
282271,
282273,
282276,
298661,
323236,
290471,
282280,
298667,
306874,
282303,
323263,
282312,
306890,
241361,
282327,
298712,
216795,
298720,
12010,
282348,
323316,
282358,
282369,
175873,
323331,
323332,
216839,
282378,
282391,
249626,
282400,
241441,
339745,
257830,
282409,
159533,
282417,
200498,
282427,
315202,
282434,
307011,
282438,
307025,
413521,
216918,
307031,
282474,
282480,
241528,
315264,
339841,
282504,
110480,
184208,
282518,
282519,
44952,
298909,
118685,
298920,
200627,
282549,
290746,
151497,
298980,
282612,
282633,
241692,
307231,
102437,
233517,
282672,
159807,
315476,
307289,
200794,
315487,
45153,
315497,
315498,
299121,
233589,
233590,
241808,
323729,
233636,
299174,
233642,
299187,
184505,
299198,
299203,
282831,
356576,
176362,
233715,
184570,
168188,
184575,
282909,
299293,
282913,
233762,
217380,
282919,
151847,
332085,
332089,
315706,
282939,
307517,
241986,
332101,
348492,
323916,
250192,
323920,
348500,
168281,
323935,
242029,
242033,
291192,
225670,
291224,
283038,
61857,
315810,
61859,
315811,
340398,
299441,
61873,
61880,
283064,
127427,
127428,
291267,
283075,
324039,
176601,
242139,
160225,
242148,
291311,
233978,
291333,
340490,
283153,
291358,
283182,
283184,
234036,
315960,
70209,
348742,
70215,
348749,
332378,
111208,
291454,
184962,
348806,
152203,
184973,
111253,
316053,
111259,
299699,
299700,
225997,
226004,
226007,
226019,
234217,
299770,
234234,
299776,
242433,
234241,
209670,
226058,
234250,
234253,
291604,
234263,
283419,
234268,
234277,
283430,
234283,
152365,
234286,
234289,
242485,
234294,
234301,
234311,
234312,
299849,
283467,
234317,
201551,
234323,
234326,
234331,
349026,
234340,
234343,
275303,
177001,
201577,
234346,
308076,
242541,
234355,
209783,
234360,
209785,
234361,
177019,
234366,
234367,
291712,
234372,
226181,
226184,
308107,
308112,
234386,
234387,
234392,
209817,
324506,
324507,
234400,
234404,
324517,
283558,
234409,
275371,
234419,
234425,
234427,
234430,
349121,
234436,
234438,
316364,
234444,
234445,
234451,
234454,
234457,
340955,
234463,
340961,
234466,
234472,
234473,
324586,
234477,
340974,
234482,
316405,
201720,
234498,
234500,
234506,
324625,
234514,
316437,
201755,
234531,
300068,
234534,
357414,
234542,
300084,
234548,
324666,
234555,
308287,
234560,
21569,
234565,
234569,
300111,
234577,
341073,
234583,
234584,
234587,
250981,
300135,
300136,
316520,
275565,
316526,
357486,
275571,
300151,
234616,
398457,
160891,
341115,
300158,
234622,
349316,
349318,
275591,
234632,
169104,
177296,
234642,
308372,
185493,
283802,
119962,
300188,
119963,
300187,
234656,
234659,
234663,
275625,
300202,
300201,
226481,
283840,
259268,
283847,
62665,
283852,
283853,
357595,
234733,
234742,
292091,
316669,
242954,
292107,
251153,
177428,
226608,
300343,
226624,
193859,
300359,
226632,
234827,
177484,
251213,
234831,
120148,
283991,
357719,
218462,
292195,
333160,
284014,
243056,
112017,
112018,
234898,
357786,
333220,
316842,
210358,
284089,
292283,
415171,
292292,
300487,
300489,
284116,
366037,
210390,
210391,
210393,
226781,
144867,
316902,
54765,
251378,
300535,
300536,
300542,
210433,
366083,
316946,
308756,
398869,
308764,
349726,
349741,
169518,
194110,
235070,
349763,
218696,
276040,
366154,
292425,
333388,
276045,
243274,
128587,
333393,
300630,
128599,
235095,
243292,
300644,
374372,
317032,
54893,
276085,
366203,
235135,
276120,
276126,
218819,
276173,
333517,
333520,
333521,
333523,
276195,
153319,
284401,
276210,
276219,
325371,
194303,
194304,
300811,
284429,
276238,
284431,
366360,
284442,
325404,
276253,
325410,
341796,
284459,
300848,
317232,
276282,
276283,
276287,
325439,
276294,
153415,
276298,
341836,
325457,
284507,
300894,
284512,
284514,
276327,
292712,
325484,
292720,
325492,
300918,
276344,
194429,
325503,
333701,
243591,
243597,
325518,
300963,
292771,
333735,
284587,
292782,
243637,
276408,
276421,
284619,
276430,
301008,
153554,
194515,
276444,
219101,
292836,
292837,
276454,
317415,
276459,
325619,
333817,
292858,
292902,
227370,
309295,
276534,
358456,
227417,
194656,
309345,
227428,
276582,
194666,
276589,
227439,
284788,
333940,
292988,
292992,
194691,
227460,
333955,
235662,
325776,
276627,
317587,
276632,
284826,
333991,
333992,
284841,
284842,
153776,
129203,
227513,
301251,
227524,
309444,
276682,
227548,
301279,
211193,
227578,
243962,
309503,
194820,
375051,
325905,
325912,
309529,
211235,
260418,
227654,
227658,
276813,
325968,
6481,
6482,
366929,
366930,
6489,
391520,
276835,
416104,
276847,
285040,
317820,
211326,
227725,
178578,
178582,
293274,
285084,
317852,
285090,
375207,
293303,
276920,
293306,
276925,
293310,
317901,
326100,
285150,
227809,
358882,
342498,
227813,
195045,
309744,
301571,
276998,
342536,
186893,
342553,
375333,
293419,
244269,
236081,
23092,
277048,
301638,
293448,
55881,
309846,
244310,
277094,
277101,
277111,
301689,
244347,
277133,
227990,
342682,
285353,
285361,
342706,
318130,
293556,
342713,
285371,
285372,
285373,
285374,
154316,
334547,
203477,
96984,
318173,
285415,
342762,
277227,
129773,
154359,
228088,
162561,
285444,
285466,
326429,
326433,
318250,
318252,
285487,
301871,
293693,
162621,
162626,
277316,
318278,
277325,
293711,
301918,
293730,
351077,
342887,
400239,
277366,
228215,
277370,
269178,
359298,
277381,
113542,
228233,
228234,
56208,
293781,
277403,
318364,
310176,
310178,
310182,
293800,
236461,
293806,
130016,
64485,
277479,
326635,
203757,
277492,
318461,
277509,
277510,
146448,
277523,
277524,
293910,
310317,
252980,
359478,
277563,
302139,
359495,
277597,
113760,
302177,
285798,
228458,
15471,
187506,
285814,
285820,
187521,
285828,
302213,
285830,
253063,
302216,
228491,
228493,
285838,
162961,
326804,
187544,
302240,
343203,
253099,
367799,
294074,
277690,
64700,
228542,
302274,
343234,
367810,
244940,
228563,
310497,
195811,
228588,
253167,
302325,
204022,
228600,
228609,
245019,
277792,
130338,
130343,
277800,
113966,
351537,
286018,
113987,
15686,
294218,
318805,
294243,
163175,
327025,
327031,
179587,
294275,
368011,
318875,
310692,
310701,
286129,
228795,
302529,
302531,
163268,
163269,
310732,
64975,
327121,
212442,
228827,
286172,
310757,
187878,
343542,
343543,
286202,
286205,
302590,
294400,
228867,
253452,
65041,
146964,
204313,
286244,
245287,
278060,
245292,
286254,
56902,
228943,
286288,
196187,
147036,
343647,
310889,
204397,
138863,
188031,
294529,
286343,
229001,
310923,
188048,
229020,
302754,
245412,
229029,
40613,
40614,
40615,
278191,
286388,
286391,
319162,
286399,
302797,
212685,
212688,
245457,
302802,
286423,
278233,
278234,
294622,
278240,
212716,
212717,
229113,
286459,
278272,
319233,
311042,
278291,
278293,
294678,
278299,
286494,
294700,
360252,
188251,
237408,
253829,
40853,
294807,
294809,
294814,
311199,
319392,
294823,
294843,
98239,
294850,
163781,
344013,
212946,
294886,
253929,
327661,
278512,
311282
] |
5c41e8fa000b445e78fc5617e4b3cc17185eca55 | e27aae6b04c6e0447f96b190537c29230479c832 | /Flix App/Flix App/Assets.xcassets/MovieDetailsViewController.swift | 7561dce58bd4dd86e9606f0cf2a44bc539afb83b | [
"Apache-2.0"
] | permissive | srajesh12/Prework | 1379103242c11e1858a314216a8b699143c1a11c | 125f2587d98aca909b0931e037a267744d33694d | refs/heads/main | 2023-04-07T18:19:31.639622 | 2021-04-13T19:21:48 | 2021-04-13T19:21:48 | 330,068,184 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 655 | swift | //
// MovieDetailsViewController.swift
// Flix App
//
// Created by Surabhi R on 2/7/21.
//
import UIKit
class MovieDetailsViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// 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.
}
*/
}
| [
327555,
398203,
356742,
384145,
391441,
361495,
375576,
384153,
399130,
361498,
361499,
258589,
254494,
155551,
436128,
254497,
254495,
397091,
351400,
356652,
319284,
383797,
396725,
402616,
397114,
111292,
384447,
266816,
352836,
360903,
359368,
437582,
330960,
146645,
399958,
402524,
224861,
362845,
332513,
399201,
224868,
384103,
374122,
372715,
352876,
349297,
210674,
320506,
361595
] |
631572feb2836bf66a1e8880282b9ac1f8166544 | 81c99a01931a1b5effe2aee0a36b3a7835d89cc2 | /Vehicle App/ViewController.swift | 52ba2e58a7f65188fa5793756f423ecccc7581dc | [] | no_license | Esolheim1429/Vehicle-APP-2-master | 930b7cdf33161548c3f66e07022a05a7db0a1f51 | 3d3ef06a37ff11857eaa87b47c28fbfe57e8d7a3 | refs/heads/master | 2020-04-07T09:20:20.562598 | 2018-11-20T15:22:44 | 2018-11-20T15:22:44 | 158,248,188 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,819 | swift | //
// ViewController.swift
// Vehicle App
//
// Created by Timothy P. Konopacki on 10/31/18.
// Copyright © 2018 TK. All rights reserved.
//
import UIKit
import GoogleSignIn
class ViewController: UIViewController, GIDSignInUIDelegate{
var signedIn = false
var vans = false
var cars = false
let googleButton = GIDSignInButton()
let appDelegate = UIApplication.shared.delegate as! AppDelegate
var counter = 0
var timer = Timer()
override func viewDidLoad() {
super.viewDidLoad()
setupGoogleButton()
signedIn = appDelegate.signedIn
print("test")
print("test2")
timer = Timer.scheduledTimer(timeInterval: 1.5, target: self, selector: #selector(hideGoogleSignIn), userInfo: nil, repeats: true)
}
fileprivate func setupGoogleButton(){
googleButton.frame = CGRect(x: 16, y: 500, width: view.frame.width - 32 , height: 50)
view.addSubview(googleButton)
GIDSignIn.sharedInstance()?.uiDelegate = self
//hideGoogleSignIn()
}
func retryLogin(){
GIDSignIn.sharedInstance()?.signIn()
}
@objc func timerAction() {
counter += 1
}
@objc func hideGoogleSignIn(){
self.signedIn = self.appDelegate.signedIn
if self.signedIn == false{
self.googleButton.isHidden = false
}else{
if self.signedIn == true{
self.googleButton.isHidden = true
}
}
}
@IBAction func vanChosen(_ sender: UIButton) {
vans = true
cars = false
//sup dude
performSegue(withIdentifier: "calendarSegue", sender: nil)
}
@IBAction func carChosen(_ sender: UIButton) {
cars = true
vans = false
//oof
//wtf
//performSegue(withIdentifier: "calendarSegue", sender: nil)
}
@IBAction func bothChosen(_ sender: UIButton) {
cars = true
vans = true
performSegue(withIdentifier: "calendarSegue", sender: nil)
}
// override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// //let nvc = segue.destination as? CalendarViewController
// nvc?.cars = cars
// nvc?.vans = vans
// }
@objc func notSignedInAlert(){
let alertController = UIAlertController(title: "Sign in first", message: nil, preferredStyle: .alert)
let cancelAlert = UIAlertAction(title: "Cancel", style: .cancel, handler: nil)
let okAlert = UIAlertAction(title: "Retry", style: .default, handler: { (action) in
self.retryLogin()
})
alertController.addAction(okAlert)
alertController.addAction(cancelAlert)
present(alertController, animated: true, completion: nil)
}
}
| [
-1
] |
74e511c0ab896ec0f50e1940031d553cec89c235 | fb5b1504eb5b24abca61bcce4e8556a912738809 | /build/src/Models/ConversationEventTopicAttachment.swift | a1a42e8143ec3fb6b52af306327a8a01e9dc86e0 | [
"MIT"
] | permissive | MyPureCloud/platform-client-sdk-ios | 135f1d124730ecc7e47e68df90a3215ba4ba6880 | 04ee2b0f5d3f8ad73078eb713427cb6f9e164dda | refs/heads/master | 2023-08-17T05:03:39.340378 | 2023-08-15T06:49:56 | 2023-08-15T06:49:56 | 130,367,583 | 0 | 2 | null | null | null | null | UTF-8 | Swift | false | false | 990 | swift | //
// ConversationEventTopicAttachment.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
//
import Foundation
public class ConversationEventTopicAttachment: Codable {
/** The unique identifier for the attachment. */
public var attachmentId: String?
/** The name of the attachment. */
public var name: String?
/** The content uri of the attachment. If set, this is commonly a public api download location. */
public var contentUri: String?
/** The type of file the attachment is. */
public var contentType: String?
/** The length of the attachment file. */
public var contentLength: Int?
public init(attachmentId: String?, name: String?, contentUri: String?, contentType: String?, contentLength: Int?) {
self.attachmentId = attachmentId
self.name = name
self.contentUri = contentUri
self.contentType = contentType
self.contentLength = contentLength
}
}
| [
-1
] |
c4198e85eefe5c1ebf61ccfe9b3956fdc78839b2 | 372bafd2525d39407f056a5a428aefa7cb67742a | /queen-ios/Extensions/UIViewExt.swift | 34f3bf71d4d7a65c18ac15be8dfa7e7190a31271 | [] | no_license | Saulgor/queen-ios | 7b90eb3a2a2eeb0c7e1ded2bcf4191937b8cb977 | 0c632d198dd96d314b8b1bcdfeae0e25648485fe | refs/heads/master | 2021-05-05T14:53:00.118789 | 2017-10-30T01:14:58 | 2017-10-30T01:14:58 | 105,178,394 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 870 | swift | //
// UIViewExt.swift
// queen-ios
//
// Created by user on 29/10/2017.
// Copyright © 2017 saulgor. All rights reserved.
//
import Foundation
class InsetLabel: UILabel {
let topInset = CGFloat(0)
let bottomInset = CGFloat(0)
let leftInset = CGFloat(5)
let rightInset = CGFloat(5)
override func drawText(in rect: CGRect) {
let insets: UIEdgeInsets = UIEdgeInsets(top: topInset, left: leftInset, bottom: bottomInset, right: rightInset)
super.drawText(in: UIEdgeInsetsInsetRect(rect, insets))
}
override public var intrinsicContentSize: CGSize {
var intrinsicSuperViewContentSize = super.intrinsicContentSize
intrinsicSuperViewContentSize.height += topInset + bottomInset
intrinsicSuperViewContentSize.width += leftInset + rightInset
return intrinsicSuperViewContentSize
}
}
| [
-1
] |
22b215a0dd43f54f5127535c7a3e9560cb0d1b4a | 042d2a6f85a11b8af97a63856f3f55d9e625b11c | /douyin/DYHotVideo/QHAwemeDemo/Modules/Acount/UserCenter/Views/InviteSectionFooter.swift | 0b0f3895729204a75c6b905a3b450de9e755c4d4 | [
"MIT"
] | permissive | a497500306/CategoryScrollView | 72ab9c3d9c6e00e79b02dd8d6a7544cc0f232636 | 0596ac90738829bf826bd17e2990b3159f98d38c | refs/heads/master | 2022-08-16T20:53:41.458551 | 2020-05-26T23:00:04 | 2020-05-26T23:00:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 7,921 | swift | //
// InviteSectionFooter.swift
// QHAwemeDemo
//
// Created by mac on 2019/10/14.
// Copyright © 2019 AnakinChen Network Technology. All rights reserved.
//
import UIKit
import DouYinScan
class InviteSectionFooter: UIView {
static let reuseId = "InviteSectionFooter"
static let footerHeight: CGFloat = 784
private lazy var shareContentView: UIView = {
let view = UIView()
view.backgroundColor = UIColor.init(r: 254, g: 250, b: 238)
return view
}()
private lazy var QRCodeImageView: UIImageView = {
let imageView = UIImageView()
return imageView
}()
private lazy var myInviteLab: UILabel = {
let label = UILabel()
label.text = "我的邀请码"
label.textColor = UIColor.init(r: 34, g: 34, b: 34)
label.font = UIFont.systemFont(ofSize: 16)
return label
}()
private lazy var inviteCodeLab: UILabel = {
let label = UILabel()
label.text = "--------"
label.textColor = UIColor.init(r: 215, g: 58, b: 45)
label.font = UIFont.systemFont(ofSize: 29)
return label
}()
private lazy var indicatorButton: UIButton = {
let button = UIButton()
button.setImage(UIImage(named: "inviteIndicator"), for: .normal)
return button
}()
private lazy var eventButton: UIButton = {
let button = UIButton()
button.backgroundColor = .clear
button.tag = 102
button.addTarget(self, action: #selector(buttonDidClick), for: .touchUpInside)
return button
}()
private lazy var urlShareBtn: UIButton = {
let button = UIButton()
button.setTitle("复制链接分享", for: .normal)
button.titleLabel?.font = UIFont.systemFont(ofSize: 17)
button.setTitleColor(UIColor.init(r: 0, g: 123, b: 255), for: .normal)
button.backgroundColor = UIColor.white
button.layer.cornerRadius = 5
button.layer.masksToBounds = true
button.tag = 100
button.addTarget(self, action: #selector(buttonDidClick), for: .touchUpInside)
return button
}()
private lazy var imageShareBtn: UIButton = {
let button = UIButton()
button.setTitle("保存图片分享", for: .normal)
button.titleLabel?.font = UIFont.systemFont(ofSize: 17)
button.setTitleColor(UIColor.init(r: 215, g: 58, b: 45), for: .normal)
button.backgroundColor = UIColor.white
button.layer.cornerRadius = 5
button.layer.masksToBounds = true
button.tag = 101
button.addTarget(self, action: #selector(buttonDidClick), for: .touchUpInside)
return button
}()
private lazy var iconImageView: UIImageView = {
let imageView = UIImageView()
imageView.image = UIImage(named: "inviteRewardIntro")
imageView.contentMode = .scaleAspectFit
return imageView
}()
var buttonClickHandler: ((_ tag: Int)->())?
override init(frame: CGRect) {
super.init(frame: frame)
self.backgroundColor = UIColor.clear
addSubview(shareContentView)
shareContentView.addSubview(QRCodeImageView)
shareContentView.addSubview(myInviteLab)
shareContentView.addSubview(inviteCodeLab)
shareContentView.addSubview(indicatorButton)
shareContentView.addSubview(eventButton)
addSubview(urlShareBtn)
addSubview(imageShareBtn)
addSubview(iconImageView)
layoutPageViews()
loadQRcode()
setupUI()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setupUI() {
if let userInviteCode = UserModel.share().userInfo?.code {
inviteCodeLab.text = userInviteCode
} else {
if let codeSave = UserDefaults.standard.object(forKey: UserDefaults.kUserInviteCode) as? String {
inviteCodeLab.text = codeSave
}
}
}
func loadQRcode() {
var downString = String(format: "%@", ConstValue.kAppDownLoadLoadUrl)
if let downloadString = AppInfo.share().share_url {
if downloadString.hasSuffix("/") {
downString = downloadString
} else {
downString = String(format: "%@%@", downloadString, "/")
}
}
if let userInviteCode = UserModel.share().userInfo?.code {
downString = String(format: "%@%@",downString, userInviteCode)
} else {
if let codeSave = UserDefaults.standard.object(forKey: UserDefaults.kUserInviteCode) as? String {
downString = String(format: "%@%@", downString, codeSave)
} else {
downString = String(format: "%@", downString)
}
}
let qrImg = ScanWrapper.createCode(codeType: "CIQRCodeGenerator", codeString: downString, size: CGSize(width: 200, height: 200), qrColor: UIColor.black, bkColor: UIColor.clear)
QRCodeImageView.image = qrImg
}
}
//MARK: -Event
extension InviteSectionFooter {
@objc func buttonDidClick(sender: UIButton) {
buttonClickHandler?(sender.tag)
}
}
//MARK: -Layout
extension InviteSectionFooter {
func layoutPageViews() {
layoutShareContentView()
layoutQRCodeImageView()
layoutMyInviteLab()
layoutInviteCodeLab()
layoutInviteIndicatorButton()
layoutEventButton()
layoutUrlShareBtn()
layoutImageShareBtn()
layoutIconImageView()
}
func layoutShareContentView() {
shareContentView.snp.makeConstraints { (make) in
make.leading.equalTo(0)
make.trailing.equalTo(0)
make.top.equalToSuperview()
make.height.equalTo(104)
}
}
func layoutQRCodeImageView() {
QRCodeImageView.snp.makeConstraints { (make) in
make.leading.equalTo(20)
make.top.equalTo(9)
make.width.height.equalTo(84)
}
}
func layoutMyInviteLab() {
myInviteLab.snp.makeConstraints { (make) in
make.leading.equalTo(QRCodeImageView.snp.trailing).offset(22)
make.top.equalTo(25)
}
}
func layoutInviteCodeLab() {
inviteCodeLab.snp.makeConstraints { (make) in
make.leading.equalTo(QRCodeImageView.snp.trailing).offset(22)
make.top.equalTo(myInviteLab.snp.bottom).offset(15)
}
}
func layoutInviteIndicatorButton() {
indicatorButton.snp.makeConstraints { (make) in
make.trailing.equalTo(-15)
make.centerY.equalTo(QRCodeImageView.snp.centerY)
make.width.equalTo(60)
make.height.equalTo(30)
}
}
func layoutEventButton() {
eventButton.snp.makeConstraints { (make) in
make.edges.equalToSuperview()
}
}
func layoutUrlShareBtn() {
urlShareBtn.snp.makeConstraints { (make) in
make.leading.equalTo(0)
make.width.equalTo((screenWidth-56)/2)
make.height.equalTo(56)
make.top.equalTo(QRCodeImageView.snp.bottom).offset(34)
}
}
func layoutImageShareBtn() {
imageShareBtn.snp.makeConstraints { (make) in
make.trailing.equalTo(0)
make.width.equalTo(urlShareBtn.snp.width)
make.height.equalTo(urlShareBtn.snp.height)
make.top.equalTo(QRCodeImageView.snp.bottom).offset(34)
}
}
func layoutIconImageView() {
iconImageView.snp.makeConstraints { (make) in
make.top.equalTo(imageShareBtn.snp.bottom).offset(30)
make.leading.equalTo(0)
make.trailing.equalTo(0)
make.height.equalTo(572)
}
}
}
| [
-1
] |
d58aef70a9732e9eb290e02047556bf5a6f66975 | acfd2fd32a45f17efb44abf20f18ca9a153d082e | /FlickrWebService/FlickrWebService/ImageViewController.swift | 688eaddd3a442931813d63f75b6a30adfebe692d | [] | no_license | aiconoa/iOS-8 | 6dde013059d3b1661d395433b0aad8d4ce4a2550 | ca085461364440764b94adc8c6f9061e00415481 | refs/heads/master | 2016-09-10T01:02:42.821816 | 2015-03-30T10:11:17 | 2015-03-30T10:11:17 | 25,679,630 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,109 | swift | //
// ImageViewController.swift
// FlickrWebService
//
// Created by formation on 17/10/2014.
// Copyright (c) 2014 aiconoa. All rights reserved.
//
import UIKit
class ImageViewController: UIViewController {
@IBOutlet weak var flickrPhotoImageView: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func tapImage(sender: UITapGestureRecognizer) {
presentingViewController!.dismissViewControllerAnimated(true) {
}
}
/*
// 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
] |
6030cfaf125e3e80f5ecdd4bcbcc7571e382adc1 | e3684e2001859c97f904e50668f27703d8b7dbc0 | /Sources/Scenes/Photos Collection/Interactor/STPhotoCollectionInteractor+FetchPhotos.swift | 16867f984139d51d1a68d83f066e3586b5ec5855 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | mikelanza/st-photo-collection-ios | 05eb25983f5eb74d2780d2933f7a0ba151d03c1e | bb8db4af324bb7b03d40b24b3d777f1688ac3e5c | refs/heads/master | 2020-06-26T17:02:52.295748 | 2019-09-30T14:44:16 | 2019-09-30T14:44:16 | 199,693,334 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,666 | swift | //
// STPhotoCollectionInteractor+FetchPhotos.swift
// STPhotoCollection-iOS
//
// Created by Crasneanu Cristian on 13/09/2019.
// Copyright © 2019 Streetography. All rights reserved.
//
import UIKit
import STPhotoCore
extension STPhotoCollectionInteractor {
func shouldFetchEntityPhotos() {
if self.photosPaginationModel.noItems || self.photosPaginationModel.noMoreItems || self.photosPaginationModel.isFetchingItems {
return
}
self.shouldFetchPhotos()
}
private func shouldFetchPhotos() {
self.photosPaginationModel.isFetchingItems = true
self.presenter?.presentWillFetchPhotos()
if let workerModel = self.fetchPhotosWorkerModel() {
self.worker?.fetchPhotos(model: workerModel)
}
}
private func fetchPhotosWorkerModel() -> STPhotoCollectionWorker.FetchPhotosModel? {
guard let model = self.model, let geoEntity = model.geoEntity else { return nil }
let skip = self.photosPaginationModel.limit * self.photosPaginationModel.currentPage
return STPhotoCollectionWorker.FetchPhotosModel(skip: skip, limit: self.photosPaginationModel.limit, geoEntity: geoEntity, entityModel: model.entityModel, filterModel: model.filterModel)
}
func successDidFetchPhotos(photos: [STPhoto]) {
self.photos.append(contentsOf: photos)
self.presentPhotos(photos: photos)
self.photosPaginationModel.incrementCurrentPage()
self.photosPaginationModel.isFetchingItems = false
self.verifyLastPageOfPhotos(photoCount: photos.count)
}
func failureDidFetchPhotos(error: OperationError) {
self.presenter?.presentDidFetchPhotos()
}
private func verifyLastPageOfPhotos(photoCount: Int) {
guard photoCount < self.photosPaginationModel.limit else {
return
}
self.photosPaginationModel.noMoreItems = true
self.presenter?.presentDidFetchPhotos()
self.presentEmptyStateIfNeeded(photoCount: photoCount)
}
private func presentEmptyStateIfNeeded(photoCount: Int) {
if self.photos.count == 0 && photoCount == 0 {
self.presenter?.presentNoMorePhotos()
}
}
private func presentPhotos(photos: [STPhoto]) {
let response = STPhotoCollection.FetchPhotos.Response(photos: photos, photoSize: self.photoItemSize)
self.presenter?.presentFetchedPhotos(response: response)
}
private func presentNoPhotosIfNeeded() {
if self.photosPaginationModel.noItems {
self.presenter?.presentNoMorePhotos()
}
}
}
| [
-1
] |
938855229d785dc2d3ffbcdb5bfe8d2045c27742 | 44ae4020c4d7c6e3180955d9e27ad589121b970f | /EvenTask/Helpers/UI/Storyboard.swift | bd19abafa4a581fd447bc9b465c0feb241a80334 | [] | no_license | meguid/EvenTask | 9db6b3142d66e7f4b5e43f24325f10025f6a249b | 625fa4aadca5b13b811e2f2760ac9550a884ab15 | refs/heads/master | 2020-04-09T21:57:03.761541 | 2019-01-23T16:56:18 | 2019-01-23T16:56:18 | 160,616,309 | 4 | 5 | null | 2019-01-23T16:56:20 | 2018-12-06T03:58:19 | Swift | UTF-8 | Swift | false | false | 733 | swift | //
// Storyboard.swift
// EvenTask
//
// Created by Ahmed Ramy on 12/7/18.
// Copyright © 2018 Ahmed Meguid. All rights reserved.
//
import UIKit
public enum Storyboard {
case events(view: ViewIdentifier)
public func viewController(bundle: Bundle? = nil) -> UIViewController {
return UIStoryboard(name: self.storyboard().storyboardId , bundle: bundle)
.instantiateViewController(withIdentifier: self.storyboard().viewId)
}
public func storyboard() -> (storyboardId: String, viewId: String) {
switch self {
case .events(let view):
return ("Events", view.rawValue)
}
}
}
public enum ViewIdentifier: String {
case eventsList = "EventsList"
}
| [
-1
] |
27617eb54de3a844b4f090ceef87deb56dfa557d | 640d4ff90a7bf30f9c86a9582ebdf7779ba488b3 | /Sources/Tokamak/MountedComponents/MountedNull.swift | cc66e975bb21f781b9b1886c8f87baa8af3d8948 | [
"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 | 340 | swift | //
// MountedNull.swift
// Tokamak
//
// Created by Max Desiatov on 05/01/2019.
//
final class MountedNull<R: Renderer>: MountedComponent<R> {
override func mount(with reconciler: StackReconciler<R>) {}
override func unmount(with reconciler: StackReconciler<R>) {}
override func update(with reconciler: StackReconciler<R>) {}
}
| [
-1
] |
58883f0a82be388bd995c064aad57146e13259ff | 751047f845086b3887f84a9a8483c4929af4f113 | /Trivia app/Views/SelfTimerView.swift | 36fdd64059c933b19eadb9e133bd074c4307e7f3 | [] | no_license | Sulemanali511/Trivia-App- | 5532d687f9eb173762c5e36b3a35e94d58feea2a | 4736162d4bb430ee3087a2040fb456e8f42c63d9 | refs/heads/main | 2023-03-27T17:15:02.750762 | 2021-03-28T17:35:52 | 2021-03-28T17:35:52 | 352,379,726 | 1 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 5,120 | swift | //
// SelfTimerView.swift
// Trivia app
//
// Created by Suleman Ali on 28/03/2021.
//
import UIKit
protocol SelfTimerViewDelegate {
func didStart()
func didEnd()
func didPause()
func didUpdate(newValue:TimeInterval)
}
class SelfTimerView: UIView {
@IBOutlet weak var backgroundView: UIView!
var delegate:SelfTimerViewDelegate?
let timeLeftShapeLayer = CAShapeLayer()
let bgShapeLayer = CAShapeLayer()
var interval:TimeInterval = 5
var timeLeft: TimeInterval = 5 {
didSet{
interval = timeLeft
}
}
var EndText:String = "00:00"
var endTime: Date?
var timeLabel = UILabel()
var timer = Timer()
let strokeIt = CABasicAnimation(keyPath: "strokeEnd")
var lineColor:UIColor = .red {
didSet{
timeLeftShapeLayer.strokeColor = lineColor.cgColor
}
}
var TimerLabelColor:UIColor = .red {
didSet{
timeLabel.textColor = lineColor
}
}
var TimerLabelFont:UIFont = .systemFont(ofSize: 30, weight: .bold) {
didSet{
timeLabel.font = TimerLabelFont
}
}
var lineleftColor:UIColor = .clear {
didSet{
timeLeftShapeLayer.fillColor = UIColor.clear.cgColor
}
}
var lineWidth:CGFloat = 15{
didSet {
bgShapeLayer.lineWidth = lineWidth
timeLeftShapeLayer.lineWidth = lineWidth
}
}
func drawBgShape() {
bgShapeLayer.path = UIBezierPath(arcCenter: CGPoint(x: backgroundView.frame.midX , y: backgroundView.frame.midY), radius:
100, startAngle: -90.degreesToRadians, endAngle: 270.degreesToRadians, clockwise: true).cgPath
bgShapeLayer.strokeColor = UIColor.white.cgColor
bgShapeLayer.fillColor = UIColor.clear.cgColor
bgShapeLayer.lineWidth = lineWidth
backgroundView.layer.insertSublayer(bgShapeLayer,at:0)
}
func drawTimeLeftShape() {
timeLeftShapeLayer.path = UIBezierPath(arcCenter: CGPoint(x: backgroundView.frame.midX , y: backgroundView.frame.midY), radius:
100, startAngle: -90.degreesToRadians, endAngle: 270.degreesToRadians, clockwise: true).cgPath
timeLeftShapeLayer.strokeColor = lineColor.cgColor
timeLeftShapeLayer.fillColor = lineleftColor.cgColor
timeLeftShapeLayer.lineWidth = lineWidth
backgroundView.layer.addSublayer(timeLeftShapeLayer)
timeLabel.text = timeLeft.time
}
func addTimeLabel() {
timeLabel = UILabel(frame: CGRect(x: backgroundView.frame.midX-50 ,y: backgroundView.frame.midY-25, width: 100, height: 50))
timeLabel.textAlignment = .center
timeLabel.textColor = TimerLabelColor
timeLabel.text = timeLeft.time
backgroundView.addSubview(timeLabel)
}
override init(frame: CGRect) {
super.init(frame: frame)
Bundle.main.loadNibNamed("SelfTimerView", owner: self, options: nil)
addSubview(backgroundView)
backgroundView.frame = self.bounds
backgroundView.backgroundColor = .clear
}
func setupUI(){
drawBgShape()
drawTimeLeftShape()
addTimeLabel()
// here you define the fromValue, toValue and duration of your animation
strokeIt.fromValue = 0
strokeIt.toValue = 1
strokeIt.duration = timeLeft
// add the animation to your timeLeftShapeLayer
// timeLeftShapeLayer.add(strokeIt, forKey: nil)
// define the future end time by adding the timeLeft to now Date()
endTime = Date().addingTimeInterval(timeLeft)
}
func start(){
interval = timeLeft
timeLabel.text = interval.time
strokeIt.fromValue = 0
strokeIt.toValue = 1
strokeIt.duration = timeLeft
timeLeftShapeLayer.add(strokeIt, forKey: nil)
endTime = Date().addingTimeInterval(interval)
timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(updateTime), userInfo: nil, repeats: true)
delegate?.didStart()
}
func stop(){
timer.invalidate()
delegate?.didPause()
}
required init?(coder: NSCoder) {
super.init(coder: coder)
Bundle.main.loadNibNamed("SelfTimerView", owner: self, options: nil)
addSubview(backgroundView)
backgroundView.frame = self.bounds
backgroundView.backgroundColor = .clear
}
@objc func updateTime() {
if interval > 0 {
delegate?.didUpdate(newValue: interval)
interval = endTime?.timeIntervalSinceNow ?? 0
timeLabel.text = interval.time
} else {
timeLabel.text = EndText
timer.invalidate()
delegate?.didEnd()
}
}
}
extension TimeInterval {
var time: String {
return String(format:"%02d:%02d", Int(self/60), Int(ceil(truncatingRemainder(dividingBy: 60))) )
}
}
extension Int {
var degreesToRadians : CGFloat {
return CGFloat(self) * .pi / 180
}
}
| [
-1
] |
b1d6c5d125d4de30951201cb5d6a5c1fcd77a6be | ff686f86e1a627d21ac577336646693620e0c9c7 | /Firestore/Swift/Tests/API/BasicCompileTests.swift | 98a5fd237319cc0ffb17fbc3b91fd8bca85079af | [
"Apache-2.0",
"LicenseRef-scancode-proprietary-license"
] | permissive | animeshp/firebase-ios-sdk | b7307b65e212f2486cf21df8fcc4d77d99c2e793 | 3e3bcb41f7c9b22d0cef652e49e04e930ffd3aed | refs/heads/master | 2023-05-24T22:13:23.996107 | 2019-06-14T16:22:55 | 2019-06-14T16:22:55 | 171,783,965 | 0 | 0 | Apache-2.0 | 2019-05-01T17:16:58 | 2019-02-21T02:15:49 | Objective-C | UTF-8 | Swift | false | false | 11,724 | swift | /*
* Copyright 2017 Google
*
* 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.
*/
// These aren't tests in the usual sense--they just verify that the Objective-C to Swift translation
// results in the right names.
import Foundation
import XCTest
import Firebase
class BasicCompileTests: XCTestCase {
func testCompiled() {
XCTAssertTrue(true)
}
}
func main() {
let db = initializeDb()
let (collectionRef, documentRef) = makeRefs(database: db)
let query = makeQuery(collection: collectionRef)
writeDocument(at: documentRef)
writeDocuments(at: documentRef, database: db)
addDocument(to: collectionRef)
readDocument(at: documentRef)
readDocumentWithSource(at: documentRef)
readDocuments(matching: query)
readDocumentsWithSource(matching: query)
listenToDocument(at: documentRef)
listenToDocuments(matching: query)
enableDisableNetwork(database: db)
clearPersistence(database: db)
types()
}
func initializeDb() -> Firestore {
// Initialize with ProjectID.
let firestore = Firestore.firestore()
// Apply settings
let settings = FirestoreSettings()
settings.host = "localhost"
settings.isPersistenceEnabled = true
settings.cacheSizeBytes = FirestoreCacheSizeUnlimited
firestore.settings = settings
return firestore
}
func makeRefs(database db: Firestore) -> (CollectionReference, DocumentReference) {
var collectionRef = db.collection("my-collection")
var documentRef: DocumentReference
documentRef = collectionRef.document("my-doc")
// or
documentRef = db.document("my-collection/my-doc")
// deeper collection (my-collection/my-doc/some/deep/collection)
collectionRef = documentRef.collection("some/deep/collection")
// parent doc (my-collection/my-doc/some/deep)
documentRef = collectionRef.parent!
// print paths.
print("Collection: \(collectionRef.path), document: \(documentRef.path)")
return (collectionRef, documentRef)
}
func makeQuery(collection collectionRef: CollectionReference) -> Query {
var query = collectionRef.whereField(FieldPath(["name"]), isEqualTo: "Fred")
.whereField("age", isGreaterThanOrEqualTo: 24)
.whereField("tags", arrayContains: "active")
.whereField(FieldPath(["tags"]), arrayContains: "active")
.whereField(FieldPath.documentID(), isEqualTo: "fred")
.order(by: FieldPath(["age"]))
.order(by: "name", descending: true)
.limit(to: 10)
query = collectionRef.firestore.collectionGroup("collection")
return query
}
func writeDocument(at docRef: DocumentReference) {
let setData = [
"foo": 42,
"bar": [
"baz": "Hello world!",
],
] as [String: Any]
let updateData = [
"bar.baz": 42,
FieldPath(["foobar"]): 42,
"server_timestamp": FieldValue.serverTimestamp(),
"array_union": FieldValue.arrayUnion(["a", "b"]),
"array_remove": FieldValue.arrayRemove(["a", "b"]),
"field_delete": FieldValue.delete(),
] as [AnyHashable: Any]
docRef.setData(setData)
// Completion callback (via trailing closure syntax).
docRef.setData(setData) { error in
if let error = error {
print("Uh oh! \(error)")
return
}
print("Set complete!")
}
// merge
docRef.setData(setData, merge: true)
docRef.setData(setData, merge: true) { error in
if let error = error {
print("Uh oh! \(error)")
return
}
print("Set complete!")
}
docRef.updateData(updateData)
docRef.delete()
docRef.delete { error in
if let error = error {
print("Uh oh! \(error)")
return
}
print("Set complete!")
}
}
func enableDisableNetwork(database db: Firestore) {
// closure syntax
db.disableNetwork(completion: { error in
if let e = error {
print("Uh oh! \(e)")
return
}
})
// trailing block syntax
db.enableNetwork { error in
if let e = error {
print("Uh oh! \(e)")
return
}
}
}
func clearPersistence(database db: Firestore) {
db.clearPersistence { error in
if let e = error {
print("Uh oh! \(e)")
return
}
}
}
func writeDocuments(at docRef: DocumentReference, database db: Firestore) {
var batch: WriteBatch
batch = db.batch()
batch.setData(["a": "b"], forDocument: docRef)
batch.setData(["a": "b"], forDocument: docRef, merge: true)
batch.setData(["c": "d"], forDocument: docRef)
// commit without completion callback.
batch.commit()
print("Batch write without completion complete!")
batch = db.batch()
batch.setData(["a": "b"], forDocument: docRef)
batch.setData(["c": "d"], forDocument: docRef)
// commit with completion callback via trailing closure syntax.
batch.commit { error in
if let error = error {
print("Uh oh! \(error)")
return
}
print("Batch write callback complete!")
}
print("Batch write with completion complete!")
}
func addDocument(to collectionRef: CollectionReference) {
collectionRef.addDocument(data: ["foo": 42])
// or
collectionRef.document().setData(["foo": 42])
}
func readDocument(at docRef: DocumentReference) {
// Trailing closure syntax.
docRef.getDocument { document, error in
if let document = document {
// Note that both document and document.data() is nullable.
if let data = document.data() {
print("Read document: \(data)")
}
if let data = document.data(with: .estimate) {
print("Read document: \(data)")
}
if let foo = document.get("foo") {
print("Field: \(foo)")
}
if let foo = document.get("foo", serverTimestampBehavior: .previous) {
print("Field: \(foo)")
}
// Fields can also be read via subscript notation.
if let foo = document["foo"] {
print("Field: \(foo)")
}
} else {
// TODO(mikelehen): There may be a better way to do this, but it at least demonstrates
// the swift error domain / enum codes are renamed appropriately.
if let errorCode = error.flatMap({
($0._domain == FirestoreErrorDomain) ? FirestoreErrorCode(rawValue: $0._code) : nil
}) {
switch errorCode {
case .unavailable:
print("Can't read document due to being offline!")
case _:
print("Failed to read.")
}
} else {
print("Unknown error!")
}
}
}
}
func readDocumentWithSource(at docRef: DocumentReference) {
docRef.getDocument(source: FirestoreSource.default) { document, error in
}
docRef.getDocument(source: .server) { document, error in
}
docRef.getDocument(source: FirestoreSource.cache) { document, error in
}
}
func readDocuments(matching query: Query) {
query.getDocuments { querySnapshot, error in
// TODO(mikelehen): Figure out how to make "for..in" syntax work
// directly on documentSet.
for document in querySnapshot!.documents {
print(document.data())
}
}
}
func readDocumentsWithSource(matching query: Query) {
query.getDocuments(source: FirestoreSource.default) { querySnapshot, error in
}
query.getDocuments(source: .server) { querySnapshot, error in
}
query.getDocuments(source: FirestoreSource.cache) { querySnapshot, error in
}
}
func listenToDocument(at docRef: DocumentReference) {
let listener = docRef.addSnapshotListener { document, error in
if let error = error {
print("Uh oh! Listen canceled: \(error)")
return
}
if let document = document {
// Note that document.data() is nullable.
if let data: [String: Any] = document.data() {
print("Current document: \(data)")
}
if document.metadata.isFromCache {
print("From Cache")
} else {
print("From Server")
}
}
}
// Unsubscribe.
listener.remove()
}
func listenToDocumentWithMetadataChanges(at docRef: DocumentReference) {
let listener = docRef.addSnapshotListener(includeMetadataChanges: true) { document, error in
if let document = document {
if document.metadata.hasPendingWrites {
print("Has pending writes")
}
}
}
// Unsubscribe.
listener.remove()
}
func listenToDocuments(matching query: Query) {
let listener = query.addSnapshotListener { snap, error in
if let error = error {
print("Uh oh! Listen canceled: \(error)")
return
}
if let snap = snap {
print("NEW SNAPSHOT (empty=\(snap.isEmpty) count=\(snap.count)")
// TODO(mikelehen): Figure out how to make "for..in" syntax work
// directly on documentSet.
for document in snap.documents {
// Note that document.data() is not nullable.
let data: [String: Any] = document.data()
print("Doc: ", data)
}
}
}
// Unsubscribe
listener.remove()
}
func listenToQueryDiffs(onQuery query: Query) {
let listener = query.addSnapshotListener { snap, error in
if let snap = snap {
for change in snap.documentChanges {
switch change.type {
case .added:
print("New document: \(change.document.data())")
case .modified:
print("Modified document: \(change.document.data())")
case .removed:
print("Removed document: \(change.document.data())")
}
}
}
}
// Unsubscribe
listener.remove()
}
func listenToQueryDiffsWithMetadata(onQuery query: Query) {
let listener = query.addSnapshotListener(includeMetadataChanges: true) { snap, error in
if let snap = snap {
for change in snap.documentChanges(includeMetadataChanges: true) {
switch change.type {
case .added:
print("New document: \(change.document.data())")
case .modified:
print("Modified document: \(change.document.data())")
case .removed:
print("Removed document: \(change.document.data())")
}
}
}
}
// Unsubscribe
listener.remove()
}
func transactions() {
let db = Firestore.firestore()
let collectionRef = db.collection("cities")
let accA = collectionRef.document("accountA")
let accB = collectionRef.document("accountB")
let amount = 20.0
db.runTransaction({ (transaction, errorPointer) -> Any? in
do {
let balanceA = try transaction.getDocument(accA)["balance"] as! Double
let balanceB = try transaction.getDocument(accB)["balance"] as! Double
if balanceA < amount {
errorPointer?.pointee = NSError(domain: "Foo", code: 123, userInfo: nil)
return nil
}
transaction.updateData(["balance": balanceA - amount], forDocument: accA)
transaction.updateData(["balance": balanceB + amount], forDocument: accB)
} catch let error as NSError {
print("Uh oh! \(error)")
}
return 0
}) { result, error in
// handle result.
}
}
func types() {
let _: CollectionReference
let _: DocumentChange
let _: DocumentReference
let _: DocumentSnapshot
let _: FieldPath
let _: FieldValue
let _: Firestore
let _: FirestoreSettings
let _: GeoPoint
let _: Firebase.GeoPoint
let _: FirebaseFirestore.GeoPoint
let _: Timestamp
let _: Firebase.Timestamp
let _: FirebaseFirestore.Timestamp
let _: ListenerRegistration
let _: Query
let _: QuerySnapshot
let _: SnapshotMetadata
let _: Transaction
let _: WriteBatch
}
| [
-1
] |
55b96186261a84362accee2a522fdc5388b2f654 | af7cdcfd091a9fe853f0c8c06436e5290fdc9f66 | /PerfectPic/ViewController.swift | fb4a5c4c7345eb564e6ef72cc98dddf683afe570 | [] | no_license | JonathanLigh/AutoAperture | 99593a4be3a0f63c3e5dc7d1aa195153862a6b8d | 5632510b82d6edc8d61af828f328896bf431c965 | refs/heads/master | 2020-03-11T03:49:00.953804 | 2018-05-03T23:13:07 | 2018-05-03T23:13:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 509 | swift | //
// ViewController.swift
// PerfectPic
//
// Created by Jonathan Ligh on 4/9/18.
// Copyright © 2018 JonathanLigh. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
| [
293888,
279041,
277508,
279046,
275466,
307212,
278543,
234511,
281107,
279064,
236057,
286234,
294433,
282145,
284197,
296487,
286249,
237616,
292915,
360501,
300086,
234551,
237624,
290875,
288827,
238653,
226878,
277057,
286786,
129604,
284740,
226887,
243786,
284235,
288331,
300107,
158285,
226896,
212561,
284242,
228945,
300116,
300629,
284240,
237655,
307288,
292435,
212573,
276580,
284261,
281701,
281703,
306791,
298189,
286314,
356460,
277612,
164974,
307311,
312433,
281202,
284275,
189557,
294518,
300149,
287350,
276597,
281205,
292478,
292990,
278657,
284289,
303242,
284298,
285837,
311437,
226447,
234641,
278675,
282262,
307353,
280219,
284315,
284317,
299165,
285855,
302235,
228000,
225955,
282275,
278693,
287399,
280231,
100521,
234665,
198315,
284328,
302767,
284336,
307379,
276150,
286390,
184504,
280760,
299709,
282301,
283839,
285377,
285378,
280770,
228548,
280772,
228551,
276167,
284361,
280775,
287437,
239310,
299727,
230608,
302286,
239314,
313550,
229585,
307410,
284373,
302295,
189655,
282329,
226009,
280790,
280797,
363743,
298211,
284391,
277224,
228585,
199402,
280808,
234223,
312049,
286963,
289524,
286965,
288501,
226038,
234232,
280824,
204027,
282365,
286462,
276736,
280832,
309506,
278786,
358147,
292102,
278791,
226055,
282377,
299786,
312586,
287231,
295696,
300817,
295699,
282389,
288251,
296216,
329499,
281373,
287007,
228127,
276256,
278304,
152356,
282917,
234279,
283433,
130346,
282411,
312107,
293682,
285495,
289596,
283453,
278845,
279360,
289600,
288579,
293700,
283461,
300358,
238920,
311624,
302411,
234829,
287055,
230737,
276309,
295766,
307029,
230745,
241499,
188253,
323933,
289120,
289121,
308064,
303977,
296811,
306540,
293742,
299374,
300400,
199024,
315250,
278897,
216433,
284534,
310649,
292730,
207738,
291709,
183173,
313733,
298375,
324491,
234380,
304015,
310673,
306578,
304531,
304536,
294812,
304540,
277406,
227740,
284576,
285087,
234402,
289697,
284580,
283556,
304550,
304551,
284586,
144811,
291755,
305582,
285103,
324528,
277935,
230323,
282548,
292277,
144822,
130487,
292280,
296374,
234423,
281530,
293308,
278973,
276412,
291774,
296901,
165832,
306633,
289224,
288205,
310734,
286158,
286162,
301012,
292824,
276959,
286175,
276965,
224743,
168936,
294889,
286189,
183278,
277487,
282095,
298989,
293874,
293875,
308721,
227315,
237556,
296436,
310773,
290299,
286204,
290303
] |
2cc427a3ac687e1c90c04fc33b71bfaacdf47f4b | cb13f191f017c70e14a7aa9eb23711e2224a47e1 | /Package.swift | 70b86c1678b44e61bef1c0494afd0e87d3d14977 | [
"Apache-2.0"
] | permissive | Tibimac/KVObserver | 58eeaa80783e145c8d931247deaf2b79c3ce564f | 3a8bd558a72c9ab393f94a6f947307e8d01c8c9e | refs/heads/master | 2020-07-23T00:15:04.101407 | 2019-03-31T18:12:26 | 2019-03-31T18:13:13 | 207,380,380 | 0 | 0 | Apache-2.0 | 2019-09-09T18:45:19 | 2019-09-09T18:45:18 | null | UTF-8 | Swift | false | false | 388 | swift | // swift-tools-version:5.0
import PackageDescription
let package = Package(
name: "KVObserver",
platforms: [
.macOS(.v10_10),
.iOS(.v8),
.tvOS(.v9),
.watchOS(.v2)
],
products: [
.library(name: "KVObserver", targets: ["KVObserver"]),
],
targets: [
.target(name: "KVObserver", dependencies: []),
.testTarget(name: "KVObserverTests", dependencies: ["KVObserver"])
]
)
| [
54331
] |
62ed2d5c2f4332d43f4d4a424236e7e37cc1eb58 | 10a23e04d7cae11fbec788e4997f674d3d681361 | /Sources/FirebladeECS/Entity+Component.swift | ac3a018cf7526460c6c63650e8e3633e08be2f11 | [
"MIT"
] | permissive | vyo/ecs | f84713d44e79274336ef418a8523ad66348cc42a | 6061a2addc6a6974fee8362b0c4a8897a4b096be | refs/heads/master | 2021-05-14T01:54:30.819605 | 2018-01-06T17:08:54 | 2018-01-06T17:08:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 968 | swift | //
// Entity+Component.swift
// FirebladeECS
//
// Created by Christian Treffs on 22.10.17.
//
// MARK: - get components
public extension Entity {
final func get<C>() -> C? where C: Component {
return nexus.get(for: identifier)
}
func get<A>(component compType: A.Type = A.self) -> A? where A: Component {
return nexus.get(for: identifier)
}
func getComponent<A>() -> () -> A? where A: Component {
func getComponentFunc() -> A? {
return get(component: A.self)
}
return getComponentFunc
}
func get<A, B>(components _: A.Type, _: B.Type) -> (A?, B?) where A: Component, B: Component {
let a: A? = get(component: A.self)
let b: B? = get(component: B.self)
return (a, b)
}
func get<A, B, C>(components _: A.Type, _: B.Type, _: C.Type) -> (A?, B?, C?) where A: Component, B: Component, C: Component {
let a: A? = get(component: A.self)
let b: B? = get(component: B.self)
let c: C? = get(component: C.self)
return (a, b, c)
}
}
| [
-1
] |
01daf24a4720880ecf00f23f0be4d6c0caf4fdc5 | fb753c64b9bf4137765d6c0bfcd69d8bb761f898 | /Classes/AppBack+FeatureToggles.swift | 90c85e0b9c18935cc0e24335dfea3b57348b7600 | [
"MIT"
] | permissive | appback-io/appback-ios | fce9cca7c5696f88c8edb0470df2ecdef34e308c | 234a32e91fbb3331dd05ff3e4275bd56f49ef50a | refs/heads/master | 2020-12-09T01:03:22.505767 | 2020-07-05T03:30:22 | 2020-07-05T03:30:22 | 233,145,605 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,209 | swift | //
// AppBack+FeatureToggles.swift
// AppBack
//
// Created by Santiago Lozano on 1/06/20.
//
import Foundation
extension AppBack {
/// Fetches the feature toggles from AppBack Core
/// - Parameters:
/// - router: your appBack translation router
/// - completion: executable after completed
public func getToggles(router: String, completion: @escaping (_ succeded: Bool) -> Void) {
let service = AppBackNetworkService()
service.parameters = [.router: router]
service.endpoint = .getFeatureToggles
service.callAppBackCore(modelType: AppBackTogglesModel.self) { [weak self] (status, model) in
guard let self = self else {
completion(false)
return
}
if status == .success {
self.saveToggles(model: model)
completion(true)
} else {
completion(false)
}
}
}
/// Obtain a boolean toogle from cache
/// - Parameter key: translation key
public func getBoolToggle(key: String) -> Bool? {
let model = loadToggles()
guard let value = model?.toggles?.first(where: { $0.key == key})?.value else {
return nil
}
if let boolean = Bool(value) {
return boolean
} else if let numericBoolean = Int(value) {
return numericBoolean == 1 ? true : false
}
return nil
}
/// Obtain an integer toogle from cache
/// - Parameter key: translation key
public func getIntToggle(key: String) -> Int? {
let model = loadToggles()
guard let value = model?.toggles?.first(where: { $0.key == key})?.value else {
return nil
}
return Int(value)
}
/// Obtain a double toogle from cache
/// - Parameter key: translation key
public func getDoubleToggle(key: String) -> Double? {
let model = loadToggles()
guard let value = model?.toggles?.first(where: { $0.key == key})?.value else {
return nil
}
return Double(value)
}
/// Obtain a string toogle from cache
/// - Parameter key: translation key
public func getStringToggle(key: String) -> String? {
let model = loadToggles()
guard let value = model?.toggles?.first(where: { $0.key == key})?.value else {
return nil
}
return value
}
/// Stores the toggles on cache
/// - Parameter model: AppBackTranslationsModel, optional
internal func saveToggles(model: AppBackTogglesModel?) {
guard let model = model else {
return
}
if let data = try? JSONEncoder().encode(model) {
UserDefaults.standard.set(data, forKey: AppBackUserDefaultsKey.featureToggles.rawValue)
}
}
/// Loads the toggles on memory
internal func loadToggles() -> AppBackTogglesModel? {
guard let data = UserDefaults.standard.object(forKey: AppBackUserDefaultsKey.featureToggles.rawValue) as? Data else {
return nil
}
return try? JSONDecoder().decode(AppBackTogglesModel.self, from: data)
}
}
| [
-1
] |
4682a8f9c95ca7cdbd3327fe194a6a507cb609fd | ef32b2744a7c573a70f344e8b736b2446f13314e | /XeroProgrammingExercise/Core/Utils/DateExtensions.swift | 083fd98b73b9dc7c14675d9828ff9e9a78dd03fd | [] | no_license | DevWithLove/XProgramExercise | 3f6f06523bd2655e68f7df12dfcea824ccc9b528 | 6feb1b135e5a003fe3077e8d2c7367a09b0ec50d | refs/heads/master | 2022-11-18T06:21:45.956968 | 2020-07-04T21:50:17 | 2020-07-04T21:50:17 | 277,190,104 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 431 | swift | //
// DateExtensions.swift
// XeroProgrammingExercise
//
// Created by Tony Mu on 3/07/20.
// Copyright © 2020 Xero Ltd. All rights reserved.
//
import Foundation
extension Date {
/// Convert date to string in format
func toString(dateFormat format: String)-> String {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = format
return dateFormatter.string(from: self)
}
}
| [
-1
] |
139f1f306028eff5175476171899a4224db06454 | 0460245f2d05245364c72ffa3ab79b7ef8055df4 | /SmartCafe/Voucher.swift | 5dadef586178b108489e877a420f40ba6a33b6b4 | [] | no_license | motizuki/Example-01 | 78af5fcc031c440d8ca88454876fcff35e0f9816 | aaa423a12857c747d7a040d9f605abc7ea862f42 | refs/heads/master | 2016-08-09T18:16:53.188517 | 2016-01-19T10:15:18 | 2016-01-19T10:15:18 | 49,340,250 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 338 | swift | //
// Voucher.swift
// SmartCafe
//
// Created by Gustavo Motizuki on 12/21/15.
// Copyright © 2015 Gustavo Motizuki. All rights reserved.
//
import Foundation
class Voucher {
var voucherId: Int?
var name: String?
var description: String?
var startDate: NSDate?
var endDate: NSDate?
var company: Company?
}
| [
-1
] |
8bee0a42de5007394b37cea2e7006c4395c0afee | 36df4c125dd81f26fe09626a40a749e0c61f4045 | /Example/CocoapodsCheck/Pods/AnyFormatKit/Source/TextFormatter/DefaultFormatters/Helpers/StringCalculator.swift | 2a10c19807c9bdc514823d9dcd663ba761b619cd | [
"MIT"
] | permissive | Relamquad/AnyFormatKitSwiftUI | 04329697ab738add8f9ca8acd8fc89ece5054d2a | eef9c3520e3b977fa0f00d79ab0dcb8de61d99e4 | refs/heads/main | 2023-07-07T13:23:53.450218 | 2021-08-17T08:19:39 | 2021-08-17T08:19:39 | 385,498,979 | 1 | 0 | MIT | 2021-07-13T06:26:52 | 2021-07-13T06:26:51 | null | UTF-8 | Swift | false | false | 1,939 | swift | //
// StringCalculator.swift
// AnyFormatKit
//
// Created by Oleksandr Orlov on 16.01.2021.
// Copyright © 2021 Oleksandr Orlov. All rights reserved.
//
import Foundation
class StringCalculator {
func unformattedRange(currentText: String, textPattern: String, from range: Range<String.Index>) -> Range<String.Index> {
let numberOfFormatCharsBeforeRange = getNumberOfFormatChars(textPattern: textPattern, text: currentText, before: range.lowerBound)
let numberOfFormatCharsInRange = getNumberOfFormatChars(textPattern: textPattern, text: currentText, in: range)
return currentText.getRangeWithOffsets(
sourceRange: range,
lowerBoundOffset: -numberOfFormatCharsBeforeRange,
upperBoundOffset: -numberOfFormatCharsInRange
)
}
private func getNumberOfFormatChars(textPattern: String, text: String, before: String.Index) -> Int {
let textLeftSlice = text.leftSlice(end: before)
let patternLeftSlice = textPattern.leftSlice(limit: textLeftSlice.count)
var result = 0
for (textSliceChar, patternSliceChar) in zip(textLeftSlice, patternLeftSlice) {
if textSliceChar == patternSliceChar { result += 1 }
}
return result
}
private func getNumberOfFormatChars(textPattern: String, text: String, in range: Range<String.Index>) -> Int {
let textSlice = text.slice(in: range)
let textPatternRange = textPattern.getSameRange(asIn: text, sourceRange: range)
let patternSlice = textPattern.slice(in: textPatternRange)
var result = 0
for (textSliceCharIndex, textSliceChar) in textSlice.enumerated() {
let isSameCharacter = patternSlice.isSameCharacter(at: textSliceCharIndex, character: textSliceChar)
if isSameCharacter {
result += 1
}
}
return result
}
}
| [
-1
] |
23202bf290c4ab2efe66c8608d9dda5b43c18287 | 799d3cdb4c302dd8458f4469294108cdfe8f054c | /mastermindAttempt/GameplayView.swift | d21b809a5e082ac2307ad13a3cff5feb505f13b1 | [] | no_license | ElinOlundForsling/MastermindNew | abc5af00cc6fcf849f935e819389b6e2923a7f83 | 1ef0c659ec86228ea73877b511e4fc5340dc7a1f | refs/heads/master | 2023-01-24T13:01:00.335840 | 2020-12-08T12:46:36 | 2020-12-08T12:46:36 | 243,793,304 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 19,151 | swift | //
// ProfileView.swift
// mastermindAttempt
//
// Created by Elin Ölund Forsling on 2020-01-24.
// Copyright © 2020 Elin Ölund Forsling. All rights reserved.
//
import UIKit
import PureLayout
// MARK: PROTOCOL
protocol GameplayViewDelegate: class {
func sendGuess(userGuess : [Int])
func pressRulesButton()
func pressInfoButton()
func pressScoreboardButton()
func sendBoard(guessBoard : [Int], currentGuess: [Int])
}
class GameplayView: UIView {
// MARK: VARIABLES
static let screenSize : CGRect = UIScreen.main.bounds
static let tallheight : CGFloat = 896.0
weak var delegate: GameplayViewDelegate?
var activeRow = 9
var userGuess : [Int] = Array(repeating: 0, count: 4)
var guessBoard = Array(repeating: 0, count: 40)
// MARK: VIEW ELEMENTS
lazy var mastermindLogo: UILabel = {
let label = UILabel()
label.text = "MASTERMIND"
label.font = UIFont(name: "Quicksand", size: 26)
label.textColor = .customBlack
return label
}()
lazy var scoreLabel: UILabel = {
var label = UILabel()
label.text = "SCORE"
label.font = UIFont(name: "Quicksand", size: 14)
label.textColor = .customCharcoal
return label
}()
lazy var streakLabel: UILabel = {
var label = UILabel()
label.text = "STREAK"
label.font = UIFont(name: "Quicksand", size: 14)
label.textColor = .customCharcoal
return label
}()
lazy var scoreNumberLabel: UILabel = {
var label = UILabel()
label.text = "00"
label.font = UIFont(name: "Quicksand-Bold", size: 14)
label.textColor = .customCharcoal
label.textAlignment = .right
return label
}()
lazy var streakNumberLabel: UILabel = {
var label = UILabel()
label.text = "00"
label.font = UIFont(name: "Quicksand-Bold", size: 14)
label.textColor = .customCharcoal
label.textAlignment = .right
return label
}()
lazy var rulesButton: UIButton = {
let button = UIButton()
button.setTitle("RULES", for: .normal)
button.titleLabel?.font = UIFont(name: "Quicksand", size: 16)
button.setTitleColor(.customCharcoal, for: .normal)
button.layer.cornerRadius = 0
button.layer.borderColor = UIColor.customCharcoal.cgColor
button.layer.borderWidth = 0
button.backgroundColor = .clear
button.contentHorizontalAlignment = .left
button.translatesAutoresizingMaskIntoConstraints = false
button.addTarget(self, action: #selector(clickRulesButton), for: .touchDown)
return button
}()
lazy var infoButton: UIButton = {
let button = UIButton()
button.setTitle("INFO", for: .normal)
button.titleLabel?.font = UIFont(name: "Quicksand", size: 16)
button.setTitleColor(.customCharcoal, for: .normal)
button.layer.cornerRadius = 0
button.layer.borderColor = UIColor.customCharcoal.cgColor
button.layer.borderWidth = 0
button.backgroundColor = .clear
button.contentHorizontalAlignment = .center
button.translatesAutoresizingMaskIntoConstraints = false
button.addTarget(self, action: #selector(clickInfoButton), for: .touchDown)
return button
}()
lazy var scoreboardButton: UIButton = {
let button = UIButton()
button.setTitle("SCOREBOARD", for: .normal)
button.titleLabel?.font = UIFont(name: "Quicksand", size: 16)
button.setTitleColor(.customCharcoal, for: .normal)
button.layer.cornerRadius = 0
button.layer.borderColor = UIColor.customCharcoal.cgColor
button.layer.borderWidth = 0
button.backgroundColor = .clear
button.contentHorizontalAlignment = .right
button.translatesAutoresizingMaskIntoConstraints = false
button.addTarget(self, action: #selector(clickScoreboardButton), for: .touchDown)
return button
}()
lazy var space1: UILayoutGuide = {
let guide = UILayoutGuide()
guide.identifier = "buttonSpacing1"
return guide
}()
lazy var space2: UILayoutGuide = {
let guide = UILayoutGuide()
guide.identifier = "buttonSpacing2"
return guide
}()
// MARK: CollectionView
lazy var collectionView: GuessCollectionView = {
let cv = GuessCollectionView()
return cv
}()
lazy var redCircle: CircleButton = {
let button = CircleButton()
button.backgroundColor = .customRed
button.setBackgroundColor(.customRedHighlight, for: .highlighted)
button.layer.borderWidth = 0
button.tag = 1
button.addTarget(self, action: #selector(buttonClicked), for: .touchDown)
return button
}()
lazy var orangeCircle: CircleButton = {
let button = CircleButton()
button.backgroundColor = .customOrange
button.setBackgroundColor(.customOrangeHighlight, for: .highlighted)
button.layer.borderWidth = 0
button.tag = 2
button.addTarget(self, action: #selector(buttonClicked), for: .touchDown)
return button
}()
lazy var yellowCircle: CircleButton = {
let button = CircleButton()
button.backgroundColor = .customYellow
button.setBackgroundColor(.customYellowHighlight, for: .highlighted)
button.layer.borderWidth = 0
button.tag = 3
button.addTarget(self, action: #selector(buttonClicked), for: .touchDown)
return button
}()
lazy var greenCircle: CircleButton = {
let button = CircleButton()
button.backgroundColor = .customGreen
button.setBackgroundColor(.customGreenHighlight, for: .highlighted)
button.layer.borderWidth = 0
button.tag = 4
button.addTarget(self, action: #selector(buttonClicked), for: .touchDown)
return button
}()
lazy var blueCircle: CircleButton = {
let button = CircleButton()
button.backgroundColor = .customBlue
button.setBackgroundColor(.customBlueHighlight, for: .highlighted)
button.layer.borderWidth = 0
button.tag = 5
button.addTarget(self, action: #selector(buttonClicked), for: .touchDown)
return button
}()
lazy var purpleCircle: CircleButton = {
let button = CircleButton()
button.backgroundColor = .customPurple
button.setBackgroundColor(.customPurpleHighlight, for: .highlighted)
button.layer.borderWidth = 0
button.tag = 6
button.addTarget(self, action: #selector(buttonClicked), for: .touchDown)
return button
}()
// MARK: Add Subviews
func addSubviews() {
addSubview(mastermindLogo)
addSubview(scoreLabel)
addSubview(streakLabel)
addSubview(scoreNumberLabel)
addSubview(streakNumberLabel)
addSubview(rulesButton)
addSubview(infoButton)
addSubview(scoreboardButton)
addLayoutGuide(space1)
addLayoutGuide(space2)
addSubview(collectionView)
addSubview(redCircle)
addSubview(orangeCircle)
addSubview(yellowCircle)
addSubview(greenCircle)
addSubview(blueCircle)
addSubview(purpleCircle)
}
// MARK: INIT
override init(frame: CGRect) {
super.init(frame: frame)
self.backgroundColor = .customBackground
addSubviews()
LogoColors().self.setMastermindColors(logo: mastermindLogo)
// MARK: RECIEVE BUTTON CLICK AND DELEGATE
collectionView.buttonEventAction = { [unowned self] in
self.delegate?.sendGuess(userGuess : self.userGuess)
}
collectionView.hideCell = { [unowned self] in
self.hideCell()
}
}
// MARK: UPDATE CONSTRAINS
override func updateConstraints() {
mastermindLogo.autoPinEdge(toSuperviewEdge: .left, withInset: 32.0)
mastermindLogo.autoPinEdge(toSuperviewEdge: .top, withInset: 64.0)
scoreLabel.autoPinEdge(toSuperviewEdge: .top, withInset: 64.0)
scoreNumberLabel.autoPinEdge(toSuperviewEdge: .top, withInset: 64.0)
streakLabel.autoPinEdge(.top, to: .bottom, of: scoreLabel, withOffset: 5)
streakNumberLabel.autoPinEdge(.top, to: .bottom, of: scoreNumberLabel, withOffset: 5)
scoreNumberLabel.autoPinEdge(toSuperviewEdge: .right, withInset: 32.0)
streakNumberLabel.autoPinEdge(toSuperviewEdge: .right, withInset: 32.0)
scoreLabel.autoPinEdge(.right, to: .left, of: scoreNumberLabel, withOffset: -15)
streakLabel.autoAlignAxis(.vertical, toSameAxisOf: scoreLabel)
rulesButton.autoSetDimension(.height, toSize: 36.0)
infoButton.autoSetDimension(.height, toSize: 36.0)
scoreboardButton.autoSetDimension(.height, toSize: 36.0)
rulesButton.autoSetDimension(.width, toSize: 60.0)
infoButton.autoSetDimension(.width, toSize: 60.0)
scoreboardButton.autoSetDimension(.width, toSize: 120.0)
rulesButton.autoPinEdge(.top, to: .bottom, of: mastermindLogo, withOffset: 18)
rulesButton.autoPinEdge(toSuperviewEdge: .left, withInset: 32)
scoreboardButton.autoPinEdge(toSuperviewEdge: .right, withInset: 32)
space1.widthAnchor.constraint(equalTo: space2.widthAnchor).isActive = true
infoButton.centerYAnchor.constraint(equalTo: rulesButton.centerYAnchor).isActive = true
scoreboardButton.centerYAnchor.constraint(equalTo: rulesButton.centerYAnchor).isActive = true
rulesButton.trailingAnchor.constraint(equalTo: space1.leadingAnchor).isActive = true
infoButton.leadingAnchor.constraint(equalTo: space1.trailingAnchor).isActive = true
infoButton.trailingAnchor.constraint(equalTo: space2.leadingAnchor).isActive = true
scoreboardButton.leadingAnchor.constraint(equalTo: space2.trailingAnchor).isActive = true
collectionView.autoPinEdge(toSuperviewEdge: .leading, withInset: 48.0)
collectionView.autoPinEdge(toSuperviewEdge: .trailing, withInset: 48.0)
collectionView.autoPinEdge(.top, to: .bottom, of: infoButton, withOffset: 16.0)
collectionView.autoPinEdge(.bottom, to: .top, of: redCircle, withOffset: -16.0)
let colorRow: NSArray = [redCircle, orangeCircle, yellowCircle, greenCircle, blueCircle, purpleCircle]
if GameplayView.screenSize.height < GameplayView.tallheight {
NSLayoutConstraint.autoSetIdentifier("GamePlayView Small", forConstraints: {
colorRow.autoSetViewsDimension(.height, toSize: 32.0)
colorRow.autoSetViewsDimension(.width, toSize: 32.0)
colorRow.autoDistributeViews(along: .horizontal, alignedTo: .horizontal, withFixedSize: 32.0, insetSpacing: true)
})
} else {
NSLayoutConstraint.autoSetIdentifier("GamePlayView Big", forConstraints: {
colorRow.autoSetViewsDimension(.height, toSize: 40.0)
colorRow.autoSetViewsDimension(.width, toSize: 40.0)
colorRow.autoDistributeViews(along: .horizontal, alignedTo: .horizontal, withFixedSize: 40.0, insetSpacing: true)
})
}
redCircle.autoPinEdge(toSuperviewEdge: .bottom, withInset: 32.0)
super.updateConstraints() // Always at the bottom of the function
}
// MARK: CLICK COLOR BUTTON
@objc func buttonClicked(sender:UIButton) {
for i in 0...3 {
let indexCell = collectionView.cellForItem(at: IndexPath(item: i, section: activeRow))
if indexCell?.tag == 0 {
indexCell?.contentView.layer.borderWidth = 0
indexCell?.tag = sender.tag
switch sender.tag {
case 1:
indexCell?.contentView.backgroundColor = .customRed
userGuess[i] = 1
case 2:
indexCell?.contentView.backgroundColor = .customOrange
userGuess[i] = 2
case 3:
indexCell?.contentView.backgroundColor = .customYellow
userGuess[i] = 3
case 4:
indexCell?.contentView.backgroundColor = .customGreen
userGuess[i] = 4
case 5:
indexCell?.contentView.backgroundColor = .customBlue
userGuess[i] = 5
case 6:
indexCell?.contentView.backgroundColor = .customPurple
userGuess[i] = 6
default:
indexCell?.contentView.backgroundColor = .clear
userGuess[i] = 0
}
let currentIndex = i + (activeRow * 4)
guessBoard[currentIndex] = Int(sender.tag)
self.delegate?.sendBoard(guessBoard: guessBoard, currentGuess: userGuess)
checkIfFull()
break
}
}
}
// MARK: CHECK IF FULL
func checkIfFull() {
for i in 0...3 {
let indexCell = collectionView.cellForItem(at: IndexPath(item: i, section: activeRow))
if indexCell?.contentView.backgroundColor == .clear {
return
}
}
collectionView.cellForItem(at: IndexPath(item: 5, section: activeRow))!.isHidden = false
}
// MARK: HIDE GUESS BUTTON
func hideCell() {
collectionView.cellForItem(at: IndexPath(item: 5, section: activeRow))!.isHidden = true
}
// MARK: UPDATE DOTS
func updateDots(white : Int, black : Int) {
self.collectionView.white = white
self.collectionView.black = black
self.collectionView.updateCell = true
self.collectionView.performBatchUpdates({
self.collectionView.reloadItems(at: [IndexPath (item: 5, section: self.activeRow)])
}, completion: nil)
self.collectionView.cellForItem(at: IndexPath(item: 5, section: self.activeRow))?.isHidden = false
}
//MARK: UPDATE LABELS
func updateLabels(streak : Int, score : Int) {
if streak < 10 {
streakNumberLabel.text = "0" + String(streak)
} else {
streakNumberLabel.text = String(streak)
}
if score < 10 {
scoreNumberLabel.text = "0" + String(score)
} else {
scoreNumberLabel.text = String(score)
}
}
// MARK: UPDATE BOARD FROM FIREBASE
func updateBoard(guessboard : [Int], userGuess: [Int], dotboard : [Int]) {
self.userGuess = userGuess
for i in activeRow...9 {
let correspondingFirstPos = i * 4
let correspondingGuessPos : [Int] = [correspondingFirstPos, correspondingFirstPos + 1, correspondingFirstPos + 2, correspondingFirstPos + 3]
for j in 0...3 {
let indexCell = collectionView.cellForItem(at: IndexPath(item: j, section: i))
switch guessboard[correspondingGuessPos[j]] {
case 0:
indexCell?.contentView.backgroundColor = .clear
indexCell?.tag = 0
case 1:
indexCell?.contentView.backgroundColor = .customRed
indexCell?.contentView.layer.borderWidth = 0
indexCell?.tag = 1
case 2:
indexCell?.contentView.backgroundColor = .customOrange
indexCell?.contentView.layer.borderWidth = 0
indexCell?.tag = 2
case 3:
indexCell?.contentView.backgroundColor = .customYellow
indexCell?.contentView.layer.borderWidth = 0
indexCell?.tag = 3
case 4:
indexCell?.contentView.backgroundColor = .customGreen
indexCell?.contentView.layer.borderWidth = 0
indexCell?.tag = 4
case 5:
indexCell?.contentView.backgroundColor = .customBlue
indexCell?.contentView.layer.borderWidth = 0
indexCell?.tag = 5
case 6:
indexCell?.contentView.backgroundColor = .customPurple
indexCell?.contentView.layer.borderWidth = 0
indexCell?.tag = 6
default:
indexCell?.contentView.backgroundColor = .clear
indexCell?.tag = 0
}
}
}
if activeRow < 9 {
for i in activeRow + 1...9 {
collectionView.cellForItem(at: IndexPath(item: 5, section: i))!.isHidden = false
self.collectionView.updateCell = true
let correspondingFirstPos = i * 4
let correspondingGuessPos : [Int] = [correspondingFirstPos, correspondingFirstPos + 1, correspondingFirstPos + 2, correspondingFirstPos + 3]
var black = 0
var white = 0
for j in 0...3 {
if dotboard[correspondingGuessPos[j]] == 1 {
black += 1
} else if dotboard[correspondingGuessPos[j]] == 2 {
white += 1
}
}
collectionView.black = black
collectionView.white = white
self.collectionView.performBatchUpdates({
self.collectionView.reloadItems(at: [IndexPath (item: 5, section: i)])
}, completion: nil)
}
}
self.collectionView.updateCell = false
}
// MARK: RESET BOARD
func resetBoard(streak : Int, score : Int) {
activeRow = 9
collectionView.black = 0
collectionView.white = 0
collectionView.updateCell = false
guessBoard = Array(repeating: 0, count: 40)
for i in 0...9 {
collectionView.reloadSections([i])
}
collectionView.layoutIfNeeded()
updateLabels(streak: streak, score: score)
}
// MARK: PRESS RULES/INFO BUTTONS
@objc func clickRulesButton() {
delegate?.pressRulesButton()
}
@objc func clickInfoButton() {
delegate?.pressInfoButton()
}
@objc func clickScoreboardButton() {
delegate?.pressScoreboardButton()
}
// MARK: REQUIRED INIT
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
| [
-1
] |
c47abb44418235723ad003b0551828bc6c77c9bc | fa594060e7538d0528014a084dc619ac87f8f730 | /项目测试/按钮测试/按钮测试/AppDelegate.swift | ff281fc034396faf78b74192c760fbb58f262619 | [] | no_license | ananlab/NSURLSession-Download | d5ad2f90ee3752f1ccab1bed1eba0f50a068dc1f | a9e3e5197cd9b24587ca6f93b367ccf6cb9f62ab | refs/heads/master | 2021-01-22T21:07:58.701178 | 2015-08-13T15:47:38 | 2015-08-13T15:47:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 6,108 | swift | //
// AppDelegate.swift
// 按钮测试
//
// Created by goofygao on 15/3/16.
// Copyright (c) 2015年 goofygao. All rights reserved.
//
import UIKit
import CoreData
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> 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 throttle down OpenGL ES frame rates. 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 inactive 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:.
// Saves changes in the application's managed object context before the application terminates.
self.saveContext()
}
// MARK: - Core Data stack
lazy var applicationDocumentsDirectory: NSURL = {
// The directory the application uses to store the Core Data store file. This code uses a directory named "ga.goofy.____" in the application's documents Application Support directory.
let urls = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)
return urls[urls.count-1] as! NSURL
}()
lazy var managedObjectModel: NSManagedObjectModel = {
// The managed object model for the application. This property is not optional. It is a fatal error for the application not to be able to find and load its model.
let modelURL = NSBundle.mainBundle().URLForResource("____", withExtension: "momd")!
return NSManagedObjectModel(contentsOfURL: modelURL)!
}()
lazy var persistentStoreCoordinator: NSPersistentStoreCoordinator? = {
// The persistent store coordinator for the application. This implementation creates and return a coordinator, having added the store for the application to it. This property is optional since there are legitimate error conditions that could cause the creation of the store to fail.
// Create the coordinator and store
var coordinator: NSPersistentStoreCoordinator? = NSPersistentStoreCoordinator(managedObjectModel: self.managedObjectModel)
let url = self.applicationDocumentsDirectory.URLByAppendingPathComponent("____.sqlite")
var error: NSError? = nil
var failureReason = "There was an error creating or loading the application's saved data."
if coordinator!.addPersistentStoreWithType(NSSQLiteStoreType, configuration: nil, URL: url, options: nil, error: &error) == nil {
coordinator = nil
// Report any error we got.
var dict = [String: AnyObject]()
dict[NSLocalizedDescriptionKey] = "Failed to initialize the application's saved data"
dict[NSLocalizedFailureReasonErrorKey] = failureReason
dict[NSUnderlyingErrorKey] = error
error = NSError(domain: "YOUR_ERROR_DOMAIN", code: 9999, userInfo: dict)
// Replace this with code to handle the error appropriately.
// abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
NSLog("Unresolved error \(error), \(error!.userInfo)")
abort()
}
return coordinator
}()
lazy var managedObjectContext: NSManagedObjectContext? = {
// Returns the managed object context for the application (which is already bound to the persistent store coordinator for the application.) This property is optional since there are legitimate error conditions that could cause the creation of the context to fail.
let coordinator = self.persistentStoreCoordinator
if coordinator == nil {
return nil
}
var managedObjectContext = NSManagedObjectContext()
managedObjectContext.persistentStoreCoordinator = coordinator
return managedObjectContext
}()
// MARK: - Core Data Saving support
func saveContext () {
if let moc = self.managedObjectContext {
var error: NSError? = nil
if moc.hasChanges && !moc.save(&error) {
// Replace this implementation with code to handle the error appropriately.
// abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
NSLog("Unresolved error \(error), \(error!.userInfo)")
abort()
}
}
}
}
| [
283144,
277514,
277003,
280085,
278551,
278042,
276510,
281635,
194085,
277030,
228396,
277038,
223280,
278577,
280132,
282203,
189025,
292450,
285796,
279148,
278125,
285296,
227455,
278656,
228481,
276611,
226440,
278665,
280205,
225934,
188050,
278674,
276629,
283803,
278687,
282274,
277154,
278692,
228009,
287402,
227499,
278700,
278705,
276149,
278711,
279223,
278718,
283838,
228544,
279753,
229068,
227533,
160973,
164566,
201439,
278751,
226031,
157956,
203532,
181516,
277262,
276751,
278287,
278289,
278801,
276755,
321296,
284432,
278808,
278297,
282910,
282915,
281379,
280370,
277306,
278844,
280382,
282433,
277826,
164166,
226634,
276313,
278877,
280415,
277344,
276321,
227687,
279405,
278896,
277363,
275828,
281972,
278902,
280439,
276347,
228220,
213886,
279422,
278916,
293773,
284557,
191374,
288147,
214934,
277912,
276892,
278943,
282016,
230320,
230322,
281011,
286130,
277941,
283058,
276923,
278971,
282558,
299970,
280007,
288200,
284617,
287689,
286157,
281041,
283091,
282075,
294390,
282616
] |
5e42d6e6a2f496de2fcc8877b9e99c3095fa0ee3 | 6828a4c7b60c40d2f47050041857cad55e76251a | /SEM/Controllers/FlowLogin/CreatePassword/CreatePasswordPresenter.swift | 12c049b8b5452df3d084813a505603e7692d1382 | [] | no_license | IpHuu/SEM | 029859a0b572208bea5c7b5471c2ac052a015c69 | 01eaa4d5a61d7e7b6208284549810fdf5f9c3044 | refs/heads/master | 2020-04-24T14:48:41.032871 | 2019-02-22T10:03:29 | 2019-02-22T10:03:29 | 172,038,389 | 0 | 0 | null | 2019-02-22T10:03:30 | 2019-02-22T09:38:37 | Swift | UTF-8 | Swift | false | false | 1,071 | swift | //
// CreatePasswordPresenter
// SEM
//
// Created by Ip Man on 12/17/18.
// Copyright © 2018 Ip Man. All rights reserved.
//
import UIKit
protocol CreatePasswordPresenterOutput {
func presentLoading(_ isLoading: Bool)
func presentAlert(message: String)
func presentError(error: APIError)
func presentRegisterSuccess(objectData: CustomerObject)
func presentForgotPasswordSuccess()
}
class CreatePasswordPresenter {
var output: CreatePasswordPresenterOutput!
}
extension CreatePasswordPresenter: CreatePasswordInteractorOutput{
func needPresentLoading(_ isLoading: Bool){
output.presentLoading(isLoading)
}
func needPresentAlert(message: String){
output.presentAlert(message: message)
}
func needPresentError(error: APIError){
output.presentError(error: error)
}
func needPresentRegisterSuccess(objectData: CustomerObject){
output.presentRegisterSuccess(objectData: objectData)
}
func needPresentForgotPasswordSuccess(){
output.presentForgotPasswordSuccess()
}
}
| [
-1
] |
dcd1ce17bed907966e68695b1712569336b9439c | 8aaac2e12c38f2d9a3f977829c53dd1045575f94 | /OnTheMapTests/OnTheMapTests.swift | ef31df6ccaabf90634d6f1435c24c1fbb300c317 | [] | no_license | mhorga/OnTheMap | 907bc5af5ec37c81688095cba2ff3d0038318a0f | 4a19b2210b93f18811525a33eed922b31d333775 | refs/heads/master | 2020-07-03T10:29:09.040836 | 2015-11-04T11:13:00 | 2015-11-04T11:13:00 | 41,064,434 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 953 | swift | //
// OnTheMapTests.swift
// OnTheMapTests
//
// Created by Marius Horga on 8/7/15.
// Copyright © 2015 Marius Horga. All rights reserved.
//
import XCTest
class OnTheMapTests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measureBlock {
// Put the code you want to measure the time of here.
}
}
}
| [
305179,
278558,
307231,
313375,
102437,
227370,
360491,
309295,
276534,
159807,
286788,
280649,
223316,
315476,
223318,
288857,
227417,
194656,
309345,
227428,
276582,
276589,
278638,
227439,
131189,
223350,
292992,
141450,
215178,
311435,
311438,
276627,
276632,
196773,
129203,
299187,
131256,
280762,
223419,
299198,
309444,
276682,
280802,
233715,
157944,
211193,
168188,
309529,
278810,
299293,
282913,
282919,
262450,
315706,
311621,
280902,
227658,
276813,
282960,
6481,
6482,
311636,
6489,
323935,
276835,
321894,
416104,
276847,
285040,
280961,
227725,
178578,
190871,
293274,
61857,
61859,
278961,
278965,
293303,
276920,
33211,
276925,
278978,
281037,
281040,
278993,
287198,
227809,
358882,
227813,
279013,
279022,
281072,
279039,
301571,
276998,
287241,
279050,
186893,
303631,
223767,
223769,
291358,
293419,
277048,
295519,
66150,
277094,
277101,
287346,
277111,
279164,
291454,
184962,
303746,
152203,
277133,
133774,
230040,
285353,
205487,
285361,
303793,
299699,
293556,
342706,
158394,
285371,
199366,
225997,
226004,
203477,
279252,
226007,
226019,
279269,
285415,
342762,
277227,
230134,
234234,
279294,
234241,
209670,
226058,
234250,
234253,
234263,
234268,
234277,
279336,
289576,
234283,
234286,
234289,
234294,
230199,
162621,
234301,
289598,
281408,
293693,
295746,
162626,
277316,
234311,
234312,
299849,
234317,
277325,
293711,
234323,
234326,
234331,
301918,
279392,
349026,
234340,
234343,
234346,
234355,
277366,
234360,
279417,
209785,
177019,
234361,
277370,
234366,
234367,
158593,
234372,
226181,
113542,
213894,
226184,
277381,
228234,
295824,
234386,
234387,
234392,
324507,
277403,
234400,
279456,
234404,
289703,
234409,
275371,
236461,
234419,
234425,
289722,
234427,
287677,
234430,
234436,
234438,
52172,
234444,
234445,
183248,
234451,
234454,
234457,
234463,
234466,
277479,
234472,
234473,
234477,
234482,
287731,
277492,
314355,
312314,
234498,
234500,
277509,
277510,
230410,
234506,
277523,
293910,
230423,
197657,
281625,
281626,
175132,
234531,
234534,
310317,
234542,
234548,
302139,
234555,
238651,
277563,
230463,
234560,
207938,
234565,
234569,
300111,
234577,
296019,
234583,
234584,
230499,
281700,
300135,
275565,
156785,
312434,
275571,
300151,
234616,
398457,
234622,
300158,
285828,
302213,
253063,
234632,
275591,
234642,
308372,
119963,
234656,
330913,
306338,
234659,
234663,
275625,
300201,
238769,
226481,
208058,
277690,
230588,
283840,
279747,
279760,
290000,
189652,
279774,
363744,
195811,
298212,
304356,
279792,
298228,
204022,
234742,
228600,
208124,
292107,
277792,
339234,
199971,
304421,
277800,
113966,
226608,
300343,
226624,
15686,
226632,
294218,
177484,
222541,
296273,
314709,
283991,
357719,
218462,
224606,
142689,
230756,
163175,
281962,
284014,
181625,
281992,
230799,
112017,
306579,
310692,
279974,
282024,
279989,
296375,
296387,
415171,
163269,
296391,
300487,
280013,
312782,
284116,
226781,
310757,
316902,
296425,
306677,
300542,
294400,
296448,
282114,
306693,
192010,
149007,
65041,
282136,
204313,
230943,
278060,
286254,
194110,
276040,
366154,
276045,
286288,
280147,
300630,
147036,
243292,
282213,
317032,
222832,
276085,
188031,
192131,
229001,
310923,
282259,
276120,
276126,
282273,
282276,
278191,
198324,
286388,
296628,
218819,
276173,
302797,
212688,
302802,
286423,
216795,
276195,
153319,
313065,
280300,
419569,
276210,
276219,
194303,
288512,
311042,
288516,
276238,
294678,
284442,
278299,
276253,
159533,
276282,
276283,
276287,
345919,
276294,
282438,
276298,
216918,
307031,
237408,
282474,
288619,
276344,
194429,
184208,
40853,
44952,
247712,
300963,
294823,
276408,
290746,
276421,
276430,
231375,
153554,
276444,
280541,
276454,
276459,
296941
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.