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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a9655341ee3aa2094312421ea1800fc6ad4f4774 | c6b0c5b3deea835463c5e9d957070474aedc3625 | /ExpertConnect/Modules/Login/Auth/ForgotPassword/ApiDataManager/FPApiDataManager.swift | 15f238b9e29bd55987d8f0cf9960524bbc88aef8 | [] | no_license | ashish0401/ExpertConnect-IOSBase | 61b9f8ca9835201e4710553630d042a8dc5c5e3e | 5f39e1b36eb724c8ee71766ff718d1c97f7ca38b | refs/heads/master | 2021-01-12T00:22:42.032239 | 2018-06-15T08:59:14 | 2018-06-15T08:59:14 | 78,709,447 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,346 | swift | //
// ApiDataManager.swift
// ExpertConnect
//
// Created by Nadeem on 23/11/16.
// Copyright © 2016 user. All rights reserved.
//
import Foundation
import SwiftyJSON
final class FPApiDataManager: FPProtocols {
init() {}
func getStatusAndMessage(callback: @escaping (ECallbackResultType) -> Void) {
do {
let api: ApiServiceProtocol = ApiService()
let url: String = try api.constructApiEndpoint(base: "http://114.143.177.218/expert_connect", params: "forget_password.php")
let headers = try api.constructHeader(withCsrfToken: true, cookieDictionary: nil)
let parameters = ["email_id":"[email protected]"] as [String : Any]
let apiConverter = FPApiModelConverter()
//api.create(url: url, parameters: model, headers: headers, callback: callback)
api.create(url,
parameters: parameters as [String : AnyObject]?,
headers: headers, converter: { (json) -> AnyObject in
return apiConverter.fromJson(json: json) as FPOutputDomainModel},
callback: callback)
} catch {
// Change it with the real error
callback(.Failure(.UnknownError))
}
}
}
| [
-1
] |
d8d9719b70a8871cd2e5ba89bb5505b2bf4d99e6 | 082bf215d0af4042de3c94620cda09857a28975f | /MyVersionControlUITests/MyVersionControlUITests.swift | 3def75b4aa466e05e35214f236c548dd497b9f89 | [] | no_license | Saranragu/MyVersionControl_v0.1 | 97dd04fdd786136bb9cce5900d8a9ddd4b3b9a3d | f48c3753bd301184f70120adb8d3888c7242377f | refs/heads/main | 2023-08-25T20:49:09.195647 | 2021-11-05T11:42:02 | 2021-11-05T11:42:02 | 424,934,721 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,440 | swift | //
// MyVersionControlUITests.swift
// MyVersionControlUITests
//
// Created by Saravanan R on 05/11/21.
//
import XCTest
class MyVersionControlUITests: XCTestCase {
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() throws {
// UI tests must launch the application that they test.
let app = XCUIApplication()
app.launch()
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testLaunchPerformance() throws {
if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) {
// This measures how long it takes to launch your application.
measure(metrics: [XCTApplicationLaunchMetric()]) {
XCUIApplication().launch()
}
}
}
}
| [
346117,
182277,
354310,
354312,
243720,
354311,
313356,
360463,
419857,
358418,
155665,
153618,
305173,
241695,
223269,
178215,
346153,
344106,
102441,
253996,
315433,
325675,
313388,
354346,
282671,
243763,
241717,
385078,
180279,
249912,
352314,
213051,
376892,
32829,
286787,
403524,
288835,
307269,
352327,
237638,
313415,
239689,
233548,
368717,
333902,
311373,
196687,
278607,
311377,
329812,
223317,
53334,
254039,
315477,
200795,
368732,
180317,
356446,
323678,
280676,
313446,
32871,
176231,
352359,
233578,
194667,
278637,
288878,
319599,
260206,
376945,
385135,
284789,
131190,
249976,
346237,
215165,
131199,
168069,
168070,
381071,
333968,
241809,
436372,
153752,
329884,
49308,
192670,
192671,
299166,
362658,
311459,
215204,
258213,
333990,
299176,
323761,
184498,
180409,
295099,
227517,
268479,
133313,
338118,
374984,
299208,
254157,
346319,
368849,
368850,
301270,
229591,
385240,
301271,
258263,
254171,
379102,
147679,
147680,
334049,
311520,
325857,
356575,
307431,
383208,
338151,
317676,
286957,
254189,
149743,
254193,
372979,
381173,
395511,
344312,
356603,
313595,
184574,
375040,
309504,
217352,
338187,
338188,
368908,
180494,
194832,
325904,
368915,
254228,
272661,
338196,
319764,
61720,
278805,
282908,
389406,
282912,
233761,
186660,
251212,
334121,
254250,
338217,
317738,
325930,
311596,
321839,
336177,
315698,
332084,
180534,
362809,
127292,
155968,
268609,
287040,
332100,
311622,
227655,
368969,
323914,
254285,
383309,
180559,
201037,
344402,
348499,
250196,
348501,
229716,
289109,
368982,
272730,
332128,
391521,
215395,
366948,
239973,
416103,
280938,
242027,
242028,
321901,
383338,
160111,
362864,
354671,
250227,
354678,
199030,
315768,
139641,
291193,
223611,
211327,
291200,
340356,
227721,
242059,
395660,
106893,
285074,
225684,
252309,
240020,
190870,
190872,
291225,
213402,
39323,
285083,
385437,
317851,
285089,
289185,
436644,
254373,
156069,
385449,
375211,
289195,
334259,
342454,
385463,
338359,
319931,
358844,
293309,
278974,
336319,
317889,
326083,
336323,
188870,
129484,
278988,
281038,
281039,
278992,
289229,
326093,
176602,
242138,
256476,
285152,
291297,
369121,
369124,
279014,
270823,
279017,
201195,
311787,
334315,
360945,
375281,
279030,
293368,
279033,
377337,
254459,
317949,
324098,
279042,
233987,
377352,
334345,
432650,
309770,
340489,
342537,
279053,
385554,
283154,
303635,
342549,
420374,
254487,
279060,
279061,
279066,
258584,
322077,
377374,
291359,
342560,
348709,
348710,
358951,
358952,
293420,
197166,
219694,
219695,
289328,
283185,
330291,
375345,
234037,
244279,
340539,
259408,
352831,
348741,
309831,
322119,
377419,
348748,
303693,
301647,
385620,
115287,
189016,
191065,
244311,
332379,
270938,
436831,
287327,
242274,
375396,
279143,
373357,
279150,
176751,
287345,
346739,
346741,
352885,
352886,
356983,
244345,
356984,
344697,
356990,
189054,
287359,
291455,
297600,
152196,
369285,
356998,
348807,
356999,
166533,
344714,
311944,
334473,
316044,
311950,
377487,
326288,
311953,
287379,
336531,
346771,
363155,
352921,
363161,
289435,
377499,
221853,
344737,
285348,
340645,
295591,
176810,
352938,
248494,
279215,
293552,
295598,
279218,
285362,
164532,
336565,
166581,
342705,
160441,
342714,
287418,
303802,
355006,
377536,
66243,
291529,
287434,
225996,
363212,
359166,
135888,
242385,
279249,
303826,
369365,
369366,
385751,
230105,
361178,
363228,
322269,
352989,
352990,
338658,
295653,
342757,
289511,
230120,
234216,
361194,
346859,
330473,
373485,
373486,
330476,
289517,
215790,
312046,
342775,
199415,
348921,
234233,
242428,
344829,
279293,
205566,
35584,
375552,
289534,
299777,
322302,
228099,
285443,
162559,
322312,
346889,
285450,
312076,
326413,
295698,
166677,
207639,
285467,
326428,
221980,
363295,
344864,
234276,
336678,
318247,
262952,
318251,
342827,
189229,
262957,
164655,
328495,
234290,
152372,
336693,
191285,
230198,
355129,
375610,
301883,
160569,
342846,
355136,
222017,
355138,
295745,
377669,
420680,
283466,
355147,
355148,
416591,
369488,
355153,
281426,
279379,
244569,
234330,
281434,
295769,
363353,
252766,
230238,
127840,
363361,
363362,
357219,
275294,
355173,
355174,
279393,
342888,
293729,
281444,
303973,
207724,
385901,
279398,
351078,
207728,
177002,
308075,
355182,
201590,
295799,
177018,
211835,
336765,
314240,
340865,
291713,
254851,
260995,
369541,
158594,
330627,
240517,
320394,
236427,
252812,
349068,
316299,
234382,
308111,
308113,
224146,
349066,
256918,
256919,
256920,
430999,
369383,
209820,
240543,
211871,
359332,
359333,
256934,
293801,
326571,
140203,
252848,
381872,
177074,
304050,
326580,
289720,
326586,
289723,
189373,
330688,
349122,
359365,
363462,
19398,
345030,
127945,
211913,
326602,
345034,
279499,
252878,
342990,
433104,
56270,
359380,
191445,
386007,
418781,
207839,
340960,
347104,
359391,
340967,
123880,
314343,
343020,
383980,
234476,
248815,
203758,
320495,
347122,
257007,
349176,
201721,
214009,
312313,
349179,
328701,
312317,
257023,
328705,
171009,
418819,
357380,
234499,
330759,
230411,
347150,
361487,
384015,
330766,
254997,
293911,
326684,
252959,
384031,
336928,
336930,
330789,
357413,
248871,
357420,
281647,
345137,
361522,
318515,
312372,
203829,
238646,
300087,
238650,
320571,
386108,
21567,
308288,
336962,
257093,
404550,
349254,
238663,
250955,
361547,
300109,
207954,
234578,
250965,
339031,
205911,
156763,
361570,
214116,
253028,
250982,
214119,
230500,
322664,
257126,
279659,
62574,
351343,
173168,
357487,
187505,
230514,
238706,
187508,
279666,
300147,
312435,
119925,
302202,
363643,
285819,
343166,
285823,
248960,
234626,
349315,
349317,
279686,
222344,
285833,
285834,
234635,
228492,
318602,
337037,
386191,
140426,
363658,
253074,
326803,
187539,
347286,
359574,
429209,
285850,
222364,
351389,
339101,
234655,
302239,
265381,
234662,
3243,
208044,
302251,
322733,
367791,
367792,
373937,
324790,
367798,
300215,
339131,
64699,
294075,
343230,
228541,
367809,
283841,
148674,
253124,
283846,
259275,
148687,
189651,
316628,
259285,
351445,
279766,
189656,
357594,
339167,
310496,
298209,
304353,
195809,
279780,
222441,
279789,
253168,
386288,
351475,
251124,
316661,
369912,
52473,
363769,
369913,
52476,
386296,
208123,
279803,
386304,
351489,
292092,
369929,
322826,
242955,
349458,
126229,
367897,
367898,
320795,
115997,
363354,
320802,
130342,
304422,
130344,
130347,
257323,
353581,
116014,
66863,
369964,
292145,
298290,
208179,
312628,
345397,
345398,
159033,
222523,
347451,
193853,
193858,
359747,
359748,
294210,
372039,
257353,
345418,
257354,
109899,
337226,
230730,
337228,
296269,
353617,
222542,
331091,
150868,
234830,
238928,
296274,
314708,
283990,
357720,
300378,
300379,
230757,
281958,
253288,
306541,
234864,
296304,
312688,
327030,
163190,
382329,
224637,
357758,
337280,
243073,
357763,
253316,
294278,
388488,
263561,
296328,
296330,
298378,
318860,
353672,
9618,
112019,
279955,
306580,
234902,
370072,
282008,
253339,
318876,
282013,
290206,
253340,
343457,
353611,
148899,
148900,
298406,
353612,
245160,
333224,
241067,
314797,
355761,
251314,
359860,
359861,
284086,
343480,
259513,
134586,
310714,
228796,
216510,
54719,
216511,
380350,
292291,
228804,
306630,
361928,
200136,
300490,
339403,
372172,
306634,
310731,
337359,
329168,
312785,
327122,
329170,
222674,
353751,
280025,
310747,
239069,
3557,
361958,
3559,
310758,
280042,
280043,
191980,
329198,
300526,
337391,
259569,
282097,
251379,
296434,
253431,
300539,
288252,
210429,
359931,
343552,
366081,
290304,
245249,
228868,
372226,
198155,
323083,
359949,
294413,
329231,
253456,
304655,
323088,
208397,
302613,
253462,
316951,
175640,
370200,
374297,
146976,
222754,
157219,
157220,
372261,
245290,
347693,
312879,
323120,
288305,
323126,
343606,
374327,
210489,
290359,
134715,
323132,
235069,
425534,
288319,
138817,
288322,
147011,
280131,
349764,
282182,
288328,
292424,
292426,
147020,
128589,
333389,
353875,
349780,
290391,
196184,
128600,
235096,
306777,
212574,
343646,
204386,
300643,
300645,
155238,
415334,
312937,
204394,
138862,
54895,
206447,
310896,
294517,
314997,
366198,
42616,
290425,
339579,
337533,
210558,
210559,
325246,
280193,
370307,
149127,
149128,
288391,
282248,
224907,
286351,
188049,
239251,
345753,
323226,
229021,
259741,
198304,
255651,
245413,
282279,
375644,
364202,
202413,
286387,
337590,
370359,
286392,
224951,
302778,
306875,
280252,
280253,
282302,
323262,
286400,
321217,
259780,
333508,
239305,
296649,
333522,
313042,
286419,
345813,
241366,
370390,
224985,
282330,
345817,
294621,
245471,
325345,
294629,
337638,
333543,
181992,
345832,
372458,
345835,
288492,
141037,
325357,
212721,
323315,
431861,
286457,
284410,
313082,
200444,
288508,
286463,
319232,
360194,
288515,
175874,
249606,
284425,
116491,
216844,
282379,
284430,
300812,
372497,
116502,
169751,
345882,
341791,
339746,
186148,
255781,
186149,
257831,
216868,
241447,
362281,
294699,
284460,
153392,
282418,
182070,
182071,
345910,
319289,
204600,
360253,
345918,
325444,
337734,
339782,
153416,
325449,
315209,
159563,
280396,
341837,
272207,
272208,
337746,
325460,
237397,
341846,
339799,
345942,
362326,
368471,
300893,
370526,
307038,
362336,
259937,
345950,
255844,
276326,
282471,
296807,
292713,
40809,
368489,
362351,
214896,
292719,
313200,
325491,
313204,
341878,
333687,
350072,
360315,
339840,
182145,
280451,
253828,
325508,
243590,
333700,
327556,
67464,
305032,
350091,
350092,
325514,
311183,
282517,
350102,
294806,
337816,
294808,
329627,
253851,
350108,
239515,
333727,
298912,
319393,
354210,
294820,
118693,
219046,
284584,
313257,
362411,
370604,
292783,
126896,
362418,
300983,
188349,
98240,
280517,
362442,
346066,
212947,
231382,
212953,
372699,
354268,
219102,
329696,
354273,
360416,
323554,
6116,
292835,
354279,
294887,
317416,
174058,
247787,
253930,
329707,
354283,
247786,
296942,
337899,
327666,
325620,
239610
] |
2326fb6ecaf0ca8add0a8f35f5f97ea6116ff878 | 33f9f3115bb736cf9f1f7799edc080eaee5144bb | /SpeedNumber/Extension/TimeInterval+Score.swift | 1d223f295cd4e8ae6d5bf1fe63c0f8ac5c28ca1e | [] | no_license | ivangodfather/SpeedNumber | 7ebc13535b89349cefade878d0cf9040c82b5d2a | 031eba24f0323125e69d6145f8d616cb667e9f9b | refs/heads/master | 2021-05-20T08:25:54.517391 | 2020-10-26T08:19:20 | 2020-10-26T08:19:20 | 252,194,407 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 274 | swift | //
// TimeInterval+Score.swift
// SpeedNumber
//
// Created by Ivan Ruiz Monjo on 02/04/2020.
// Copyright © 2020 Ivan Ruiz Monjo. All rights reserved.
//
import Foundation
extension TimeInterval {
var score: String {
String(format: "%.2f", self)
}
}
| [
-1
] |
d624d592b08ac4a687ae6005df99ce1b3f837efb | 5c9eae3def7feb2658991dc6f77604350ad5099f | /FoodTracker/RatingControl.swift | dd94afc60b6ffa909dbc3583c70867ddfe416d2f | [] | no_license | daniel-jin/FoodTracker | 1162fa5fa24800ae5302a88aa479106663746e73 | cf653a488a3aa6fd2826856f49ff332c0c239ca9 | refs/heads/master | 2021-06-24T06:57:26.374363 | 2017-09-11T03:30:27 | 2017-09-11T03:30:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,530 | swift | //
// RatingControl.swift
// FoodTracker
//
// Created by Daniel Jin on 9/10/17.
// Copyright © 2017 Apple Inc. All rights reserved.
//
import UIKit
@IBDesignable class RatingControl: UIStackView {
//MARK: Properties
private var ratingButtons = [UIButton]()
var rating = 0 {
didSet {
updateButtonSelectionStates()
}
}
@IBInspectable var starSize: CGSize = CGSize(width: 44.0, height: 44.0) {
didSet {
setupButtons()
}
}
@IBInspectable var starCount: Int = 5 {
didSet {
setupButtons()
}
}
//MARK: Initialization
override init(frame: CGRect) {
super.init(frame: frame)
setupButtons()
}
required init(coder: NSCoder) {
super.init(coder: coder)
setupButtons()
}
//MARK: Button Action
func ratingButtonTapped(button: UIButton) {
guard let index = ratingButtons.index(of: button) else {
fatalError("The button, \(button), is not in the ratingButtons array: \(ratingButtons)")
}
// Calculate the rating of the selected button
let selectedRating = index + 1
if selectedRating == rating {
// If the selected star represents the current rating, reset the rating to 0.
rating = 0
} else {
// Otherwise set the rating to the selected star
rating = selectedRating
}
}
//MARK: Private methods
private func setupButtons() {
// clear any existing buttons
for button in ratingButtons {
removeArrangedSubview(button)
button.removeFromSuperview()
}
ratingButtons.removeAll()
// Load Button Images
let bundle = Bundle(for: type(of: self))
let filledStar = UIImage(named: "filledStar", in: bundle, compatibleWith: self.traitCollection)
let emptyStar = UIImage(named:"emptyStar", in: bundle, compatibleWith: self.traitCollection)
let highlightedStar = UIImage(named:"highlightedStar", in: bundle, compatibleWith: self.traitCollection)
for index in 0..<starCount {
// Create the button
let button = UIButton()
// Set the button images
button.setImage(emptyStar, for: .normal)
button.setImage(filledStar, for: .selected)
button.setImage(highlightedStar, for: .highlighted)
button.setImage(highlightedStar, for: [.highlighted, .selected])
// Add constraints
button.translatesAutoresizingMaskIntoConstraints = false
button.heightAnchor.constraint(equalToConstant: starSize.height).isActive = true
button.widthAnchor.constraint(equalToConstant: starSize.width).isActive = true
// Set the accessibility label
button.accessibilityLabel = "Set \(index + 1) star rating"
// Setup the button action
button.addTarget(self, action: #selector(RatingControl.ratingButtonTapped(button:)), for: .touchUpInside)
// Add the button to the stack
addArrangedSubview(button)
// Add the new button to the rating button array
ratingButtons.append(button)
}
updateButtonSelectionStates()
}
private func updateButtonSelectionStates() {
for (index, button) in ratingButtons.enumerated() {
// If the index of a button is less than the rating, that button should be selected.
button.isSelected = index < rating
// Set the hint string for the currently selected star
let hintString: String?
if rating == index + 1 {
hintString = "Tap to reset the rating to zero."
} else {
hintString = nil
}
// Calculate the value string
let valueString: String
switch (rating) {
case 0:
valueString = "No rating set."
case 1:
valueString = "1 star set."
default:
valueString = "\(rating) stars set."
}
// Assign the hint string and value string
button.accessibilityHint = hintString
button.accessibilityValue = valueString
}
}
}
| [
301920,
293345,
190402,
217187,
293665,
304105,
292142,
306990,
314420,
243349,
304054,
298713
] |
fc9df6ca9b73abc885e0ba7f412e760f6e632836 | 2c3058277a8428c917dc1bb5e64cde3f01cacdd5 | /ScrumPoker/View/Vote/VoteController.swift | 7f1532a433ed7b4fe0ef4ca54179479587af42d7 | [] | no_license | intellitour/ScrumPoker | 7eeb6ca68fbdd0df7d83a5a0a99811436caf9533 | f9fa6f719cac7fa76829c97ac9905bd69b2644e9 | refs/heads/main | 2023-09-05T13:34:20.082967 | 2021-11-08T19:55:45 | 2021-11-08T19:55:45 | 425,973,828 | 0 | 0 | null | 2021-11-08T19:51:35 | 2021-11-08T19:51:35 | null | UTF-8 | Swift | false | false | 1,767 | swift | //
// VoteController.swift
// ScrumPoker
//
// Created by Wesley Marra on 06/11/21.
//
import UIKit
import RxSwift
import RxSwiftExt
import RxRelay
protocol VoteToPresenter: AnyObject {
var voteObserver: Observable<Vote> { get }
func setLoading(_ loading: Bool)
}
class VoteController: UIViewController {
var voteBehavior = BehaviorRelay<Vote?>(value: nil)
var presenter: VotePresenterToView!
let disposeBag = DisposeBag()
private var vote: Vote?
@IBOutlet weak var activityIndicator: UIActivityIndicatorView!
@IBOutlet weak var storyField: UITextField!
@IBOutlet weak var developerField: UITextField!
@IBOutlet weak var pointsField: UITextField!
@IBAction func onRegisterVote(_ sender: UIButton) {
guard let story = storyField.text,
let developer = developerField.text,
let points = pointsField.text else { return }
voteBehavior.accept(Vote(idEstoria: Int(story), idDesenvolvedor: Int(developer), pontos: Int(points)))
}
override func viewDidLoad() {
super.viewDidLoad()
presenter.viewDidLoad()
bind()
}
private func bind() {
presenter.registeredVote.bind { [weak self] vote in
self?.vote = vote
self?.showToast(message: "Voto computado com sucesso!")
}
.disposed(by: disposeBag)
}
}
extension VoteController: VoteToPresenter {
var voteObserver: Observable<Vote> {
return voteBehavior.unwrap().asObservable()
}
func setLoading(_ loading: Bool) {
if loading {
self.activityIndicator.startAnimating()
} else {
self.activityIndicator.stopAnimating()
}
}
}
| [
-1
] |
b496482bf63e3df9572f55c730b914f7bbed38ab | 6d31b12ff30a9faf5badd7871c4cd38add2cc535 | /Twrendings/Preview Content/Preview Assets.xcassets/locations.dataset/CollectionViewDemo/CollectionViewDemo/Album.swift | abf3d6a490d29b8c1311d70942b4fdc3e5c3b5b2 | [] | no_license | RamoneHsu/Twrendings | 0e42d9a30ab85c1ba9cf0bad160dc623db515577 | 976db9441dcc03aa657b77f99e0ea2a928047f02 | refs/heads/master | 2021-01-14T01:31:14.295976 | 2020-02-23T17:13:15 | 2020-02-23T17:13:15 | 242,557,200 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 256 | swift | //
// Album.swift
// CollectionViewDemo
//
// Created by SHIH-YING PAN on 2020/1/20.
// Copyright © 2020 SHIH-YING PAN. All rights reserved.
//
import Foundation
struct Album {
var name: String
var singer: String
var imageName: String
}
| [
-1
] |
a0bffc5888c7dc31351aa17a15f1199c3bbd6155 | 4d2202100f944c7bb8eda8cbaecce71fcfbd0aea | /Culinary/ViewControllers/Other/Dishes/ViewModel/DishFeedViewModel.swift | 69cd5b603604dbe054f1bc4b52adc57dfd4be845 | [] | no_license | snazarovone/Culinarium | db8193711ad8bc2f4fd48a881ed6ff6a75323a44 | 43be43eef64351c38e00fd974671baa8c31fdc4a | refs/heads/master | 2022-11-19T01:02:08.120538 | 2020-07-24T18:42:51 | 2020-07-24T18:42:51 | 282,286,827 | 2 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 934 | swift | //
// DishFeedViewModel.swift
// Culinary
//
// Created by Sergey Nazarov on 28.02.2020.
// Copyright © 2020 Sergey Nazarov. All rights reserved.
//
import Foundation
import RxSwift
import RxCocoa
class DishFeedViewModel: DishFeedViewModelType{
private var dishesMainInfo: BehaviorRelay<[DishMainInfo]> = BehaviorRelay(value: [])
init(dishesMainInfo: BehaviorRelay<[DishMainInfo]>){
self.dishesMainInfo = dishesMainInfo
}
func numberForRaw() -> Int {
return dishesMainInfo.value.count
}
func cellForRow(at indexPath: IndexPath) -> DishFeedCellViewModelType {
return DishFeedCellViewModel(dish: dishesMainInfo.value[indexPath.row])
}
func didSelectRow(at indexPath: IndexPath) -> Int? {
return dishesMainInfo.value[indexPath.row].id
}
func dishes() -> BehaviorRelay<[DishMainInfo]>{
return dishesMainInfo
}
}
| [
-1
] |
3b9b6501e6e5d583f8b9b88c4937aab9647e2cb1 | ea244195e86877a5dcd3bdc253b2e7ac098427d5 | /Source/GetRequests.swift | 475cd780e7cad8f840f34a9d4ec436f94ebdd11b | [
"MIT"
] | permissive | Nea88/DribbbleSwift | 2663c912e30dcda302ebfd13c37a6c101fb83fd3 | 94027b9e9844c0de53f6c6201bffc4a815b7cca9 | refs/heads/master | 2021-01-12T14:40:17.963914 | 2016-10-26T20:39:16 | 2016-10-26T20:39:16 | 72,042,266 | 0 | 0 | null | 2016-10-26T20:36:30 | 2016-10-26T20:36:30 | null | UTF-8 | Swift | false | false | 31,787 | swift | //
// Models.swift
// DribbbleSwift
//
// Created by George on 2016-05-06.
// Copyright © 2016 George. All rights reserved.
//
import Foundation
var access_token: String! = nil
var OAuth2Token: String! = nil
open class ConfigDS{
open class func setAccessToken(_ token: String!){
access_token = token
}
}
//MARK: Array protocol returns an array of types by initlizaing using the json passed
protocol ArrayProtocol {
init(json: JSON)
}
extension ArrayProtocol {
static func initArray<T:ArrayProtocol>(json: JSON) -> [T] {
var array = [T]()
json.forEach(){
array.append(T.init(json: $0.1))
}
return array
}
}
//Mark: Shots
/**
Limit the results to a specific type with the following possible values
*/
public enum ShotListDS: String{
case animated, attachments, debuts, playoffs, rebounds, teams, any
}
/**
A period of time to limit the results to with the following possible values
*/
public enum ShotTimeFrameDS: String{
case week, month, year, ever
}
/**
The sort field with the following possible values.
*/
public enum ShotSortDS: String{
case comments, recent, views
}
//Mark: Images
open class ImagesDS{
open var hidpi: String?
open var normal: String!
open var teaser: String!
init(json: JSON){
hidpi = json["hidpi"].string
normal = json["normal"].string
teaser = json["teaser"].string
}
}
open class ShotsDS: ArrayProtocol{
open var id : Int!
open var title : String!
open var description : String?
open var width: Int!
open var height: Int!
open var images: ImagesDS!
open var views_count : Int!
open var likes_count : Int!
open var comments_count : Int!
open var attachments_count: Int!
open var rebounds_count: Int!
open var buckets_count: Int!
open var created_at: String!
open var updated_at: String!
open var html_url: String!
open var attachments_url: String!
open var buckets_url: String!
open var comments_url: String!
open var likes_url: String!
open var projects_url: String!
open var rebounds_url: String!
open var animated: Bool!
open var tags: [String]?
open var user: UserDS!
open var team: TeamDS?
required public init(json: JSON){
id = json["id"].int
title = json["title"].string
description = json["description"].string
width = json["width"].int
height = json["height"].int
images = ImagesDS.init(json: json["images"])
views_count = json["views_count"].int
likes_count = json["likes_count"].int
comments_count = json["comments_count"].int
attachments_count = json["attachments_count"].int
rebounds_count = json["rebounds_count"].int
buckets_count = json["buckets_count"].int
created_at = json["created_at"].string
updated_at = json["updated_at"].string
html_url = json["html_url"].string
attachments_url = json["attachments_url"].string
buckets_url = json["buckets_url"].string
comments_url = json["comments_url"].string
likes_url = json["likes_url"].string
projects_url = json["projects_url"].string
rebounds_url = json["rebounds_url"].string
animated = json["animated"].bool
tags = json["tags"].arrayObject as? [String]
user = UserDS.init(json: json["user"])
team = TeamDS.init(json: json["team"])
}
/**
List shots
- parameter perPage: Resources per page, maximum = 100
-parameter page: Current page of resource. Default = 1
- parameter list: Limit the results to a specific type with the following possible values: animated, attachments, debuts, playoffs, rebounds, teams teams
- parameter sort: The sort field with the following possible values: comments, recent, views. Default = .views
- parameter timeframe: A period of time to limit the results to with the following possible values: week, month, year, ever
- parameter date: Limit the timeframe to a specific date, week, month, or year. Must be in the format of YYYY-MM-DD.
- parameter completionHandler: return NSError, JSON, NSURLResponse and an array of shots.
*/
open class func getShots(perPage: Int = 30, page: Int = 1, list: ShotListDS? = nil, sort: ShotSortDS? = nil, timeframe: ShotTimeFrameDS? = nil,date: String? = nil, completionHandler: @escaping (ClientReturn, _ shots: [ShotsDS]?) -> ()) -> (){
let url = "/shots"
var params: [String: AnyObject] = [:]
params["per_page"] = perPage as AnyObject?
params["page"] = page as AnyObject?
if(list != nil){
params["list"] = list!.rawValue as AnyObject?
}
if(sort != nil){
params["sort"] = sort!.rawValue as AnyObject?
}
if(timeframe != nil){
params["timeframe"] = timeframe?.rawValue as AnyObject?
}
if(date != nil){
params["date"] = date as AnyObject?
}
HTTPRequest.request(url, parameters: params){
api in
var shots: [ShotsDS]?
if let json = api.json{
shots = ShotsDS.initArray(json: json)
}
completionHandler(api, shots)
}
}
/**
List attachments for a shot
- parameter perPage: Resources per page, maximum = 100
-parameter page: Current page of resource. Default = 1
- parameter shotID: id assigned to shot
- parameter completionHandler: return NSError, JSON, NSURLResponse and an array of attachments
*/
open class func getAttachments(shotID: Int, perPage: Int = 30, page: Int = 1, completionHandler: @escaping (ClientReturn, _ attachments: [AttachmentDS]?) -> ()) -> (){
let url = "/shots/\(shotID)/attachments"
var params: [String: AnyObject] = [:]
params["per_page"] = perPage as AnyObject?
params["page"] = page as AnyObject?
HTTPRequest.request(url, parameters: params){
api in
var attachments: [AttachmentDS]?
if let json = api.json{
attachments = AttachmentDS.initArray(json: json)
}
completionHandler(api, attachments)
}
}
/**
List buckets for a shot
- parameter perPage: Resources per page, maximum = 100
- parameter page: Current page of resource. Default = 1
- parameter shotID: id assigned to shot
- parameter completionHandler: return NSError, JSON, NSURLResponse and an array of buckets
*/
open class func getBuckets(shotID: Int, perPage: Int = 30, page: Int = 1, completionHandler: @escaping (ClientReturn, _ buckets: [BucketDS]?) -> ()) -> (){
let url = "/shots/\(shotID)/buckets"
var params: [String: AnyObject] = [:]
params["per_page"] = perPage as AnyObject?
params["page"] = page as AnyObject?
HTTPRequest.request(url, parameters: params){
api in
var buckets: [BucketDS]?
if let json = api.json{
buckets = BucketDS.initArray(json: json)
}
completionHandler(api, buckets)
}
}
/**
List comments for a shot
- parameter perPage: Resources per page, maximum = 100. Default = 30
- parameter page: Current page of resource. Default = 1
- parameter shotID: id assigned to shot
- parameter completionHandler: return NSError, JSON, NSURLResponse and an array of comments
*/
open class func getComments(shotID: Int, perPage: Int = 30, page: Int = 1, completionHandler: @escaping (ClientReturn, _ comments: [CommentDS]?) -> ()) -> (){
let url = "/shots/\(shotID)/comments"
var params: [String: AnyObject] = [:]
params["per_page"] = perPage as AnyObject?
params["page"] = page as AnyObject?
HTTPRequest.request(url, parameters: params){
api in
var comments:[CommentDS]?
if let json = api.json{
comments = CommentDS.initArray(json: json)
}
completionHandler(api, comments)
}
}
/**
List the likes for a shot
- parameter perPage: Resources per page, maximum = 100
- parameter page: Current page of resource. Default = 1
- parameter shotID: id assigned to shot
- parameter completionHandler: return NSError, JSON, NSURLResponse and an array of likes
*/
open class func getLikes(shotID: Int, perPage: Int = 30, page: Int = 1, completionHandler: @escaping (ClientReturn, _ likes: [ShotLikesDS]?) -> Void) -> (){
let url = "/shots/\(shotID)/likes"
var params: [String: AnyObject] = [:]
params["per_page"] = perPage as AnyObject?
params["page"] = page as AnyObject?
HTTPRequest.request(url, parameters: params){
api in
var likes:[ShotLikesDS]?
if let json = api.json{
likes = ShotLikesDS.initArray(json: json)
}
completionHandler(api, likes)
}
}
/**
List projects for a shot
- parameter perPage: Resources per page, maximum = 100
- parameter page: Current page of resource. Default = 1
- parameter shotID: id assigned to shot
- parameter completionHandler: return NSError, JSON, NSURLResponse and an array of projects
*/
open class func getProjects(shotID: Int, perPage: Int = 30, page: Int = 1, completionHandler: @escaping (ClientReturn, _ projects: [ProjectDS]?) -> ()) -> (){
let url = "/shots/\(shotID)/projects"
var params: [String: AnyObject] = [:]
params["per_page"] = perPage as AnyObject?
params["page"] = page as AnyObject?
HTTPRequest.request(url, parameters: params){
api in
var project:[ProjectDS]?
if let json = api.json{
project = ProjectDS.initArray(json: json)
}
completionHandler(api, project)
}
}
/**
List rebounds for a shot
- parameter perPage: Resources per page, maximum = 100
- parameter page: Current page of resource. Default = 1
- parameter shotID: id assigned to shot
- parameter completionHandler: return NSError, JSON, NSURLResponse and an array of rebounds.
*/
open class func getRebounds(shotID: Int, perPage: Int = 30, page: Int = 1, completionHandler: @escaping (ClientReturn, _ rebounds: [ShotsDS]?) -> ()) -> (){
let url = "/shots/\(shotID)/rebounds"
var params: [String: AnyObject] = [:]
params["per_page"] = perPage as AnyObject?
params["page"] = page as AnyObject?
HTTPRequest.request(url, parameters: params){
api in
var shots:[ShotsDS]?
if let json = api.json{
shots = ShotsDS.initArray(json: json)
}
completionHandler(api, shots)
}
}
}
//MARK: User/Team Model
open class UserAndTeamBaseModel{
open var id: Int!
open var name: String!
open var username: String!
open var html_url: String!
open var avatar_url: String!
open var bio: String!
open var location: String!
open var links: (web: String?, twitter: String?)
open var buckets_count: Int!
open var comments_received_count: Int!
open var followers_count: Int!
open var followings_count: Int!
open var likes_count: Int!
open var likes_received_count: Int!
open var projects_count: Int!
open var rebounds_received_count: Int!
open var shots_count: Int!
open var can_upload_shot: Bool!
open var type: String!
open var pro: Bool!
open var buckets_url: String!
open var followers_url: String!
open var following_url: String!
open var likes_url: String!
open var projects_url: String!
open var shots_url: String!
open var teams_url: String!
open var created_at: String!
open var updated_at: String!
open var teams_count: Int!
init(json: JSON){
id = json["id"].int
name = json["name"].string
username = json["username"].string
html_url = json["html_url"].string
avatar_url = json["avatar_url"].string
bio = json["bio"].string
location = json["location"].string
links = (web: json["links"]["web"].string, twitter: json["links"]["twitter"].string)
buckets_count = json["buckets_count"].int
comments_received_count = json["comments_received_count"].int
followers_count = json["followers_count"].int
followings_count = json["followings_count"].int
likes_count = json["likes_count"].int
likes_received_count = json["likes_received_count"].int
projects_count = json["projects_count"].int
rebounds_received_count = json["rebounds_received_count"].int
shots_count = json["shots_count"].int
can_upload_shot = json["can_upload_shot"].bool
type = json["type"].string
pro = json["pro"].bool
buckets_url = json["buckets_url"].string
followers_url = json["followers_url"].string
likes_url = json["likes_url"].string
projects_url = json["projects_url"].string
shots_url = json["shots_url"].string
teams_url = json["teams_url"].string
created_at = json["created_at"].string
updated_at = json["updated_at"].string
teams_count = json["teams_count"].int
}
}
//MARK: FollowersDS
open class FollowersDS: ArrayProtocol{
open var id: Int!
open var created_at: String!
open var follower: UserDS!
required public init(json: JSON){
id = json["id"].int
created_at = json["created_at"].string
follower = UserDS.init(json: json["follower"])
}
}
//MARK: FolloweeDS
open class FolloweeDS: ArrayProtocol{
open var id: Int!
open var created_at: String!
open var followee: UserDS!
required public init(json: JSON){
id = json["id"].int
created_at = json["created_at"].string
followee = UserDS.init(json: json["followee"])
}
}
//MARK: UserDS
open class UserDS: UserAndTeamBaseModel, ArrayProtocol{
open var team: TeamDS?
override required public init(json: JSON) {
super.init(json: json)
if(json["type"] == "Team"){
team = TeamDS.init(json: json)
}
}
/**
Get a single user
- parameter username: username assigned to user
- parameter completionHandler: return NSError, JSON, NSURLResponse and a user object.
*/
open class func getUser(_ username: String, completionHandler: @escaping (ClientReturn, _ user: UserDS?) -> ()) -> (){
let url = "/users/\(username)"
HTTPRequest.request(url, parameters: nil){
api in
var user: UserDS?
if let json = api.json{
user = UserDS.init(json: json)
}
completionHandler(api, user)
}
}
/**
List a user’s buckets
- parameter username: username assigned to user
- parameter perPage: Resources per page, maximum = 100
-parameter page: Current page of resource. Default = 1
- parameter completionHandler: return NSError, JSON, NSURLResponse and an array of buckets.
*/
open class func getBuckets(_ username: String, perPage: Int = 30, page: Int = 1, completionHandler: @escaping (ClientReturn, _ buckets: [BucketDS]?) -> ()) -> (){
let url = "/users/\(username)/buckets"
var params: [String: AnyObject] = [:]
params["per_page"] = perPage as AnyObject?
params["page"] = page as AnyObject?
HTTPRequest.request(url, parameters: params){
api in
var buckets: [BucketDS]?
if let json = api.json{
buckets = BucketDS.initArray(json: json)
}
completionHandler(api, buckets)
}
}
/**
List followers of a user
- parameter username: username assigned to user
- parameter perPage: Resources per page, maximum = 100
-parameter page: Current page of resource. Default = 1
- parameter completionHandler: return NSError, JSON, NSURLResponse and an array followers.
*/
open class func getFollowers(_ username: String, perPage: Int = 30, page: Int = 1, completionHandler: @escaping (ClientReturn, _ followers: [FollowersDS]?) -> ()) -> (){
let url = "/users/\(username)/followers"
var params: [String: AnyObject] = [:]
params["per_page"] = perPage as AnyObject?
params["page"] = page as AnyObject?
HTTPRequest.request(url, parameters: params){
api in
var users: [FollowersDS]?
if let json = api.json{
users = FollowersDS.initArray(json: json)
}
completionHandler(api, users)
}
}
/**
List users followed by a user
- parameter username: username assigned to user
- parameter perPage: Resources per page, maximum = 100
-parameter page: Current page of resource. Default = 1
- parameter completionHandler: return NSError, JSON, NSURLResponse and an array of followees.
*/
open class func getFollowing(_ username: String, perPage: Int = 30, page: Int = 1, completionHandler: @escaping (ClientReturn, _ followees: [FolloweeDS]?) -> ()) -> (){
let url = "/users/\(username)/following"
var params: [String: AnyObject] = [:]
params["per_page"] = perPage as AnyObject?
params["page"] = page as AnyObject?
HTTPRequest.request(url, parameters: params){
api in
var users: [FolloweeDS]?
if let json = api.json{
users = FolloweeDS.initArray(json: json)
}
completionHandler(api, users)
}
}
/**
Check if one user is following another
- parameter username: username of user
- parameter targetUser: username of user to be checked if following
- parameter completionHandler: return NSError, JSON, NSURLResponse and returns true if status code = 204, else returns false if status code = 404
*/
open class func checkIfUserFollowingUser(_ username: String, targetUser: String, completionHandler: @escaping (ClientReturn, _ isFollowing: Bool) -> ()) -> (){
let url = "/users/\(username)/following/\(targetUser)"
HTTPRequest.request(url, parameters: nil){
api in
var following: Bool!
if let httpResponse = api.response as? HTTPURLResponse{
switch httpResponse.statusCode{
case 204:
following = true
default:
following = false
}
}
completionHandler(api, following)
}
}
/**
List shot likes for a user
- parameter username: username assigned to user
- parameter perPage: Resources per page, maximum = 100
-parameter page: Current page of resource. Default = 1
- parameter completionHandler: return NSError, JSON, NSURLResponse and an array of shots.
*/
open class func getLikes(_ username: String, perPage: Int = 30, page: Int = 1, completionHandler: @escaping (ClientReturn, _ likes: [UserLikesDS]?) -> ()) -> (){
let url = "/users/\(username)/likes"
var params: [String: AnyObject] = [:]
params["per_page"] = perPage as AnyObject?
params["page"] = page as AnyObject?
HTTPRequest.request(url, parameters: params){
api in
var shots: [UserLikesDS]?
if let json = api.json{
shots = UserLikesDS.initArray(json: json)
}
completionHandler(api, shots)
}
}
/**
List a user’s projects
- parameter username: username assigned to user
- parameter perPage: Resources per page, maximum = 100
-parameter page: Current page of resource. Default = 1
- parameter completionHandler: return NSError, JSON, NSURLResponse and an array of projects.
*/
open class func getProjects(_ username: String, perPage: Int = 30, page: Int = 1, completionHandler: @escaping (ClientReturn, _ projects: [ProjectDS]?) -> ()) -> (){
let url = "/users/\(username)/projects"
var params: [String: AnyObject] = [:]
params["per_page"] = perPage as AnyObject?
params["page"] = page as AnyObject?
HTTPRequest.request(url, parameters: params){
api in
var projects: [ProjectDS]?
if let json = api.json{
projects = ProjectDS.initArray(json: json)
}
completionHandler(api, projects)
}
}
/**
List shots for a user
- parameter username: username assigned to user
- parameter perPage: Resources per page, maximum = 100
-parameter page: Current page of resource. Default = 1
- parameter completionHandler: return NSError, JSON, NSURLResponse and an array of shots.
*/
open class func getShots(_ username: String, perPage: Int = 30, page: Int = 1, completionHandler: @escaping (ClientReturn, _ shots: [ShotsDS]?) -> ()) -> (){
let url = "/users/\(username)/shots"
var params: [String: AnyObject] = [:]
params["per_page"] = perPage as AnyObject?
params["page"] = page as AnyObject?
HTTPRequest.request(url, parameters: params){
api in
var projects: [ShotsDS]?
if let json = api.json{
projects = ShotsDS.initArray(json: json)
}
completionHandler(api, projects)
}
}
/**
List a user’s teams
- parameter username: username assigned to user
- parameter perPage: Resources per page, maximum = 100
-parameter page: Current page of resource. Default = 1
- parameter completionHandler: return NSError, JSON, NSURLResponse and an array of teams.
*/
open class func getTeams(_ username: String, completionHandler: @escaping (ClientReturn, _ teams: [TeamDS]?) -> ()) -> (){
let url = "/users/\(username)/teams"
HTTPRequest.request(url, parameters: nil){
api in
var projects: [TeamDS]?
if let json = api.json{
projects = TeamDS.initArray(json: json)
}
completionHandler(api, projects)
}
}
}
//Mark: Team
open class TeamDS: UserAndTeamBaseModel, ArrayProtocol{
open var members_count: Int!
open var members_url: String!
open var team_shots_url: String!
public required override init(json: JSON){
super.init(json: json)
members_count = json["members_count"].int
members_url = json["members_url"].string
team_shots_url = json["team_shots_url"].string
}
/**
List a team’s members
- parameter perPage: Resources per page, maximum = 100
-parameter page: Current page of resource. Default = 1
- parameter completionHandler: return NSError, JSON, NSURLResponse and an array of users.
*/
open class func getTeamMembers(_ teamName: String, perPage: Int = 30, page: Int = 1, completionHandler: @escaping (ClientReturn, _ members: [UserDS]?) -> ()) -> (){
let url = "/teams/\(teamName)/members"
var params: [String: AnyObject] = [:]
params["per_page"] = perPage as AnyObject?
params["page"] = page as AnyObject?
HTTPRequest.request(url, parameters: params){
api in
var members: [UserDS]?
if let json = api.json{
members = UserDS.initArray(json: json)
}
completionHandler(api, members)
}
}
/**
List shots for a team
- parameter teamId: id assigned to team
- parameter perPage: Resources per page, maximum = 100
-parameter page: Current page of resource. Default = 1
- parameter completionHandler: return NSError, JSON, NSURLResponse and an array of shots.
*/
open class func getTeamShots(_ teamName: String, perPage: Int = 30, page: Int = 1, completionHandler: @escaping (ClientReturn, _ shots: [ShotsDS]?) -> ()) -> (){
let url = "/teams/\(teamName)/shots"
var params: [String: AnyObject] = [:]
params["per_page"] = perPage as AnyObject?
params["page"] = page as AnyObject?
HTTPRequest.request(url, parameters: params){
api in
var shots: [ShotsDS]?
if let json = api.json{
shots = ShotsDS.initArray(json: json)
}
completionHandler(api, shots)
}
}
}
//Mark: Likes
//MARK: ShotLikes
open class ShotLikesDS: ArrayProtocol{
open var id: Int!
open var created_at: String!
open var user: UserDS!
public required init(json: JSON){
id = json["id"].int
created_at = json["created_at"].string
user = UserDS.init(json: json["user"])
}
}
//MARK: UserLikes
open class UserLikesDS: ArrayProtocol {
open var id: Int!
open var created_at: String!
open var shot: ShotsDS!
public required init(json: JSON){
id = json["id"].int
created_at = json["created_at"].string
shot = ShotsDS.init(json: json["shot"])
}
}
//Mark: Comments
open class CommentDS: ArrayProtocol{
open var id: Int!
open var body: String!
open var likes_count: Int!
open var likes_url: String!
open var created_at: String!
open var updated_at: String!
open var user: UserDS!
public required init(json: JSON){
id = json["id"].int
body = json["body"].string
likes_count = json["likes_count"].int
likes_url = json["likes_url"].string
created_at = json["created_at"].string
updated_at = json["updated_at"].string
user = UserDS.init(json: json["user"])
}
}
//Mark: Attachment
open class AttachmentDS: ArrayProtocol{
open var id: Int!
open var url: String!
open var thumbnail_url: String!
open var size: Int!
open var content_type: String!
open var views_count: Int!
open var created_at: String!
public required init(json: JSON){
id = json["id"].int
url = json["url"].string
thumbnail_url = json["thumbnail_url"].string
size = json["size"].int
content_type = json["content_type"].string
views_count = json["views_count"].int
created_at = json["created_at"].string
}
}
//Mark: Bucket
open class BucketDS: ArrayProtocol{
open var id: Int!
open var name: String!
open var description: String?
open var shots_count: Int!
open var created_at: String!
open var updated_at: String!
open var user: UserDS!
public required init(json: JSON){
id = json["id"].int
name = json["name"].string
description = json["description"].string
created_at = json["created_at"].string
updated_at = json["updated_at"].string
user = UserDS.init(json: json["user"])
}
/**
Get a bucket
- parameter bucketId: ID assigned to bucket
- parameter completionHandler: return NSError, JSON, NSURLResponse and a bucket object
*/
open class func getBucket(bucketId: Int, completionHandler: @escaping (_ clientReturn: ClientReturn?, _ bucket: BucketDS?) -> ()) -> (){
let url = "/buckets/\(bucketId)"
HTTPRequest.request(url, parameters: nil, completionHandler: {
api in
var bucket: BucketDS?
if let json = api.json{
bucket = BucketDS.init(json: json)
}
completionHandler(api, bucket)
})
}
/**
List shots for a bucket
- parameter bucketId: ID assigned to bucket
- parameter perPage: Resources per page, maximum = 100
-parameter page: Current page of resource. Default = 1
- parameter completionHandler: return NSError, JSON, NSURLResponse and an array of shots
*/
open class func getShots(bucketId: Int, perPage: Int = 30, page: Int = 1, completionHandler: @escaping (_ clientReturn: ClientReturn?, _ shots: [ShotsDS]?) -> ()) -> (){
let url = "/buckets/\(bucketId)/shots"
var params: [String: AnyObject] = [:]
params["per_page"] = perPage as AnyObject?
params["page"] = page as AnyObject?
HTTPRequest.request(url, parameters: params, completionHandler: {
api in
var shots: [ShotsDS]?
if let json = api.json{
shots = ShotsDS.initArray(json: json)
}
completionHandler(api, shots)
})
}
}
//Mark: Project
open class ProjectDS: ArrayProtocol{
open var id: Int!
open var name: String!
open var description: String?
open var shots_count: Int!
open var created_at: String!
open var updated_at: String!
open var user: UserDS!
public required init(json: JSON){
id = json["id"].int
name = json["name"].string
description = json["description"].string
created_at = json["created_at"].string
updated_at = json["updated_at"].string
user = UserDS.init(json: json["user"])
}
/**
Get a project
- parameter projectID: ID assigned to project
- parameter completionHandler: return NSError, JSON, NSURLResponse and a project object
*/
open class func getProject(projectId: Int, completionHandler: @escaping (_ clientReturn: ClientReturn?, _ project: ProjectDS?) -> ()) -> (){
let url = "/projects/\(projectId)"
HTTPRequest.request(url, parameters: nil, completionHandler: {
api in
var bucket: ProjectDS?
if let json = api.json{
bucket = ProjectDS.init(json: json)
}
completionHandler(api, bucket)
})
}
/**
List shots for a project
- parameter projectId: ID assigned to project
- parameter perPage: Resources per page, maximum = 100
-parameter page: Current page of resource. Default = 1
- parameter completionHandler: return NSError, JSON, NSURLResponse and an array of shots
*/
open class func getShots(projectID projectId: Int, page: Int = 0, perPage: Int = 30, completionHandler: @escaping (_ clientReturn: ClientReturn?, _ shots: [ShotsDS]?) -> ()) -> (){
let url = "/projects/\(projectId)/shots"
var params: [String: AnyObject] = [:]
params["per_page"] = perPage as AnyObject?
params["page"] = page as AnyObject?
HTTPRequest.request(url, parameters: params, completionHandler: {
api in
var shots: [ShotsDS]?
if let json = api.json{
shots = ShotsDS.initArray(json: json)
}
completionHandler(api, shots)
})
}
}
| [
-1
] |
2c0e48c318360a150cb00e023ba58cd306eafec4 | f62ce2382122a58c678799f23f614c0e9efe50ef | /ING-IMDBTests/ApiCallTests.swift | 8bee860d755206a11f3d3c0a06cdbf3243d4ded4 | [] | no_license | onurtuna/TMDB-Example | 40bc6471f7ee1c129be9fb4076f770de21da0f09 | a11c3d846fc5d8e72fae9dc35db418ee8929b6a2 | refs/heads/main | 2023-02-16T18:20:57.781470 | 2021-01-11T11:46:56 | 2021-01-11T11:46:56 | 317,870,915 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,405 | swift | //
// ApiCallTests.swift
// ING-IMDBTests
//
// Created by Onur Tuna on 2.12.2020.
//
import XCTest
@testable import ING_IMDB
class ApiCallTests: 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 test_MovieApi() {
let promise = expectation(description: "Api call should return 200")
guard let apiKey = KeyManager.getTmdbApiKey() else {
XCTFail("Api key is nil.")
return
}
if apiKey.isEmpty {
XCTFail("Api key is empty.")
return
}
let url = URL(string: "https://api.themoviedb.org/3/movie/popular?language=en-US&api_key=\(apiKey)&page=1")!
let task = URLSession.shared.dataTask(with: url, completionHandler: { [weak self] data, response, error in
if error != nil {
XCTFail("Api returned error.")
return
}
guard let _ = data else {
XCTFail("Data is corrupt.")
return
}
promise.fulfill()
})
task.resume()
wait(for: [promise], timeout: 5)
}
}
| [
-1
] |
6ecf3212c9ea71f9f54f82ee22151f9d668791c1 | d9a12e52c8e4803ce1cf3e38521e5cce7f37548e | /Sources/Cocoa/Components/XCPageViewController.swift | e1086223fc81338c80f9095f6de1fed5ac2aae4b | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | shivanid95/xcore.swift | 5faa83326f5a64bfc6f2943de397db15d0517f7e | d44a342c42e0fbcc14fedaad93a30071b6e8136e | refs/heads/master | 2020-06-01T08:40:15.806890 | 2019-05-20T22:29:40 | 2019-05-20T22:29:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 9,316 | swift | //
// XCPageViewController.swift
//
// Copyright © 2014 Zeeshan Mian
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
import UIKit
private class XCUIPageViewController: UIPageViewController {
var isScrollEnabled = true {
didSet {
scrollView?.isScrollEnabled = isScrollEnabled
}
}
// Subclasses have to be responsible when using this setting
// as view controller count stays at one when the bounce is disabled.
var isBounceForSinglePageEnabled = true
private var scrollView: UIScrollView? {
didSet {
scrollView?.bounces = isBounceForSinglePageEnabled
scrollView?.isScrollEnabled = isScrollEnabled
}
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
guard scrollView == nil else { return }
for view in view.subviews {
if let aScrollView = view as? UIScrollView {
scrollView = aScrollView
}
}
}
}
open class XCPageViewController: UIViewController {
public enum PageControlPosition {
case top
case center
case bottom
}
open var pageViewController: UIPageViewController!
public let pageControl = UIPageControl()
public let pageControlHeight: CGFloat = 40
open var pageControlPosition: PageControlPosition = .bottom
open var viewControllers: [UIViewController] = []
/// The default value is `false`.
open var isBounceForSinglePageEnabled = false
open var isScrollEnabled = true {
didSet { (pageViewController as? XCUIPageViewController)?.isScrollEnabled = isScrollEnabled }
}
/// Spacing between between pages. The default value is `0`.
/// Page spacing is only valid if the transition style is `.scroll`.
open var pageSpacing: CGFloat = 0
open var transitionStyle: UIPageViewController.TransitionStyle = .scroll
open var navigationOrientation: UIPageViewController.NavigationOrientation = .horizontal
private var didChangeCurrentPage: ((_ index: Int) -> Void)?
/// A callback for listening to page change events.
open func didChangeCurrentPage(_ callback: ((_ index: Int) -> Void)? = nil) {
didChangeCurrentPage = callback
}
public convenience init(viewControllers: [UIViewController], pageSpacing: CGFloat = 0) {
self.init(nibName: nil, bundle: nil)
self.viewControllers = viewControllers
self.pageSpacing = pageSpacing
}
open override func viewDidLoad() {
super.viewDidLoad()
edgesForExtendedLayout = []
setupPageViewController()
}
private func setupPageViewController() {
pageViewController = XCUIPageViewController(transitionStyle: transitionStyle, navigationOrientation: navigationOrientation, options: [.interPageSpacing: pageSpacing])
pageViewController.delegate = self
pageViewController.dataSource = self
pageViewController.view.frame = view.frame
if !viewControllers.isEmpty {
pageViewController.setViewControllers([viewControllers[0]], direction: .forward, animated: false)
}
addViewController(pageViewController, enableConstraints: true)
pageControl.isUserInteractionEnabled = false
pageControl.numberOfPages = viewControllers.count
view.addSubview(pageControl)
setupConstraints()
if viewControllers.count == 1 {
(pageViewController as? XCUIPageViewController)?.isBounceForSinglePageEnabled = isBounceForSinglePageEnabled
}
(pageViewController as? XCUIPageViewController)?.isScrollEnabled = isScrollEnabled
}
private func setupConstraints() {
pageControl.anchor.make {
$0.height.equalTo(pageControlHeight)
$0.horizontally.equalToSuperview()
switch pageControlPosition {
case .top:
$0.top.equalTo(view)
case .center:
$0.centerY.equalTo(view)
case .bottom:
$0.bottom.equalTo(view)
}
}
}
}
// MARK: UIPageViewControllerDataSource & UIPageViewControllerDelegate
extension XCPageViewController: UIPageViewControllerDataSource, UIPageViewControllerDelegate {
open func pageViewController(_ pageViewController: UIPageViewController, viewControllerAfter viewController: UIViewController) -> UIViewController? {
let indexOfCurrentVC = indexOf(viewController)
return indexOfCurrentVC < viewControllers.count - 1 ? viewControllers[indexOfCurrentVC + 1] : nil
}
open func pageViewController(_ pageViewController: UIPageViewController, viewControllerBefore viewController: UIViewController) -> UIViewController? {
let indexOfCurrentVC = indexOf(viewController)
return indexOfCurrentVC > 0 ? viewControllers[indexOfCurrentVC - 1] : nil
}
open func pageViewController(_ pageViewController: UIPageViewController, didFinishAnimating finished: Bool, previousViewControllers: [UIViewController], transitionCompleted completed: Bool) {
guard completed, let newViewController = pageViewController.viewControllers?.first else { return }
let index = indexOf(newViewController)
pageControl.currentPage = index
updateStatusBar(for: index)
didChangeCurrentPage?(pageControl.currentPage)
}
}
// MARK: Navigation API
extension XCPageViewController {
/// Set current view controller index to be displayed.
///
/// - Parameters:
/// - index: The index of the view controller to be displayed.
/// - direction: The navigation direction. The default value is `.forward`.
/// - animated: A boolean value that indicates whether the transition is to be animated. The default value is `false`.
/// - completion: A block to be called when setting the current view controller animation completes. The default value is `nil`.
open func setCurrentPage(_ index: Int, direction: UIPageViewController.NavigationDirection = .forward, animated: Bool = false, completion: ((Bool) -> Void)? = nil) {
guard viewControllers.count > index else { return }
let viewControllerAtIndex = viewControllers[index]
pageViewController.setViewControllers([viewControllerAtIndex], direction: direction, animated: animated, completion: completion)
pageControl.currentPage = index
updateStatusBar(for: index)
}
open func removeViewController(_ viewController: UIViewController) {
guard let index = viewControllers.index(of: viewController) else { return }
viewControllers.remove(at: index)
reloadData()
}
open func replaceViewController(_ viewControllerToReplace: UIViewController, withViewControllers: [UIViewController]) {
guard let index = viewControllers.index(of: viewControllerToReplace) else { return }
viewControllers.remove(at: index)
viewControllers.insert(contentsOf: withViewControllers, at: index)
reloadData()
}
open func reloadData() {
setCurrentPage(pageControl.currentPage)
}
}
// MARK: Helpers
extension XCPageViewController {
private func indexOf(_ viewController: UIViewController) -> Int {
return viewControllers.index(of: viewController) ?? 0
}
private func updateStatusBar(for index: Int) {
guard let vc = viewControllers.at(index) else { return }
if let nvc = vc as? UINavigationController {
statusBarStyle = nvc.preferredStatusBarStyle
} else {
statusBarStyle = vc.statusBarStyle ?? vc.preferredStatusBarStyle
}
}
}
// MARK: Statusbar and Orientation
extension XCPageViewController {
open override var prefersStatusBarHidden: Bool {
return isStatusBarHidden ?? super.prefersStatusBarHidden
}
open override var preferredStatusBarStyle: UIStatusBarStyle {
return statusBarStyle ?? super.preferredStatusBarStyle
}
open override var shouldAutorotate: Bool {
return isAutorotateEnabled ?? super.shouldAutorotate
}
open override var preferredStatusBarUpdateAnimation: UIStatusBarAnimation {
return statusBarUpdateAnimation ?? super.preferredStatusBarUpdateAnimation
}
}
| [
-1
] |
835965055b13741883a6d50922c84e96882d2e1c | a38a9ce9cc7033c5232be5bc9d95c3e99a4a96f4 | /Project 03 ToDo/ToDoTableViewController.swift | c3c7b0c3fb33b35406bebca8525bf59c2881673f | [] | no_license | cyeung11/Days-of-Swift-Project-03-ToDo | c0a7f9be9e3ed80c1ccbf26b779667ea91bc4e7e | d85d6381565bb64144cbf061a9c9e7d9937cc3a5 | refs/heads/master | 2020-03-26T18:27:09.240101 | 2018-08-18T11:14:51 | 2018-08-18T11:14:51 | 145,213,703 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,611 | swift | //
// ToDoTableViewController.swift
// Project 03 ToDo
//
// Created by Chris on 18/8/2018.
// Copyright © 2018 Chris. All rights reserved.
//
import UIKit
class ToDoTableViewController: UITableViewController, UISplitViewControllerDelegate {
var todoList = [ToDo(title: "Buy Milk", date: Date(timeIntervalSince1970: 1533139200), category: ToDo.Category.food),
ToDo(title: "Call Tim", date: Date(timeIntervalSince1970: 1534953600), category: ToDo.Category.people),
ToDo(title: "Presentation", date: Date(timeIntervalSince1970: 1534694400), category: ToDo.Category.work)]
override func awakeFromNib() {
super.awakeFromNib()
splitViewController?.delegate = self
}
override func viewDidLoad() {
super.viewDidLoad()
self.clearsSelectionOnViewWillAppear = true
self.navigationItem.rightBarButtonItem = self.editButtonItem
}
@IBAction private func addToDo(_ sender: Any) {
performSegue(withIdentifier: "edit", sender: nil)
}
// MARK: SplitView Delegate
func splitViewController(_ splitViewController: UISplitViewController, collapseSecondary secondaryViewController: UIViewController, onto primaryViewController: UIViewController) -> Bool {
return true
}
// MARK: TableView Delegate
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 90.0
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
performSegue(withIdentifier: "edit", sender: todoList[indexPath.row])
}
// MARK: - Table view data source
override func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return todoList.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "todo", for: indexPath)
let todo = todoList[indexPath.row]
cell.imageView?.image = UIImage(named: todo.category.image())
cell.textLabel?.text = todo.title
let dateformatter = DateFormatter()
dateformatter.dateStyle = .medium
cell.detailTextLabel?.text = dateformatter.string(from: todo.date)
return cell
}
// Override to support editing the table view.
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
todoList.remove(at: indexPath.row)
tableView.deleteRows(at: [indexPath], with: .fade)
}
}
// Override to support rearranging the table view.
override func tableView(_ tableView: UITableView, moveRowAt fromIndexPath: IndexPath, to: IndexPath) {
let todo = todoList.remove(at: fromIndexPath.row)
todoList.insert(todo, at: to.row)
}
// MARK: - Navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
if segue.identifier == "edit", let editVC = segue.destination as? EditViewController, let senderToDo = sender as? ToDo{
editVC.todo = senderToDo
}
}
}
| [
-1
] |
c698ae6d820e55d6fd898f496fa6292d76cc23bb | d917f7dcb3fdd9c98cf72de9180ea03a8c15a7db | /FunFacts/ViewController.swift | e5bbe59c0631fdbeb89a405361bb270f4a627897 | [] | no_license | frankie-lee/FunFactPractice | 3c73171e92d8b733652c0e1cedbccf96da9fac54 | a4951693ac97e73c97c60b5e37fa33be007a9b81 | refs/heads/master | 2020-04-06T06:46:31.068901 | 2014-11-24T21:28:47 | 2014-11-24T21:28:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 991 | swift | //
// ViewController.swift
// FunFacts
//
// Created by Frank Lee on 2014-10-17.
// Copyright (c) 2014 franklee. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var factLabel: UILabel!
@IBOutlet weak var newFactButton: UIButton!
let factBook = FactBook()
let colorWheel = ColorWheel()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
factLabel.text = factBook.randomFact()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func newFactButtonPressed(sender: UIButton) {
var randomColor = colorWheel.randomColor()
view.backgroundColor = randomColor
newFactButton.tintColor = randomColor
factLabel.text = factBook.randomFact()
}
}
| [
277315
] |
79270c40155303bd8b9bad4858202142e1f8df3d | c8a1f1a39dba732757f13fb3921ea102613ea7c6 | /Sources/EasyImagy/ImageSlice.swift | 940c099cdb4750789e4218f3b0c8cdf46f6cdad0 | [
"MIT"
] | permissive | AJTY/EasyImagy | 6bdd998e6db40aa8f28c6cb18be5ae5288737441 | 0df4e14f3f43a3b49aebfae2f810673d7a2ab067 | refs/heads/master | 2020-04-27T08:03:27.411424 | 2019-03-06T14:21:39 | 2019-03-06T14:21:39 | 174,157,721 | 0 | 0 | MIT | 2019-03-06T14:30:40 | 2019-03-06T14:11:39 | Swift | UTF-8 | Swift | false | false | 5,298 | swift | public struct ImageSlice<Pixel> : ImageProtocol {
public typealias SubImage = ImageSlice<Pixel>
public typealias Element = Pixel // FIXME: Remove this line in the future. Swift 4.1 needs it to build `ImageSlice`.
internal var image: Image<Pixel>
public let xRange: CountableRange<Int>
public let yRange: CountableRange<Int>
internal init(image: Image<Pixel>, xRange: CountableRange<Int>, yRange: CountableRange<Int>) {
precondition(image.xRange.isSuperset(of: xRange), "`xRange` is out of bounds: \(xRange)")
precondition(image.yRange.isSuperset(of: yRange), "`yRange` is out of bounds: \(yRange)")
self.image = image
self.xRange = xRange
self.yRange = yRange
}
public init(width: Int, height: Int, pixels: [Pixel]) {
self.init(image: Image<Pixel>(width: width, height: height, pixels: pixels), xRange: 0..<width, yRange: 0..<height)
}
public subscript(x: Int, y: Int) -> Pixel {
get {
precondition(xRange.contains(x), "`x` is out of bounds: \(x)")
precondition(yRange.contains(y), "`y` is out of bounds: \(y)")
return image[x, y]
}
set {
precondition(xRange.contains(x), "`x` is out of bounds: \(x)")
precondition(yRange.contains(y), "`y` is out of bounds: \(y)")
image[x, y] = newValue
}
}
public subscript(xRange: CountableRange<Int>, yRange: CountableRange<Int>) -> ImageSlice<Pixel> {
precondition(self.xRange.isSuperset(of: xRange), "`xRange` is out of bounds: \(xRange)")
precondition(self.yRange.isSuperset(of: yRange), "`yRange` is out of bounds: \(yRange)")
return image[xRange, yRange]
}
}
extension ImageSlice {
public init(_ image: Image<Pixel>) {
self.init(image: image, xRange: image.xRange, yRange: image.yRange)
}
}
#if canImport(CoreGraphics)
import Foundation
import CoreGraphics
extension ImageSlice { // Gray or PremultipliedRGBA
internal static func generatedCGImage<Component>(
slice: ImageSlice<Pixel>,
colorSpace: CGColorSpace,
bitmapInfo: CGBitmapInfo,
componentType: Component.Type
) -> CGImage {
let imageCount = slice.image.count
let pixelCount = slice.image.width * slice.height
let length = pixelCount * MemoryLayout<Pixel>.size
let offset = slice.yRange.lowerBound * slice.image.width + slice.xRange.lowerBound
var data: Data
if offset + pixelCount <= imageCount {
let bytes: UnsafeMutablePointer<Pixel> = UnsafeMutablePointer(mutating: slice.image.pixels) + (slice.yRange.lowerBound * slice.image.width + slice.xRange.lowerBound)
data = Data(bytes: bytes, count: length)
} else {
let bytes: UnsafeMutablePointer<Pixel> = UnsafeMutablePointer(mutating: slice.image.pixels) + (slice.yRange.lowerBound * slice.image.width + slice.xRange.lowerBound)
let pointer: UnsafeMutablePointer<UInt8> = UnsafeMutableRawPointer(bytes).bindMemory(to: UInt8.self, capacity: length)
data = Data(capacity: pixelCount * MemoryLayout<Pixel>.size)
data.append(pointer, count: (imageCount - offset) * MemoryLayout<Pixel>.size)
data.append(pointer, count: (offset + pixelCount - imageCount) * MemoryLayout<Pixel>.size)
}
let provider: CGDataProvider = CGDataProvider(data: data as CFData)!
return CGImage(
width: slice.width,
height: slice.height,
bitsPerComponent: MemoryLayout<Component>.size * 8,
bitsPerPixel: MemoryLayout<Pixel>.size * 8,
bytesPerRow: MemoryLayout<Pixel>.size * slice.image.width,
space: colorSpace,
bitmapInfo: bitmapInfo,
provider: provider,
decode: nil,
shouldInterpolate: false,
intent: CGColorRenderingIntent.defaultIntent
)!
}
internal static func withGeneratedCGImage<Component, R>(
slice: ImageSlice<Pixel>,
colorSpace: CGColorSpace,
bitmapInfo: CGBitmapInfo,
body: (CGImage) throws -> R,
componentType: Component.Type
) rethrows -> R {
var slice = slice
let length = slice.image.width * slice.height * MemoryLayout<Pixel>.size
let bytes: UnsafeMutablePointer<Pixel> = &slice.image.pixels + (slice.yRange.lowerBound * slice.image.width + slice.xRange.lowerBound)
let provider: CGDataProvider = CGDataProvider(data: Data(
bytesNoCopy: bytes,
count: length,
deallocator: .none
) as CFData)!
let cgImage = CGImage(
width: slice.width,
height: slice.height,
bitsPerComponent: MemoryLayout<Component>.size * 8,
bitsPerPixel: MemoryLayout<Pixel>.size * 8,
bytesPerRow: MemoryLayout<Pixel>.size * slice.image.width,
space: colorSpace,
bitmapInfo: bitmapInfo,
provider: provider,
decode: nil,
shouldInterpolate: false,
intent: CGColorRenderingIntent.defaultIntent
)!
return try body(cgImage)
}
}
#endif
| [
-1
] |
ca838a85c44004e36a8168f9043772a53bc2a25c | 5dcf90c1b6212b650bc9dc3273bd810ccecfba3b | /BullsEye/AppDelegate.swift | fa5608577b8b232bb6ffad29de6e71468261600c | [] | no_license | vetri02/BullsEye | 7a05eeffeaaa434c3262b68bfdb7f2f32ff0b5b1 | 52c0681f7bcf62d09ea2996db2030c5cc3245414 | refs/heads/master | 2020-05-19T14:52:03.080369 | 2019-05-09T18:32:27 | 2019-05-09T18:32:27 | 185,070,062 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,202 | swift | //
// AppDelegate.swift
// BullsEye
//
// Created by Vetrichelvan Jeyapalpandy on 04/05/19.
// Copyright © 2019 Vetrichelvan Jeyapalpandy. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
294924,
229388,
327695,
229391,
229394,
229397,
229399,
229402,
229405,
229408,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
286774,
286776,
319544,
286778,
204856,
229432,
286791,
237640,
286797,
237646,
311375,
163920,
196692,
319573,
311383,
319590,
311400,
303212,
131192,
237693,
303230,
327814,
303241,
131209,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
295110,
286922,
286924,
286926,
319694,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
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,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
98756,
278980,
319945,
278986,
319947,
278990,
278994,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
172526,
311791,
279023,
172529,
279027,
319989,
172534,
180727,
164343,
311804,
287230,
279040,
303617,
287234,
172550,
303623,
172552,
320007,
287238,
279051,
172558,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
311850,
279082,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
213575,
172618,
303690,
33357,
287309,
303696,
279124,
172634,
262752,
172644,
311911,
295533,
172655,
172656,
352880,
295538,
172660,
287349,
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,
287400,
279208,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
279231,
287427,
312005,
312006,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
312035,
279267,
295654,
279272,
230128,
312048,
312050,
189169,
230131,
205564,
303871,
230146,
328453,
295685,
230154,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
230241,
279394,
303976,
336744,
303981,
303985,
303987,
328563,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
304007,
304009,
213895,
304011,
230284,
304013,
295822,
279438,
189329,
295825,
304019,
189331,
58262,
304023,
304027,
279452,
410526,
279461,
304042,
213931,
230327,
304055,
287675,
197564,
230334,
304063,
304065,
295873,
189378,
156612,
213954,
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,
164973,
205934,
312432,
279669,
337018,
189562,
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,
214294,
296215,
320792,
230681,
296213,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
230718,
296255,
312639,
296259,
378181,
296262,
230727,
238919,
296264,
320840,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
148843,
410987,
230763,
230768,
296305,
312692,
230773,
304505,
304506,
181626,
181631,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
288154,
337306,
288160,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
312755,
296373,
312759,
337335,
288185,
279991,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
148946,
370130,
222676,
288210,
280021,
288212,
288214,
329177,
239064,
288217,
288218,
288220,
239070,
288224,
370146,
280034,
288226,
288229,
320998,
280036,
288232,
280038,
288230,
288234,
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,
181854,
403039,
280158,
370272,
239202,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
190118,
321195,
296622,
321200,
337585,
296634,
296637,
313027,
280260,
206536,
280264,
206539,
206541,
206543,
313044,
280276,
321239,
280283,
313052,
18140,
288478,
313055,
321252,
313066,
288494,
280302,
280304,
313073,
321266,
419570,
288499,
288502,
288510,
124671,
67330,
280324,
198405,
198416,
280337,
296723,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
321336,
296767,
288576,
345921,
337732,
304968,
280393,
280402,
173907,
313171,
313176,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
247688,
280464,
124817,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
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,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
215123,
354390,
288859,
280669,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
288909,
141455,
141459,
280725,
313498,
275608,
100520,
288936,
280747,
288940,
288947,
321717,
280764,
280769,
280771,
280774,
313548,
321740,
280783,
280786,
313557,
280793,
280796,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280825,
280827,
280830,
280831,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
305464,
280888,
280891,
289087,
280897,
305480,
239944,
239947,
305485,
305489,
379218,
280919,
354653,
354656,
313700,
313705,
280937,
190832,
280946,
223606,
313720,
280956,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
240021,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
289221,
289227,
281045,
281047,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
240132,
330244,
223752,
150025,
338440,
281095,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
150066,
158262,
158266,
289342,
281154,
322115,
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,
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,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
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,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
306555,
298365,
290174,
224641,
281987,
298372,
314756,
265604,
224647,
281990,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
290321,
282130,
323090,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282144,
290344,
306731,
290349,
290351,
290356,
28219,
224849,
282195,
282199,
282201,
306778,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
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,
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,
241509,
110438,
298860,
110445,
282478,
315249,
282481,
110450,
315251,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
298901,
241560,
241563,
241565,
241567,
241569,
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,
299167,
315552,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
299185,
323763,
184503,
299191,
307385,
307386,
258235,
307388,
176311,
307390,
176316,
184512,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
184579,
282893,
323854,
291089,
282906,
291104,
233766,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
283033,
242075,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
291254,
127417,
291260,
127421,
127424,
299457,
127429,
127434,
315856,
127440,
315860,
176597,
127447,
283095,
299481,
127449,
176605,
242143,
127455,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
127490,
127494,
283142,
135689,
233994,
127497,
127500,
291341,
233998,
127506,
234003,
127509,
234006,
127511,
152087,
234010,
135707,
242202,
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,
225948,
135839,
299680,
225954,
299684,
135844,
242343,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
226005,
226008,
299740,
242396,
201444,
299750,
283368,
234219,
283372,
226037,
283382,
316151,
234231,
234236,
242431,
209665,
234242,
299778,
242436,
234246,
226056,
291593,
234248,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
201496,
234264,
234266,
234269,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
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,
234364,
291711,
234368,
291714,
234370,
291716,
234373,
316294,
226182,
234375,
308105,
226185,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
234396,
324508,
291742,
226200,
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,
275406,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
324599,
234493,
316416,
234496,
234501,
308231,
234504,
234507,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
234585,
242777,
275545,
234593,
234595,
234597,
300133,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234629,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
324757,
234647,
234648,
226453,
234650,
308379,
275606,
300189,
324766,
119967,
234653,
324768,
283805,
234657,
242852,
300197,
234661,
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,
275725,
177424,
283917,
349464,
283939,
259367,
292143,
283951,
300344,
226617,
243003,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
316768,
292192,
218464,
292197,
316774,
243046,
218473,
136562,
324978,
333178,
275834,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
300433,
234899,
300436,
357783,
316824,
316826,
300448,
144807,
144810,
144812,
144814,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
316917,
292343,
308727,
300537,
316933,
316947,
308757,
308762,
316959,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
284223,
284226,
284228,
243268,
292421,
284231,
226886,
284234,
366155,
317004,
276043,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
292433,
284247,
317015,
235097,
243290,
284249,
276053,
284253,
300638,
243293,
284255,
284258,
292452,
292454,
177766,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
292479,
284288,
292481,
284290,
325250,
284292,
292485,
325251,
276098,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
284354,
358083,
284358,
358089,
284362,
276170,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
358114,
358116,
276197,
317158,
358119,
325353,
358122,
358126,
276206,
358128,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
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,
292721,
284529,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
317332,
358292,
284564,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
292776,
284585,
276395,
292784,
276402,
358326,
161718,
358330,
276411,
276425,
301009,
301011,
301013,
301015,
358360,
301017,
292823,
292828,
153568,
292839,
292843,
292845,
178161,
227314,
325624,
317435,
317446,
292876,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
243779,
325700,
292934,
243785,
350293,
350295,
309337,
227418,
350299,
350302,
227423,
350304,
178273,
309346,
227426,
194660,
350308,
309350,
309348,
292968,
309352,
309354,
301163,
350313,
350316,
227430,
301167,
276586,
350321,
227440,
284786,
276595,
350325,
252022,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
153765,
284837,
350375,
350379,
350381,
350383,
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,
309494,
243960,
227583,
276735,
276739,
211204,
276742,
227596,
325910,
309530,
342298,
211232,
317729,
211241,
325937,
325943,
211260,
260421,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
293227,
276843,
293232,
276848,
186744,
211324,
285061,
317833,
178572,
285070,
178583,
227738,
317853,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
293304,
293307,
293314,
309707,
293325,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
293346,
276964,
293352,
236013,
293364,
301562,
317951,
309764,
301575,
121352,
293387,
236043,
342541,
317963,
113167,
55822,
309779,
317971,
309781,
55837,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
219714,
301636,
318020,
301639,
301643,
285265,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
309871,
121458,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
334488,
227992,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
293555,
318132,
154292,
277173,
342707,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
137946,
113378,
203491,
228069,
277223,
342760,
56041,
285417,
56043,
277232,
228081,
56059,
310015,
310020,
310029,
228113,
285459,
277273,
293659,
326430,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
293696,
310080,
277317,
293706,
277329,
162643,
310100,
301911,
277337,
301921,
400236,
236397,
162671,
326514,
310134,
236408,
15224,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277411,
310179,
293798,
293802,
236460,
293811,
276579,
293817,
293820,
203715,
326603,
293849,
293861,
228327,
228328,
318442,
228332,
326638,
277486,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
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,
392326,
294026,
302218,
285835,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
310486,
302296,
384222,
310498,
285927,
318698,
302315,
228592,
294132,
138485,
204026,
228606,
204031,
64768,
310531,
138505,
228617,
318742,
204067,
130345,
277801,
277804,
285997,
285999,
277807,
113969,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
302403,
294211,
384328,
277832,
277836,
294221,
294223,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
277857,
277860,
302436,
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,
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,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
310780,
40448,
228864,
286214,
302603,
302614,
302617,
286233,
302621,
286240,
146977,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
196133,
310831,
245288,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286312,
40554,
286313,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
278168,
179870,
327333,
229030,
212648,
302764,
278188,
319153,
278196,
319163,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
286420,
229076,
286425,
319194,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
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,
188340,
40886,
319419,
294844,
294847,
237508,
393177,
294876,
294879,
294883,
294890,
311279,
278513,
237555,
311283,
278516,
237562
] |
aedb67aa979bcb95612aeeadc22054ee7c6309de | 87c4b77b74c4e40ab4d800ea4f02ee97ebaf79a9 | /Sources/FioriCharts/Model/ChartLabelAttributes.swift | 4846be9fde2c71ea403d5b44ac56ac375784cab7 | [
"Apache-2.0"
] | permissive | SAP/cloud-sdk-ios-fiori | 3e7d12d6998ba07355d5b2eea898939101574a69 | 195dffe10902dc7c555014fb889a01eb0fa1433b | refs/heads/main | 2023-08-30T16:05:33.785389 | 2023-08-10T18:34:48 | 2023-08-10T20:51:06 | 244,403,367 | 109 | 47 | Apache-2.0 | 2023-09-13T02:54:19 | 2020-03-02T15:18:54 | Swift | UTF-8 | Swift | false | false | 2,366 | swift | import Foundation
import SwiftUI
public class ChartLabelAttributes: ObservableObject, Identifiable, NSCopying {
/// Text color for the label.
@Published public var color: Color
/// Size of the label font in points.
@PublishedConstrainedValue(0 ... 100) public var fontSize: CGFloat = 12
/// font weight
// @Published public var fontWeight: CGFloat = 1
/// Specifies how far from the axis labels should be rendered.
@PublishedConstrainedValue(-10 ... 10) public var offset: CGFloat = 0
/// True when the associated label(s) should be hidden.
@Published public var isHidden: Bool
public let id = UUID()
public init(color: Color = .preferredColor(.tertiaryLabel),
fontSize: Double = 12,
offset: Double = 0,
isHidden: Bool = false)
{
self._color = Published(initialValue: color)
self._fontSize = PublishedConstrainedValue(wrappedValue: CGFloat(fontSize), 0 ... 100)
self._offset = PublishedConstrainedValue(wrappedValue: CGFloat(offset), -10 ... 10)
self._isHidden = Published(initialValue: isHidden)
}
public func copy(with zone: NSZone? = nil) -> Any {
ChartLabelAttributes(color: self.color,
fontSize: Double(self.fontSize),
offset: Double(self.offset),
isHidden: self.isHidden)
}
}
extension ChartLabelAttributes: Equatable {
public static func == (lhs: ChartLabelAttributes, rhs: ChartLabelAttributes) -> Bool {
lhs.color == rhs.color &&
lhs.fontSize == rhs.fontSize &&
lhs.offset == rhs.offset &&
lhs.isHidden == rhs.isHidden
}
}
extension ChartLabelAttributes: CustomStringConvertible {
public var description: String {
let nf = NumberFormatter()
nf.numberStyle = .none
nf.maximumFractionDigits = 2
return """
{
"ChartLabelAttributes": {
"color": \(String(describing: self.color)),
"fontSize": \(nf.string(from: NSNumber(value: Double(self.fontSize))) ?? "nil"),
"offset": \(nf.string(from: NSNumber(value: Double(self.offset))) ?? "nil"),
"isHidden": \(self.isHidden)
}
}
"""
}
}
| [
-1
] |
ea5cf6008dd4d1b8a8693736085dfd89c096c48e | 059a4444c3b0ef28b209b8aef49315a77d6fcfe5 | /EduFinance/AppDelegate.swift | dbf16dda5b9470677b89f46a9133cba4efc549ac | [] | no_license | PramithPrasanna/EduFinance | b3d1529753a06f0491671e02a4a16194d546e993 | 811e3ab77fc4ef7620f9790740c033cd6633ab4b | refs/heads/main | 2023-03-29T05:33:32.055162 | 2021-04-04T04:38:16 | 2021-04-04T04:38:16 | 328,715,451 | 0 | 1 | null | 2021-01-12T02:15:55 | 2021-01-11T15:54:56 | Swift | UTF-8 | Swift | false | false | 1,355 | swift | //
// AppDelegate.swift
// EduFinance
//
// Created by Pramith Prasanna on 1/11/21.
//
import UIKit
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
| [
393222,
393224,
393230,
393250,
344102,
393261,
393266,
213048,
385081,
376889,
393275,
376905,
327756,
254030,
286800,
368727,
180313,
368735,
180320,
376931,
286831,
368752,
286844,
417924,
262283,
286879,
286888,
377012,
327871,
377036,
180431,
377046,
418007,
418010,
377060,
327914,
205036,
393456,
393460,
418043,
336123,
385280,
336128,
262404,
164106,
180490,
368911,
262416,
262422,
377117,
262436,
336180,
262454,
393538,
262472,
344403,
213332,
65880,
262496,
418144,
262499,
213352,
246123,
262507,
262510,
213372,
385419,
393612,
262550,
262552,
385440,
385443,
262566,
385451,
262573,
393647,
385458,
262586,
344511,
262592,
360916,
369118,
328177,
328179,
328182,
328189,
328192,
164361,
410128,
393747,
254490,
188958,
385570,
33316,
377383,
197159,
352821,
197177,
418363,
188987,
369223,
385609,
385616,
352864,
369253,
262760,
352874,
352887,
254587,
377472,
148105,
377484,
352918,
98968,
344744,
361129,
336555,
385713,
434867,
164534,
336567,
328378,
164538,
328386,
344776,
352968,
352971,
418507,
352973,
385742,
385748,
361179,
189153,
369381,
361195,
418553,
344831,
344835,
336643,
344841,
361230,
336659,
418580,
418585,
434970,
369435,
418589,
262942,
418593,
336675,
328484,
418598,
418605,
336696,
361273,
328515,
336708,
328519,
361288,
336711,
328522,
336714,
426841,
197468,
254812,
361309,
361315,
361322,
328573,
377729,
369542,
361360,
222128,
345035,
386003,
345043,
386011,
386018,
386022,
435187,
328714,
361489,
386069,
386073,
336921,
336925,
345118,
377887,
345133,
345138,
386101,
361536,
197707,
189520,
345169,
156761,
361567,
148578,
345199,
386167,
361593,
410745,
361598,
214149,
345222,
386186,
337047,
345246,
214175,
337071,
337075,
386258,
328924,
66782,
222437,
386285,
328941,
386291,
345376,
353570,
345379,
410917,
345382,
337205,
345399,
378169,
369978,
337222,
337229,
337234,
263508,
402791,
345448,
271730,
378227,
271745,
181638,
353673,
181643,
181654,
230809,
181670,
181673,
181678,
181681,
337329,
181684,
181690,
361917,
181696,
337349,
181703,
271839,
329191,
361960,
329194,
116210,
337398,
337415,
329226,
419339,
419343,
419349,
419355,
370205,
419359,
394786,
419362,
370213,
419368,
419376,
206395,
214593,
419400,
419402,
353867,
419406,
419410,
394853,
345701,
222830,
370297,
403075,
345736,
198280,
403091,
345749,
419483,
345757,
345762,
419491,
345765,
419497,
419501,
370350,
419506,
419509,
419512,
337592,
419517,
337599,
419527,
419530,
419535,
272081,
394966,
419542,
419544,
181977,
345818,
419547,
419550,
419559,
337642,
419563,
337645,
370415,
141051,
337659,
337668,
362247,
395021,
362255,
116509,
345887,
378663,
345905,
354106,
354111,
247617,
354117,
370503,
329544,
370509,
354130,
247637,
337750,
370519,
313180,
354142,
354150,
354156,
345964,
345967,
345970,
345974,
403320,
354172,
247691,
337808,
247700,
329623,
436126,
436132,
337833,
362413,
337844,
346057,
346063,
247759,
329697,
354277,
190439,
247789,
354313,
346139,
436289,
378954,
395339,
338004,
100453,
329832,
329855,
329885,
411805,
346272,
100524,
387249,
379066,
387260,
256191,
395466,
346316,
411861,
411864,
411868,
411873,
379107,
411876,
387301,
346343,
338152,
387306,
387312,
346355,
436473,
321786,
379134,
411903,
411916,
379152,
395538,
387349,
338199,
387352,
182558,
338211,
395566,
248111,
362822,
436555,
190796,
379233,
354673,
248186,
420236,
379278,
354727,
338352,
338381,
330189,
338386,
338403,
338409,
248308,
199164,
330252,
199186,
330267,
354855,
10828,
199249,
346721,
174695,
248425,
191084,
338543,
191092,
346742,
330383,
354974,
150183,
174774,
248504,
174777,
223934,
355024,
273108,
355028,
264918,
183005,
256734,
436962,
338660,
338664,
264941,
363251,
207619,
264964,
338700,
256786,
199452,
363293,
396066,
346916,
396069,
215853,
355122,
355131,
355140,
355143,
338763,
355150,
330580,
355166,
265055,
265058,
355175,
387944,
355179,
330610,
355218,
330642,
412599,
207808,
379848,
396245,
330710,
248792,
248798,
347105,
257008,
183282,
265207,
330748,
265214,
330760,
330768,
248862,
347176,
396328,
158761,
199728,
396336,
330800,
396339,
339001,
388154,
388161,
347205,
330826,
412764,
339036,
257120,
265320,
248951,
420984,
330889,
347287,
248985,
339097,
44197,
380070,
339112,
249014,
126144,
330958,
330965,
265432,
265436,
388319,
388347,
175375,
159005,
175396,
208166,
273708,
347437,
372015,
347441,
372018,
199988,
44342,
175415,
396600,
437566,
175423,
437570,
437575,
437583,
331088,
437587,
331093,
396633,
175450,
437595,
175457,
208227,
175460,
175463,
265580,
437620,
175477,
249208,
175483,
249214,
175486,
175489,
249218,
249224,
249227,
249234,
175513,
175516,
396705,
175522,
355748,
380332,
396722,
208311,
372163,
216517,
380360,
216522,
339404,
372176,
208337,
339412,
413141,
339417,
339420,
249308,
339424,
249312,
339428,
339434,
249328,
69113,
372228,
208398,
380432,
175635,
265778,
265795,
396872,
265805,
224853,
224857,
257633,
224870,
372327,
257646,
372337,
224884,
224887,
224890,
224894,
372353,
224897,
216707,
421508,
126596,
224904,
224909,
11918,
159374,
224913,
126610,
224916,
224919,
126616,
208538,
224922,
224926,
224929,
224932,
257704,
224936,
224942,
257712,
224947,
257716,
257720,
224953,
257724,
224959,
257732,
224965,
224969,
339662,
224975,
257747,
224981,
224986,
257761,
224993,
257764,
224999,
339695,
225012,
257787,
225020,
257790,
339710,
225025,
257794,
339721,
257801,
257804,
225038,
257807,
225043,
372499,
167700,
225048,
257819,
225053,
184094,
225058,
257833,
225066,
257836,
413484,
225070,
225073,
372532,
257845,
225079,
397112,
225082,
397115,
225087,
225092,
225096,
323402,
257868,
225103,
257871,
397139,
225108,
225112,
257883,
257886,
225119,
257890,
339814,
225127,
274280,
257896,
257901,
225137,
339826,
257908,
225141,
257912,
225148,
257916,
257920,
225155,
339844,
225165,
397200,
225170,
380822,
225175,
225180,
118691,
184244,
372664,
372702,
372706,
356335,
380918,
372738,
405533,
430129,
266294,
266297,
421960,
356439,
421990,
266350,
356466,
266362,
381068,
225423,
250002,
250004,
225429,
356506,
225437,
135327,
225441,
438433,
225444,
438436,
225447,
438440,
225450,
258222,
225455,
430256,
225458,
225461,
225466,
389307,
225470,
381120,
372929,
430274,
225475,
389320,
225484,
225487,
225490,
225493,
266453,
225496,
225499,
225502,
225505,
356578,
225510,
217318,
225514,
225518,
372976,
381176,
397571,
389380,
356637,
356640,
356643,
356646,
266536,
356649,
356655,
332080,
340275,
356660,
397622,
332090,
225597,
332097,
201028,
348488,
332106,
332117,
348502,
250199,
250202,
332125,
250210,
348522,
348525,
348527,
332152,
389502,
250238,
332161,
356740,
332172,
373145,
340379,
389550,
324030,
266687,
160234,
127471,
340472,
381436,
324094,
266754,
324099,
324102,
324111,
340500,
324117,
324131,
332324,
381481,
356907,
324139,
324142,
356916,
324149,
324155,
348733,
324164,
356934,
348743,
381512,
324170,
324173,
324176,
389723,
332380,
373343,
381545,
340627,
373398,
184982,
258721,
332453,
332459,
389805,
332463,
381617,
332471,
332483,
332486,
373449,
357069,
332493,
357073,
332511,
332520,
340718,
332533,
348924,
373510,
389926,
348978,
152370,
340789,
348982,
398139,
127814,
357201,
357206,
389978,
430939,
357211,
357214,
201579,
201582,
349040,
340849,
430965,
324472,
398201,
119674,
324475,
430972,
340858,
340861,
324478,
373634,
398211,
324484,
324487,
381833,
324492,
324495,
430995,
324501,
324510,
422816,
324513,
398245,
201637,
324524,
340909,
324538,
324541,
398279,
340939,
340941,
209873,
340957,
431072,
398306,
340963,
209895,
201711,
349172,
349180,
439294,
209943,
357410,
250914,
185380,
357418,
209965,
209971,
209975,
209979,
209987,
209990,
209995,
341071,
349267,
250967,
210010,
341091,
210025,
210030,
210036,
210039,
349308,
210044,
349311,
160895,
152703,
210052,
210055,
349319,
218247,
210067,
210077,
210080,
251044,
210084,
185511,
210095,
210098,
210107,
210115,
332997,
210127,
333009,
210131,
333014,
210138,
210143,
218354,
218360,
251128,
275706,
275712,
275715,
275721,
349459,
333078,
251160,
349484,
349491,
251189,
415033,
251210,
357708,
210260,
365911,
259421,
365921,
333154,
251235,
374117,
333162,
234866,
390516,
333175,
357755,
251271,
136590,
374160,
112020,
349590,
357792,
259515,
415166,
415185,
366034,
366038,
415191,
415193,
415196,
415199,
423392,
333284,
415207,
366056,
366061,
415216,
210420,
415224,
423423,
415257,
415263,
366117,
415270,
144939,
415278,
415281,
415285,
415290,
415293,
349761,
415300,
333386,
366172,
333413,
423528,
423532,
210544,
415353,
333439,
415361,
267909,
333498,
210631,
333511,
358099,
333534,
366307,
366311,
431851,
366318,
210672,
366321,
366325,
210695,
268041,
210698,
366348,
210706,
399128,
333594,
210719,
358191,
366387,
210739,
358200,
325440,
366401,
341829,
325446,
46920,
341834,
341838,
341843,
415573,
358234,
341851,
350045,
399199,
259938,
399206,
358255,
268143,
399215,
358259,
341876,
243579,
325504,
333698,
333708,
333724,
382890,
350146,
358371,
350189,
350193,
350202,
333818,
350206,
350213,
268298,
350224,
350231,
333850,
350237,
350240,
350244,
350248,
178218,
350251,
350256,
350259,
350271,
243781,
350285,
374864,
342111,
342133,
374902,
432271,
333997,
334011,
260289,
260298,
350410,
350416,
350422,
350425,
334045,
350445,
375026,
358644,
350458,
350461,
350464,
350467,
325891,
350475,
375053,
268559,
350480,
432405,
350486,
325914,
350490,
325917,
350493,
325919,
350498,
194852,
350504,
358700,
391468,
350509,
358704,
358713,
358716,
383306,
334161,
383321,
383330,
383333,
391530,
383341,
334203,
268668,
194941,
391563,
366990,
416157,
342430,
268701,
375208,
326058,
375216,
334262,
334275,
326084,
358856,
195039,
334304,
334311,
375277,
334321,
350723,
186897,
342545,
334358,
342550,
342554,
334363,
350761,
252461,
334384,
358961,
383536,
334394,
252482,
219718,
334407,
334420,
350822,
375400,
334465,
334468,
162445,
326290,
342679,
342683,
260766,
342710,
244409,
260797,
260801,
350917,
154317,
391894,
154328,
416473,
64230,
113388,
342766,
375535,
203506,
342776,
391937,
391948,
375568,
326416,
375571,
375574,
162591,
326441,
383793,
326451,
326454,
260924,
375612,
244540,
326460,
326467,
244551,
326473,
326477,
416597,
326485,
326490,
342874,
326502,
375656,
433000,
326507,
326510,
211825,
211831,
351097,
392060,
359295,
351104,
342915,
400259,
236430,
342930,
252822,
392091,
400285,
252836,
359334,
211884,
400306,
351168,
359361,
359366,
326598,
359382,
359388,
383967,
343015,
359407,
261108,
244726,
261111,
383997,
261129,
261147,
359451,
211998,
261153,
261159,
359470,
359476,
343131,
384098,
384101,
367723,
384107,
187502,
343154,
384114,
212094,
351364,
384135,
384139,
384143,
351381,
384160,
384168,
367794,
384181,
367800,
351423,
384191,
326855,
244937,
253130,
343244,
146642,
359649,
343270,
351466,
351479,
343306,
261389,
359694,
384269,
253200,
384275,
245020,
245029,
171302,
351534,
376110,
245040,
425276,
212291,
384323,
343365,
212303,
367965,
343393,
343398,
367980,
425328,
343409,
253303,
154999,
343417,
327034,
245127,
384397,
245136,
245142,
245145,
343450,
245148,
245151,
245154,
245157,
245162,
327084,
359865,
384443,
146876,
327107,
384453,
327110,
327115,
327117,
359886,
359890,
343507,
368092,
343534,
343539,
368119,
343544,
368122,
409091,
359947,
359955,
359983,
343630,
179802,
155239,
327275,
245357,
138864,
155254,
155273,
368288,
245409,
425638,
425649,
155322,
425662,
155327,
155351,
155354,
212699,
155363,
245475,
155371,
245483,
409335,
155393,
155403,
155422,
360223,
155438,
155442,
155447,
417595,
360261,
155461,
376663,
155482,
261981,
425822,
376671,
155487,
155490,
155491,
327531,
261996,
376685,
261999,
262002,
327539,
147317,
262005,
425845,
262008,
262011,
155516,
155521,
155525,
360326,
155531,
262027,
262030,
262033,
262036,
262039,
262042,
155549,
262045,
262048,
262051,
327589,
155559,
155562,
155565,
393150,
393169,
384977,
155611,
155619,
253923,
155621,
253926,
327654,
204784,
393203,
360438,
253943,
393206,
393212,
155646
] |
6bc8c7d3dac19eb3b317fd78f7fca3e71659838f | fae6d890d3dfffe0375f1f72d9db27bcf70f5e3e | /EnglishOrFrench/main.swift | 63d51fd0f9f43bb28fcacf7f42e7876ef1f2914d | [] | no_license | Lcs-ADanchukLauzon/English-or-French | 8158ac049518eb17c698b2def57bf324f71e2c67 | 81bedda57b02412a6fb30bb99d19f3519df07fc5 | refs/heads/master | 2020-03-16T19:12:19.644914 | 2018-05-10T11:53:25 | 2018-05-10T11:53:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 770 | swift | //
// main.swift
// English or French?
//
import Foundation
// INPUT
// Collect and filter user input here
// PROCESS
// Implement the primary logic of the problem here
// Some output may be given here if you desire
// Example of how to collect multiple input lines
let expectedLines = 4
print("Please enter the \(expectedLines) of text:")
for _ in 1...expectedLines {
// Get the input (use guard-let to guarantee it is not nil)
// and then print it out
guard let givenLine = readLine() else {
// If someone enters nil input, just skip to the next line
continue
}
// Now we have the line, we can print it out, analyze it as needed, et cetera
print(givenLine)
}
// OUTPUT
// Report results to the user here
| [
-1
] |
e91956ac7ed6ef53d0fccdbfdd86bc9319e8716c | 9e4a37bee7369dd721cd87fa915e32066371f760 | /AAInfographicsDemo/Demo/AdditionalContent2/HideOrShowChartSeriesVC.swift | 9b2bc4e556efb61d71d6aef51a7bcf226d927898 | [
"MIT"
] | permissive | AAChartModel/AAChartKit-Swift | 1938d77654611ddb83551570cbfd903cb30ad1e0 | 4abae1f1ce961d420f5a8658ccfbcc9b9580b0dd | refs/heads/master | 2023-09-01T03:12:41.195337 | 2023-07-28T06:43:05 | 2023-07-28T06:43:05 | 88,613,768 | 2,478 | 264 | MIT | 2023-09-13T07:01:44 | 2017-04-18T10:43:14 | Swift | UTF-8 | Swift | false | false | 8,845 | swift | //
// ChartSeriesHideOrShowVC.swift
// AAInfographicsDemo
//
// Created by AnAn on 2018/6/17.
// Copyright © 2018年 An An. All rights reserved.
//*************** ...... SOURCE CODE ...... ***************
//***...................................................***
//*** https://github.com/AAChartModel/AAChartKit ***
//*** https://github.com/AAChartModel/AAChartKit-Swift ***
//***...................................................***
//*************** ...... SOURCE CODE ...... ***************
/*
*********************************************************************************
*
* 🌕 🌖 🌗 🌘 ❀❀❀ WARM TIPS!!! ❀❀❀ 🌑 🌒 🌓 🌔
*
* Please contact me on GitHub,if there are any problems encountered in use.
* GitHub Issues : https://github.com/AAChartModel/AAChartKit-Swift/issues
* -------------------------------------------------------------------------------
* And if you want to contribute for this project, please contact me as well
* GitHub : https://github.com/AAChartModel
* StackOverflow : https://stackoverflow.com/users/12302132/codeforu
* JianShu : https://www.jianshu.com/u/f1e6753d4254
* SegmentFault : https://segmentfault.com/u/huanghunbieguan
*
*********************************************************************************
*/
import UIKit
import AAInfographics
@available(iOS 10.0, macCatalyst 13.1, *)
class HideOrShowChartSeriesVC: UIViewController {
public var chartType: AAChartType?
public var step: Bool?
private var aaChartView: AAChartView?
override func viewDidLoad() {
super.viewDidLoad()
title = "SeriesHideOrShow"
view.backgroundColor = .white
setUpSegmentedControls()
setUpTheHideChartSeriesSwitch()
setUpTheAAChartView()
}
private func setUpTheAAChartView() {
let chartViewWidth = view.frame.size.width
let chartViewHeight = view.frame.size.height - 220
aaChartView = AAChartView()
aaChartView?.frame = CGRect(x: 0,
y: 60,
width: chartViewWidth,
height: chartViewHeight)
///AAChartViewd的内容高度(内容高度默认和 AAChartView 等高)
aaChartView?.contentHeight = chartViewHeight - 20
aaChartView?.isScrollEnabled = false
view.addSubview(aaChartView!)
let aaChartModel = AAChartModel()
.chartType(chartType!)//图形类型
.animationType(.bounce)//图形渲染动画类型为"bounce"
.title("CHART SERIES HIDE OR SHOW")//图形标题
.subtitle("2020/08/08")//图形副标题
.dataLabelsEnabled(false)//是否显示数字
.stacking(.normal)
.colorsTheme(["#fe117c","#ffc069","#06caf4","#7dffc0"])
.scrollablePlotArea(
AAScrollablePlotArea()
.minWidth(1800)
.scrollPositionX(1))
if chartType == .column || chartType == .bar {
if chartType == .bar {
aaChartModel
.scrollablePlotArea(
AAScrollablePlotArea()
.minHeight(1800)
.scrollPositionX(1))
}
aaChartModel.series([
AASeriesElement()
.name("Tokyo")
.data([7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6])
,
AASeriesElement()
.name("New York")
.data([0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5])
,
AASeriesElement()
.name("Berlin")
.data([0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0])
,
AASeriesElement()
.name("London")
.data([3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8])
,])
} else {
aaChartModel
.markerRadius(0)//折线连接点半径长度,为0时相当于没有折线连接点
.series([
AASeriesElement()
.name("Tokyo Hot")
.data([0.45, 0.43, 0.50, 0.55, 0.58, 0.62, 0.83, 0.39, 0.56, 0.67, 0.50, 0.34, 0.50, 0.67, 0.58, 0.29, 0.46, 0.23, 0.47, 0.46, 0.38, 0.56, 0.48, 0.36])
.step(step!)
,
AASeriesElement()
.name("Berlin Hot")
.data([0.38, 0.31, 0.32, 0.32, 0.64, 0.66, 0.86, 0.47, 0.52, 0.75, 0.52, 0.56, 0.54, 0.60, 0.46, 0.63, 0.54, 0.51, 0.58, 0.64, 0.60, 0.45, 0.36, 0.67])
.step(step!)
,
AASeriesElement()
.name("New York Hot")
.data([0.46, 0.32, 0.53, 0.58, 0.86, 0.68, 0.85, 0.73, 0.69, 0.71, 0.91, 0.74, 0.60, 0.50, 0.39, 0.67, 0.55, 0.49, 0.65, 0.45, 0.64, 0.47, 0.63, 0.64])
.step(step!)
,
AASeriesElement()
.name("London Hot")
.data([0.60, 0.51, 0.52, 0.53, 0.64, 0.84, 0.65, 0.68, 0.63, 0.47, 0.72, 0.60, 0.65, 0.74, 0.66, 0.65, 0.71, 0.59, 0.65, 0.77, 0.52, 0.53, 0.58, 0.53])
.step(step!)
,
])
}
aaChartView?.aa_drawChartWithChartModel(aaChartModel)
}
private func setUpSegmentedControls() {
let segmentedNamesArray = [
["hide One",
"hide Two",
"hide Three",
"hide Four",
],
["show One",
"show Two",
"show Three",
"show Four",
]
]
let typeLabelNameArr = ["HIDE CHART SERIES",
"SHOW CHART SERIES"]
for i in 0..<segmentedNamesArray.count {
let segment = UISegmentedControl.init(items: segmentedNamesArray[i])
segment.frame = CGRect(x: 20,
y: 40.0 * CGFloat(i) + (view.frame.size.height - 145),
width: view.frame.size.width-40,
height: 20)
segment.tag = i
segment.tintColor = .red
segment.selectedSegmentIndex = 0
segment.addTarget(self,
action: #selector(segmentDidSelected(segmentedControl:)),
for: .valueChanged)
view.addSubview(segment)
let subLabel = UILabel()
subLabel.font = UIFont(name: "EuphemiaUCAS", size: 12.0)
subLabel.frame = CGRect(x: 20,
y: 40 * CGFloat(i) + (view.frame.size.height - 165),
width: view.frame.size.width-40,
height: 20)
subLabel.text = typeLabelNameArr[i]
subLabel.backgroundColor = .clear
subLabel.textColor = .lightGray
view.addSubview(subLabel)
}
}
@objc func segmentDidSelected(segmentedControl:UISegmentedControl) {
if segmentedControl.tag == 0 {
aaChartView?.aa_hideTheSeriesElementContentWithSeriesElementIndex(segmentedControl.selectedSegmentIndex)
} else {
aaChartView?.aa_showTheSeriesElementContentWithSeriesElementIndex(segmentedControl.selectedSegmentIndex)
}
}
private func setUpTheHideChartSeriesSwitch() {
let i = 0
let uiSwitch = UISwitch()
uiSwitch.frame = CGRect(x: 100 * CGFloat(i) + 20,
y: view.frame.size.height - 70,
width: 100,
height: 20)
uiSwitch.isOn = false
uiSwitch.addTarget(self,
action: #selector(switchDidChange(switchView:)),
for:.valueChanged)
view.addSubview(uiSwitch)
let subLabel = UILabel()
subLabel.font = UIFont(name: "EuphemiaUCAS", size: 10)
subLabel.frame = CGRect(x: 100 * CGFloat(i) + 20,
y:view.frame.size.height - 45,
width: 200,
height: 35)
subLabel.text = "Hide Chart Whole Series Content"
subLabel.backgroundColor = .clear
subLabel.textColor = .lightGray
view .addSubview(subLabel)
}
@objc func switchDidChange(switchView:UISwitch) {
aaChartView?.isSeriesHidden = switchView.isOn
}
}
| [
-1
] |
73ed3c84ebcd50f85cd1d5e13b89de9fdc68ff5d | 3fb3f04efbce728ca329829012c8075e5f0420e6 | /Photos/Photos/PhotoCollectionViewCell.swift | 55786555d31d82cba547f0fd68dae437593d28e6 | [] | no_license | scottharris86/ios-photo-collection | 009de873bdcbff642ff0a460f3c5100b21793111 | 1db6c1f20fa21065a073a085617a329dc993915f | refs/heads/master | 2020-12-23T22:58:32.235727 | 2020-01-31T00:40:46 | 2020-01-31T00:40:46 | 237,302,429 | 0 | 0 | null | 2020-01-30T20:47:14 | 2020-01-30T20:47:13 | null | UTF-8 | Swift | false | false | 623 | swift | //
// PhotoCollectionViewCell.swift
// Photos
//
// Created by scott harris on 1/30/20.
// Copyright © 2020 scott harris. All rights reserved.
//
import UIKit
class PhotoCollectionViewCell: UICollectionViewCell {
@IBOutlet weak var photoImageView: UIImageView!
@IBOutlet weak var titleLabel: UILabel!
var photo: Photo? {
didSet {
updateViews()
}
}
func updateViews() {
if let photo = photo {
photoImageView.image = UIImage(data: photo.imageData)
titleLabel.text = photo.title
}
}
}
| [
-1
] |
b0b378284fb7cc3ce5e6341e97ecff2038727dba | 6a8e00f6117c421f62235baa9bcf688c0c7dbec3 | /TestDemo/TestDemo/Delegates/AppDelegate.swift | 2c54068fe4252ea649b50726767d9782d5ff378b | [] | no_license | sapnakardas/testDemo | 26245b50b05ec77276842861958d9de20302bf9f | 097c90cdb358ea2c8eb9d4517142c05b4bd6ef0e | refs/heads/master | 2022-11-13T17:11:13.894099 | 2020-07-06T04:56:58 | 2020-07-06T04:56:58 | 277,445,348 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,644 | swift | //
// AppDelegate.swift
// TestDemo
//
// Created by Sapu on 27/06/20.
// Copyright © 2020 Sapna. All rights reserved.
//
import UIKit
import IQKeyboardManagerSwift
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
// IQKeyboard enable
IQKeyboardManager.shared.enable = true
IQKeyboardManager.shared.shouldShowToolbarPlaceholder = false
return true
}
// MARK: UISceneSession Lifecycle
@available(iOS 13.0, *)
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
@available(iOS 13.0, *)
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
| [
330252,
330768,
386069,
209943,
345625,
359451,
346139,
332324,
382502,
209965,
209971,
209975,
213048,
188987,
214593,
209987,
214610,
352856,
368735,
333413,
210027,
187502,
342133,
210039,
210044,
329855,
126610,
210071,
98968,
339097,
126616,
347287,
419483,
210077,
260766,
210080,
192673,
245409,
345762,
210084,
185511,
210088,
333997,
210095,
210098,
337592,
180416,
210115,
330958,
333009,
411864,
268507,
66782,
338664,
327914,
203506,
346355,
418553,
141051,
257787,
339710,
257790,
257794,
257801,
257804,
257807,
333594,
339747,
257833,
273708,
347437,
347441,
348978,
340275,
336711,
345930,
263508,
247637,
348502,
257883,
425822,
354142,
257890,
175463,
257901,
211825,
330610,
358259,
257908,
333689,
257916,
373634,
342915,
333708,
247719,
211884,
184244,
216517,
330189,
338409,
247789,
334321,
116210,
380918,
337398,
381436,
328702
] |
6258eb222b34ab172fe24402b2a0b9d7ab1bf3db | e07eebbd7ba0ca2f203e313ea426e9906c75e559 | /Concentration/Concentration.swift | ce88b470342cf1fc6ad09f44d703ffd27b84aa51 | [] | no_license | lassesilk/Concentration | 6422192ff8762f58af998c42109e5ad217c86372 | 335bdd7774132cc3f4bdd6f65bd7951455322e34 | refs/heads/master | 2020-03-15T05:05:07.077202 | 2018-05-03T10:44:25 | 2018-05-03T10:44:25 | 131,981,214 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,679 | swift | //
// Concentration.swift
// Concentration
//
// Created by Lasse Silkoset on 19.03.2018.
// Copyright © 2018 Lasse Silkoset. All rights reserved.
//
import Foundation
//Model base.
struct Concentration
{
private(set) var cards = [Card]()
private var indexOfOneAndOnlyFaceUpCard: Int? {
get {
return cards.indices.filter { cards[$0].isFaceUp }.oneAndOnly
// var foundIndex: Int?
// for index in cards.indices {
// if cards[index].isFaceUp {
// if foundIndex == nil {
// foundIndex = index
// } else {
// return nil
// }
// }
// }
// return foundIndex
}
set {
for index in cards.indices {
cards[index].isFaceUp = (index == newValue)
}
}
}
mutating func chooseCard(at index: Int) {
//assertions used to crash the program if you make a mistake in your code, when shipping to app store, assertsions are ignored. ex of crash:
// passed index of -1.
assert(cards.indices.contains(index), "Concentration. chooseCard(at: \(index): chosen index not in the cards")
if !cards[index].isMatched {
if let matchIndex = indexOfOneAndOnlyFaceUpCard, matchIndex != index {
//Check if cards match
if cards[matchIndex] == cards[index] {
cards[matchIndex].isMatched = true
cards[index].isMatched = true
}
cards[index].isFaceUp = true
} else {
indexOfOneAndOnlyFaceUpCard = index
}
}
}
init(numberOfPairsOfCards: Int) {
for _ in 1...numberOfPairsOfCards {
let card = Card()
//let matchingCard = Card() <- This is to create another card who is equal to the first one.
// when you assign a struct to another variabel, it copies it. So matchingCard is a copy of Card. So we can do
// like this:
let matchingCard = card
cards.append(card)
cards.append(matchingCard)
//If i want I can just remove the let matchingCard and append card twice, since it is a copy.
// like this:
//cards += [card, card]
}
//TODO: Shuffle the cards
}
}
extension Collection {
var oneAndOnly: Element? {
return count == 1 ? first : nil
}
}
| [
-1
] |
bd179e418a7c86ca5a40fe6e0414c9ed0fc44571 | 5edb59a6151332ad0f46c29b04339555e59f4c49 | /Bookwitty/Models/ProductForm.swift | dff857eed9e22d3c7195eba6f22a09ce1add8ea9 | [] | no_license | MarwanT/Bookwitty | 1884c9a1285eda0823c599ec30cdf0c6e7f56457 | 5546894180dbb787ab9e924427920e4cc512360c | refs/heads/master | 2020-06-18T11:02:59.043669 | 2017-07-12T17:15:16 | 2017-07-12T17:15:16 | 196,272,931 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,413 | swift | //
// ProductForm.swift
// Bookwitty
//
// Created by Marwan on 6/29/17.
// Copyright © 2017 Keeward. All rights reserved.
//
import Foundation
struct ProductForm {
var key: String
var value: String
init?() {
self.init(key: "", value: "")
}
init?(key: String, value: String) {
guard !key.isBlank else {
return nil
}
self.key = key
self.value = value
}
}
extension ProductForm {
static func unknownFormatInstance(with key: String) -> ProductForm {
var unknownKey = key
if unknownKey.isBlank {
unknownKey = "UNKNOWN_KEY"
}
return ProductForm(key: unknownKey, value: Strings.unknown_format())!
}
}
extension ProductForm {
/*
* The list of formats below is taken from the ONIX documentation here:
* https://www.medra.org/stdoc/onix-codelist-7.htm
*/
private static let electronicProductForms = [
"AA", "AB", "AC", "AD", "AE", "AF", "AG", "AH", "AI", "AJ", "AK", "AL", "AZ",
"DA", "DB", "DC", "DD", "DE", "DF", "DG", "DH", "DI", "DJ", "DK", "DL", "DM",
"DN", "DZ", "VA", "VB", "VC", "VD", "VE", "VF", "VG", "VH", "VI", "VJ", "VK",
"VL", "VM", "VN", "VO", "VP", "VZ", "WW" ]
var isElectronicFormat: Bool {
return ProductForm.electronicProductForms.contains(self.key)
}
static func isElectronicFormat(_ key: String) -> Bool {
return electronicProductForms.contains(key.uppercased())
}
}
| [
-1
] |
85f353d313762c8876e6c6c3bb8e9d341e1823b6 | 3f612b25d5b11729de818529c77a860793540d47 | /BasicProject/Utility/AppUtility.swift | edb742eae6b341b9755c78b14faaa9158cbb6f16 | [] | no_license | RaviMehtaiOS/SwiftBasicProject | 6920c499b4606f6ff36ae0e8fa5d053d8b968d9b | 8dc6ceffdc0a162e5ca328373c0a0df91ccf40c1 | refs/heads/master | 2020-04-14T05:40:13.182242 | 2018-12-31T12:04:48 | 2018-12-31T12:04:48 | 163,665,664 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 652 | swift | //
// AppUtility.swift
// BasicProject
//
// Created by Ravi Mehta on 23/08/18.
// Copyright © 2018 Ravi Mehta. All rights reserved.
//
import UIKit
class AppUtility {
class func showAlert(title: String = "Basic Project", message: String) {
let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert)
let okAction = UIAlertAction(title: "OK", style: .default) { (action) in
alertController.dismiss(animated: true, completion: nil)
}
alertController.addAction(okAction)
topViewController.present(alertController, animated: true, completion: nil)
}
}
| [
-1
] |
cb6f945a8c6fa7b32e6b2e1d963fbca6a474ce38 | 62eb17c6edcebc0ecea298f5b153022ef55dd77a | /cybexMobile/ViewControllers/Home/HomeViewController.swift | bdc3dac1d1a48ee3c106a66897a5cae7db4f8cb7 | [] | no_license | CandyBull/cybex-ios | 96d415c6a008c7e9ddd9fd9e2824b6ad2c946fe4 | ad34ddd2b446b2f3477ed4a3e7a954d26a786aee | refs/heads/master | 2020-07-28T01:46:26.429254 | 2019-07-30T06:52:53 | 2019-07-30T06:52:53 | 209,269,785 | 0 | 0 | null | 2019-09-18T09:26:54 | 2019-09-18T09:26:53 | null | UTF-8 | Swift | false | false | 8,519 | swift | //
// HomeViewController.swift
// cybexMobile
//
// Created by koofrank on 2018/3/12.
// Copyright © 2018年 Cybex. All rights reserved.
//
import Foundation
import ReSwift
import RxCocoa
import RxSwift
import SwiftyJSON
import TinyConstraints
import Repeat
import BigInt
enum ViewType: Int {
case homeContent = 1
case businessTitle
case gameTradeTitle
case comprehensive
}
class HomeViewController: BaseViewController, UINavigationControllerDelegate, UIScrollViewDelegate {
var timer: Timer?
var coordinator: (HomeCoordinatorProtocol & HomeStateManagerProtocol)?
var pair: Pair? {
didSet {
if vcType == ViewType.businessTitle.rawValue {
guard let pair = pair, let index = MarketConfiguration.newMarketBaseAssets.map({ $0.id }).firstIndex(of: pair.base) else { return }
if let selectedIndex = MarketHelper.filterQuoteAssetTicker(pair.base).firstIndex(where: { (ticker) -> Bool in
return ticker.quote == pair.quote
}) {
self.businessTitleView?.selectedIndex = selectedIndex
self.businessTitleView?.leftView.changeToHighStatus(1 + index, save: true)
}
} else if vcType == ViewType.gameTradeTitle.rawValue {
guard let pair = pair, let index = MarketConfiguration.gameMarketBaseAssets.map({ $0.id }).firstIndex(of: pair.base) else { return }
if let selectedIndex = MarketHelper.filterQuoteAssetTicker(pair.base).firstIndex(where: { (ticker) -> Bool in
return ticker.quote == pair.quote
}) {
self.businessTitleView?.selectedIndex = selectedIndex
self.businessTitleView?.leftView.viewType = QuotesTitleView.ViewType.game.rawValue
self.businessTitleView?.leftView.changeToHighStatus(1 + index, save: true)
}
}
}
}
var contentView: HomeContentView?
var businessTitleView: BusinessTitleView?
var base: String {
if self.vcType == ViewType.homeContent.rawValue {
if let titleView = self.contentView {
return MarketConfiguration.marketBaseAssets.map({ $0.id })[titleView.currentBaseIndex]
}
return ""
} else if vcType == ViewType.gameTradeTitle.rawValue {
if let titleView = self.businessTitleView {
return MarketConfiguration.gameMarketBaseAssets.map({ $0.id })[titleView.currentBaseIndex]
}
return ""
} else {
if let titleView = self.businessTitleView {
return MarketConfiguration.marketBaseAssets.map({ $0.id })[titleView.currentBaseIndex]
}
return ""
}
}
var vcType: Int = 1 {
didSet {
switchContainerView()
}
}
override func viewDidLoad() {
super.viewDidLoad()
startLoading()
setupUI()
}
func setupUI() {
if #available(iOS 11.0, *) {
navigationItem.largeTitleDisplayMode = .always
}
self.localizedText = R.string.localizable.navWatchlist.key.localizedContainer()
switchContainerView()
}
func switchContainerView() {
contentView?.removeFromSuperview()
businessTitleView?.removeFromSuperview()
if self.vcType == ViewType.homeContent.rawValue ||
self.vcType == ViewType.comprehensive.rawValue {
contentView = HomeContentView()
contentView?.viewType = ViewType.init(rawValue: self.vcType) ?? ViewType.homeContent
self.view.addSubview(contentView!)
contentView?.edgesToDevice(vc: self,
insets: TinyEdgeInsets(top: 0, left: 0, bottom: 0, right: 0),
priority: .required,
isActive: true,
usingSafeArea: true)
} else {
businessTitleView = BusinessTitleView(frame: self.view.bounds)
self.view.addSubview(businessTitleView!)
businessTitleView?.edges(to: self.view,
insets: TinyEdgeInsets(top: 0, left: 0, bottom: 0, right: 0))
self.updateUI()
}
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
if checkNeedRefresh(appData.tickerData.value) {
self.updateUI()
if self.vcType == ViewType.comprehensive.rawValue {
self.parent?.endLoading()
} else {
self.endLoading()
}
}
}
func checkNeedRefresh(_ result: [Ticker]) -> Bool {
if self.vcType == ViewType.comprehensive.rawValue {
if result.count >= MarketConfiguration.shared.marketPairs.value.count, result.count != 0 {
return true
}
} else {
let tickers = result.filter { (ticker) -> Bool in
return ticker.base == self.base
}
if tickers.count == MarketConfiguration.shared.marketPairs.value.filter({ $0.base == self.base}).count,
tickers.count != 0 {
return true
}
}
return false
}
override func configureObserveState() {
appData.tickerData.asObservable().filter({[weak self] (result) -> Bool in
guard let self = self else { return false}
return self.checkNeedRefresh(result)
}).take(1)
.subscribe(onNext: {[weak self] (_) in
guard let self = self else { return }
self.updateUI()
if self.vcType == ViewType.comprehensive.rawValue {
self.parent?.endLoading()
} else {
self.endLoading()
}
self.timer = Timer.scheduledTimer(timeInterval: 3,
target: self,
selector: #selector(self.updateUI),
userInfo: nil,
repeats: true)
}, onError: nil, onCompleted: nil, onDisposed: nil).disposed(by: disposeBag)
}
@objc func updateUI() {
self.performSelector(onMainThread: #selector(self.refreshTableView),
with: nil,
waitUntilDone: false)// non block tracking mode
}
@objc func refreshTableView() {
if self.isVisible {
let data = appData.tickerData.value
if self.vcType == ViewType.homeContent.rawValue || self.vcType == ViewType.comprehensive.rawValue {
// self.contentView?.data = data.filter({$0.baseVolume != "0"})
self.contentView?.data = data
self.contentView?.viewType = ViewType(rawValue: self.vcType) ?? .homeContent
} else {
// self.businessTitleView?.data = data.filter({$0.baseVolume != "0"})
self.businessTitleView?.data = data
}
}
}
}
extension HomeViewController {
@objc func cellClicked(_ data: [String: Any]) {
if vcType == ViewType.homeContent.rawValue {//首页
if let selectedPair = data["pair"] as? Pair {
self.coordinator?.openMarket(selectedPair)
}
} else if vcType == ViewType.comprehensive.rawValue {
if let index = data["index"] as? Int,
appData.tickerData.value.count >= MarketConfiguration.shared.marketPairs.value.count {
let datas = MarketHelper.filterPopAssetsCurrency()
if datas.count > index {
let buckets = MarketHelper.filterPopAssetsCurrency()[index]
if buckets.incre != .greater {
return
}
self.coordinator?.openMarket(Pair(base: buckets.base, quote:buckets.quote))
}
}
} else {
if let value = data["info"] as? Pair {
if let superVC = self.parent as? TradeViewController {
superVC.startLoading()
superVC.pair = value
superVC.sendEventActionWith()
}
}
}
}
}
| [
-1
] |
34b5415b4487ec94f00057856ef25d329ccfb75d | ff568c523c5a6f7ed180fef7ba4e66e18c64cc42 | /withdrawalChallenge.playground/Contents.swift | d46b61456d86d0f8d2a1133d1c9e68fe748387f9 | [] | no_license | ugozeal/Swift-Algorithms | ee4e1149378d65ee700557dbcb2a4b5a6e392022 | b2e93d27bb498ada7ffa09b48eb59c66b05fc43c | refs/heads/master | 2023-02-20T07:04:37.020344 | 2023-02-18T17:31:31 | 2023-02-18T17:31:31 | 290,518,977 | 2 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,086 | swift | import UIKit
func withdraw(_ n: Int) -> [Int] {
//coding and coding..
var count100 = 0; var count50 = 0; var count20 = 0
var newN = n
var emptyArray = [Int]()
while newN > 0 {
switch newN{
case newN % 100: newN = newN - 100; count100 += 1
case newN % 50:newN = newN - 50;count50 += 1
case newN % 20:newN = newN - 20;count20 += 1
default:newN = newN - 20;count20 += 1
}
// if newN % 100 == 0 {
// newN = newN - 100
// count100 += 1
// continue
//
// }else if newN % 50 == 0 {
// newN = newN - 50
// count50 += 1
// continue
// }
// else if newN % 20 == 0{
// newN = newN - 20
// count20 += 1
//
// }else {
// newN = newN - 20
// count20 += 1
// }
}
// emptyArray.append(count100)
// emptyArray.append(count50)
// emptyArray.append(count20)
emptyArray += [count100, count50, count20]
return emptyArray
}
withdraw(110)
| [
-1
] |
64c4bca4cda8478effcc2d74157e574b0c6b37e1 | e0fb6340021ac5efa20890865792ece68f766be5 | /dummyYummy/dummyYummy/СommonUI/RecipesView/RecipesViewProtocol.swift | 75ca01641d395723dbc436664e0a1232b36ea375 | [] | no_license | badyi/dummyYummy | 86453269ae55bee72467203531d4cd9d578c9a32 | f6ac70fa6f28bfe74aad770205f1ed0d021b249b | refs/heads/master | 2023-07-05T05:09:06.975788 | 2021-08-22T18:22:51 | 2021-08-22T18:22:51 | 378,257,965 | 16 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 603 | swift | //
// RecipeViewProtocol.swift
// dummyYummy
//
// Created by badyi on 17.07.2021.
//
import UIKit
protocol RecipesViewProtocol: AnyObject {
/// Reload collection view
func reloadCollectionView()
/// Function for reloading collection view at specific indexes
/// - Parameter indexPaths: indexes of cells to reload
func reloadItems(at indexPaths: [IndexPath])
/// Need this method to stop
/// animtion in visible cells when new view controller is pushed
func stopVisibleCellsAnimation()
/// Reload visible cells on user screen
func reloadVisibleCells()
}
| [
-1
] |
0d4907b1da5ff74f15dfca3082f3fde192ab02df | ec8003a12ec6c2cfff4ee3f3fd7827046ae649d3 | /LuceneSearchDemo/ViewController.swift | 1f7481ffc8b4c9f32aa8457e565093e79c283cae | [
"MIT"
] | permissive | kevindelord/LuceneSearchDemo-iOS | b8a227ab7cf02be36f9ffd70f2133ed248ff42d9 | f9ba8b13351515f70b55cc5e131811dc60cd9574 | refs/heads/master | 2021-01-22T17:28:32.065893 | 2016-05-27T08:10:26 | 2016-05-27T08:10:26 | 58,736,577 | 0 | 0 | null | 2016-05-13T12:06:31 | 2016-05-13T12:06:31 | null | UTF-8 | Swift | false | false | 6,434 | swift | //
// ViewController.swift
// LuceneSearchDemo
//
// Copyright (c) 2015 Lukhnos Liu.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
import UIKit
class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate, UISearchBarDelegate {
let cellReuseID = "DocumentCell"
var foundDocuments: NSArray = []
@IBOutlet var searchBar: UISearchBar!
@IBOutlet var infoView: UIView!
@IBOutlet var activityIndicator: UIActivityIndicatorView!
@IBOutlet var infoLabel: UILabel!
@IBOutlet var linkButton: UIButton!
@IBOutlet var tableView: UITableView!
@IBOutlet var reindexButtonItem: UIBarButtonItem!
enum State {
case Welcome, Searching, NoResult, HasResults, RebuildingIndex
}
var state: State = .NoResult {
didSet {
updateUIState()
}
}
override func viewDidLoad() {
super.viewDidLoad()
state = .Welcome
tableView.registerNib(UINib(nibName: cellReuseID, bundle: nil), forCellReuseIdentifier: cellReuseID)
tableView.rowHeight = 108;
searchBar.autocapitalizationType = UITextAutocapitalizationType.None
}
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
if !NSFileManager.defaultManager().fileExistsAtPath(Document.indexRootPath()) {
rebuildAction()
}
if let selectedIndexPath = tableView.indexPathForSelectedRow {
tableView.deselectRowAtIndexPath(selectedIndexPath, animated: false)
}
}
@IBAction func moreInfoAction() {
UIApplication.sharedApplication().openURL(NSURL(string: "https://lukhnos.org/mobilelucene/app-ios")!)
}
@IBAction func rebuildAction() {
reindexButtonItem.enabled = false
state = .RebuildingIndex
searchBar.text = ""
searchBar.resignFirstResponder()
searchBar.hidden = true
foundDocuments = []
tableView.reloadData()
Document.rebuildIndex({
self.state = .Welcome
self.searchBar.hidden = false
self.reindexButtonItem.enabled = true
})
}
func updateUIState() {
let hideInfo: Bool
switch (state) {
case .Welcome:
hideInfo = false
activityIndicator.stopAnimating()
infoLabel.hidden = false
infoLabel.text = NSLocalizedString("Search with Lucene", comment: "");
linkButton.hidden = false
case .Searching:
hideInfo = false
activityIndicator.startAnimating()
infoLabel.hidden = true
infoLabel.text = ""
linkButton.hidden = true
case .NoResult:
hideInfo = false
activityIndicator.stopAnimating()
infoLabel.hidden = false
infoLabel.text = NSLocalizedString("No Results", comment: "");
linkButton.hidden = true
case .HasResults:
hideInfo = true
activityIndicator.stopAnimating()
infoLabel.hidden = true
infoLabel.text = "";
linkButton.hidden = true
case .RebuildingIndex:
hideInfo = false
activityIndicator.startAnimating()
infoLabel.hidden = false
infoLabel.text = NSLocalizedString("Indexing Reviews…", comment: "");
linkButton.hidden = true
}
infoView.hidden = hideInfo
tableView.hidden = !hideInfo
}
var text = NSMutableString()
func searchBarSearchButtonClicked(searchBar: UISearchBar) {
searchBar.resignFirstResponder()
state = .Searching
if let t = searchBar.text {
text.setString(t)
}
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), {
if let docs = Document.search(self.text) {
self.foundDocuments = docs
} else {
self.foundDocuments = []
}
dispatch_async(dispatch_get_main_queue(), {
if self.foundDocuments.count > 0 {
self.state = .HasResults
} else {
self.state = .NoResult
}
self.tableView.setContentOffset(CGPointZero, animated: false)
self.tableView.reloadData()
})
})
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return foundDocuments.count
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier(cellReuseID, forIndexPath: indexPath) as! DocumentCell
let doc = foundDocuments[indexPath.row] as! Document
cell.configureCell(doc)
return cell
}
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
performSegueWithIdentifier("showDetail", sender: self)
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if let selectedIndexPath = tableView.indexPathForSelectedRow {
let doc = foundDocuments[selectedIndexPath.row] as! Document
let controller = segue.destinationViewController as! DetailsViewController
controller.document = doc
}
}
}
| [
-1
] |
ba7635eab276515946190666beb77a256382b70a | d7f9b021161333abc5f677ef8dda237ade96aad9 | /FoundMaster/detailsTableFieldExt.swift | 183be2c77ad9eb713520a146bed94b100316f909 | [] | no_license | lim-james/Found | 297e8b6a7f778141451a941c557523ccdae79bde | 0ec123c30dca43b7581c5f911f760376d0cde35a | refs/heads/master | 2021-08-19T07:14:00.231472 | 2017-11-25T04:53:25 | 2017-11-25T04:53:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,682 | swift | //
// detailsTableViewExt.swift
// FoundMaster
//
// Created by Storm Lim Got Game on 12/11/16.
// Copyright © 2016 J.Lim. All rights reserved.
//
extension detailsVC {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
//if it is location row, open map
if indexPath.row == 1 {
performSegue(withIdentifier: "openMap", sender: self)
}
}
//declare number of rows (fixed)
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 4
}
//set up rows
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! detailsTVC
switch indexPath.row {
case 0:
//first row - item name
cell.label.text = name
cell.icon.image = UIImage(named: "ic_label_48pt")
case 1:
//seocnd row - location
cell.label.text = location
cell.icon.image = UIImage(named: "ic_location_on_48pt")
case 2:
//third row - date
cell.label.text = date
cell.icon.image = UIImage(named: "ic_event_48pt")
case 3:
//forth row - name of person who found
cell.label.text = person
cell.icon.image = UIImage(named: "ic_account_circle_48pt")
default:
cell.label.text = ""
cell.icon.image = nil
}
return cell
}
}
| [
-1
] |
50fc31c64a0b6446e402b90fadc98a61363e0dad | 58a2995dd249b73813a4be2c16c552d7f5620bfe | /network/resource-manager/Sources/network/commands/RouteTables.swift | dfe8d7cbf27e73e29b683405bb4006ae58b75b1b | [
"MIT"
] | permissive | Azure/azure-libraries-for-swift | e577d83d504f872cf192c31d97d11edafc79b8be | b7321f3c719c381894e3ee96c5808dbcc97629d7 | refs/heads/master | 2023-05-30T20:22:09.906482 | 2021-02-01T09:29:10 | 2021-02-01T09:29:10 | 106,317,605 | 9 | 5 | MIT | 2021-02-01T09:29:11 | 2017-10-09T18:02:45 | Swift | UTF-8 | Swift | false | false | 1,933 | swift | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// RouteTables is the network Client
import Foundation
import azureSwiftRuntime
extension Commands {
public struct RouteTables {
public static func CreateOrUpdate(resourceGroupName: String, routeTableName: String, subscriptionId: String, parameters: RouteTableProtocol) -> RouteTablesCreateOrUpdate {
return CreateOrUpdateCommand(resourceGroupName: resourceGroupName, routeTableName: routeTableName, subscriptionId: subscriptionId, parameters: parameters)
}
public static func Delete(resourceGroupName: String, routeTableName: String, subscriptionId: String) -> RouteTablesDelete {
return DeleteCommand(resourceGroupName: resourceGroupName, routeTableName: routeTableName, subscriptionId: subscriptionId)
}
public static func Get(resourceGroupName: String, routeTableName: String, subscriptionId: String) -> RouteTablesGet {
return GetCommand(resourceGroupName: resourceGroupName, routeTableName: routeTableName, subscriptionId: subscriptionId)
}
public static func List(resourceGroupName: String, subscriptionId: String) -> RouteTablesList {
return ListCommand(resourceGroupName: resourceGroupName, subscriptionId: subscriptionId)
}
public static func ListAll(subscriptionId: String) -> RouteTablesListAll {
return ListAllCommand(subscriptionId: subscriptionId)
}
public static func UpdateTags(resourceGroupName: String, routeTableName: String, subscriptionId: String, parameters: TagsObjectProtocol) -> RouteTablesUpdateTags {
return UpdateTagsCommand(resourceGroupName: resourceGroupName, routeTableName: routeTableName, subscriptionId: subscriptionId, parameters: parameters)
}
}
}
| [
-1
] |
ea265cc5dbf496de92c110555f112df5622ebdda | f6df77aef13aaff863a993b437c395ae710965f3 | /DAL/Model/Responses/Applications/AddApplicationResponse.swift | f88a75ff72e6bb41f2f05a4a708aa45ab8968da9 | [] | no_license | djaustin/fyp-ios | 124ab66b0857ced6dd2f1c41ea5c0b4c62a5b47c | 58d09dac9908f50edbbcc14444aa76219b36eac3 | refs/heads/master | 2020-04-10T19:47:53.565800 | 2018-03-31T16:07:24 | 2018-03-31T16:07:24 | 161,247,702 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 477 | swift | //
// AddApplicationResponse.swift
// Digital Monitor
//
// Created by Dan Austin on 23/01/2018.
// Copyright © 2018 Dan Austin. All rights reserved.
//
import Foundation
/// Response body of POST request to applications endpoint
struct PostApplicationResponse : Codable {
var status: String
var data: PostApplicationResponseData
struct PostApplicationResponseData : Codable {
var application: DMApplication
var locations: [URL]
}
}
| [
-1
] |
d7728167a0121832fad6e2da477ac8526c6bfcb5 | 5991b3449a7cce48716926d35541d15303bc91b9 | /wallet/wallet/Views/InputPasscodeWithCustomPad.swift | 4a331c9a39b412774985d9c5aea6fd3ea42917ac | [
"MIT"
] | permissive | praveshkhatana/pirate-chain-ios-wallet | f8636f5ecf2fef351a730ee39d6644b4a25eaa1c | 936f56d6f969d2892646065f2ad5d4fd40d623e7 | refs/heads/master | 2023-05-19T12:50:45.776990 | 2021-05-21T18:01:01 | 2021-05-21T18:01:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 6,853 | swift | //
// InputPasscodeWithCustomPad.swift
// ARRR-Wallet
//
// Created by Lokesh Sehgal on 20/05/21.
// Copyright © 2021 Francisco Gindre. All rights reserved.
//
import Foundation
import SwiftUI
struct InputPasscodeWithCustomPad: View {
@State var isPassCodeEntered = false
@EnvironmentObject var appEnvironment: ZECCWalletEnvironment
@Environment(\.presentationMode) var mode:Binding<PresentationMode>
@State var copiedValue: PasteboardItemModel?
@State var destination: Destination?
@State var aUniqueCode : [String] = []
@State var customDigits : [NumPadRow] = []
var anInitialPassCode = ""
let aPasscodeTitle = "Enter a Passcode".localized()
let aConfirmPasscode = "Confirm Passcode".localized()
enum Destination: Int, Identifiable, Hashable {
case inputPasscode
var id: Int {
return self.rawValue
}
}
func getRandomNumbers()->[Int]{
var allNumbers = [0,1,2,3,4,5,6,7,8,9]
var uniqueNumbers = [Int]()
while allNumbers.count > 0 {
let number = Int(arc4random_uniform(UInt32(allNumbers.count)))
uniqueNumbers.append(allNumbers[number])
allNumbers.swapAt(number, allNumbers.count-1)
allNumbers.removeLast()
}
return uniqueNumbers
}
func getRandomizedPadDigits()->[NumPadRow]{
var customPadDigits = [NumPadRow]()
let uniqueNumbers = getRandomNumbers()
var aColumnIndex = 0
var aRowIndex = 0
var arrayOfNumPadValues = [NumPadValue]()
for aNumber in uniqueNumbers {
if aColumnIndex > 2 {
aColumnIndex = 0
customPadDigits.append(NumPadRow(id: aRowIndex, row: arrayOfNumPadValues))
arrayOfNumPadValues.removeAll()
aRowIndex += 1
}
if uniqueNumbers.last == aNumber {
arrayOfNumPadValues.append(NumPadValue(id: 0, value: "delete.left.fill"))
arrayOfNumPadValues.append(NumPadValue(id: 1, value: String(aNumber)))
}else{
arrayOfNumPadValues.append(NumPadValue(id: aColumnIndex, value: String(aNumber)))
}
aColumnIndex += 1
}
customPadDigits.append(NumPadRow(id: 3, row: arrayOfNumPadValues))
return customPadDigits
}
var body: some View {
ZStack(alignment: .center) {
ZcashBackground.pureBlack
NavigationView{
VStack{
VStack{
Spacer()
Text(!isPassCodeEntered ? aPasscodeTitle : aConfirmPasscode).font(.title)
HStack(spacing: 20){
ForEach(aUniqueCode,id: \.self){i in
Text(i).font(.title).fontWeight(.semibold)
}
}.padding(.vertical)
Spacer()
CustomNumberPad(uniqueCodes: $aUniqueCode,customDigits: $customDigits)
}
}.onAppear {
if customDigits.isEmpty {
customDigits = getRandomizedPadDigits()
}
NotificationCenter.default.addObserver(forName: NSNotification.Name("EnteredCode"), object: nil, queue: .main) { (_) in
self.isPassCodeEntered = true
}
}
}.preferredColorScheme(.dark)
.animation(.spring())
}.background(Color.black)
}
}
struct InputPasscodeWithCustomPad_Previews: PreviewProvider {
static var previews: some View {
InputPasscodeWithCustomPad()
}
}
struct NumPadRow : Identifiable {
var id : Int
var row : [NumPadValue]
}
struct NumPadValue : Identifiable {
var id : Int
var value : String
}
struct CustomNumberPad : View {
@Binding var uniqueCodes : [String]
@Binding var customDigits : [NumPadRow]
var body : some View{
VStack(alignment: .leading,spacing: 20){
ForEach(customDigits){index in
HStack(spacing: self.getScreenSpacing()){
ForEach(index.row){jIndex in
Button(action: {
if jIndex.value == "delete.left.fill"{
self.uniqueCodes.removeLast()
}
else{
self.uniqueCodes.append(jIndex.value)
if self.uniqueCodes.count == 4{
// Success here code is verified
print(self.getPasscode())
NotificationCenter.default.post(name: NSNotification.Name("EnteredCode"), object: nil)
self.uniqueCodes.removeAll()
}
}
}) {
if jIndex.value == "delete.left.fill"{
Image(systemName: jIndex.value).font(.body).padding(.vertical)
}
else{
Text(jIndex.value).font(.title).fontWeight(.semibold).padding(.vertical)
}
}
}
}
}
}.foregroundColor(.white)
}
func getScreenSpacing()->CGFloat{
return UIScreen.main.bounds.width / 3
}
func getPasscode()->String{
var code = ""
for i in self.uniqueCodes{
code += i
}
return code.replacingOccurrences(of: " ", with: "")
}
}
| [
-1
] |
27248c878e8c5bcbb44835efd6e43b1f42e3b73f | 0354d8e29fcbb65a06525bcac1f55fd08288b6e0 | /clients/swift4/generated/SwaggerClient/Classes/Swaggers/Models/GithubScm.swift | a98c8b5e1e01083e9c415d109b8a603b526a1b93 | [
"MIT"
] | permissive | zhiwei55/swaggy-jenkins | cdc52956a40e947067415cec8d2da1425b3d7670 | 678b5477f5f9f00022b176c34b840055fb1b0a77 | refs/heads/master | 2020-03-06T20:38:53.012467 | 2018-02-19T01:53:33 | 2018-02-19T01:54:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 560 | swift | //
// GithubScm.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
//
import Foundation
open class GithubScm: Codable {
public var _class: String?
public var links: GithubScmlinks?
public var credentialId: String?
public var id: String?
public var uri: String?
public init() {}
private enum CodingKeys: String, CodingKey {
case _class = "_class"
case links = "_links"
case credentialId = "credentialId"
case id = "id"
case uri = "uri"
}
}
| [
-1
] |
1d97633456d766b414b8ba7a24d09a703c1dc15a | e6e16c28c411839e97e81fa5fc4b6446a1897a29 | /Smack2/AppDelegate.swift | 8602fef6ba76711713bdc4e1c30f339b2301e5f3 | [] | no_license | zaydm19/Smack2 | a23a901803af41c31dc120f1fabc8990fee8d01f | dbb8187be2995a9c7c7714a12cd51f3b3c858bbb | refs/heads/master | 2021-08-14T20:44:21.018768 | 2017-10-31T15:34:58 | 2017-10-31T15:34:58 | 109,016,426 | 0 | 0 | null | 2017-11-08T20:35:57 | 2017-10-31T15:36:53 | Swift | UTF-8 | Swift | false | false | 2,173 | swift | //
// AppDelegate.swift
// Smack2
//
// Created by Zayd Midani on 2017-10-31.
// Copyright © 2017 Zayd Midani. 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,
229388,
294924,
278542,
327695,
229391,
229394,
278548,
229397,
229399,
229402,
352284,
229405,
278556,
278559,
229408,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
311349,
286774,
319544,
204856,
229432,
286776,
286778,
352318,
286791,
237640,
286797,
278605,
311375,
163920,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
237693,
303230,
327814,
131209,
303241,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
286916,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
303347,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
295220,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
278983,
319945,
278986,
278990,
278994,
311767,
279003,
279006,
188895,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
320007,
287238,
172552,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
311850,
279082,
279084,
172591,
172598,
172607,
172609,
172612,
377413,
172614,
213575,
172618,
303690,
33357,
303696,
279124,
172634,
262752,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
295538,
189040,
172660,
287349,
189044,
189039,
287355,
287360,
295553,
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,
279231,
287427,
312005,
312006,
107208,
107212,
172748,
287436,
172751,
287440,
295633,
172755,
303827,
279255,
287450,
303835,
279258,
189149,
303838,
213724,
312035,
279267,
295654,
279272,
312048,
230128,
312050,
230131,
205564,
303871,
230146,
295685,
328453,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
303976,
336744,
303981,
303985,
303987,
328563,
303991,
303997,
295806,
295808,
304005,
295813,
304007,
320391,
304009,
213895,
304011,
189325,
304013,
295822,
213902,
189329,
295825,
189331,
304019,
279438,
58262,
304023,
279452,
279461,
279462,
304042,
213931,
304055,
230327,
287675,
197564,
230334,
304063,
238528,
304065,
213954,
189378,
156612,
312272,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
295945,
230413,
197645,
295949,
320528,
140312,
295961,
238620,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
296004,
132165,
336964,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
361576,
296040,
205931,
296044,
164973,
205934,
279661,
312432,
337018,
189562,
279679,
304258,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
165038,
238766,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
304348,
304354,
296163,
320740,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
230679,
320792,
230681,
296215,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
296259,
296262,
230727,
296264,
320840,
238919,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
410987,
230763,
148843,
230768,
296305,
312692,
230773,
304505,
181626,
304506,
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,
280021,
329177,
288217,
288218,
280027,
288220,
239070,
239064,
288224,
370146,
280034,
288226,
288229,
280036,
280038,
288232,
288230,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
148990,
321022,
206336,
402942,
296446,
296450,
230916,
230919,
304651,
370187,
304653,
230923,
402969,
230940,
222752,
108066,
296486,
296488,
157229,
230961,
157236,
288320,
288325,
124489,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
239202,
370279,
312938,
280183,
280191,
116354,
280194,
280208,
280211,
288408,
280222,
419489,
190118,
198310,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
419522,
313027,
280260,
419525,
206536,
280264,
206539,
206541,
206543,
280276,
321239,
280283,
18140,
313052,
288478,
313055,
321252,
313066,
288494,
280302,
313073,
419570,
288499,
321266,
288502,
280314,
288510,
124671,
67330,
280324,
280331,
198416,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
288576,
345921,
337732,
280388,
304968,
280402,
173907,
313176,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
313258,
321458,
296883,
124853,
10170,
296890,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
354265,
354270,
239586,
313320,
354281,
231404,
124913,
165876,
321528,
313340,
288764,
239612,
239617,
313347,
288773,
313358,
305176,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
280681,
313451,
223341,
280687,
215154,
313458,
149618,
280691,
313464,
321659,
288895,
321670,
215175,
288909,
141455,
275606,
280725,
313498,
100520,
280747,
288940,
288947,
280755,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
321740,
313548,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
280811,
280817,
125171,
280819,
157940,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
305464,
280891,
289087,
280897,
280900,
239944,
305480,
280906,
239947,
305485,
305489,
280919,
248153,
215387,
354653,
354656,
313700,
313705,
280937,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
240011,
199051,
289166,
240017,
297363,
190868,
240021,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
305594,
289210,
281024,
289218,
289227,
436684,
281047,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
330244,
240132,
223752,
338440,
150025,
281095,
223757,
281102,
223763,
223765,
322074,
281116,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
338528,
338532,
199273,
281196,
158317,
19053,
313973,
297594,
281210,
158347,
264845,
182926,
133776,
182929,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
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,
174955,
224110,
207733,
207737,
183172,
158596,
338823,
322440,
314249,
183184,
240535,
224151,
289687,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
183260,
420829,
289762,
322534,
297961,
183277,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
216376,
298306,
380226,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
306555,
314747,
298365,
290171,
290174,
224641,
281987,
314756,
298372,
281990,
224647,
298377,
314763,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
282101,
241142,
191992,
290298,
151036,
290302,
290305,
306694,
192008,
323084,
257550,
282127,
290321,
282130,
290325,
282133,
241175,
290328,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
28219,
282186,
224849,
282195,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282255,
282261,
175770,
298651,
323229,
282269,
298655,
323231,
61092,
282277,
282295,
323260,
282300,
323266,
282310,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
315190,
241464,
159545,
282425,
298811,
307009,
413506,
241475,
307012,
298822,
315211,
307027,
315221,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
315253,
315255,
339838,
315267,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
298901,
44948,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
241581,
241583,
323504,
241586,
290739,
241588,
282547,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
307211,
282639,
282645,
241693,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
307287,
315482,
217179,
315483,
192605,
307290,
233567,
200801,
299105,
217188,
299109,
307303,
315495,
356457,
307307,
45163,
315502,
192624,
307314,
323700,
299126,
233591,
307329,
315524,
307338,
233613,
241813,
307352,
299164,
299167,
184479,
184481,
315557,
184486,
307370,
307372,
307374,
307376,
323763,
299191,
176311,
307385,
307386,
258235,
307388,
176316,
307390,
184503,
299200,
307394,
307396,
299204,
184518,
307399,
323784,
233679,
307409,
307411,
299225,
233701,
307432,
282881,
282893,
323854,
291089,
282906,
291104,
233766,
295583,
307508,
315701,
332086,
307510,
307512,
307515,
307518,
282942,
282947,
323917,
282957,
110926,
233808,
323921,
315733,
323926,
233815,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
291226,
242075,
283033,
291231,
61855,
283042,
291238,
291241,
127403,
127405,
127407,
291247,
299440,
299444,
127413,
291254,
283062,
127417,
291260,
127421,
127424,
299457,
127429,
127431,
315856,
127440,
176592,
315860,
176597,
127447,
283095,
299481,
127449,
176605,
242143,
127455,
127457,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
291314,
127474,
291317,
135672,
127480,
233979,
291323,
127485,
291330,
127490,
127494,
283142,
127497,
135689,
233994,
127500,
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,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
135839,
299680,
225954,
135844,
299684,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
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,
242450,
234258,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
234278,
299814,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
316233,
234313,
316235,
234316,
283468,
242511,
234319,
234321,
234324,
201557,
234329,
234333,
308063,
234336,
242530,
349027,
234338,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
234364,
291711,
234368,
234370,
291714,
291716,
234373,
316294,
226182,
234375,
308105,
226185,
234379,
201603,
324490,
234384,
234390,
226200,
234393,
209818,
308123,
234396,
324508,
291742,
324504,
234398,
234401,
291747,
291748,
234405,
291750,
324518,
324520,
234407,
234410,
291754,
291756,
324522,
226220,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
324536,
275384,
234428,
291773,
234431,
242623,
324544,
324546,
234434,
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,
324599,
234487,
234490,
234493,
234496,
316416,
308226,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
234519,
234520,
316439,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
234546,
275508,
234549,
300085,
300088,
234553,
234556,
234558,
316479,
234561,
308291,
316483,
234563,
160835,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
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,
324757,
234647,
226453,
234648,
234650,
308379,
275608,
234653,
300189,
119967,
324766,
324768,
283805,
234657,
242852,
234661,
300197,
283813,
234664,
275626,
234667,
316596,
308414,
300223,
234687,
300226,
308418,
283844,
300229,
308420,
308422,
234692,
283850,
300234,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
300270,
300272,
120053,
300278,
316663,
275703,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
349451,
177424,
275725,
283917,
349464,
415009,
283939,
259367,
292143,
283951,
300344,
243003,
283963,
226628,
283973,
300357,
177482,
283983,
316758,
357722,
316766,
316768,
292192,
218464,
292197,
316774,
218473,
324978,
136562,
333178,
275834,
275836,
275840,
316803,
316806,
316811,
316814,
226703,
300433,
234899,
226709,
357783,
316824,
316826,
300448,
144807,
144810,
144812,
284076,
144814,
144820,
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,
284213,
308790,
284215,
316983,
194103,
284218,
226877,
292414,
284223,
284226,
284228,
243268,
292421,
284231,
226886,
128584,
284234,
366155,
317004,
276043,
284238,
226895,
284241,
292433,
284243,
300628,
284245,
194130,
284247,
317015,
235097,
243290,
284249,
276052,
276053,
300638,
284251,
284253,
284255,
284258,
292452,
292454,
284263,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
292479,
284288,
292481,
284290,
325250,
284292,
292485,
325251,
276095,
276098,
284297,
317066,
284299,
317068,
276109,
284301,
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,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
284379,
284381,
284384,
358114,
284386,
358116,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
284399,
358128,
276206,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
300828,
300830,
276255,
325408,
300832,
300834,
284449,
317221,
227109,
358183,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
366406,
276295,
153417,
292681,
358224,
276308,
178006,
317271,
284502,
276315,
292700,
284511,
317279,
292715,
300912,
292721,
284529,
300915,
292729,
317306,
284540,
292734,
325512,
358292,
284564,
317332,
399252,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
284585,
276395,
292784,
358326,
161718,
358330,
276411,
276418,
301009,
301011,
301013,
292823,
301015,
358360,
301017,
292828,
276446,
153568,
276448,
292839,
276455,
350186,
292843,
276460,
178161,
227314,
276466,
350200,
325624,
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,
284739,
325700,
292934,
243785,
276553,
350293,
350295,
309337,
227418,
350299,
194649,
350302,
194654,
227423,
178273,
309346,
227426,
309348,
350308,
309350,
194660,
309352,
350313,
309354,
301163,
350316,
292968,
227430,
301167,
276583,
350321,
276590,
284786,
276595,
350325,
227440,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
309450,
276685,
309455,
276689,
309462,
301272,
309468,
194780,
309471,
301283,
317672,
317674,
325867,
243948,
309491,
227571,
309494,
243960,
227583,
276735,
227587,
276739,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
235858,
276829,
276833,
391523,
276836,
293227,
293232,
276848,
186744,
211324,
227709,
285061,
366983,
317833,
178572,
285070,
285077,
227738,
317853,
276896,
317858,
342434,
317864,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
129486,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
293346,
227810,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
236043,
342541,
113167,
309779,
317971,
309781,
277011,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
23094,
277054,
219714,
129603,
318020,
301636,
301639,
301643,
285265,
399955,
309844,
277080,
309849,
285282,
326244,
318055,
277100,
309871,
121458,
170619,
309885,
309888,
277122,
277128,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
334488,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
293555,
318132,
342707,
154292,
277173,
277177,
277181,
318144,
277187,
277194,
277196,
277201,
342745,
137946,
342747,
113378,
228069,
277223,
342760,
285417,
56043,
56045,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
293666,
285474,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
301884,
293696,
310080,
277317,
293706,
277322,
162643,
310100,
301911,
301913,
277337,
301921,
236397,
162671,
310134,
15224,
236408,
277368,
416639,
416640,
113538,
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,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
293956,
277573,
228422,
310344,
293960,
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,
302218,
294026,
285835,
384148,
162964,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
302296,
384222,
310498,
285927,
318698,
302315,
228592,
294132,
138485,
228601,
204026,
228606,
64768,
310531,
138505,
228617,
318742,
277798,
130345,
113964,
285997,
384302,
285999,
113969,
318773,
318776,
286010,
417086,
286016,
302403,
294211,
384328,
146765,
294221,
326991,
294223,
179547,
146784,
302436,
294246,
327015,
310632,
327017,
351594,
351607,
310648,
310651,
310657,
310659,
351619,
294276,
327046,
253320,
310665,
318858,
310672,
351633,
310689,
130468,
228776,
277932,
310703,
130486,
310710,
310712,
310715,
302526,
228799,
302534,
245191,
310727,
64966,
302541,
302543,
310737,
228825,
163290,
310749,
310755,
187880,
310764,
286188,
310772,
40440,
212472,
40443,
286203,
310780,
40448,
228864,
286214,
228871,
302603,
302614,
302617,
286233,
302621,
187936,
146977,
187939,
40484,
294435,
40486,
286246,
40488,
245288,
294439,
40491,
294440,
294443,
294445,
310831,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
400976,
212560,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286312,
40554,
286313,
310892,
40557,
40560,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
302764,
278188,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
302793,
294601,
212690,
319187,
286420,
278227,
229076,
286425,
319194,
278235,
229086,
278238,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
311048,
294664,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
188252,
237409,
294776,
360317,
294785,
327554,
360322,
40851,
294811,
319390,
237470,
40865,
319394,
294817,
294821,
311209,
180142,
294831,
188340,
40886,
294844,
294847,
237508,
393177,
294876,
294879,
294883,
393190,
294890,
311279,
278513,
237555,
311283,
278519,
237562
] |
c6dc1c14b88753e3e0bfc4c940f0944f0238b083 | 73e3833e8b985c58ced29e867604bc44f9a81876 | /Todoey/Controllers/ToDoListViewController.swift | 8f333f3bac04c65811cc05f9e3cc241be4d4e759 | [] | no_license | kevinstewartsmith/Todoey | 0c1bf82f324b665ed80c69808c0c9cbf46f30248 | ebbd45aa576277d4408dfe5129a3e8dbf6f5ecdd | refs/heads/master | 2020-07-25T09:02:21.708500 | 2019-10-09T06:39:38 | 2019-10-09T06:39:38 | 208,239,887 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,439 | swift | //
// ViewController.swift
// Todoey
//
// Created by Kevin Smith on 9/13/19.
// Copyright © 2019 Kevin Smith. All rights reserved.
//
import UIKit
import RealmSwift
class ToDoListViewController: UITableViewController {
var toDoItems : Results<Item>?
let realm = try! Realm()
var selectedCategory : Category? {
didSet{
loadItems()
}
}
override func viewDidLoad() {
super.viewDidLoad()
print(FileManager.default.urls(for: .documentDirectory, in: .userDomainMask))
}
//MARK: - Tableview Datasource Methods
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return toDoItems?.count ?? 1
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
print("cellForRowAtIndexPathCalled")
let cell = tableView.dequeueReusableCell(withIdentifier: "ToDoItemCell", for: indexPath)
if let item = toDoItems?[indexPath.row]{
cell.textLabel?.text = item.title
cell.accessoryType = item.done ? .checkmark : .none
} else {
cell.textLabel?.text = "No Items Added"
}
return cell
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if let item = toDoItems?[indexPath.row]{
do{
try realm.write {
item.done = !item.done
//realm.delete(item)
}
} catch {
print("Error saving done status \(error)")
}
tableView.deselectRow(at: indexPath, animated: true)
}
tableView.reloadData()
}
//MARK: - Add New Items
@IBAction func addButtonPressed(_ sender: UIBarButtonItem) {
var textField = UITextField()
let alert = UIAlertController(title: "Add New Todoey Item", message: "", preferredStyle: .alert)
let action = UIAlertAction(title: "Add Item", style: .default) { (action) in
if let currentCategory = self.selectedCategory {
do{
try self.realm.write {
let newItem = Item()
newItem.title = textField.text!
newItem.dateCreated = Date()
currentCategory.items.append(newItem)
}
} catch {
print("Error saving new items, \(error)")
}
}
self.tableView.reloadData()
}
alert.addTextField { (alertTextField) in
alertTextField.placeholder = "Create new item"
textField = alertTextField
print(alertTextField.text)
print("Now")
}
alert.addAction(action)
present(alert, animated: true, completion: nil)
}
//MARK: - Manipulation methods
func loadItems(){
toDoItems = selectedCategory?.items.sorted(byKeyPath: "title", ascending: true)
tableView.reloadData()
}
}
//MARK: - Search bar methods
extension ToDoListViewController: UISearchBarDelegate {
func searchBarSearchButtonClicked(_ searchBar: UISearchBar) {
//Querying the database
toDoItems = toDoItems?.filter("title CONTAINS[cd] %@", searchBar.text!).sorted(byKeyPath: "dateCreated", ascending: true)
tableView.reloadData()
}
//let request : NSFetchRequest<Item> = Item.fetchRequest()
//
// //We will query the data with an NSPredicate. Defines how we sort the database
// let predicate = NSPredicate(format: "title CONTAINS[cd] %@", searchBar.text!)
//
// request.sortDescriptors = [NSSortDescriptor(key: "title", ascending: true)]
//
// loadItems(with: request, predicate: predicate)
func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {
if searchBar.text?.count == 0 {
loadItems()
DispatchQueue.main.async {
searchBar.resignFirstResponder()
}
}
}
}
| [
-1
] |
fe33c68538dbc1c6760c1810c60f5751d632fae7 | fe343dd672b20fe4a6db4f753f9ed46fefd19bf7 | /HW3_EmreKeskin/ViewController.swift | cb73bde7ffcf335eba2eab0ece874a775ea992f3 | [] | no_license | Hepsiburada-mobil-iOS-Bootcamp/HW3_EmreKeskin | fdf2596640618042714bdea42b5f32ec6c6dbf4b | 0c8688bb6b11cd7e3cc20dc6d78e51693381f988 | refs/heads/main | 2023-08-16T20:39:37.954114 | 2021-10-13T14:48:55 | 2021-10-13T14:48:55 | 416,783,218 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 276 | swift | //
// ViewController.swift
// Week_3
//
// Created by Emre Keskin on 13.10.2021.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
}
| [
-1
] |
f88b3d0a07543270c48fb1cac73d3d1abd6dcacb | 2ba4a17afc39f169d89ef9fa5fa45d2874cfa1eb | /CPprojectTests/CPprojectTests.swift | 4a56100f96b32d66e2240c6d0115fb30cff0346b | [] | no_license | edmondVanovertveldt/CPProject | e4e9e5848f7b9630ac26c592108e640a004f7b10 | 94959d0b291a797e03eddd3260758e40042de51f | refs/heads/master | 2021-03-22T03:05:05.924837 | 2018-01-11T16:33:29 | 2018-01-11T16:33:29 | 117,102,958 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 970 | swift | //
// CPprojectTests.swift
// CPprojectTests
//
// Created by Edmond on 05/01/2018.
// Copyright © 2018 Edmond. All rights reserved.
//
import XCTest
@testable import CPproject
class CPprojectTests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}
| [
360462,
278558,
229413,
204840,
278570,
344107,
155694,
229424,
237620,
229430,
180280,
163896,
376894,
286788,
352326,
254027,
311372,
196691,
278615,
180311,
180312,
385116,
237663,
254048,
319591,
278634,
221290,
319598,
204916,
131191,
237689,
131198,
311438,
278677,
196760,
426138,
311458,
278691,
278704,
377009,
131256,
278714,
295098,
139479,
229597,
311519,
205035,
286958,
327929,
344313,
147717,
368905,
278797,
254226,
319763,
368916,
262421,
377114,
278816,
237856,
237857,
311597,
98610,
180535,
336183,
278842,
287043,
139589,
319813,
311621,
344401,
377169,
368981,
155990,
278869,
368984,
106847,
98657,
270701,
270706,
139640,
311681,
311685,
106888,
385417,
385422,
213403,
246178,
385454,
377264,
278970,
311738,
33211,
319930,
336320,
311745,
278978,
254406,
188871,
278989,
278993,
278999,
328152,
369116,
188894,
287198,
279008,
279013,
279018,
311786,
319981,
279029,
254456,
279032,
377338,
377343,
279039,
254465,
287241,
279050,
303631,
139792,
279057,
303636,
279062,
393751,
279065,
377376,
180771,
377386,
197167,
385588,
279094,
115270,
385615,
426576,
369235,
287318,
295519,
139872,
66150,
279146,
295536,
287346,
139892,
287352,
344696,
279164,
189057,
311941,
336518,
311945,
369289,
344715,
279177,
311949,
287374,
377489,
311954,
352917,
230040,
271000,
377497,
303771,
377500,
221852,
295576,
205471,
344738,
139939,
279210,
287404,
205487,
295599,
303793,
336564,
287417,
303803,
287422,
377539,
287433,
287439,
164560,
385747,
279252,
361176,
418520,
287452,
295652,
279269,
369385,
230125,
312047,
279280,
312052,
230134,
172792,
344827,
221948,
205568,
295682,
197386,
434957,
295697,
426774,
197399,
426775,
197411,
279336,
262954,
295724,
312108,
197422,
353070,
164656,
303920,
262962,
295729,
230199,
197431,
336702,
295744,
353109,
377686,
230234,
189275,
435039,
295776,
303972,
385893,
279397,
230248,
246641,
246643,
295798,
246648,
279417,
361337,
254850,
369538,
287622,
295824,
189348,
279464,
140204,
377772,
304051,
230332,
189374,
377790,
353215,
353216,
213957,
213960,
345033,
279498,
386006,
304087,
418776,
50143,
123881,
320493,
287731,
271350,
295927,
304122,
328700,
328706,
410627,
320516,
295942,
386056,
353290,
377869,
238610,
418837,
140310,
230423,
320536,
197657,
189474,
369701,
238639,
312373,
238651,
377926,
238664,
296019,
353367,
304222,
230499,
279660,
173166,
312434,
377972,
279672,
377983,
279685,
402565,
222343,
386189,
296086,
238743,
296092,
238765,
279728,
238769,
402613,
279747,
353479,
402634,
279760,
189652,
279765,
189653,
419029,
148696,
296153,
279774,
304351,
304356,
222440,
279785,
328940,
279792,
386294,
386301,
320770,
386306,
328971,
312587,
353551,
173334,
320796,
222494,
353584,
345396,
386359,
378172,
279875,
304456,
312648,
337225,
230729,
222541,
296270,
238927,
353616,
222559,
378209,
230756,
386412,
230765,
296303,
279920,
296307,
116084,
181625,
337281,
148867,
296329,
296335,
9619,
370071,
173491,
304564,
279989,
353719,
361927,
296392,
280010,
280013,
312782,
222675,
329173,
239068,
280032,
271843,
280041,
296433,
280055,
288249,
296448,
230913,
329225,
230921,
296461,
304656,
329232,
370197,
230943,
402985,
394794,
230959,
288309,
312889,
288318,
280130,
288327,
280147,
239198,
157281,
99938,
312940,
222832,
288378,
337534,
337535,
263809,
239237,
288392,
239250,
419478,
337591,
296632,
280257,
280267,
403148,
9936,
9937,
370388,
272085,
345814,
280278,
280280,
18138,
67292,
345821,
321247,
321249,
345833,
345834,
288491,
239341,
67315,
173814,
313081,
288512,
67332,
288516,
280327,
280329,
321302,
345879,
321310,
313120,
255776,
362283,
378668,
280366,
296755,
280372,
321337,
280380,
345919,
436031,
403267,
280390,
280392,
345929,
304977,
18262,
362327,
280410,
345951,
362337,
345955,
296806,
288619,
288620,
280430,
214895,
313199,
362352,
296814,
313203,
182144,
305026,
67463,
329622,
337815,
214937,
214938,
239514,
436131,
436137,
362417,
288697,
362431,
214977,
280514,
280519,
214984,
362443,
280541,
329695,
436191,
313319,
247785,
296941,
436205,
43014,
354316,
313357,
354343,
354345,
223274,
346162,
288828,
436285,
288833,
288834,
436292,
403525,
436301,
338001,
338003,
223316,
280661,
329814,
354393,
280675,
280677,
43110,
313447,
321637,
436329,
329829,
288879,
223350,
280694,
288889,
215164,
215166,
280712,
215178,
346271,
436383,
362659,
239793,
182456,
280762,
223419,
379071,
280768,
149703,
280778,
346314,
321745,
280795,
387296,
280802,
379106,
346346,
321772,
436470,
149760,
411906,
272658,
338218,
321840,
379186,
280887,
321860,
280902,
289110,
305495,
215385,
379225,
321894,
280939,
313713,
354676,
199029,
436608,
362881,
240002,
436611,
240016,
108944,
190871,
149916,
420253,
141728,
289189,
289194,
108972,
272813,
338356,
436661,
281040,
289232,
256477,
281072,
174593,
420369,
207393,
289332,
174648,
338489,
338490,
281166,
281171,
297560,
436832,
436834,
313966,
281199,
420463,
346737,
313971,
346740,
420471,
330379,
330387,
117396,
346772,
117397,
330388,
264856,
314009,
289434,
346779,
166582,
289462,
314040,
158394,
363211,
363230,
289502,
264928,
330474,
289518,
125684,
199414,
322313,
117517,
322319,
166676,
207640,
281377,
289576,
191283,
273207,
289598,
281408,
281427,
281433,
330609,
174963,
207732,
158593,
224145,
355217,
256922,
289690,
289698,
420773,
289703,
363438,
347055,
289727,
273344,
330689,
363458,
379844,
19399,
183248,
248796,
347103,
314342,
52200,
289774,
183279,
347123,
240630,
257024,
330754,
322570,
330763,
281626,
175132,
248872,
314436,
314448,
339030,
281697,
281700,
257125,
322663,
281706,
273515,
207979,
404593,
363641,
363644,
150657,
248961,
330888,
363669,
339100,
380061,
429214,
199839,
339102,
306338,
265379,
249002,
306346,
3246,
421048,
208058,
322749,
265412,
290000,
298208,
298212,
298213,
290022,
330984,
298221,
298228,
216315,
208124,
437505,
322824,
257305,
339234,
372009,
412971,
298291,
306494,
216386,
224586,
372043,
331090,
314709,
314710,
372054,
159066,
314720,
281957,
134506,
306542,
380271,
208244,
249204,
290173,
306559,
306560,
314751,
224640,
298374,
314758,
314760,
142729,
388487,
314766,
306579,
224661,
282007,
290207,
314783,
314789,
282022,
314791,
282024,
396711,
396712,
380337,
380338,
150965,
380357,
339398,
306631,
306639,
413137,
429542,
282096,
306673,
306677,
191990,
290300,
290301,
282114,
372227,
306692,
306693,
323080,
282129,
175639,
282136,
388632,
396827,
282141,
134686,
306723,
347694,
290358,
265798,
282183,
265804,
396882,
290390,
306776,
44635,
396895,
323172,
282213,
224883,
314998,
323196,
339584,
282245,
282246,
290443,
323217,
282259,
298654,
282271,
282273,
282276,
298661,
323236,
290471,
282280,
298667,
224946,
110268,
224958,
282303,
274115,
282312,
306890,
282318,
241361,
241365,
282327,
298712,
298720,
282339,
12010,
282348,
282355,
282358,
339715,
323331,
323332,
216839,
339720,
282378,
372496,
323346,
282391,
282400,
339745,
315171,
257830,
421672,
282409,
282417,
200498,
282427,
282434,
307011,
282438,
323406,
307025,
413521,
216918,
307031,
241495,
282474,
282480,
241528,
339841,
241540,
282504,
315273,
315274,
110480,
184208,
372626,
380821,
282518,
282519,
298909,
118685,
298920,
323507,
282549,
290745,
290746,
274371,
151497,
372701,
298980,
380908,
290811,
282633,
241692,
315432,
233517,
102445,
176175,
282672,
241716,
225351,
315465,
315476,
307289,
315487,
356447,
45153,
307299,
307301,
438377,
299121,
233589,
233590,
266357,
422019,
241808,
381073,
233636,
184484,
299174,
233642,
323762,
299187,
405687,
299198,
258239,
389313,
299203,
299209,
372941,
282831,
266449,
356576,
176362,
307435,
438511,
381172,
184575,
381208,
282909,
299293,
151839,
233762,
217380,
282919,
332083,
332085,
332089,
315706,
282939,
307517,
438596,
332101,
323913,
348492,
323920,
348500,
168281,
332123,
323935,
332127,
242023,
160110,
242033,
291192,
340357,
225670,
242058,
373134,
291224,
242078,
61857,
315810,
61859,
315811,
381347,
340398,
299441,
283064,
127427,
127428,
291267,
283075,
324039,
373197,
176601,
160225,
291311,
291333,
340490,
283153,
258581,
291358,
283182,
283184,
234036,
315960,
348732,
242237,
70209,
348742,
70215,
348749,
381517,
332378,
201308,
111208,
184940,
373358,
389745,
209530,
291454,
373375,
152195,
348806,
152203,
316049,
111253,
316053,
111258,
111259,
176808,
299699,
299700,
422596,
422599,
291530,
225995,
225997,
242386,
422617,
422626,
299746,
234217,
299759,
226033,
299770,
234234,
299776,
242433,
291585,
430849,
291592,
62220,
422673,
430865,
291604,
422680,
234277,
283430,
152365,
422703,
422709,
152374,
160571,
430910,
160575,
160580,
381773,
201551,
242529,
349026,
357218,
177001,
201577,
308076,
242541,
209783,
209785,
177019,
185211,
308092,
398206,
291712,
381829,
316298,
308107,
308112,
349072,
234386,
324506,
324507,
390045,
185250,
283558,
185254,
373687,
373706,
316364,
340961,
234472,
234473,
324586,
316405,
349175,
201720,
127992,
357379,
234500,
324625,
234514,
308243,
316437,
357414,
300084,
308287,
218186,
234577,
341073,
439384,
234587,
300135,
316520,
300136,
357486,
144496,
234609,
300150,
300151,
291959,
160891,
300158,
234625,
349316,
349318,
234638,
373903,
169104,
177296,
308372,
185493,
119962,
283802,
300187,
300188,
234663,
300201,
300202,
373945,
283840,
259268,
283847,
283852,
259280,
316627,
333011,
234733,
292085,
234742,
292091,
128251,
234755,
439562,
292107,
414990,
251153,
177428,
349462,
382258,
300343,
382269,
333117,
193859,
300359,
234827,
177484,
406861,
259406,
234831,
120148,
283991,
357719,
374109,
234850,
292195,
333160,
284014,
243056,
316787,
111993,
357762,
112017,
234898,
259475,
275859,
357786,
251298,
333220,
316842,
374191,
284089,
292283,
300487,
300489,
284107,
210390,
210391,
210393,
144867,
316902,
251378,
308723,
333300,
300535,
300536,
333303,
300542,
259599,
308756,
398869,
374296,
374299,
308764,
333343,
431649,
169518,
431663,
194110,
349763,
218696,
292425,
243274,
128587,
333388,
300630,
128599,
333408,
300644,
317032,
415338,
243307,
54893,
325231,
325245,
235135,
194180,
415375,
333470,
153251,
300714,
210603,
415420,
333503,
218819,
259781,
333517,
333520,
333521,
325346,
153319,
325352,
284401,
300794,
325371,
194303,
194304,
300811,
284431,
243472,
366360,
284442,
325404,
333610,
284459,
399147,
431916,
300848,
259899,
325439,
153415,
341836,
415567,
325457,
317269,
341847,
284507,
350044,
300894,
128862,
284512,
284514,
276327,
292712,
423789,
325492,
276341,
300918,
341879,
317304,
333688,
194429,
112509,
55167,
325503,
333701,
243591,
325515,
243597,
325518,
333722,
350109,
300963,
292771,
415655,
284587,
292782,
243637,
284619,
301008,
153554,
194515,
292836,
292837,
317415,
325619,
432116,
292858,
415741,
333828,
358410,
399373,
317467,
145435,
292902,
227370,
325674,
309295,
129076,
243767,
358456,
309345,
227428,
194666,
260207,
432240,
284788,
292988,
292992,
194691,
227460,
415881,
104587,
235662,
317587,
284825,
284826,
333991,
284842,
227513,
227524,
309444,
227548,
194782,
301279,
317664,
243962,
375039,
309503,
325905,
325912,
309529,
227616,
211235,
432421,
211238,
358703,
358709,
260418,
227654,
6481,
366930,
6489,
391520,
383332,
383336,
416104,
285040,
317820,
211326,
317831,
227725,
252308,
178582,
293274,
285084,
121245,
285090,
342450,
293303,
293310,
416197,
129483,
342476,
317901,
326100,
342498,
276963,
358882,
334309,
391655,
432618,
375276,
309744,
301571,
416286,
375333,
244269,
375343,
236081,
23092,
375351,
244281,
301638,
309830,
293448,
55881,
416341,
309846,
285271,
416351,
268899,
39530,
301689,
244347,
326287,
375440,
334481,
318106,
318107,
342682,
285361,
342706,
318130,
293556,
383667,
285373,
39614,
154316,
96984,
375526,
285415,
342762,
342763,
293612,
154359,
432893,
162561,
285444,
383754,
285458,
310036,
326429,
293664,
326433,
400166,
293672,
301871,
285487,
375609,
285497,
293693,
252741,
318278,
293711,
244568,
244570,
301918,
293730,
342887,
400239,
310131,
269178,
400252,
359298,
359299,
260996,
113542,
228233,
228234,
392074,
56208,
293781,
318364,
310176,
310178,
310182,
293800,
236461,
293806,
326581,
326587,
326601,
359381,
433115,
343005,
326635,
203757,
187374,
383983,
277492,
318461,
293886,
277509,
293893,
433165,
384016,
433174,
252958,
203830,
359478,
277597,
113760,
302177,
392290,
253029,
228458,
15471,
351344,
285814,
285820,
392318,
187521,
384131,
285828,
302213,
285830,
302216,
228491,
162961,
326804,
285851,
351390,
302240,
253099,
253100,
318639,
367799,
113850,
294074,
64700,
228540,
228542,
302274,
367810,
228563,
195808,
310497,
228588,
302325,
261377,
228609,
253216,
261425,
351537,
286013,
286018,
294218,
146762,
294219,
318805,
425304,
294243,
163175,
327024,
318848,
179587,
253317,
384393,
368011,
318864,
318868,
318875,
310692,
245161,
286129,
286132,
228795,
425405,
302531,
425418,
310732,
302540,
64975,
310736,
228827,
286172,
187878,
286202,
359930,
286205,
302590,
294400,
253451,
359950,
146964,
253463,
302623,
286244,
245287,
245292,
196164,
56902,
228943,
286288,
179801,
343647,
286306,
310889,
204397,
138863,
188016,
294529,
286343,
229001,
310923,
188048,
425626,
229020,
302754,
40613,
40614,
40615,
229029,
286388,
286391,
384695,
327358,
286399,
212685,
302797,
384720,
245457,
302802,
286423,
278233,
278234,
294622,
278240,
212716,
212717,
360177,
229113,
278272,
319233,
311042,
360195,
278291,
278293,
294678,
286494,
294700,
409394,
319292,
360252,
360264,
188251,
376669,
245599,
237408,
425825,
425833,
417654,
188292,
294807,
294809,
376732,
294814,
311199,
319392,
294823,
327596,
294843,
188348,
98239,
237504,
294850,
384964,
163781,
344013,
212942,
24532,
294886,
311281,
311282
] |
988ee42f19c59778f5d56285e0bb340423ca365a | ca4d58f6d90e2c921204858eed8eeccab1828658 | /Discovery/src/08.Enumerations.playground/Contents.swift | e94f9fe30352a99c94b7ed472f13f31409ca005a | [
"MIT"
] | permissive | dashgeng/SwiftDiscovery | 42032ac436f454e23ef840f1bcb969642875ac18 | 3bafd4cbd915d9e34bc8b829105fe080bff055f3 | refs/heads/master | 2021-01-09T23:56:19.720090 | 2017-05-04T07:20:48 | 2017-05-04T07:20:48 | 88,492,019 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 10 | swift | // 枚举
| [
18165
] |
9d2a301f0873adbdd143eca57296e79fafd65109 | eceeb001abcf206a7c603f15dd1ad8f0ac1ab72f | /ParkingTests/ParkingTests.swift | 7d11e386199539a3e2f35d57e9322caefb542b2d | [] | no_license | NCUECSIE/Parking-iOS | ca9d1ee690d6760483275eecac25dcf271c3ba5c | b282d388609183b02722739a2bae7a60e1dfea37 | refs/heads/master | 2021-01-23T00:46:18.637716 | 2017-06-05T19:48:31 | 2017-06-05T19:48:31 | 92,846,345 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 912 | swift | //
// ParkingTests.swift
// ParkingTests
//
// Created by Peter on 2017/5/30.
//
//
import XCTest
@testable import Parking
class ParkingTests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}
| [
98333,
278558,
16419,
229413,
204840,
278570,
344107,
253999,
229424,
237620,
229430,
319542,
180280,
213052,
352326,
311372,
311374,
196691,
278615,
237663,
131178,
278634,
319598,
352368,
204916,
131191,
237689,
131198,
278655,
319629,
311438,
278677,
278685,
311458,
278691,
49316,
278699,
173,
32941,
278704,
278708,
131256,
180408,
295098,
254170,
311519,
286958,
327929,
278797,
180493,
254226,
278816,
237857,
278842,
287041,
311621,
139589,
319821,
254286,
344401,
155990,
106847,
246127,
139640,
246136,
246137,
311681,
311691,
377264,
278970,
319930,
311738,
336317,
311745,
278978,
188871,
278989,
278993,
278999,
328152,
369116,
287198,
279008,
279013,
279018,
311786,
319987,
279029,
279032,
279039,
287241,
279050,
139791,
303631,
279057,
303636,
279062,
279065,
180771,
377386,
352829,
115270,
377418,
287318,
295519,
66150,
344680,
279146,
295536,
287346,
287352,
279164,
189057,
311941,
279177,
369289,
377483,
344715,
311949,
287374,
385680,
352917,
230040,
271000,
295576,
303771,
221852,
279206,
295590,
279210,
287404,
205487,
295599,
303793,
164533,
287417,
303803,
287422,
66242,
287433,
287439,
279252,
287452,
295652,
279269,
312047,
279280,
230134,
221948,
279294,
205568,
295682,
312079,
295697,
336671,
344865,
279336,
295724,
312108,
353069,
164656,
328499,
353078,
230199,
353079,
197434,
336702,
295746,
353094,
353095,
353109,
230234,
279392,
295776,
303972,
246641,
246648,
279417,
361337,
254850,
287622,
295824,
189348,
279464,
353195,
140204,
353197,
230332,
353215,
353216,
213960,
279498,
50143,
123881,
304110,
320494,
287731,
295927,
386042,
304122,
320507,
328700,
312314,
328706,
320516,
230410,
320527,
238610,
418837,
140310,
197657,
336929,
189474,
345132,
238639,
238651,
214086,
238664,
296019,
353367,
156764,
156765,
304222,
230499,
279660,
312434,
353397,
279672,
337017,
279685,
222343,
296086,
238743,
296092,
238765,
279728,
238769,
230588,
279747,
353479,
353481,
353482,
189652,
279765,
189653,
148696,
296153,
279774,
304351,
304356,
279792,
353523,
320770,
279814,
312587,
328971,
320796,
115998,
304421,
279854,
345396,
116026,
222524,
279875,
304456,
230729,
312648,
222541,
296270,
238927,
296273,
222559,
230756,
230765,
296303,
279920,
312689,
116084,
181625,
378244,
304524,
296335,
279974,
279984,
173491,
304564,
279989,
280004,
361927,
296392,
280010,
370123,
148940,
280013,
312782,
222675,
353750,
239068,
280032,
280041,
361963,
329200,
321009,
280055,
288249,
230913,
230921,
304656,
329232,
230959,
288309,
288318,
124485,
288326,
288327,
280147,
239198,
157281,
312940,
222832,
247416,
288378,
337535,
312965,
288392,
239250,
345752,
255649,
321199,
321207,
296632,
337591,
280251,
280257,
321219,
280267,
9936,
9937,
280278,
280280,
18138,
321247,
321249,
280300,
313081,
124669,
288512,
288516,
280329,
321295,
321302,
116505,
321310,
313120,
247590,
280366,
280372,
321337,
280380,
280390,
280392,
345929,
337745,
18262,
370522,
345951,
362337,
345955,
296806,
288619,
288620,
280430,
296814,
362352,
313203,
124798,
182144,
305026,
67463,
329622,
124824,
214937,
214938,
239514,
354212,
313254,
124852,
288697,
214977,
280514,
280519,
214984,
247757,
231375,
280541,
354274,
337895,
354280,
247785,
296941,
362480,
223218,
313339,
313357,
182296,
239650,
329765,
354343,
354345,
223274,
124975,
346162,
124984,
288828,
288833,
288834,
354385,
280661,
329814,
338007,
354393,
280675,
280677,
43110,
313447,
321637,
329829,
288879,
280694,
223350,
288889,
215164,
313469,
215166,
280712,
215178,
346271,
239793,
125109,
182456,
280762,
223419,
379071,
280768,
338119,
280778,
321745,
280795,
280802,
338150,
346346,
125169,
338164,
125183,
125188,
313608,
125193,
321800,
125198,
125203,
338197,
125208,
305440,
125217,
125235,
280887,
125240,
182597,
182598,
280902,
289110,
379225,
272729,
354655,
321894,
280939,
313713,
354676,
362881,
248194,
395659,
395661,
240016,
108944,
141728,
289189,
108972,
281037,
281040,
289232,
330218,
281072,
109042,
289304,
182817,
338490,
322120,
281166,
281171,
354911,
436832,
191082,
313966,
281199,
330379,
330387,
330388,
314009,
289434,
338613,
289462,
314040,
109241,
158394,
248517,
363211,
289502,
363230,
338662,
346858,
289518,
322291,
199414,
35583,
363263,
322313,
322319,
166676,
207640,
281377,
289598,
281408,
420677,
281427,
281433,
322395,
109409,
330609,
174963,
207732,
109428,
158593,
240518,
109447,
289690,
289703,
240552,
289722,
289727,
363458,
19399,
183248,
338899,
248797,
207838,
314342,
52200,
289774,
183279,
314355,
240630,
314362,
134150,
330763,
281626,
175132,
248872,
322612,
314448,
339030,
281697,
314467,
281700,
322663,
281706,
207979,
363644,
150657,
248961,
339102,
249002,
306346,
208058,
339130,
290000,
298208,
298212,
290022,
330984,
298221,
298228,
216315,
208124,
363771,
388349,
322824,
126237,
339234,
298291,
224586,
372043,
331090,
314709,
314710,
134491,
314720,
281957,
306542,
314739,
249204,
249205,
290169,
306559,
224640,
306560,
298374,
314758,
314760,
142729,
388487,
314766,
306579,
224661,
282007,
290207,
314783,
314789,
282022,
282024,
241066,
314798,
380357,
306631,
306639,
191981,
282096,
306677,
191990,
290301,
282114,
306692,
306693,
323080,
323087,
323089,
282129,
282136,
282141,
282146,
306723,
290358,
282183,
224847,
118353,
290390,
306776,
44635,
282213,
323178,
224883,
314998,
323196,
175741,
282245,
282246,
224901,
290443,
323217,
282259,
282273,
257699,
323236,
282276,
298661,
290471,
282280,
298667,
61101,
282303,
323264,
306890,
241361,
282327,
298712,
159455,
298720,
282339,
12010,
282348,
282355,
282358,
282369,
175873,
323331,
323332,
216839,
323346,
282391,
249626,
282400,
241441,
339745,
315171,
257830,
282409,
282417,
200498,
282427,
282434,
307011,
315202,
282438,
413521,
282480,
241528,
315264,
241540,
282504,
315273,
315274,
184208,
282518,
282519,
118685,
298909,
298980,
282612,
290811,
282633,
241692,
102437,
315434,
233517,
282672,
241716,
315465,
315476,
307289,
200794,
315487,
45153,
307299,
315498,
299121,
233589,
233590,
241808,
323729,
233636,
299174,
233642,
299187,
184505,
299198,
258239,
299203,
282831,
356576,
176362,
184570,
299293,
282909,
233762,
217380,
151847,
282919,
332083,
332085,
332089,
315706,
282939,
241986,
332101,
323916,
348492,
282960,
250192,
323920,
348500,
168281,
332123,
323935,
332127,
242029,
242033,
291192,
315773,
291198,
225670,
332167,
242058,
291224,
283038,
242078,
61857,
315810,
381347,
61859,
315811,
340398,
61873,
299441,
61880,
283064,
291265,
127427,
283075,
291267,
127428,
324039,
176601,
242139,
160225,
242148,
127465,
291311,
233978,
340490,
283153,
291358,
283182,
283184,
234036,
315960,
70209,
348742,
70215,
348749,
111208,
291454,
348806,
184973,
316049,
111253,
111258,
299699,
299700,
225995,
242386,
299746,
299759,
234234,
299770,
299776,
291592,
291604,
291612,
234277,
283430,
152365,
242485,
234294,
160575,
299849,
283467,
201549,
201551,
349026,
275303,
177001,
201577,
308076,
242541,
209783,
209785,
177019,
308092,
316298,
308107,
308112,
209817,
324506,
324507,
127902,
324517,
283558,
316333,
316343,
349121,
316364,
340955,
340961,
234472,
234473,
324586,
340974,
316405,
201720,
234500,
324625,
234514,
308243,
316437,
201755,
300068,
357414,
300084,
324666,
308287,
21569,
300111,
341073,
234587,
250981,
300135,
300136,
316520,
316526,
357486,
144496,
234609,
300146,
300150,
300151,
160891,
341115,
300158,
234625,
349316,
349318,
234638,
169104,
177296,
308372,
185493,
283802,
119962,
300187,
300188,
234663,
300201,
300202,
283840,
259268,
283847,
62665,
283852,
283853,
357595,
333022,
234733,
292091,
316669,
234755,
242954,
292107,
251153,
177428,
333090,
300343,
333117,
193859,
300359,
177484,
251213,
234831,
120148,
283991,
357719,
316765,
292195,
333160,
284014,
243056,
111993,
112017,
112018,
234898,
357786,
333220,
316842,
210358,
284089,
292283,
415171,
300487,
300489,
284107,
366037,
210390,
210391,
210393,
144867,
366053,
316902,
103909,
54765,
251378,
308723,
300536,
300542,
210433,
366083,
292356,
316946,
308756,
398869,
308764,
349726,
349741,
169518,
194110,
235070,
349763,
292423,
218696,
292425,
243274,
128587,
333388,
333393,
300630,
235095,
128599,
333408,
374372,
317032,
54893,
333430,
366203,
300714,
218819,
333509,
333517,
333520,
333521,
333523,
153319,
284401,
300794,
325371,
194303,
194304,
300811,
284429,
284431,
243472,
161554,
366360,
284442,
325404,
325410,
341796,
284459,
317232,
325439,
325445,
153415,
341836,
325457,
317269,
284507,
300894,
284512,
284514,
276327,
292712,
325484,
292720,
325492,
194429,
325503,
333701,
243591,
243597,
325518,
292771,
300963,
333735,
284587,
292782,
317360,
243637,
284619,
301008,
153554,
219101,
292836,
292837,
317415,
325619,
333817,
292858,
145435,
317467,
292902,
227370,
325674,
309295,
358456,
309345,
194666,
284788,
333940,
292988,
292992,
333955,
227460,
235662,
325776,
317587,
284825,
284826,
333991,
333992,
284842,
227513,
301251,
227524,
309444,
227548,
194782,
301279,
383206,
243962,
309503,
194820,
375051,
325905,
325912,
227616,
211235,
211238,
260418,
325968,
6481,
366929,
366930,
6489,
334171,
391520,
416104,
285040,
211326,
227725,
227726,
178582,
285084,
317852,
285090,
375207,
293303,
293310,
317901,
326100,
285150,
358882,
342498,
195045,
309744,
301571,
342536,
342553,
375333,
293419,
244269,
236081,
23092,
309830,
301638,
55881,
309846,
244310,
244327,
301689,
244347,
227990,
342682,
285361,
342706,
342713,
285373,
154316,
318173,
285415,
293612,
154359,
162561,
285444,
326414,
285458,
326429,
293664,
326433,
318250,
318252,
285487,
301871,
285497,
293693,
318278,
293711,
301918,
293730,
351077,
342887,
400239,
310131,
269178,
359298,
113542,
416646,
228233,
228234,
236428,
56208,
293781,
318364,
310182,
236461,
293806,
130016,
64485,
203757,
277492,
293893,
146448,
326685,
252980,
359478,
302139,
359495,
277597,
302177,
285798,
228458,
318572,
15471,
187506,
285814,
285820,
187521,
285828,
302213,
285830,
302216,
228491,
228493,
285838,
162961,
326804,
285851,
302240,
343203,
253099,
367799,
64700,
228540,
228542,
302274,
343234,
367810,
244940,
228563,
228588,
253167,
302325,
228609,
245019,
130338,
130343,
351537,
171317,
318775,
286013,
286018,
113987,
294218,
318805,
294243,
163175,
327025,
327031,
294275,
368011,
318864,
318875,
310692,
286129,
228795,
302529,
302531,
163268,
302540,
310732,
64975,
310736,
327121,
228827,
286172,
310757,
187878,
245223,
343542,
343543,
286202,
228861,
286205,
228867,
253452,
146964,
302623,
187938,
245287,
245292,
286254,
56902,
228943,
286288,
196187,
343647,
286306,
310889,
204397,
138863,
294529,
229001,
310923,
188048,
302739,
229020,
302754,
245412,
229029,
40613,
40614,
40615,
286391,
319162,
327358,
286399,
302797,
212685,
212688,
245457,
302802,
286423,
278233,
278234,
294622,
229088,
278240,
212716,
212717,
229113,
286459,
278272,
319233,
311042,
278291,
278293,
294678,
294700,
360252,
319292,
188251,
245599,
237408,
302946,
188292,
253829,
327557,
294807,
294814,
311199,
319392,
294823,
294843,
294850,
163781,
344013,
212946,
294886,
253929,
327661,
278512,
311281,
311282
] |
5c34854cfe51238ce9c421f9b57307be8cdb409e | a305cc32c5661f3ca3c3a49b8e33da6b5a71d148 | /Package.swift | 7a50cbfea866f06c20e0ab9cb96e07c6b7afe53d | [
"Apache-2.0"
] | permissive | liujoshua/AssessmentModel-KotlinNative | 2436f3b00cc657add5111e185715c338296e327c | 0632d5dcdb386999547bcbff7253cd53771d5b70 | refs/heads/master | 2023-04-29T22:53:38.889750 | 2021-05-08T03:27:02 | 2021-05-08T03:27:02 | 260,323,242 | 0 | 0 | Apache-2.0 | 2020-04-30T21:35:10 | 2020-04-30T21:35:09 | null | UTF-8 | Swift | false | false | 1,249 | swift | // swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "AssessmentModel",
platforms: [
.iOS(.v13)
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "AssessmentModel",
targets: ["AssessmentModel"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.binaryTarget(name: "AssessmentModel",
path: "SwiftPackage/Binaries/AssessmentModel.xcframework"),
.testTarget(
name: "AssessmentModelTests",
dependencies: ["AssessmentModel"],
path: "SwiftPackage/Tests/AssessmentModelTests",
resources: [ .process("Resources")]),
]
)
| [
324608,
415748,
304657,
237593,
154138,
369691,
192028,
217118,
159263,
425505,
201762,
224295,
140330,
201771,
372779,
201773,
402986,
102447,
201775,
201777,
321584,
33336,
321598,
173122,
389700,
159303,
389705,
254035,
341075,
327255,
296024,
385112,
384092,
395359,
160864,
261220,
374373,
139366,
258151,
66668,
362606,
373359,
2161,
192626,
431731,
298612,
2165,
253045,
273525,
339573,
346745,
201853,
2173,
160898,
2179,
204420,
357000,
204425,
201866,
330389,
162966,
339093,
176794,
380058,
2205,
44192,
393379,
2212,
248488,
315563,
222381,
258733,
336559,
108215,
173752,
225979,
256188,
222400,
225985,
357568,
389316,
211655,
66762,
66765,
159439,
256720,
253649,
339667,
366292,
385237,
266456,
340697,
411879,
194808,
353017,
205050,
379128,
388856,
393979,
395512,
425724,
425728,
388865,
388867,
162564,
388868,
388870,
343308,
136461,
347417,
150811,
259360,
311584,
334115,
52520,
341807,
388918,
255800,
388922,
377150,
388930,
384848,
134482,
339800,
253789,
341853,
253793,
246116,
211813,
357222,
431973,
251240,
253801,
253805,
21871,
1905,
260978,
337271,
249211,
420230,
43400,
373131,
349583,
215442,
355224,
1946,
1947,
355228,
1950,
1952,
355233,
1955,
1957,
1960,
1963,
222123,
258475,
355243,
305585,
235957,
1976,
201144,
398776,
326591,
329151,
344514,
432587,
1996,
1998,
184787,
338388,
380372,
2006,
2008,
2011,
262620,
319457,
208354,
241122,
416228,
380902,
164333,
347124,
247797,
411133
] |
f99e9114f6d9528ec3fa4cb2fa0034d05b3b2404 | 40981faf79372758b88029b1e9c7f0f4fe3fadf3 | /AppFiles/GroceryGuru/GroceryGuru/LaunchAnimationViewController.swift | 3821b69bc6b03d3b2fdfc18cef13082e3553c6f3 | [] | no_license | brennenhogan/GroceryGuru | 7a936bf8b3ecf17cb2c2183227571ef13726b8f7 | 0011eaf0e937a8b9a2bc0eeb80336d66d41a9cde | refs/heads/main | 2023-04-25T01:14:34.369521 | 2021-05-18T01:16:56 | 2021-05-18T01:16:56 | 348,110,100 | 2 | 1 | null | 2021-05-02T20:18:08 | 2021-03-15T20:15:58 | Swift | UTF-8 | Swift | false | false | 1,466 | swift | //
// LaunchAnimationViewController.swift
// GroceryGuru
//
// Created by Brennen Hogan on 4/23/21.
//
import UIKit
class LaunchAnimationViewController: UIViewController {
private let imageView: UIImageView = {
let imageView = UIImageView(frame: CGRect(x: 67, y: 293, width: 256, height: 256))
imageView.layer.cornerRadius = 10
imageView.image = UIImage(named:"GG_Logo_Clear_256")
return imageView
}()
override func viewDidLoad() {
super.viewDidLoad()
view.addSubview(imageView)
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
DispatchQueue.main.asyncAfter(deadline: .now()+0.25, execute: {
self.animate()
})
}
private func animate(){
UIView.animate(withDuration: 0.8, animations: {
self.imageView.frame = CGRect(
x: 131,
y: 101,
width: 128,
height: 128
)
self.imageView.backgroundColor = UIColor(hex: 0x617757)
self.view.backgroundColor = UIColor.white
}){ (done) in
DispatchQueue.main.asyncAfter(deadline: .now()+0.55, execute: {
let sb = UIStoryboard(name: "Main", bundle: nil)
let vc = sb.instantiateInitialViewController()
UIApplication.shared.keyWindow?.rootViewController = vc
})
}
}
}
| [
-1
] |
e1be35c8a346c25ccde784a5f98d7962a182d6f6 | 528c48e83aa976003559871bff8ae4545f5858af | /CardSort/Algorithms/SortProtocol.swift | cfd4b3ff151fdeb97de807008582098954e87c57 | [] | no_license | okryl/Card | 8758165656ed733f8c5f8b2b34dca7f33f86cc88 | e242c142c0abe8a8d77b60db959329c1aaec4f2f | refs/heads/master | 2020-04-06T20:52:02.950968 | 2018-11-25T21:19:54 | 2018-11-25T21:19:54 | 157,785,699 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 283 | swift | //
// SortProtocol.swift
// CardSort
//
// Created by Omer Karayel on 15.11.2018.
// Copyright © 2018 Omer Karayel. All rights reserved.
//
import Foundation
protocol SortProtocol {
var groups: [[Card]] {get}
var cards: [Card]! {get}
var allCards: [Card]! {get}
}
| [
-1
] |
4946208e5efde3b04acb00a58616ea7c5ddacc61 | 96ca292a67dbbdafed0919859d81c7a6e129c49f | /akane/Reddit/Article.swift | dd26aa88cab6b4e8458a9b04987ee1cd95194f4b | [
"MIT"
] | permissive | slightair/akane | c09a0e4368f3313b0d2a48fadc8082a6b0715cd5 | 4575a2057c89c80229872812b2c744758523e7ca | refs/heads/master | 2021-01-11T23:56:21.071462 | 2017-04-22T09:37:50 | 2017-04-22T09:37:50 | 78,649,776 | 4 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 467 | swift | import Foundation
import Himotoki
struct Article {
let title: String
let name: String
}
extension Article: Decodable {
static func decode(_ e: Extractor) throws -> Article {
return try Article(title: e <| ["data", "title"],
name: e <| ["data", "name"])
}
}
func == (lhs: Article, rhs: Article) -> Bool {
return
lhs.title == rhs.title &&
lhs.name == rhs.name
}
extension Article: Equatable {}
| [
-1
] |
d36a63d0c04e76752caa74b1c47c59604fed81d3 | d0280f41da8d9f0dba676fadd277e6bdf741149d | /validation-test/compiler_crashers_fixed/01280-swift-type-walk.swift | 56ffce8ba6197d90750d81d7f4a32bc84f68751d | [
"Apache-2.0",
"Swift-exception"
] | permissive | zhongaiyemaozi/swift | 310a5867a3f797986ddaa3769589c5cc484ee47a | ca165e5c4afae294ae386c2ca4593e5f22c416f0 | refs/heads/master | 2021-01-12T10:05:08.416860 | 2016-12-13T09:00:12 | 2016-12-13T09:00:12 | 76,355,607 | 4 | 0 | null | 2016-12-13T12:11:21 | 2016-12-13T12:11:21 | null | UTF-8 | Swift | false | false | 600 | swift | // This source file is part of the Swift.org open source project
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
// RUN: not %target-swift-frontend %s -typecheck
func p(l: Any, g: Any) -> (((Any, Any) -> Any) -> Any) {
return {
(p: (Any, Any) -> Any) -> Any in
func n<n : l,) {
}
protocol f {
k g d {
}
j j<l : d> : d {
}
class f: f {
}
class B : l {
}
func a<b:a
| [
91316,
91317,
74943,
74947,
74949,
74951,
74952,
74953,
74954,
74956,
74958,
74959,
74962,
74964,
91351,
74970,
74974,
74975,
74976,
74977,
74978,
74979,
74981,
74982,
74983,
74984,
74985,
74987,
74988,
74991,
74993,
74997,
75011,
75012,
75016,
75017,
75020,
75021,
75025,
75026,
75035,
75037,
75040,
75043,
75045,
75047,
75049,
75050,
75051,
75055,
75056,
75066,
75068,
75071,
75075,
75076,
75077,
75079,
75082,
75092,
75097,
75098,
75102,
75103,
75110,
75117,
75120,
75125,
75133,
75135,
75142,
75145,
75147,
75148,
75153,
75154,
75155,
75164,
75166,
75168,
75172,
75173,
75174,
75176,
75180,
75185,
75186,
75187,
75190,
75192,
75193,
75194,
75196,
75200,
75201,
75205,
75206,
75218,
75219,
75222,
75223,
75225,
75230,
75236,
75237,
75239,
75242,
75245,
75250,
75258,
75260,
75261,
91645,
91647,
91648,
75265,
75266,
91650,
75268,
91651,
91656,
75274,
91660,
91665,
91674,
91675,
75293,
75295,
75296,
91679,
91684,
75304,
91688,
75306,
75310,
75312,
75315,
91702,
91703,
75320,
75321,
75322,
91707,
91708,
75325,
91711,
91712,
75329,
91716,
75333,
91717,
75335,
75337,
75340,
75342,
75343,
91726,
91728,
91729,
91731,
75350,
75351,
91734,
91736,
91738,
75356,
75357,
75358,
91740,
75360,
91741,
75362,
91742,
75364,
75365,
91746,
91747,
75368,
75370,
75373,
91757,
91759,
75377,
91761,
91765,
91766,
91767,
75384,
75388,
91772,
75394,
75396,
75400,
91784,
75402,
91785,
75404,
75410,
75411,
91794,
75416,
75417,
75418,
91800,
91803,
75422,
91808,
75425,
75426,
75428,
75430,
75431,
91817,
91818,
75439,
75440,
91825,
91827,
91828,
75445,
75446,
91831,
75449,
91833,
91834,
75454,
91840,
75458,
91843,
91844,
75461,
75462,
91846,
75464,
75465,
91848,
91852,
75469,
75470,
91853,
75472,
75473,
75474,
91854,
75476,
91856,
75478,
91860,
75481,
91865,
91866,
91867,
91869,
75486,
91870,
91872,
91873,
91874,
91876,
75495,
91880,
75497,
91881,
91883,
91884,
91885,
75503,
75504,
75505,
75507,
91897,
75514,
75515,
75516,
91898,
91901,
75519,
91902,
75521,
91904,
91909,
75528,
75529,
75530,
91915,
75531,
91917,
75533,
75535,
75536,
75537,
75540,
91927,
75544,
75545,
91936,
75553,
75554,
91937,
91940,
91941,
91943,
75560,
91947,
75564,
75565,
75568,
75570,
75571,
75572,
91956,
75575,
91960,
75579,
75581,
91965,
91966,
75585,
75586,
75590,
91974,
91976,
75594,
91978,
75599,
75603,
75604,
75605,
75606,
75607,
91987,
91988,
75610,
91989,
91995,
91997,
75614,
91999,
75616,
92002,
75619,
92004,
92005,
75623,
75628,
92012,
92013,
75633,
92017,
92018,
75636,
92019,
75638,
92021,
92023,
92025,
75642,
92028,
75645,
92030,
75648,
92033,
92036,
75656,
75657,
92043,
75662,
92047,
92053,
75670,
75671,
92055,
75674,
92059,
75677,
92061,
92063,
75681,
92066,
75684,
92069,
92071,
92074,
92075,
75694,
92079,
92082,
75699,
75700,
92083,
92085,
92087,
75704,
92091,
92095,
92096,
75714,
75715,
92100,
75717,
92101,
75719,
75721,
92108,
92109,
92115,
92116,
75733,
75734,
75736,
75737,
75738,
75739,
75740,
75741,
92120,
92121,
75744,
75745,
75746,
92123,
92124,
92126,
92128,
92131,
75753,
75754,
75755,
92142,
75760,
92144,
75762,
92147,
75766,
92151,
92150,
92154,
75772,
75773,
75775,
92159,
92161,
75778,
92164,
92165,
75786,
92171,
92172,
92173,
92174,
92176,
75793,
75794,
75795,
92178,
92179,
92180,
92183,
75800,
75801,
75802,
92187,
92188,
92189,
92193,
75810,
75811,
75812,
75813,
92196,
92197,
75816,
92203,
92204,
75823,
92207,
75825,
92208,
92210,
92212,
75829,
92213,
75831,
92214,
92217,
75835,
92221,
92223,
75840,
75842,
75843,
92227,
92228,
92229,
75848,
75849,
92232,
75851,
75852,
92236,
75854,
75855,
75856,
92241,
75858,
75859,
92244,
92245,
92246,
75863,
92247,
75865,
92250,
75868,
75869,
92254,
75872,
75873,
92256,
92262,
75879,
75882,
92267,
75885,
75888,
92272,
75890,
92275,
75892,
75897,
75898,
92281,
92285,
75903,
75905,
75906,
75909,
92293,
92294,
75912,
75913,
75914,
75915,
75916,
75917,
92297,
92299,
92300,
92308,
75925,
75927,
75928,
75929,
75930,
92311,
92314,
75933,
75934,
92315,
92318,
92321,
75939,
75941,
92330,
75948,
75949,
75950,
92335,
75953,
75955,
92339,
75958,
75961,
75963,
75964,
92347,
92348,
75967,
92350,
92352,
75970,
92354,
75972,
75975,
75981,
92366,
92367,
92369,
92370,
75987,
92371,
92372,
92373,
75991,
92376,
92377,
75994,
75995,
92378,
75997,
92385,
92386,
76003,
92387,
92388,
76007,
92391,
92393,
76010,
92395,
92401,
76018,
76019,
92403,
76021,
76022,
92406,
92408,
76026,
76027,
76029,
92413,
92414,
76036,
92421,
76038,
76039,
76040,
76041,
76042,
76043,
92422,
76045,
92423,
76047,
92425,
76049,
92428,
76051,
76052,
92429,
92430,
92437,
92438,
92439,
76058,
92440,
76060,
76061,
92443,
92450,
92454,
92456,
76075,
76076,
76077,
92460,
92465,
76082,
92467,
92468,
76089,
92473,
92474,
92475,
92476,
92477,
92479,
92480,
76097,
76098,
92481,
92483,
76101,
92484,
92487,
76104,
92490,
76109,
76110,
92493,
92494,
92497,
92498,
76117,
76120,
92504,
92509,
92510,
76127,
92511,
76129,
76130,
76131,
92513,
92515,
76134,
76135,
76136,
92519,
76139,
92524,
76142,
92526,
76146,
92530,
76149,
76150,
92533,
92534,
92535,
92536,
92537,
76158,
92542,
92546,
92548,
76165,
92549,
92550,
92551,
92553,
76170,
76171,
92554,
92557,
76174,
76175,
92560,
92565,
92566,
92567,
76185,
76186,
92570,
92572,
92575,
76192,
76193,
76194,
92577,
76196,
92580,
92581,
76199,
92583,
76201,
76202,
92584,
92587,
76208,
92592,
76210,
92593,
76215,
92599,
92600,
92603,
76220,
76221,
92604,
92606,
92610,
76227,
92611,
92615,
76234,
76235,
92618,
76237,
76238,
76239,
76240,
76241,
76242,
76243,
76244,
92620,
92626,
76247,
92629,
92630,
76250,
92633,
92635,
76254,
76255,
76257,
92641,
92642,
92644,
76261,
76262,
92645,
92647,
92648,
92651,
76268,
92653,
76270,
92655,
92656,
92657,
76275,
92663,
76281,
92670,
76288,
76290,
92675,
92676,
92677,
92678,
76295,
76296,
76297,
92679,
92681,
76301,
76304,
92688,
76307,
76308,
76309,
92694,
92695,
76313,
92698,
76316,
92701,
76318,
92706,
76323,
92707,
76328,
76329,
76330,
76331,
76332,
92712,
92715,
76337,
92721,
76339,
92723,
76341,
76342,
92724,
76344,
92726,
92727,
76347,
92728,
92729,
92732,
92734,
76352,
92736,
92739,
92740,
76362,
92748,
76365,
76368,
92755,
76375,
92760,
92761,
92763,
92764,
92765,
76383,
76386,
92770,
92773,
92775,
76393,
92781,
76398,
76399,
92782,
92784,
92786,
76403,
76404,
92788,
92789,
92790,
76411,
76412,
92795,
76414,
92797,
76422,
92807,
76424,
76425,
76426,
92813,
92820,
76438,
92822,
92823,
92824,
76442,
92825,
92827,
76445,
76446,
92828,
92831,
76451,
76452,
76453,
92836,
92837,
92839,
76462,
76463,
92848,
92850,
76468,
92855,
76475,
92860,
76480,
76482,
92868,
76485,
92869,
92873,
76490,
92877,
92880,
92883,
76500,
92884,
92885,
76504,
92888,
76506,
76507,
92892,
76509,
76513,
92897,
92902,
92903,
92904,
92905,
92906,
76527,
92911,
76529,
92913,
76531,
76532,
92915,
92918,
76539,
76540,
92923,
92927,
76544,
76546,
76548,
92932,
92935,
76552,
76554,
76555,
92938,
76557,
76558,
76560,
76561,
92945,
76566,
76568,
92952,
92953,
92954,
76572,
76573,
92956,
76577,
76578,
92963,
92968,
92969,
92973,
76590,
92975,
76597,
76598,
76599,
76600,
76601,
92981,
92983,
76605,
76607,
92991,
92993,
92994,
92995,
76612,
76613,
76614,
92997,
76621,
76623,
76624,
93007,
93010,
76628,
93013,
93014,
76631,
93017,
93019,
93020,
76637,
93021,
93023,
93024,
76643,
76645,
93030,
93031,
93036,
76657,
76659,
93043,
93047,
93049,
76668,
93052,
76670,
76672,
93057,
76674,
76683,
93070,
93072,
76690,
93074,
76692,
76695,
76697,
76705,
76706,
76707,
76708,
93091,
93093,
76711,
93094,
76713,
76715,
93100,
93101,
76718,
93105,
76723,
93107,
76725,
93109,
76727,
76728,
76729,
93110,
76731,
93112,
93114,
76734,
93115,
93116,
93117,
93119,
76740,
76743,
76745,
76746,
93129,
76748,
76749,
93130,
93134,
76752,
76753,
93142,
76759,
93145,
76764,
76768,
93153,
93154,
93155,
76772,
76773,
93158,
93160,
76778,
76780,
93165,
93166,
76788,
76789,
93173,
93175,
93176,
76794,
76795,
93180,
76797,
93183,
76804,
93189,
76806,
93192,
76809,
93194,
76811,
76812,
76815,
76816,
76817,
93199,
76820,
76821,
76822,
76823,
76824,
76825,
93205,
93207,
76829,
76831,
76832,
76833,
93217,
76835,
93219,
93221,
76838,
93223,
93230,
93232,
76849,
93235,
93237,
93238,
93239,
76856,
76859,
76862,
76863,
93246,
93247,
76866,
93248,
93249,
93252,
93254,
76872,
76873,
76874,
93258,
76876,
76878,
93263,
93265,
93267,
76884,
93268,
93269,
93270,
76888,
76889,
93271,
76891,
93274,
76895,
93281,
76898,
93283,
93284,
93286,
93287,
93289,
93290,
76907,
93291,
76909,
76910,
76911,
93293,
93294,
93297,
76915,
93301,
76918,
76919,
93302,
76921,
76922,
76923,
93303,
76925,
93305,
76927,
76928,
93309,
76930,
93310,
76934,
93321,
93325,
93326,
76943,
76944,
76945,
93328,
76947,
93332,
76949,
93335,
76952,
76953,
93337,
76955,
76956,
93339,
93340,
76959,
76960,
93342,
76962,
93343,
76964,
93346,
76966,
93347,
93348,
93350,
76970,
76971,
76972,
93351,
93352,
93353,
76976,
93354,
93355,
93356,
93360,
93362,
93363,
76984,
93368,
76991,
76992,
76994,
93378,
76999,
77000,
93385,
77003,
93388,
93389,
77006,
93391,
77010,
77011,
93394,
93399,
93400,
93402,
93404,
77021,
77022,
77023,
93412,
93413,
93415,
77033,
77034,
93419,
77036,
77038,
93422,
77042,
77043,
77044,
93428,
93429,
93430,
77048,
93432,
93433,
93434,
77054,
77055,
77056,
93438,
93441,
93442,
93444,
77061,
93445,
77063,
77064,
93446,
77066,
93449,
77068,
93450,
93452,
77071,
93456,
77076,
93464,
93465,
93466,
77084,
93468,
93469,
77087,
93474,
93475,
93479,
93481,
77098,
93483,
77100,
93484,
93485,
77103,
93489,
77106,
93490,
93491,
93495,
77112,
77116,
93500,
93503,
77121,
77124,
93510,
93511,
93513,
93514,
77131,
77132,
93521,
93522,
93524,
77141,
77143,
93527,
77147,
77150,
93537,
93538,
93539,
77158,
77159,
77160,
77161,
77162,
77164,
93549,
93550,
93552,
77169,
93554,
77172,
77173,
93556,
77175,
93558,
93559,
93560,
77180,
93564,
93567,
77184,
93569,
77186,
93570,
93571,
77192,
93577,
93578,
93579,
93580,
77198,
93582,
77200,
77201,
77202,
77203,
93585,
77209,
77211,
93596,
77214,
93599,
77221,
77225,
93610,
93612,
93613,
77231,
77232,
93615,
93618,
77239,
77240,
77241,
77242,
93624,
77244,
93628,
77248,
93633,
93635,
93642,
93643,
77267,
77268,
93652,
77270,
93654,
77272,
77273,
93655,
77275,
93660,
93661,
77278,
93667,
93668,
93670,
77287,
93671,
93672,
93673,
77293,
77294,
77295,
93678,
77297,
77298,
93681,
77300,
93682,
77302,
77303,
93684,
93689,
77306,
93693,
93700,
77317,
77321,
93705,
93707,
93708,
77325,
93709,
77328,
77329,
77330,
77331,
93715,
93716,
77334,
93718,
77339,
93725,
77344,
93729,
93735,
93736,
77355,
93739,
77358,
93742,
93743,
93744,
77362,
77363,
93745,
93747,
77366,
93750,
93751,
77369,
77370,
77375,
77380,
77381,
93766,
77384,
77385,
77386,
93768,
93770,
77389,
93771,
93772,
93775,
93778,
77395,
93779,
93787,
93788,
77405,
93789,
93791,
77408,
77409,
93792,
93794,
93796,
93797,
77416,
93800,
77419,
77420,
93811,
77428,
93814,
93815,
77433,
77434,
77435,
77436,
93818,
93821,
77439,
93822,
93823,
77442,
77443,
77444,
93824,
77446,
77447,
93827,
93831,
77451,
93835,
77455,
77457,
93844,
77461,
77462,
93846,
77464,
93849,
77466,
93852,
93854,
93855,
77472,
93856,
77476,
93861,
77478,
77479,
77480,
93866,
77483,
77484,
93867,
77486,
93870,
77488,
93871,
77490,
93872,
77492,
93875,
77494,
93881,
93890,
93892,
77509,
93894,
77511,
93896,
93899,
77517,
77524,
93909,
93913,
93914,
93915,
93916,
77535,
93919,
93921,
77538,
93922,
77540,
93923,
93926,
77544,
77546,
77547,
93930,
77549,
93935,
93936,
93938,
93940,
77557,
93942,
77562,
93947,
77564,
77567,
77568,
93951,
93953,
93954,
93956,
77572,
93957,
77575,
77576,
93960,
77578,
77579,
93962,
77581,
77582,
93964,
77584,
93966,
77592,
93980,
93982,
77601,
93988,
93992,
77610,
77611,
77612,
93995,
77621,
94005,
77623,
77624,
77626,
94010,
94015,
77632,
77633,
77634,
94016,
77636,
94019,
94021,
94025,
77642,
77645,
94029,
94030,
77648,
77650,
94034,
94035,
94036,
77655,
94039,
94042,
77659,
94045,
77662,
77663,
94046,
94048,
94049,
77667,
94051,
77670,
77673,
77676,
77678,
94063,
77681,
77688,
94072,
94074,
77693,
77694,
94082,
94083,
94085,
77702,
94086,
94088,
94090,
77708,
77710,
94094,
94095,
94097,
77714,
94103,
77720,
77721,
77722,
94106,
94109,
94111,
77728,
94114,
77731,
94116,
77734,
77737,
77738,
94122,
94123,
94127,
94130,
77747,
77749,
94133,
77751,
94136,
77753,
94138,
77755,
77758,
94142,
77761,
77763,
94149,
94150,
77767,
77770,
77773,
77774,
77775,
77778,
77783,
94168,
77785,
77786,
77789,
94174,
77794,
94179,
94184,
94187,
77805,
77806,
77807,
77810,
94195,
94197,
77815,
94199,
94201,
94203,
94206,
94209,
77826,
94211,
94212,
77829,
77831,
94218,
77835,
77836,
94221,
77838,
94222,
77840,
94229,
94231,
77848,
94232,
94234,
77854,
94239,
77860,
77863,
77864,
94250,
94251,
94252,
77869,
77870,
94253,
94255,
77876,
94260,
77878,
94262,
94265,
77883,
77885,
77886,
94271,
94274,
77891,
77892,
77894,
94278,
77896,
94279,
94281,
77899,
77900,
94282,
94283,
94286,
77910,
94295,
77913,
77915,
94303,
94304,
77921,
77922,
94308,
94309,
94310,
94316,
94318,
77936,
77938,
77939,
94323,
77941,
77942,
77943,
77944,
77945,
94325,
94326,
94331,
94332,
77950,
77951,
94334,
94336,
77954,
77955,
77956,
94337,
77958,
94338,
77960,
94339,
94340,
77965,
77966,
94349,
94352,
77969,
94354,
94356,
77974,
77975,
77976,
77977,
77978,
77979,
77980,
94360,
94363,
77983,
77984,
77988,
94372,
94374,
94375,
77993,
94378,
77995,
94379,
94380,
94385,
78002,
94386,
78005,
94389,
94390,
94391,
94393,
78011,
94395,
94396,
78014,
78015,
94400,
94401,
78019,
94404,
78021,
78022,
78024,
94408,
94409,
94410,
78028,
94411,
94412,
78031,
94413,
94414,
78034,
78035,
94415,
78037,
78038,
94417,
78040,
94420,
78042,
94421,
94424,
78045,
94426,
94433,
94435,
78054,
78055,
94441,
78058,
94444,
78061,
94445,
94448,
78066,
78067,
78068,
78069,
94450,
78070,
94451,
94453,
94455,
78074,
94458,
78076,
94461,
78078,
78079,
78080,
94462,
94464,
94466,
78084,
78085,
78086,
94468,
94471,
94473,
94475,
78092,
78095,
94480,
94481,
94486,
78104,
94491,
78112,
94496,
78114,
94498,
78116,
94500,
94501,
78119,
94502,
78122,
94506,
78126,
78127,
94512,
94515,
78133,
94519,
78136,
78137,
94524,
78143,
78144,
78145,
78146,
78147,
78148,
78149,
78150,
94531,
94533,
94537,
78154,
78155,
94539,
94540,
78158,
94543,
78162,
78163,
94548,
94549,
94551,
94552,
78171,
78172,
94558,
94559,
94560,
78177,
94561,
78179,
94562,
94563,
94567,
78184,
94568,
94570,
78190,
94574,
78192,
94575,
78195,
78198,
94583,
78200,
94584,
78202,
78204,
78205,
94589,
94591,
78208,
78212,
94596,
78214,
78218,
94602,
78220,
94604,
78223,
94607,
94609,
94611,
78228,
94613,
94615,
78232,
94618,
78236,
94622,
78239,
94624,
78243,
78244,
94628,
94630,
78247,
78249,
78250,
78251,
94633,
78253,
78254,
78255,
94638,
78257,
94642,
78259,
94646,
78263,
94649,
78266,
78267,
78268,
94653,
94656,
94658,
94659,
94660,
78277,
94662,
78279,
94663,
78281,
78282,
94666,
78285,
78286,
94670,
78288,
94673,
94674,
94676,
78295,
94680,
78297,
78298,
78299,
94683,
94685,
94687,
94688,
94691,
94692,
94693,
78310,
78311,
78315,
94700,
78318,
94702,
94703,
78322,
78326,
78327,
94714,
94715,
78333,
78335,
94719,
94722,
78339,
78342,
78343,
94729,
78346,
94730,
94731,
78352,
94736,
94738,
78356,
78357,
78358,
78359,
78360,
94742,
94745,
94748,
94749,
78366,
78367,
78370,
94754,
94756,
94757,
94758,
94759,
78376,
94760,
94761,
94762,
78380,
94768,
94769,
78387,
94772,
94778,
94785,
78404,
78405,
94789,
78414,
78415,
78418,
94802,
78422,
78423,
94808,
78425,
94810,
94811,
78429,
94813,
94814,
94818,
78435,
94819,
78437,
94821,
78440,
78441,
94825,
78447,
78448,
94831,
78451,
94835,
94836,
94839,
78458,
94842,
78460,
94843,
78462,
94845,
94846,
94853,
94855,
94857,
78476,
78478,
78481,
78482,
78485,
78486,
94870,
94874,
78490,
78491,
78493,
94878,
94879,
78499,
94883,
78501,
94884,
94886,
78504,
94890,
94892,
78510,
78511,
78513,
78516,
94900,
94901,
94903,
78521,
94906,
78524,
78526,
78527,
78528,
78529,
94911,
78531,
94914,
78533,
78534,
94916,
94917,
94918,
94919,
94921,
94923,
78541,
94929,
78548,
78549,
94935,
94936,
78553,
78554,
94937,
78556,
78557,
94941,
94942,
94944,
94945,
78564,
78566,
94952,
78569,
94956,
78581,
94968,
78591,
78594,
94978,
78598,
78600,
94984,
78602,
78603,
78604,
94986,
78606,
94990,
78608,
94992,
78610,
94994,
78612,
78613,
94995,
94998,
78616,
78617,
94999,
78619,
78620,
95001,
95002,
95006,
78624,
78625,
95007,
78627,
78628,
78629,
78630,
95009,
95010,
95011,
78634,
95015,
95020,
95022,
78640,
78641,
95024,
95028,
78646,
78647,
95030,
95033,
78650,
95034,
78652,
95035,
95036,
78655,
78656,
78657,
78658,
95044,
95045,
78662,
95048,
78667,
78668,
95052,
78671,
95055,
78675,
95059,
78678,
78683,
95069,
95073,
95074,
78691,
95076,
95077,
78694,
78697,
78701,
95086,
78703,
78704,
95087,
95088,
95091,
95092,
95093,
95095,
78713,
78714,
78715,
78716,
95100,
95101,
78719,
78720,
78721,
95102,
78723,
95106,
95108,
95110,
78728,
78729,
78730,
95116,
78734,
78736,
95120,
78738,
95121,
95126,
95127,
78744,
95128,
95130,
95131,
95132,
78749,
78750,
95134,
95135,
95138,
78755,
78756,
78757,
95142,
78759,
95143,
78761,
78762,
78764,
95151,
78768,
78769,
95153,
95154,
95156,
78774,
95159,
95160,
95161,
95163,
78780,
95164,
95165,
78783,
95166,
95167,
78786,
95170,
95171,
78789,
95175,
78792,
78793,
78794,
78795,
78796,
78797,
78798,
95177,
78800,
95182,
95184,
78803,
95188,
78806,
78807,
78811,
95195,
78813,
95198,
95199,
78818,
95203,
95204,
95207,
78824,
95209,
95210,
95211,
95214,
95215,
78832,
95219,
78836,
95220,
95221,
95223,
78840,
78841,
95224,
95226,
78844,
95229,
78846,
78847,
78848,
95231,
95232,
78851,
78852,
95235,
78856,
78857,
95242,
78860,
95245,
78863,
78866,
78868,
95252,
78872,
95256,
95258,
95261,
95262,
78879,
95265,
95266,
78883,
95267,
95271,
95273,
78890,
78892,
95278,
78895,
95280,
78897,
95282,
78901,
95287,
78904,
78905,
78906,
95289,
78910,
95294,
78912,
95301,
78918,
95302,
95303,
95310,
78928,
78930,
78936,
95321,
95323,
78941,
95326,
95327,
78944,
78945,
78946,
78947,
95329,
95332,
95336,
95337,
95341,
95345,
78962,
95347,
95349,
78966,
78972,
78974,
95360,
95361,
95363,
95364,
78982,
78983,
95367,
78985,
95368,
78987,
95369,
95371,
78992,
78994,
95378,
78996,
95379,
95381,
78999,
95383,
95388,
95390,
79007,
95392,
79010,
79011,
95394,
95395,
79014,
79015,
79016,
95397,
79018,
95400,
95402,
95405,
95406,
95408,
79025,
79026,
95410,
79028,
95411,
79030,
95414,
95415,
79034,
95419,
79036,
95420,
79038,
95421,
79040,
95425,
79042,
79043,
79044,
79045,
95427,
95428,
79048,
95432,
79050,
79051,
95433,
95435,
79054,
79055,
95436,
79057,
95440,
79059,
95442,
95444,
79063,
79065,
95449,
79067,
95452,
79069,
79070,
79071,
95454,
79075,
95459,
79077,
79078,
95462,
79080,
95465,
79083,
79084,
95467,
79086,
95469,
95473,
79091,
79093,
95481,
79100,
95487,
79110,
95494,
79112,
79114,
95500,
79117,
95501,
79119,
95503,
79121,
95504,
95505,
95508,
79125,
95512,
79133,
95517,
95519,
79139,
95523,
95524,
95525,
95526,
95528,
79146,
95531,
95532,
95533,
79152,
79153,
95536,
79155,
79156,
79157,
79158,
95539,
95540,
79161,
95552,
95553,
79170,
95555,
79172,
79175,
95559,
95561,
79178,
79179,
79180,
79181,
95563,
79183,
79185,
79187,
79188,
79189,
95571,
79191,
95576,
95579,
79196,
79197,
79198,
95582,
95583,
95586,
95588,
95590,
95593,
95601,
95602,
79222,
79223,
95608,
79225,
95609,
95611,
95614,
79233,
95620,
79238,
95623,
95624,
95625,
95626,
79245,
95630,
79248,
79250,
95636,
79253,
95637,
95639,
95642,
95644,
95645,
95646,
95647,
95649,
79268,
79269,
79275,
79276,
95660,
79278,
95662,
79281,
95667,
79287,
95672,
95673,
95674,
79291,
79293,
79294,
79295,
95681,
95682,
79299,
95685,
79305,
79306,
79308,
95693,
79311,
95695,
79313,
79314,
95696,
79316,
95697,
79319,
95707,
95709,
95711,
95713,
79330,
95714,
79332,
95715,
79334,
95717,
95719,
95720,
79339,
79340,
95725,
95726,
79346,
79347,
95733,
95735,
95736,
95737,
79356,
79357,
79358,
95744,
79361,
95745,
95746,
79369,
95753,
79371,
79372,
79373,
79374,
95755,
95757,
95762,
95764,
79383,
95767,
79385,
95770,
79388,
95772,
79390,
79391,
95774,
79394,
79395,
95778,
95780,
95782,
79399,
95785,
79402,
79403,
95789,
95790,
95791,
79409,
79410,
95793,
95795,
95797,
79417,
95801,
79419,
79420,
95803,
95804,
95805,
95806,
95808,
79426,
95811,
79429,
79431,
79432,
95817,
95819,
79439,
79442,
79444,
95828,
95829,
95830,
95832,
95834,
79451,
95835,
79454,
95839,
79457,
95842,
79459,
95843,
79461,
79462,
95845,
95848,
95850,
79467,
95852,
79469,
79472,
95857,
79474,
95858,
95859,
79477,
79478,
79479,
95860,
79481,
95861,
79483,
95864,
79485,
95867,
95870,
95871,
95872,
79492,
79493,
79494,
95877,
79496,
95879,
79498,
95880,
79500,
95881,
95884,
95885,
95888,
79506,
79508,
79509,
95893,
79514,
95899,
95900,
79518,
79519,
95902,
79522,
95906,
79524,
79525,
95909,
79527,
95910,
79529,
95914,
79533,
79535,
95919,
95921,
79538,
95922,
79540,
95923,
79542,
95924,
79544,
95925,
95926,
79547,
79548,
79549,
79550,
79551,
79552,
95931,
95934,
79555,
95935,
95936,
79558,
95938,
95939,
79561,
79562,
79563,
79564,
95940,
95942,
95945,
95949,
79569,
95951,
95955,
79572,
79573,
79574,
95960,
79577,
79578,
95962,
95963,
79582,
95968,
79585,
95970,
95972,
79588,
95975,
95976,
95977,
79594,
79595,
95981,
79598,
95985,
95986,
79605,
79606,
95991,
79610,
95996,
95997,
95998,
79616,
96001,
79618,
96002,
96003,
79621,
79622,
79623,
79624,
96004,
96005,
96009,
79628,
96013,
79633,
79634,
96018,
79636,
96019,
79638,
79639,
96021,
96022,
79642,
96024,
79644,
79645,
96027,
96028,
96029,
79651,
96035,
96036,
96038,
79655,
79660,
96045,
79662,
79668,
79670,
96054,
96056,
96057,
79675,
79676,
79677,
79678,
96059,
79680,
96060,
96062,
79683,
96064,
96067,
79687,
79688,
96072,
79693,
96081,
79698,
79700,
96084,
79703,
79704,
79705,
79706,
79707,
79708,
96088,
96089,
79713,
79717,
79719,
96106,
79723,
79724,
96107,
79726,
79727,
96109,
79729,
96111,
79732,
79733,
96121,
79743,
96129,
96131,
96132,
96133,
79750,
96141,
79759,
79761,
79762,
96147,
79764,
79765,
79766,
79767,
96150,
79769,
79770,
96151,
79772,
96157,
96158,
79775,
79781,
96165,
96166,
96168,
96173,
79790,
96174,
96175,
79793,
96176,
96177,
96180,
79798,
79799,
96184,
79801,
96185,
96187,
96189,
96191,
96193,
96194,
96195,
79814,
96201,
79818,
96202,
96203,
79821,
79822,
96205,
79824,
96208,
96216,
79835,
96221,
96224,
96225,
96226,
79843,
79845,
79846,
79847,
96233,
96238,
79855,
96241,
96242,
96243,
96244,
79861,
96246,
96247,
79864,
96248,
79867,
96256,
79873,
79874,
96257,
96260,
96261,
96263,
96264,
79882,
79885,
96269,
96271,
79888,
79891,
79892,
79893,
79894,
79895,
79896,
96278,
96279,
96284,
79901,
96285,
96286,
79904,
79905,
96287,
79907,
96288,
79909,
96289,
79911,
96290,
79913,
79914,
96292,
79916,
96296,
96297,
96298,
79922,
79923,
79924,
88115,
79926,
79930,
96314,
96318,
96319,
79936,
79939,
96325,
96326,
96327,
79944,
79947,
96332,
79949,
96334,
96337,
96338,
79957,
79958,
96341,
96344,
96345,
79962,
79966,
79967,
79968,
79969,
79971,
79972,
79973,
96357,
96359,
79982,
96368,
79986,
79987,
79988,
79990,
79991,
96374,
96376,
96377,
96380,
79997,
96381,
79999,
80000,
96382,
96385,
80003,
96386,
79996,
80007,
96393,
96394,
96395,
96396,
96397,
80015,
80016,
80017,
96400,
80019,
80020,
80021,
80022,
96407,
80024,
96409,
96410,
80028,
80029,
96413,
80031,
96414,
96416,
96419,
96420,
96424,
96425,
96428,
96429,
80048,
96433,
80050,
96434,
96436,
80056,
80057,
80062,
96446,
88256,
80065,
80066,
80067,
96449,
96450,
96452,
80072,
96456,
80074,
96457,
96458,
80077,
80078,
96459,
80080,
96461,
80082,
96467,
96468,
80085,
80086,
96473,
80093,
96480,
96481,
80100,
96485,
96488,
80109,
80110,
96499,
96501,
80119,
80120,
80121,
96506,
80124,
80125,
80126,
96510,
96512,
80129,
80130,
96514,
96516,
80134,
96519,
80137,
80138,
80139,
80140,
80141,
96524,
96527,
80144,
96528,
96533,
96535,
96537,
80154,
80157,
80159,
80160,
96543,
80162,
96544,
96546,
80165,
80166,
96554,
96556,
96557,
80174,
80175,
96561,
80179,
80180,
96563,
80182,
96570,
96571,
80192,
96576,
96578,
80195,
96579,
80197,
96581,
80199,
80200,
96583,
80203,
96587,
80205,
80206,
96591,
80208,
96592,
80210,
80212,
80213,
96596,
80218,
96602,
80220,
96603,
96606,
96607,
80225,
96609,
96611,
96613,
96614,
80231,
96615,
80234,
80235,
96618,
96620,
96621,
80239,
96622,
80242,
96627,
96632,
96635,
96636,
80253,
96637,
80255,
96639,
96645,
80263,
96648,
80266,
96650,
80268,
96651,
80270,
96657,
80275,
96662,
80280,
96664,
80282,
96667,
96668,
80285,
96669,
96672,
96673,
80290,
80292,
96676,
80294,
80301,
96686,
80303,
96687,
96691,
96692,
80311,
80313,
80314,
80315,
96699,
96700,
96702,
80319,
96704,
80324,
96711,
80329,
80330,
96714,
96718,
80335,
96720,
80337,
80338,
96723,
80340,
80342,
145878,
96729,
80346,
80348,
96733,
80350,
80351,
96735,
96736,
96737,
80355,
96738,
96739,
96740,
80363,
80364,
80367,
80368,
96752,
80370,
80372,
96756,
80374,
80375,
80376,
80377,
96757,
96759,
80380,
96761,
80382,
80383,
80384,
96765,
96766,
80389,
96777,
80394,
96779,
80397,
96783,
80401,
96785,
96787,
96791,
80408,
80409,
96793,
80412,
80414,
80415,
96798,
96799,
96801,
96803,
80422,
96807,
96809,
80426,
80427,
96812,
80429,
96813,
96815,
80432,
80433,
80434,
96818,
80437,
80438,
88631,
96821,
80441,
96824,
96825,
96826,
96831,
80451,
80452,
80456,
80457,
80467,
80471,
80478,
80481,
80485,
80487,
80490,
80497,
80498,
80502,
80504,
80505,
80507,
80508,
80522,
80527,
80529,
80531,
80532,
80536,
80548,
80550,
80554,
80556,
80558,
80559,
80563,
80565,
80570,
80571,
80573,
80575,
80579,
80585,
80586,
80588,
80591,
80594,
80598,
80599,
80600,
80606,
80607,
88856,
88858,
88868,
88870,
88873,
88875,
88876,
88877,
88878,
88880,
88882,
88883,
88888,
88890,
88891,
88893,
88894,
88895,
88902,
88906,
88907,
88908,
88909,
88911,
88912,
88914,
88917,
88919,
88921,
88922,
88924,
95927
] |
d50953013e587b7beaecba006a3b207ebb1ca66f | 2d88bdb4f4a1b1abd30e00fc6bce5c6e01b81f5c | /Sources/ImageRow.swift | 85b9e6c6771a1600aecf3d6bd90b2ad270863979 | [
"MIT"
] | permissive | EurekaCommunity/ImageRow | 2b98ac7fac3a4eb2fb474c973af2751824ff0caa | 5682215c037bc5ff9b9b9ddb219f906f078e4c25 | refs/heads/master | 2022-05-10T00:12:25.329908 | 2022-04-18T18:35:04 | 2022-04-18T18:35:04 | 69,901,981 | 107 | 85 | MIT | 2022-04-18T18:35:05 | 2016-10-03T19:09:45 | Swift | UTF-8 | Swift | false | false | 9,973 | swift | // ImageRow.swift
// ImageRow ( https://github.com/EurekaCommunity/ImageRow )
//
// Copyright (c) 2016 Xmartlabs SRL ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
import Eureka
import Foundation
import UIKit
public struct ImageRowSourceTypes: OptionSet {
public let rawValue: Int
public var imagePickerControllerSourceTypeRawValue: Int { return self.rawValue >> 1 }
public init(rawValue: Int) { self.rawValue = rawValue }
init(_ sourceType: UIImagePickerController.SourceType) { self.init(rawValue: 1 << sourceType.rawValue) }
public static let PhotoLibrary = ImageRowSourceTypes(.photoLibrary)
public static let Camera = ImageRowSourceTypes(.camera)
public static let SavedPhotosAlbum = ImageRowSourceTypes(.savedPhotosAlbum)
public static let All: ImageRowSourceTypes = [Camera, PhotoLibrary, SavedPhotosAlbum]
}
public extension ImageRowSourceTypes {
var localizedString: String {
switch self {
case ImageRowSourceTypes.Camera:
return NSLocalizedString("Take Photo", comment: "")
case ImageRowSourceTypes.PhotoLibrary:
return NSLocalizedString("Photo Library", comment: "")
case ImageRowSourceTypes.SavedPhotosAlbum:
return NSLocalizedString("Saved Photos", comment: "")
default:
return ""
}
}
}
public enum ImageClearAction {
case no
case yes(style: UIAlertAction.Style)
}
public protocol ImageRowProtocol {
var placeholderImage: UIImage? { get }
var thumbnailImage: UIImage? { get }
}
//MARK: Row
open class _ImageRow<Cell: CellType>: OptionsRow<Cell>, PresenterRowType, ImageRowProtocol, ImagePickerProtocol where Cell: BaseCell, Cell.Value == UIImage {
public typealias PresenterRow = ImagePickerController
/// Defines how the view controller will be presented, pushed, etc.
open var presentationMode: PresentationMode<PresenterRow>?
/// Will be called before the presentation occurs.
open var onPresentCallback: ((FormViewController, PresenterRow) -> Void)?
open var sourceTypes: ImageRowSourceTypes
open var imageURL: URL?
open var clearAction = ImageClearAction.yes(style: .destructive)
open var placeholderImage: UIImage?
open var thumbnailImage: UIImage?
open var actionTintColor: UIColor
open var userPickerInfo : [UIImagePickerController.InfoKey:Any]?
open var allowEditor : Bool
open var useEditedImage : Bool
private var _sourceType: UIImagePickerController.SourceType = .camera
public required init(tag: String?) {
sourceTypes = .All
userPickerInfo = nil
allowEditor = false
useEditedImage = false
actionTintColor = .systemBlue
super.init(tag: tag)
presentationMode = .presentModally(controllerProvider:
ControllerProvider.callback { [weak self] in
let controller = ImagePickerController()
controller.allowsEditing = self?.allowEditor ?? false
return controller
}, onDismiss: { [weak self] vc in
self?.select()
vc.dismiss(animated: true)
})
self.displayValueFor = nil
}
// copy over the existing logic from the SelectorRow
func displayImagePickerController(_ sourceType: UIImagePickerController.SourceType) {
if let presentationMode = presentationMode, !isDisabled {
if let controller = presentationMode.makeController(){
controller.row = self
controller.sourceType = sourceType
onPresentCallback?(cell.formViewController()!, controller)
presentationMode.present(controller, row: self, presentingController: cell.formViewController()!)
} else {
_sourceType = sourceType
presentationMode.present(nil, row: self, presentingController: cell.formViewController()!)
}
}
}
/// Extends `didSelect` method
/// Selecting the Image Row cell will open a popup to choose where to source the photo from,
/// based on the `sourceTypes` configured and the available sources.
open override func customDidSelect() {
guard !isDisabled else {
super.customDidSelect()
return
}
deselect()
selectSource()
}
open func selectSource() {
var availableSources: ImageRowSourceTypes = []
if UIImagePickerController.isSourceTypeAvailable(.photoLibrary) {
let _ = availableSources.insert(.PhotoLibrary)
}
if UIImagePickerController.isSourceTypeAvailable(.camera) {
let _ = availableSources.insert(.Camera)
}
if UIImagePickerController.isSourceTypeAvailable(.savedPhotosAlbum) {
let _ = availableSources.insert(.SavedPhotosAlbum)
}
sourceTypes.formIntersection(availableSources)
if sourceTypes.isEmpty {
super.customDidSelect()
guard let presentationMode = presentationMode else { return }
if let controller = presentationMode.makeController() {
controller.row = self
controller.title = selectorTitle ?? controller.title
onPresentCallback?(cell.formViewController()!, controller)
presentationMode.present(controller, row: self, presentingController: self.cell.formViewController()!)
} else {
presentationMode.present(nil, row: self, presentingController: self.cell.formViewController()!)
}
return
}
// Now that we know the number of sources aren't empty, let the user select the source
let sourceActionSheet = UIAlertController(title: nil, message: selectorTitle, preferredStyle: .actionSheet)
sourceActionSheet.view.tintColor = actionTintColor
guard let tableView = cell.formViewController()?.tableView else { fatalError() }
if let popView = sourceActionSheet.popoverPresentationController {
popView.sourceView = tableView
popView.sourceRect = tableView.convert(cell.accessoryView?.frame ?? cell.contentView.frame, from: cell)
}
createOptionsForAlertController(sourceActionSheet)
// if thumbnail or value is set, offer clear action
if case .yes(let style) = clearAction, value != nil || thumbnailImage != nil {
let clearPhotoOption = UIAlertAction(title: NSLocalizedString("Clear Photo", comment: ""), style: style) { [weak self] _ in
self?.value = nil
self?.thumbnailImage = nil
self?.imageURL = nil
self?.updateCell()
}
sourceActionSheet.addAction(clearPhotoOption)
}
if sourceActionSheet.actions.count == 1 {
if let imagePickerSourceType = UIImagePickerController.SourceType(rawValue: sourceTypes.imagePickerControllerSourceTypeRawValue) {
displayImagePickerController(imagePickerSourceType)
}
} else {
let cancelOption = UIAlertAction(title: NSLocalizedString("Cancel", comment: ""), style: .cancel, handler: nil)
sourceActionSheet.addAction(cancelOption)
if let presentingViewController = cell.formViewController() {
presentingViewController.present(sourceActionSheet, animated: true)
}
}
}
/**
Prepares the pushed row setting its title and completion callback.
*/
open override func prepare(for segue: UIStoryboardSegue) {
super.prepare(for: segue)
guard let rowVC = segue.destination as? PresenterRow else { return }
rowVC.title = selectorTitle ?? rowVC.title
rowVC.onDismissCallback = presentationMode?.onDismissCallback ?? rowVC.onDismissCallback
onPresentCallback?(cell.formViewController()!, rowVC)
rowVC.row = self
rowVC.sourceType = _sourceType
}
}
public extension _ImageRow {
func createOptionForAlertController(_ alertController: UIAlertController, sourceType: ImageRowSourceTypes) {
guard let pickerSourceType = UIImagePickerController.SourceType(rawValue: sourceType.imagePickerControllerSourceTypeRawValue), sourceTypes.contains(sourceType) else { return }
let option = UIAlertAction(title: NSLocalizedString(sourceType.localizedString, comment: ""), style: .default) { [weak self] _ in
self?.displayImagePickerController(pickerSourceType)
}
alertController.addAction(option)
}
func createOptionsForAlertController(_ alertController: UIAlertController) {
createOptionForAlertController(alertController, sourceType: .Camera)
createOptionForAlertController(alertController, sourceType: .PhotoLibrary)
createOptionForAlertController(alertController, sourceType: .SavedPhotosAlbum)
}
}
/// A selector row where the user can pick an image
public final class ImageRow: _ImageRow<ImageCell>, RowType {
public required init(tag: String?) {
super.init(tag: tag)
}
}
| [
236355,
217092,
298439,
108265,
123210,
310156,
205466
] |
0689855c5d38bdae4377fe2384df748e375677a5 | 1f66c4e7e48f657ce1078f524c5d859a90ece485 | /TheMoviesDb/TheMoviesDb/Cells/Details/DetailSeriesCastViewCell.swift | 1c56b84ef3e7808b97c8f2a6cb2ff80fc46e0dca | [] | no_license | oliver-anh-nguyen/swift_the_movie_db | 2fd0e51d93c27bfe298483051c03b158dbd9449f | 77d1a1af6eba4110f904a41205028e977127fa51 | refs/heads/master | 2022-04-20T23:50:07.324428 | 2020-04-22T07:59:33 | 2020-04-22T07:59:33 | 256,098,252 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,969 | swift | //
// DetailSeriesCastViewCell.swift
// TheMoviesDb
//
// Created by admin on 4/18/20.
// Copyright © 2020 admin. All rights reserved.
//
import Foundation
import UIKit
import Nuke
class DetailSeriesCastViewCell: UICollectionViewCell {
private lazy var viewBg: UIView = {
let outerView = UIView()
self.addSubview(outerView)
return outerView
}()
private lazy var imgBg: UIImageView = {
let img = UIImageView()
img.image = UIImage(named: image_detail_avatar)
img.clipsToBounds = true
img.layer.cornerRadius = imgCornerRadius
self.viewBg.addSubview(img)
return img
}()
private lazy var title: UILabel = {
let labelTitle = UILabel()
labelTitle.font = UIFont(name: font_helvetica_bold, size: 12)
labelTitle.textColor = UIColor(red: 0.29, green: 0.29, blue: 0.29, alpha: 1)
labelTitle.textAlignment = .justified
labelTitle.numberOfLines = 1
self.addSubview(labelTitle)
return labelTitle
}()
private lazy var desc: UILabel = {
let label = UILabel()
label.font = UIFont(name: font_helvetica, size: 12)
label.textColor = UIColor(red: 0.608, green: 0.608, blue: 0.608, alpha: 1)
label.textAlignment = .justified
label.numberOfLines = 1
self.addSubview(label)
return label
}()
override init(frame: CGRect) {
super.init(frame: frame)
self.setupLayout()
}
override func prepareForReuse() {
super.prepareForReuse()
//self.imgBg.image = UIImage(named: "")
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func setupLayout() {
self.viewBg.snp.makeConstraints {
$0.centerX.equalToSuperview()
$0.width.equalTo(70)
$0.height.equalTo(102)
$0.top.equalTo(15)
}
self.viewBg.viewShadow()
self.imgBg.snp.makeConstraints {
$0.edges.equalToSuperview()
}
self.title.snp.makeConstraints {
$0.left.right.equalTo(self.imgBg)
$0.top.equalTo(self.imgBg.snp.bottom).offset(5)
$0.height.equalTo(16)
}
self.desc.snp.makeConstraints {
$0.left.right.equalTo(self.imgBg)
$0.top.equalTo(self.title.snp.bottom).offset(2)
$0.height.equalTo(14)
}
}
func configure(viewModel: MovieCast) {
if viewModel.profilePath != nil {
Nuke.loadImage(
with: viewModel.profileURL,
options: ImageLoadingOptions(
transition: .fadeIn(duration: 0.33)
),
into: self.imgBg
)
}
self.title.text = viewModel.name
self.desc.text = viewModel.character
}
}
| [
-1
] |
7e3791fdc5e847840d49fd3abc7fd76a0217d462 | 9e9c0585115ea0adb083ea4313bacabf8cf985dc | /AppetizerExamIOS/models/ITunesWrapper.swift | 4879dd5dd98d49a20889e4ec630aadaab33f33a0 | [] | no_license | deibeeed/AppetizerExamIOS- | 15d779ae3ff2e5856d5db3e67c0d0532ec9404b0 | 70a2c3b03e6262490d79c67e7a7199568f08139d | refs/heads/master | 2020-04-26T23:09:11.541790 | 2019-03-05T13:06:44 | 2019-03-05T13:06:44 | 173,893,628 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 493 | swift | //
// ITunesWrapper.swift
// AppetizerExamIOS
//
// Created by David Andrew Francis Duldulao on 04/03/2019.
// Copyright © 2019 AppetizerIOSCodingExam. All rights reserved.
//
import Foundation
import ObjectMapper
class ITunesWrapper: Mappable {
var resultCount: Int = -1
var results: [ITunes] = []
required init?(map: Map) {
}
func mapping(map: Map) {
self.resultCount <- map["resultCount"]
self.results <- map["results"]
}
}
| [
-1
] |
8de4cc93269875ec1b241bbf8e9eb57dfaa5a50a | fc39338f899adc7b2f8f494ed681a047f64c98b6 | /rainyshinycloudy/CurrentWeather.swift | 3842228d74abaec69fe3594ffd7218d01df7be39 | [] | no_license | AbdelRahmanAref/Weather-App | 23ecf55387705a08e8dbbcfc911e9da1afc77035 | 17df837e4a86f54e6d98c044476e9e3ec8986aa6 | refs/heads/master | 2021-01-23T10:57:42.170965 | 2017-06-02T01:22:14 | 2017-06-02T01:22:14 | 93,113,755 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,340 | swift | //
// CurrentWeather.swift
// rainyshinycloudy
//
// Created by AbdelRahman Aref on 5/29/17.
// Copyright © 2017 AbdelRahman Aref. All rights reserved.
//
import UIKit
import Alamofire
class CurrentWeather {
var _cityName: String!
var _date:String!
var _weatherType: String!
var _currentTemp: Double!
var cityName: String{
if _cityName == nil {
_cityName = ""
}
return _cityName
}
var date:String{
if _date == nil{
_date = ""
}
let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .long
dateFormatter.timeStyle = .none
let currentDate = dateFormatter.string(from: Date())
self._date = "Today, \(currentDate)"
return _date
}
var weatherType: String{
if _weatherType == nil {
_weatherType = ""
}
return _weatherType
}
var currentTemp:Double{
if _currentTemp == nil {
_currentTemp = 0.0
}
return _currentTemp
}
func downloadWeatherDetails(completed: @escaping DownloadComplete) {
//Download Current Weather Data
Alamofire.request(CURRENT_WEATHER_URL).responseJSON { response in
let result = response.result
if let dict = result.value as? Dictionary<String, AnyObject> {
if let name = dict["name"] as? String {
self._cityName = name.capitalized
}
if let weather = dict["weather"] as? [Dictionary<String, AnyObject>] {
if let main = weather[0]["main"] as? String {
self._weatherType = main.capitalized
}
}
if let main = dict["main"] as? Dictionary<String, AnyObject> {
if let currentTemperature = main["temp"] as? Double {
let kelvinToCelisus = (currentTemperature - 273)
self._currentTemp = kelvinToCelisus
}
}
}
completed()
}
}
}
| [
294216,
291261
] |
3061d427dbdc5f0680b3e687f0c456869c28ec9a | d9018ffdff11ee6d0840ce7adeae6e6ea225dd3a | /VidaFacil-iOS/Controllers/DetailsViewController.swift | 1c16d81c8f1cc00a3c2a430eb08ae5f510810ffc | [] | no_license | Droguigs/VidaFacil | cc92de365fee1493fb96c851e9b634bbd6318758 | ab5519ddccfb661b6a9662af288c93c0edb8163c | refs/heads/master | 2020-05-03T01:27:57.747812 | 2019-10-20T02:18:28 | 2019-10-20T12:03:42 | 178,338,132 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,959 | swift | //
// DetailsViewController.swift
// VidaFacil-iOS
//
// Created by Douglas Schiavi on 13/08/19.
// Copyright © 2019 Douglas Schiavi. All rights reserved.
//
import UIKit
import SDWebImage
class DetailsViewController: BaseViewController {
@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var imageView: UIImageView!
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var streetLabel: UILabel!
@IBOutlet weak var phoneLabel: UILabel!
@IBOutlet weak var gradeLabel: UILabel!
var establishment: Establishment?
var establishments: [Product] = []
override func viewDidLoad() {
super.viewDidLoad()
setupData()
tableView.delegate = self
tableView.dataSource = self
}
func setupData() {
self.imageView.sd_setImage(with: establishment?.image.toUrl(), placeholderImage: #imageLiteral(resourceName: "pig_icon"))
self.titleLabel.text = establishment?.description ?? "Estabelecimento"
self.streetLabel.text = establishment?.address ?? ""
self.phoneLabel.text = establishment?.phone ?? ""
if let grade = establishment?.average?.average {
self.gradeLabel.text = "\(grade)"
} else {
self.gradeLabel.text = "-"
}
ServicesManager.sharedInstance.api.establishments(establishmentId: establishment?.id ?? 0) { (result, error) in
if let _error = error {
self.showError(_error)
} else if let _result = result {
self.establishments = _result.data?.products ?? []
self.tableView.reloadData()
}
}
}
override func viewWillAppear(_ animated: Bool) {
self.titleLabel.textColor = .black
self.streetLabel.textColor = .black
self.phoneLabel.textColor = .black
self.gradeLabel.textColor = .black
self.tableView.backgroundColor = .white
}
}
extension DetailsViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return establishments.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: EstablishmentTableViewCell.identifier, for: indexPath) as! EstablishmentTableViewCell
cell.setup(name: establishments[indexPath.row].description, description: establishments[indexPath.row].discountType?.description ?? "", percentage: establishments[indexPath.row].discount + "%")
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
self.tableView.deselectRow(at: indexPath, animated: false)
// ServicesManager.sharedInstance.api
performSegue(withIdentifier: "Details-QR", sender: self)
}
}
| [
-1
] |
063ebe7ce7e4a725d30dd6261fe1cf7b48e16616 | 415991df946f16256185c594c491a7e7a696c1a8 | /Sources/iOS/App/CustomViews/Post/MastodonCompactPollViewController.swift | bd1d052f0e87da06102ace6932cae8f6693257b5 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | cinderella-project/iMast | 81e38c791feb50338f03fe892b1969a36e76362a | 99d076e900e6b3cf6bbbf3717db9ebe282a90a5f | refs/heads/master | 2023-08-21T05:53:55.225235 | 2023-08-06T22:24:55 | 2023-08-06T22:24:55 | 89,772,358 | 111 | 16 | Apache-2.0 | 2023-09-06T22:24:28 | 2017-04-29T08:11:08 | Swift | UTF-8 | Swift | false | false | 5,314 | swift | //
// MastodonCompactPollViewController.swift
//
// iMast https://github.com/cinderella-project/iMast
//
// Created by rinsuki on 2019/07/26.
//
// ------------------------------------------------------------------------
//
// Copyright 2017-2019 rinsuki and other contributors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import UIKit
import Mew
import Ikemen
import SnapKit
import iMastiOSCore
class MastodonCompactPollViewController: UIViewController, Instantiatable, Injectable {
typealias Input = MastodonPost
typealias Environment = MastodonUserToken
let environment: Environment
var input: Input
let titleLabel = UILabel() ※ { v in
v.text = "投票"
}
let expireLabel = UILabel() ※ { v in
v.text = "n票 / あとn日ぐらい"
v.setContentHuggingPriority(UILayoutPriority(251), for: .horizontal)
}
let descriptionLabel = UILabel() ※ { v in
v.text = "4択の中から1つ: 選択肢1 / 選択肢2 / 選択肢3 / 選択肢4"
}
var paddingConstraint: Constraint!
required init(with input: Input, environment: Environment) {
self.input = input
self.environment = environment
super.init(nibName: nil, bundle: Bundle(for: type(of: self)))
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
view.layer.cornerRadius = 8
view.layer.borderWidth = 1 / UIScreen.main.scale
view.layer.borderColor = UIColor.gray.cgColor
let stackView = UIStackView(arrangedSubviews: [
UIStackView(arrangedSubviews: [
titleLabel,
expireLabel,
]) ※ { v in
v.axis = .horizontal
},
descriptionLabel,
]) ※ { v in
v.axis = .vertical
v.spacing = 4
v.isUserInteractionEnabled = false
}
self.view.addSubview(stackView)
stackView.snp.makeConstraints { snp in
self.paddingConstraint = snp.width.height.equalToSuperview().offset(-16).constraint
snp.centerX.centerY.equalToSuperview()
}
self.input(input)
}
override func loadView() {
let view = UIButton(type: .custom)
view.addTarget(self, action: #selector(self.onTapped), for: .touchUpInside)
self.view = view
}
func input(_ input: Input) {
self.input = input
guard let poll = input.poll else {
self.view.isHidden = true
return
}
self.view.isHidden = false
self.titleLabel.font = UIFont.boldSystemFont(ofSize: CGFloat(Defaults.timelineTextFontsize))
self.expireLabel.font = UIFont.systemFont(ofSize: CGFloat(Defaults.timelineTextFontsize))
self.descriptionLabel.font = UIFont.systemFont(ofSize: CGFloat(Defaults.timelineTextFontsize))
self.paddingConstraint.update(offset: -Defaults.timelineTextFontsize)
var expireLabelComponents = ["\(poll.votes_count)票"]
if poll.expired {
expireLabelComponents.append("締め切り済み")
} else if let expires = poll.expires_at {
let trueRemains = expires.timeIntervalSinceNow
let remains = fabs(trueRemains)
let finished = trueRemains < 0
var remainsString: String
if remains > (24 * 60 * 60 * 1.5) {
remainsString = "\(Int(remains / (24 * 60 * 60)))日"
} else if remains > (60 * 60 * 1.5) {
remainsString = "\(Int(remains / (60 * 60)))時間"
} else if remains > (60 * 1.5) {
remainsString = "\(Int(remains / 60))分"
} else {
if finished {
remainsString = "ちょっと"
} else {
remainsString = "もうすぐ"
}
}
expireLabelComponents.append(finished ? "\(remainsString)前に終わるはずだった" : "あと\(remainsString)ぐらい")
} else {
expireLabelComponents.append("期限不定")
}
expireLabel.text = expireLabelComponents.joined(separator: " / ")
descriptionLabel.text = "\(poll.options.count)択の中から\(poll.multiple ? "複数" : "一個")選択 : \(poll.options.map { $0.title }.joined(separator: " / "))"
}
@objc func onTapped() {
let newVC = MastodonPostDetailViewController.instantiate(self.input, environment: self.environment)
self.navigationController?.pushViewController(newVC, animated: true)
}
}
| [
-1
] |
0b2e22ee3e13b24c580752a755fe08e35d998b90 | b8e42818c8a891de97a6aead7748fa13f33d46ce | /Materials/WeakVars.playground/Contents.swift | c8f0a895a766e1e26d88d45f36acb45be6e8da28 | [] | no_license | brennanMKE/SwiftCurriculum | 3ffc6950b469a582956056a0192bad97b7137ee2 | 4206f070f03bfff5f17e269ef5527858f5764c3c | refs/heads/master | 2021-01-10T12:53:38.563314 | 2016-10-28T15:40:59 | 2016-10-28T15:40:59 | 54,801,947 | 12 | 0 | null | 2016-04-11T14:39:27 | 2016-03-26T22:14:37 | null | UTF-8 | Swift | false | false | 1,230 | swift | // SwiftCurriculum: https://github.com/brennanMKE/SwiftCurriculum
// Blog Post: https://medium.com/swift-curriculum/swift-weak-vars-9aac18751f00
// Swift Version: 3.0
// A weak var allows for preventing circular references which would result in memory leaks.
// Below a person can have a reference to an apartment and an apartment has a tentant
// property referencing a person.
class Person {
let name: String
var apartment: Apartment?
init(name: String) { self.name = name }
deinit { print("\(name) is being deinitialized") }
}
class Apartment {
let number: Int
weak var tenant: Person?
init(number: Int) { self.number = number }
deinit { print("Apartment #\(number) is being deinitialized") }
}
var person: Person? = Person(name: "Tim")
var apartment: Apartment? = Apartment(number: 101)
// set apartment in person to the apartment
person?.apartment = apartment
// set the tenant with the optional value for person
apartment?.tenant = person
// now there are weak references between both variables
// clear person value which is a weak reference in apartment
person = nil
// show that person is now nil because it is a weak var
apartment?.tenant
// clear out apartment
apartment = nil
| [
-1
] |
0ae69f8e12f220f4d85773911409b99db08e53b9 | 333832efad3dd2c356debb554a23209876d8321b | /ppass_ios/TransitionController.swift | 5028587a9ba136881f86e7e88b35669b3bc1cbbc | [] | no_license | hidekiohnuma/passbox | 118363171d3a88a26f46b5c321314686ba15c244 | 2952d17a8a2c033572a988deec949bd6fed57c39 | refs/heads/master | 2021-08-23T20:55:21.640921 | 2017-12-06T14:04:03 | 2017-12-06T14:04:03 | 113,321,595 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 722 | swift | //
// TransitionController.swift
// JASidePanels_Menu_Sample
//
import UIKit
class TransitionController: JASidePanelController {
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func viewDidAppear(animated: Bool) {
}
override func awakeFromNib() {
self.leftPanel = (self.storyboard?.instantiateViewControllerWithIdentifier("MenuViewController"))! as UIViewController
self.centerPanel = (self.storyboard?.instantiateViewControllerWithIdentifier("MapController"))! as UIViewController
}
}
| [
-1
] |
ac2fde3d1d1a503e536e4534a78ae221c22ce4f9 | 6e58655cb6e55f6cd563d87c6e63ccea90b07bdc | /SwiftCalc/SwiftCalc/ViewController.swift | 1219f9a9468f4184c25f9318ede1096326333a9e | [] | no_license | dclguan/ios-decal-hw2 | bb5234cdfc4ad794b09bbc0b81a077033c17f091 | aa16c4920e3dcdcbb9e42590d24a27d57780edab | refs/heads/master | 2020-05-29T08:41:08.747909 | 2016-10-04T02:31:04 | 2016-10-04T02:31:04 | 69,821,362 | 0 | 0 | null | 2016-10-02T20:50:44 | 2016-10-02T20:50:43 | null | UTF-8 | Swift | false | false | 11,874 | swift | //
// ViewController.swift
// SwiftCalc
//
// Created by Zach Zeleznick on 9/20/16.
// Copyright © 2016 zzeleznick. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
// MARK: Width and Height of Screen for Layout
var w: CGFloat!
var h: CGFloat!
// IMPORTANT: Do NOT modify the name or class of resultLabel.
// We will be using the result label to run autograded tests.
// MARK: The label to display our calculations
var resultLabel = UILabel()
// TODO: This looks like a good place to add some data structures.
// One data structure is initialized below for reference.
var currArg = ""
var prevTotalVal = ""
var decimal = false
var prevOp : operators = operators.empty
enum operators : String{
case clear = "C"
case sign = "+/-"
case percent = "%"
case divide = "/"
case multiply = "*"
case subtract = "-"
case add = "+"
case equal = "="
case zero = "0"
case dot = "."
case empty
}
let margin = 1e-10
override func viewDidLoad() {
super.viewDidLoad()
view = UIView(frame: UIScreen.main.bounds)
view.backgroundColor = UIColor(white: 1.0, alpha: 1.0)
w = view.bounds.size.width
h = view.bounds.size.height
navigationItem.title = "Calculator"
// IMPORTANT: Do NOT modify the accessibilityValue of resultLabel.
// We will be using the result label to run autograded tests.
resultLabel.accessibilityValue = "resultLabel"
makeButtons()
// Do any additional setup here.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func updateCurrArg(_ content: String) {
guard currArg.characters.count < 7 else { return }
if (content == operators.zero.rawValue) {
guard currArg != operators.zero.rawValue else { return }
}
if (content == operators.dot.rawValue) {
guard !decimal else { return }
if (currArg == "") {
currArg += "0"
}
decimal = true
}
currArg += content
}
func clearArgs() {
currArg = ""
prevTotalVal = ""
prevOp = operators.empty
decimal = false
resultLabel.text = "0"
}
func flipSign() {
guard Double(currArg) != nil else {
guard Double(prevTotalVal) != nil else { return }
if (prevTotalVal.characters.count >= 7) {
return
}
prevTotalVal = flipSignHelper(input: prevTotalVal)
updateResultLabel(prevTotalVal)
return
}
if (currArg.characters.count >= 7) {
return
}
currArg = flipSignHelper(input: currArg)
updateResultLabel(currArg)
}
func flipSignHelper(input: String) -> String {
let tempConv = Double(input)
var ret : String = ""
if (floor(tempConv!) == tempConv) || (round(tempConv!) == tempConv) {
ret = String(0 - Int(input)!)
} else {
ret = String(0 - Double(input)!)
}
return ret
}
func applyOperation(operation: operators) {
guard Double(currArg) != nil else {
updateResultLabel(prevTotalVal)
prevOp = operation
return
}
guard Double(prevTotalVal) != nil else {
prevTotalVal = currArg
currArg = ""
decimal = false
updateResultLabel(prevTotalVal)
prevOp = operation
return
}
let tempTot = Double(prevTotalVal)
let tempCur = Double(currArg)
let newTot = calculate(a: tempTot!, b: tempCur!, operation: prevOp)
let flooredTot = floor(newTot)
let ceilTot = round(newTot)
if (newTot >= flooredTot - margin && newTot <= flooredTot + margin) {
//if (newTot == flooredTot) {
prevTotalVal = (abs(flooredTot) > 1e7 || abs(flooredTot) < 1e-4)
? flooredTot.scientificStyle : String(Int(flooredTot))
decimal = false
//} else if (newTot == ceilTot) {
} else if(newTot >= ceilTot - margin && newTot <= ceilTot + margin) {
prevTotalVal = (abs(ceilTot) > 1e7 || abs(ceilTot) < 1e-4)
? ceilTot.scientificStyle : String(Int(ceilTot))
decimal = false
} else {
prevTotalVal = (abs(newTot) > 1e7 || abs(newTot) < 1e-4)
? newTot.scientificStyle : String(newTot)
decimal = true
}
prevOp = operation
if (prevOp == operators.equal) {
currArg = prevTotalVal
prevTotalVal = ""
updateResultLabel(currArg)
} else {
currArg = ""
decimal = false
updateResultLabel(prevTotalVal)
}
}
// TODO: Ensure that resultLabel gets updated.
// Modify this one or create your own.
func updateResultLabel(_ content: String) {
if (content.characters.count > 7) {
resultLabel.text = content.substring(to: content.index(content.startIndex, offsetBy: 7))
} else {
resultLabel.text = content
}
}
// TODO: A calculate method with no parameters, scary!
// Modify this one or create your own.
func calculate(a: Double, b:Double, operation: operators) -> Double {
var result : Double = 0.0
switch operation{
case operators.divide:
result = a / b
case operators.multiply:
result = a * b
case operators.subtract:
result = a - b
case operators.add:
result = a + b
default: ()
}
return result
}
// REQUIRED: The responder to a number button being pressed.
func numberPressed(_ sender: CustomButton) {
guard Int(sender.content) != nil else { return }
updateCurrArg(sender.content)
updateResultLabel(currArg)
}
// REQUIRED: The responder to an operator button being pressed.
func operatorPressed(_ sender: CustomButton) {
guard Int(sender.content) == nil else { return }
let arg = sender.content
switch arg{
case operators.clear.rawValue:
clearArgs()
case operators.sign.rawValue:
flipSign()
case operators.percent.rawValue:
()
case operators.divide.rawValue:
applyOperation(operation: operators.divide)
case operators.multiply.rawValue:
applyOperation(operation: operators.multiply)
case operators.subtract.rawValue:
applyOperation(operation: operators.subtract)
case operators.add.rawValue:
applyOperation(operation: operators.add)
case operators.equal.rawValue:
applyOperation(operation: operators.equal)
default: ()
}
}
// REQUIRED: The responder to a number or operator button being pressed.
func buttonPressed(_ sender: CustomButton) {
guard (sender.content == operators.zero.rawValue || sender.content == operators.dot.rawValue) else { return }
let arg = sender.content
switch arg{
case operators.zero.rawValue:
updateCurrArg(arg)
updateResultLabel(currArg)
case operators.dot.rawValue:
updateCurrArg(arg)
updateResultLabel(currArg)
default: ()
}
}
// IMPORTANT: Do NOT change any of the code below.
// We will be using these buttons to run autograded tests.
func makeButtons() {
// MARK: Adds buttons
let digits = (1..<10).map({
return String($0)
})
let operators = ["/", "*", "-", "+", "="]
let others = ["C", "+/-", "%"]
let special = ["0", "."]
let displayContainer = UIView()
view.addUIElement(displayContainer, frame: CGRect(x: 0, y: 0, width: w, height: 160)) { element in
guard let container = element as? UIView else { return }
container.backgroundColor = UIColor.black
}
displayContainer.addUIElement(resultLabel, text: "0", frame: CGRect(x: 70, y: 70, width: w-70, height: 90)) {
element in
guard let label = element as? UILabel else { return }
label.textColor = UIColor.white
label.font = UIFont(name: label.font.fontName, size: 60)
label.textAlignment = NSTextAlignment.right
}
let calcContainer = UIView()
view.addUIElement(calcContainer, frame: CGRect(x: 0, y: 160, width: w, height: h-160)) { element in
guard let container = element as? UIView else { return }
container.backgroundColor = UIColor.black
}
let margin: CGFloat = 1.0
let buttonWidth: CGFloat = w / 4.0
let buttonHeight: CGFloat = 100.0
// MARK: Top Row
for (i, el) in others.enumerated() {
let x = (CGFloat(i%3) + 1.0) * margin + (CGFloat(i%3) * buttonWidth)
let y = (CGFloat(i/3) + 1.0) * margin + (CGFloat(i/3) * buttonHeight)
calcContainer.addUIElement(CustomButton(content: el), text: el,
frame: CGRect(x: x, y: y, width: buttonWidth, height: buttonHeight)) { element in
guard let button = element as? UIButton else { return }
button.addTarget(self, action: #selector(operatorPressed), for: .touchUpInside)
}
}
// MARK: Second Row 3x3
for (i, digit) in digits.enumerated() {
let x = (CGFloat(i%3) + 1.0) * margin + (CGFloat(i%3) * buttonWidth)
let y = (CGFloat(i/3) + 1.0) * margin + (CGFloat(i/3) * buttonHeight)
calcContainer.addUIElement(CustomButton(content: digit), text: digit,
frame: CGRect(x: x, y: y+101.0, width: buttonWidth, height: buttonHeight)) { element in
guard let button = element as? UIButton else { return }
button.addTarget(self, action: #selector(numberPressed), for: .touchUpInside)
}
}
// MARK: Vertical Column of Operators
for (i, el) in operators.enumerated() {
let x = (CGFloat(3) + 1.0) * margin + (CGFloat(3) * buttonWidth)
let y = (CGFloat(i) + 1.0) * margin + (CGFloat(i) * buttonHeight)
calcContainer.addUIElement(CustomButton(content: el), text: el,
frame: CGRect(x: x, y: y, width: buttonWidth, height: buttonHeight)) { element in
guard let button = element as? UIButton else { return }
button.backgroundColor = UIColor.orange
button.setTitleColor(UIColor.white, for: .normal)
button.addTarget(self, action: #selector(operatorPressed), for: .touchUpInside)
}
}
// MARK: Last Row for big 0 and .
for (i, el) in special.enumerated() {
let myWidth = buttonWidth * (CGFloat((i+1)%2) + 1.0) + margin * (CGFloat((i+1)%2))
let x = (CGFloat(2*i) + 1.0) * margin + buttonWidth * (CGFloat(i*2))
calcContainer.addUIElement(CustomButton(content: el), text: el,
frame: CGRect(x: x, y: 405, width: myWidth, height: buttonHeight)) { element in
guard let button = element as? UIButton else { return }
button.addTarget(self, action: #selector(buttonPressed), for: .touchUpInside)
}
}
}
}
| [
-1
] |
464a8d84a175605b01edef8d6b63a6901c2bae90 | 8c7e6b23e3bc22f84287a099c3bc45afc482b8de | /weibo/weibo/Classes/View/Main/WBBaseViewController.swift | e97203874e11e78111fed6d7ee0732c51727e99e | [] | no_license | leoAntu/weibo-swift | 98a5abec35551a23737fb6aaee9fb395436ec418 | 8a417dc520e56665d493eaf62cced1362f1351a2 | refs/heads/master | 2021-08-17T09:15:43.173101 | 2017-11-21T02:42:58 | 2017-11-21T02:42:58 | 108,828,326 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,104 | swift | //
// WBBaseViewController.swift
// weibo
//
// Created by 叮咚钱包富银 on 2017/10/18.
// Copyright © 2017年 叮咚钱包富银. All rights reserved.
//
import UIKit
class WBBaseViewController: UIViewController, UIGestureRecognizerDelegate {
var tableView: UITableView?
/// 刷新控件
var refreshControl: WBRefreshControl?
/// 上拉刷新标记
var isPullup = false
//访客信息
var visitorInfo: [String: String]?
deinit {
NotificationCenter.default.removeObserver(self)
}
override func viewDidLoad() {
super.viewDidLoad()
setUI()
WBNetworkManager.shared.userLogon ? loadData() : ()
NotificationCenter.default.addObserver(self, selector: #selector(loginSuccess), name: NSNotification.Name(rawValue:WBUserLoginSuccessedNotification), object: nil)
}
@objc private func loginSuccess() {
view = nil
NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue:WBUserLoginSuccessedNotification), object: nil)
}
@objc func loadData() {
//子类不重写方法,默认关闭
refreshControl?.endRefreshing()
}
@objc private func loginAction() {
print("登录")
//发送登录通知,要mianViewController执行登录
NotificationCenter.default.post(name: NSNotification.Name(rawValue: WBUserShouldLoginNotification), object: nil)
}
@objc private func registerAction() {
print("注册")
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
if (self.navigationController != nil) && self.navigationController?.viewControllers.count == 1{
navigationController?.interactivePopGestureRecognizer?.isEnabled = false
} else {
weak var weakSelf = self
navigationController?.interactivePopGestureRecognizer?.delegate = weakSelf
navigationController?.interactivePopGestureRecognizer?.isEnabled = true
}
}
func createTableView() {
tableView = UITableView(frame: view.bounds, style: .plain)
tableView?.tableFooterView = UIView()
view.insertSubview(tableView!, belowSubview: (self.navigationController?.navigationBar)!)
//设置滚动条的位置,和tableView对齐
tableView?.scrollIndicatorInsets = (tableView?.contentInset)!
tableView?.delegate = self
tableView?.dataSource = self
refreshControl = WBRefreshControl()
tableView?.addSubview(refreshControl!)
refreshControl?.addTarget(self, action: #selector(loadData), for: .valueChanged)
}
}
extension WBBaseViewController {
private func setUI() {
automaticallyAdjustsScrollViewInsets = false
WBNetworkManager.shared.userLogon ? createTableView() : setVisitorView()
}
private func setVisitorView() {
let visitorView = WBVisitorView(frame: view.bounds)
view.addSubview(visitorView)
visitorView.visitorInfo = visitorInfo
visitorView.loginButton.addTarget(self, action: #selector(loginAction), for: .touchUpInside)
visitorView.registerButton.addTarget(self, action: #selector(registerAction), for: .touchUpInside)
setNoLoginNavBarItems()
}
private func setNoLoginNavBarItems() {
self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登录", target: self, action: #selector(loginAction))
self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注册", target: self, action: #selector(registerAction))
}
}
extension WBBaseViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 10
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 0
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 0;
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
return UITableViewCell()
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 10
}
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
//获取当前row
let row = indexPath.row
//获取最后的section
let section = tableView.numberOfSections - 1
if row < 0 || section < 0 {
return
}
// 获取最后section 中最后的row
let count = tableView.numberOfRows(inSection: section)
//如果是最后一个cell 就下拉刷新
if row == (count - 1) && !isPullup {
print("上拉刷新")
isPullup = true
loadData()
}
}
}
| [
-1
] |
1f4e06f0129bd32f8c169c0d43da35f5128a3431 | a43e7d25636d2098574ec71f52e38f79705d44cb | /Example/BlockDataSource/AppDelegate.swift | 7b3c163ed6976029f6f97be6bfccc4fe97affebf | [
"MIT"
] | permissive | JosephLin/BlockDataSource | 6fbe80dab6776ad6cbcf10447e884eabe2211abe | ad47938676854d4d9841a31705a0b4a27026fff3 | refs/heads/master | 2021-01-11T12:16:22.187985 | 2016-12-13T03:31:34 | 2016-12-13T03:31:34 | 76,495,770 | 0 | 0 | null | 2016-12-14T20:45:52 | 2016-12-14T20:45:52 | null | UTF-8 | Swift | false | false | 3,822 | swift | // The MIT License (MIT)
//
// Copyright (c) 2016 Adam Cumiskey
//
// 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.
//
//
// AppDelegate.swift
// BlockDataSource
//
// Created by Adam Cumiskey on 06/29/2016.
// Copyright (c) 2016 Adam Cumiskey. All rights reserved.
//
import UIKit
import BlockDataSource
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
if window == nil {
window = UIWindow(frame: UIScreen.main.bounds)
let mainVC = MainViewController(style: .grouped)
mainVC.title = "Menu"
let navVC = UINavigationController(rootViewController: mainVC)
navVC.view.frame = window!.bounds
window!.rootViewController = navVC
window!.makeKeyAndVisible()
}
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:.
}
}
| [
299681,
237669,
203976,
297616,
297617,
210769,
210771,
173365,
410517,
190839,
173369,
169823
] |
3d06feb7db239b899af77b4b5fe7e847fc774b1c | d65a178368efc61267ab1e8a433521241c7b3e58 | /Orbit/WriteViewController.swift | 581d9780e754cf4ab46912f56749e1c37b0add62 | [] | no_license | toffler00/DotNote | d6589d6448cd09d7d345cf4e43c4994447a449e2 | aaf2aacf0f584e4bed3effe6d047123bd8653f44 | refs/heads/master | 2020-06-25T23:16:26.283731 | 2019-07-29T12:46:41 | 2019-07-29T12:46:41 | 199,450,969 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 50,732 | swift | //
// WriteViewController.swift
// Orbit
//
// Created by David Koo on 25/08/2018.
// Copyright © 2018 orbit. All rights reserved.
//
import UIKit
import CoreLocation
import RealmSwift
import RSKImageCropper
protocol WriteDoneDelegate: class {
func writeDone()
}
class WriteViewController: UIViewController {
let appDelegate = UIApplication.shared.delegate as! AppDelegate
var isImageLoadingFromiCloud: Bool = false
fileprivate var keyboardShown = false
var contentsTextViewCGRect : CGRect!
//MARK: Ream Property
var realm = try! Realm()
var settingData : Results<Settings>!
//Delegate
weak var writeDoneDelegate: WriteDoneDelegate!
fileprivate var date : UILabel!
fileprivate var titleLabel : UILabel!
fileprivate var contentTitle: UITextField!
var dayOfWeek: UILabel!
var weather: UILabel!
var contentsAlignment : String = "left"
// fileprivate var weatherImg : UIImageView!
fileprivate var writeDoneIcon : UIImageView!
fileprivate var dateTF : CustomTextFiled!
fileprivate var weatherTF : CustomTextFiled!
var selectedDate : Date!
fileprivate var createAtMonth : String!
var containerV : UIView!
fileprivate var contStackV : UIStackView!
fileprivate var stackBox : UIStackView!
fileprivate var tapWeather : UIImageView!
fileprivate var tapDate : UIImageView!
var contentImgV : UIImageView!
fileprivate var cameraIconImgView : UIImageView!
fileprivate var iconBgView : UIView!
fileprivate var contents : UITextView!
// fileprivate var models : [Model.Contents] = [Model.Contents]()
var selectedImageData: Data?
fileprivate var datePicker : UIDatePicker!
fileprivate var weatherPicker : UIPickerView!
let pickerData : [String] = [ "맑음", "천둥번개", "이슬비", "비","눈","눈,비","진눈깨비", "안개", "구름", "구름조금"]
var backButton : UIImageView = UIImageView()
var weatherItem : Int = 0
fileprivate var type : String = "diary"
init(nibName nibNameOrNil: String? = nil, bundle nibBundleOrNil: Bundle? = nil, delegate: WriteDoneDelegate) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
self.writeDoneDelegate = delegate
view.backgroundColor = .white
}
//MARK: LifeCycle
override func viewWillAppear(_ animated: Bool) {
registerForKeyboardNotification()
regitsterForTextViewNotification()
setUpWriteDoneIcon(bool: true)
setNavigationBackButton(onView: self, in: backButton, bool: true)
}
override func viewDidAppear(_ animated: Bool) {
// setNavigationBackButton(onView: self, in: backButton, bool: true)
}
override func viewWillDisappear(_ animated: Bool) {
unregisterForKeyboardNotification()
unregisterForTextViewTextNotification()
setUpWriteDoneIcon(bool: false)
setNavigationBackButton(onView: self, in: backButton, bool: false)
}
override func viewDidDisappear(_ animated: Bool) {
}
override func viewDidLoad() {
super.viewDidLoad()
let realmManager = RealmManager.shared.realm
settingData = realmManager.objects(Settings.self)
self.navigationController?.navigationBar.barTintColor = UIColor(red: 1, green: 1, blue: 240/255, alpha: 1)
self.navigationController?.navigationBar.prefersLargeTitles = true
self.navigationItem.largeTitleDisplayMode = .always
self.navigationItem.title = "일기"
self.navigationItem.hidesBackButton = true
self.view.backgroundColor = UIColor(red: 1, green: 1, blue: 240/255, alpha: 1)
}
override func viewWillLayoutSubviews() {
if containerV == nil {
setupLayout()
setInformation(in: selectedDate)
applySetting()
}
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func applySetting() {
let settingData = self.settingData[0]
let contentsFont = settingData.contentsFont
let contentsFontSize = CGFloat(settingData.contentsFontSize)
contents.font = UIFont(name: contentsFont, size: contentsFontSize)
}
func setInformation(in todayDate : Date) {
// selectedDate = stringToDate(in: todayDate, dateFormat: "dd MMM yyyy hh mm")
dayOfWeek.text = getWeekDay(in: selectedDate, dateFormat: "EEEE")
date.text = dateToString(in: selectedDate, dateFormat: "dd MMM yyyy")
createAtMonth = dateToString(in: selectedDate, dateFormat: "MMM yyyy")
let weatherID = getWeatherID()
setWeather(id: weatherID)
}
private func getWeatherID() -> Int {
let selectDate = dateToString(in: self.selectedDate, dateFormat: "yyyyMMdd")
let today = getDate(dateFormat: "yyyyMMdd")
if selectDate == today {
return self.weatherItem
} else {
return 0
}
}
func setWeather(id : Int) {
switch id {
case 200...299:
weather.text = "천둥번개"
case 300...399:
weather.text = "이슬비"
case 500...599:
weather.text = "비"
case 600, 601, 602, 620, 621, 622 :
weather.text = "눈"
case 611, 612:
weather.text = "진눈깨비"
case 615, 616:
weather.text = "눈,비"
case 700...799:
weather.text = "안개"
case 800:
weather.text = "맑음"
case 801, 802:
weather.text = "구름"
case 803, 804:
weather.text = "구름조금"
default:
weather.text = "날씨를 선택하세요"
}
}
}
//MARK: writeDone Post
extension WriteViewController {
@objc func writeDone() {
if contentTitle.text == "" {
showAlert(title: "경 고", message: "제목이 빈칸이네요 \n 제목을 적어주세요.",
cancelBtn: true, buttonTitle: "확인", onView: self, completion: nil)
} else {
if contents.text == "" || contents.text == "글을 입력하세요" {
showAlert(title: "경 고", message: "작성한 내용이 없습니다. \n 이대로 저장할까요?",
cancelBtn: true, buttonTitle: "확인", onView: self) { (action) in
self.contents.text = " "
let data = Content(type: self.type,
createdAt: self.selectedDate,
createdAtMonth : self.createAtMonth ,
title: self.contentTitle.text!,
weather: self.weather.text!,
body: self.contents.text!,
contentsAlignment: self.contentsAlignment,
image: self.selectedImageData)
RealmManager.shared.creat(object: data)
self.writeDoneDelegate.writeDone()
self.navigationController?.popViewController(animated: true)
}
} else {
let data = Content(type : self.type, createdAt: self.selectedDate,
createdAtMonth : self.createAtMonth ,title: self.contentTitle.text!,
weather: self.weather.text!, body: self.contents.text!,
contentsAlignment: self.contentsAlignment,image: self.selectedImageData)
RealmManager.shared.creat(object: data)
self.writeDoneDelegate.writeDone()
self.navigationController?.popViewController(animated: true)
}
}
}
func getWeekDay() {
let today = Date()
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "EEEE"
dateFormatter.locale = Locale(identifier: "kr_KR")
let weekDay = dateFormatter.string(from: today).capitalized
self.dayOfWeek.text = weekDay
}
}
//MARK: Setup Layout
extension WriteViewController {
fileprivate func setupLayout() {
// containerV UIView
log.debug("setup Layout")
self.view.backgroundColor = UIColor(red: 1, green: 1, blue: 240/255, alpha: 1)
containerV = UIView()
containerV.translatesAutoresizingMaskIntoConstraints = false
let const : [NSLayoutConstraint] = [NSLayoutConstraint(item: containerV, attribute: .top, relatedBy: .equal,
toItem:self.view.safeAreaLayoutGuide,attribute: .top, multiplier: 1, constant: 8),
NSLayoutConstraint(item: containerV, attribute: .bottom, relatedBy: .equal,
toItem: self.view.safeAreaLayoutGuide,attribute: .bottom, multiplier: 1, constant: -8),
NSLayoutConstraint(item: containerV, attribute: .leading, relatedBy: .equal,
toItem: self.view.safeAreaLayoutGuide,attribute: .leading, multiplier: 1, constant: 8),
NSLayoutConstraint(item: containerV, attribute: .trailing, relatedBy: .equal,
toItem: self.view.safeAreaLayoutGuide,attribute: .trailing, multiplier: 1, constant: -8)]
self.view.addSubview(containerV)
self.view.addConstraints(const)
containerV.backgroundColor = .clear
// dayofWeek Label
dayOfWeek = UILabel()
dayOfWeek.translatesAutoresizingMaskIntoConstraints = false
let constWeek : [NSLayoutConstraint] = [
NSLayoutConstraint(item: dayOfWeek, attribute: .top, relatedBy: .equal, toItem: containerV,
attribute: .top, multiplier: 1, constant: 8),
NSLayoutConstraint(item: dayOfWeek, attribute: .leading, relatedBy: .equal, toItem: containerV,
attribute: .leading, multiplier: 1, constant: 8),
NSLayoutConstraint(item: dayOfWeek, attribute: .height, relatedBy: .equal, toItem: nil,
attribute: .height, multiplier: 1, constant: 30),
NSLayoutConstraint(item: dayOfWeek, attribute: .width, relatedBy: .equal, toItem: containerV,
attribute: .width, multiplier: 0.4, constant: 0)]
containerV.addSubview(dayOfWeek)
containerV.addConstraints(constWeek)
dayOfWeek.numberOfLines = 1
dayOfWeek.font = setFont(type: .contents, onView: self, font: "NanumBarunGothicBold", size: 24)
dayOfWeek.textAlignment = NSTextAlignment.left
dayOfWeek.backgroundColor = .clear
//MARK: date Label
date = UILabel()
date.translatesAutoresizingMaskIntoConstraints = false
let constDate : [NSLayoutConstraint] = [
NSLayoutConstraint(item: date, attribute: .top, relatedBy: .equal, toItem: dayOfWeek, attribute: .bottom,
multiplier: 1, constant: 1),
NSLayoutConstraint(item: date, attribute: .leading, relatedBy: .equal, toItem: dayOfWeek, attribute: .leading,
multiplier: 1, constant: 0),
NSLayoutConstraint(item: date, attribute: .trailing, relatedBy: .equal, toItem: dayOfWeek, attribute: .trailing,
multiplier: 1, constant: 0),
NSLayoutConstraint(item: date, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .height,
multiplier: 1,constant: 24),
NSLayoutConstraint(item: date, attribute: .width, relatedBy: .equal, toItem: containerV, attribute: .width,
multiplier: 0.4, constant: 0)]
containerV.addSubview(date)
containerV.addConstraints(constDate)
date.numberOfLines = 1
date.adjustsFontForContentSizeCategory = true
date.adjustsFontSizeToFitWidth = true
date.font = setFont(type: .date, onView: self, font: "NanumBarunGothic", size: 16)
date.textAlignment = NSTextAlignment.left
date.backgroundColor = .clear
//dateTF textfield
dateTF = CustomTextFiled()
dateTF.translatesAutoresizingMaskIntoConstraints = false
let constDateTF : [NSLayoutConstraint] = [
NSLayoutConstraint(item: dateTF, attribute: .top, relatedBy: .equal, toItem: date, attribute: .top,
multiplier: 1, constant: 1),
NSLayoutConstraint(item: dateTF, attribute: .leading, relatedBy: .equal, toItem: date, attribute: .leading,
multiplier: 1, constant: 0),
NSLayoutConstraint(item: dateTF, attribute: .trailing, relatedBy: .equal, toItem: date, attribute: .trailing,
multiplier: 1, constant: 20),
NSLayoutConstraint(item: dateTF, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .height,
multiplier: 1,constant: 24)]
containerV.addSubview(dateTF)
containerV.addConstraints(constDateTF)
dateTF.backgroundColor = .clear
dateTF.isUserInteractionEnabled = true
let changeDateGestureRecognizer = UITapGestureRecognizer(target: self,
action: #selector(touchUpInsideDateLabel(sender:)))
dateTF.addGestureRecognizer(changeDateGestureRecognizer)
dateTF.allowsEditingTextAttributes = false
// weather Label
weather = UILabel()
weather.translatesAutoresizingMaskIntoConstraints = false
let constWeather : [NSLayoutConstraint] = [
NSLayoutConstraint(item: weather, attribute: .top, relatedBy: .equal, toItem: date,
attribute: .bottom, multiplier: 1, constant: 1),
NSLayoutConstraint(item: weather, attribute: .leading, relatedBy: .equal, toItem: date,
attribute: .leading, multiplier: 1, constant: 0),
NSLayoutConstraint(item: weather, attribute: .height, relatedBy: .equal, toItem: nil,
attribute: .height, multiplier: 1, constant: 20),
NSLayoutConstraint(item: weather, attribute: .width, relatedBy: .equal, toItem: date,
attribute: .width, multiplier: 1, constant: 0)]
containerV.addSubview(weather)
containerV.addConstraints(constWeather)
weather.font = setFont(type: .weather, onView: self, font: "NanumBarunGothic", size: 16)
weather.numberOfLines = 1
weather.textAlignment = NSTextAlignment.left
weather.backgroundColor = .clear
weatherTF = CustomTextFiled()
weatherTF.translatesAutoresizingMaskIntoConstraints = false
let constWeatherTF : [NSLayoutConstraint] = [
NSLayoutConstraint(item: weatherTF, attribute: .top, relatedBy: .equal, toItem: weather,
attribute: .top, multiplier: 1, constant: 0),
NSLayoutConstraint(item: weatherTF, attribute: .leading, relatedBy: .equal, toItem: weather,
attribute: .leading, multiplier: 1, constant: 0),
NSLayoutConstraint(item: weatherTF, attribute: .height, relatedBy: .equal, toItem: nil,
attribute: .height, multiplier: 1, constant: 20),
NSLayoutConstraint(item: weatherTF, attribute: .trailing, relatedBy: .equal, toItem: weather,
attribute: .trailing, multiplier: 1, constant: 20)]
containerV.addSubview(weatherTF)
containerV.addConstraints(constWeatherTF)
weatherTF.allowsEditingTextAttributes = false
let changeWeatherGesture = UITapGestureRecognizer(target: self, action: #selector(weatherTextFieldReconiger))
weatherTF.isUserInteractionEnabled = true
weatherTF.addGestureRecognizer(changeWeatherGesture)
// tapDate UIImageView
tapDate = UIImageView()
tapDate.translatesAutoresizingMaskIntoConstraints = false
let constTapDate : [NSLayoutConstraint] = [
NSLayoutConstraint(item: tapDate, attribute: .top, relatedBy: .equal, toItem: date,
attribute: .top, multiplier: 1, constant: 4),
NSLayoutConstraint(item: tapDate, attribute: .bottom, relatedBy: .equal, toItem: date,
attribute: .bottom, multiplier: 1, constant: -4),
NSLayoutConstraint(item: tapDate, attribute: .leading, relatedBy: .equal, toItem: date,
attribute: .trailing, multiplier: 1, constant: 0),
NSLayoutConstraint(item: tapDate, attribute: .width, relatedBy: .equal, toItem: nil,
attribute: .width, multiplier: 1, constant: 16)]
containerV.addSubview(tapDate)
containerV.addConstraints(constTapDate)
tapDate.image = UIImage(named: "right")
//tapWeather UIImageView
tapWeather = UIImageView()
tapWeather.translatesAutoresizingMaskIntoConstraints = false
let constTapWeather : [NSLayoutConstraint] = [
NSLayoutConstraint(item: tapWeather, attribute: .top, relatedBy: .equal, toItem: weather,
attribute: .top, multiplier: 1, constant: 2),
NSLayoutConstraint(item: tapWeather, attribute: .bottom, relatedBy: .equal, toItem: weather,
attribute: .bottom, multiplier: 1, constant: -2),
NSLayoutConstraint(item: tapWeather, attribute: .leading, relatedBy: .equal, toItem: weather,
attribute: .trailing, multiplier: 1, constant: 0),
NSLayoutConstraint(item: tapWeather, attribute: .width, relatedBy: .equal, toItem: nil,
attribute: .width, multiplier: 1, constant: 16)]
containerV.addSubview(tapWeather)
containerV.addConstraints(constTapWeather)
tapWeather.image = UIImage(named: "right")
// contStackV UIStackView
contStackV = UIStackView()
contStackV.translatesAutoresizingMaskIntoConstraints = false
let constStackV : [NSLayoutConstraint] = [
NSLayoutConstraint(item: contStackV, attribute: .top, relatedBy: .equal, toItem: weather, attribute: .bottom,
multiplier: 1, constant: 0),
NSLayoutConstraint(item: contStackV, attribute: .bottom, relatedBy: .equal, toItem: containerV, attribute: .bottom,
multiplier: 1, constant: -8),
NSLayoutConstraint(item: contStackV, attribute: .leading, relatedBy: .equal, toItem: containerV, attribute: .leading,
multiplier: 1, constant: 8),
NSLayoutConstraint(item: contStackV, attribute: .trailing, relatedBy: .equal, toItem: containerV, attribute: .trailing,
multiplier: 1, constant: -8)]
containerV.addSubview(contStackV)
containerV.addConstraints(constStackV)
//stackBox UIStackView
stackBox = UIStackView()
stackBox.translatesAutoresizingMaskIntoConstraints = false
let constStackBox : [NSLayoutConstraint] = [
NSLayoutConstraint(item: stackBox, attribute: .top, relatedBy: .equal, toItem: contStackV, attribute: .top,
multiplier: 1, constant: 0),
NSLayoutConstraint(item: stackBox, attribute: .leading, relatedBy: .equal, toItem: contStackV, attribute: .leading,
multiplier: 1, constant: 0),
NSLayoutConstraint(item: stackBox, attribute: .trailing, relatedBy: .equal, toItem: contStackV, attribute: .trailing,
multiplier: 1, constant: 0),
NSLayoutConstraint(item: stackBox, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .height,
multiplier: 1, constant: 38)]
contStackV.addSubview(stackBox)
contStackV.addConstraints(constStackBox)
stackBox.distribution = .fill
stackBox.spacing = 1
//iconBgView
iconBgView = UIView()
iconBgView.translatesAutoresizingMaskIntoConstraints = false
let constIconBgView : [NSLayoutConstraint] = [
NSLayoutConstraint(item: iconBgView, attribute: .width, relatedBy: .equal, toItem: nil, attribute: .width,
multiplier: 1, constant:72),
NSLayoutConstraint(item: iconBgView, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .height,
multiplier: 1, constant: 72),
NSLayoutConstraint(item: iconBgView, attribute: .trailing, relatedBy: .equal, toItem: stackBox, attribute: .trailing,
multiplier: 1, constant: 0)]
stackBox.addSubview(iconBgView)
stackBox.addConstraints(constIconBgView)
//contentImgV UIImageView
contentImgV = UIImageView()
contentImgV.translatesAutoresizingMaskIntoConstraints = false
let constImgV : [NSLayoutConstraint] = [
NSLayoutConstraint(item: contentImgV, attribute: .top, relatedBy: .equal, toItem: dayOfWeek, attribute: .top,
multiplier: 1, constant:0),
NSLayoutConstraint(item: contentImgV, attribute: .leading, relatedBy: .equal, toItem: containerV, attribute: .trailing,
multiplier: 1, constant: containerV.frame.size.width / 3 + 8),
NSLayoutConstraint(item: contentImgV, attribute: .width, relatedBy: .equal, toItem: containerV, attribute: .width,
multiplier: 0.25, constant: 0),
NSLayoutConstraint(item: contentImgV, attribute: .height, relatedBy: .equal, toItem: contentImgV, attribute: .width,
multiplier: 0.75, constant: 0)]
containerV.addSubview(self.contentImgV)
containerV.addConstraints(constImgV)
contentImgV.layer.cornerRadius = 16
contentImgV.layer.maskedCorners = [CACornerMask.layerMinXMinYCorner, CACornerMask.layerMinXMaxYCorner]
contentImgV.layer.borderWidth = 0.5
contentImgV.layer.borderColor = UIColor.black.cgColor
contentImgV.clipsToBounds = true
contentImgV.backgroundColor = .clear
//titleLabel
// titleLabel = UILabel()
// titleLabel.translatesAutoresizingMaskIntoConstraints = false
// let constTitleLB : [NSLayoutConstraint] = [
// NSLayoutConstraint(item: titleLabel, attribute: .top, relatedBy: .equal, toItem: stackBox, attribute: .top,
// multiplier: 1, constant: 0),
// NSLayoutConstraint(item: titleLabel, attribute: .height, relatedBy: .equal, toItem: stackBox, attribute: .height,
// multiplier: 0.5, constant: 0),
// NSLayoutConstraint(item: titleLabel, attribute: .leading, relatedBy: .equal, toItem: stackBox, attribute: .leading,
// multiplier: 1, constant: 0),
// NSLayoutConstraint(item: titleLabel, attribute: .trailing, relatedBy: .equal, toItem: iconBgView, attribute: .leading,
// multiplier: 1, constant: 0)]
//
// stackBox.addSubview(titleLabel)
// stackBox.addConstraints(constTitleLB)
// titleLabel.font = setFont(type: .contents, onView: self, font: "NanumBarunGothicBold", size: 20)
// titleLabel.text = "Today Title"
// titleLabel.backgroundColor = .clear
//MARK: contentTitle Label
contentTitle = UITextField()
contentTitle.translatesAutoresizingMaskIntoConstraints = false
let constTitle : [NSLayoutConstraint] = [
NSLayoutConstraint(item: contentTitle, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .height,
multiplier: 1, constant: 30),
NSLayoutConstraint(item: contentTitle, attribute: .top, relatedBy: .equal, toItem: stackBox, attribute: .top,
multiplier: 1, constant: 8),
NSLayoutConstraint(item: contentTitle, attribute: .leading, relatedBy: .equal, toItem: stackBox, attribute: .leading,
multiplier: 1, constant: 0),
NSLayoutConstraint(item: contentTitle, attribute: .trailing, relatedBy: .equal, toItem: stackBox, attribute: .trailing,
multiplier: 1, constant: -72)]
stackBox.addSubview(contentTitle)
stackBox.addConstraints(constTitle)
contentTitle.attributedPlaceholder = NSAttributedString(string: " 제목을 쓰윽쓰윽",
attributes: [NSAttributedString.Key.foregroundColor :
UIColor(red: 208/255, green: 207/255, blue: 208/255, alpha: 1)])
contentTitle.backgroundColor = UIColor(red: 246/255, green: 252/255, blue: 226/255, alpha: 1)
contentTitle.font = setFont(type: .contents, onView: self, font: "NanumBarunGothic", size: 14)
contentTitle.tintColor = .gray
let titleGesture = UITapGestureRecognizer(target: self, action: #selector(addToolBarToTextFieldKeyboard))
contentTitle.addGestureRecognizer(titleGesture)
contentTitle.isUserInteractionEnabled = true
//cameraIconImgView UIImageView
cameraIconImgView = UIImageView()
cameraIconImgView.translatesAutoresizingMaskIntoConstraints = false
let constCameraIconImg : [NSLayoutConstraint] = [
NSLayoutConstraint(item: cameraIconImgView, attribute: .centerY, relatedBy: .equal, toItem: contentTitle,
attribute: .centerY, multiplier: 1, constant: 0),
NSLayoutConstraint(item: cameraIconImgView, attribute: .leading, relatedBy: .equal, toItem: contentTitle,
attribute: .trailing, multiplier: 1, constant: 24),
NSLayoutConstraint(item: cameraIconImgView, attribute: .width, relatedBy: .equal, toItem: nil,
attribute: .width, multiplier: 1, constant: 25),
NSLayoutConstraint(item: cameraIconImgView, attribute: .height, relatedBy: .equal, toItem: nil,
attribute: .height, multiplier: 1, constant: 25)]
stackBox.addSubview(cameraIconImgView)
stackBox.addConstraints(constCameraIconImg)
cameraIconImgView.contentMode = .scaleAspectFit
// cameraIconImgView.layer.cornerRadius = 9
// cameraIconImgView.clipsToBounds = true
cameraIconImgView.backgroundColor = .clear
cameraIconImgView.image = UIImage(named: "camera")
cameraIconImgView.isUserInteractionEnabled = true
let addImageGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(addImageGesture))
cameraIconImgView.addGestureRecognizer(addImageGestureRecognizer)
//contents UITextView
contents = UITextView()
contents.translatesAutoresizingMaskIntoConstraints = false
let constContens : [NSLayoutConstraint] = [
NSLayoutConstraint(item: contents, attribute: .top, relatedBy: .equal, toItem: stackBox, attribute: .bottom,
multiplier: 1, constant: 4),
NSLayoutConstraint(item: contents, attribute: .leading, relatedBy: .equal, toItem: contStackV, attribute: .leading,
multiplier: 1, constant: 0),
NSLayoutConstraint(item: contents, attribute: .trailing, relatedBy: .equal, toItem: contStackV, attribute: .trailing,
multiplier: 1, constant: 0),
NSLayoutConstraint(item: contents, attribute: .bottom, relatedBy: .equal, toItem: contStackV, attribute: .bottom,
multiplier: 1, constant: 0)]
contStackV.addSubview(contents)
contStackV.addConstraints(constContens)
contents.backgroundColor = UIColor(red: 246/255, green: 252/255, blue: 226/255, alpha: 1)
contents.isScrollEnabled = true
// contents.font = setFont(type: .contents, onView: self, font: "NanumBarunGothic", size: 16)
let spacing = NSMutableParagraphStyle()
spacing.lineSpacing = 6
contents.text = "글을 입력하세요"
contents.tintColor = .gray
contents.textColor = UIColor(red: 208/255, green: 207/255, blue: 208/255, alpha: 1)
let contentsGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(contentsTextViewReconiger(sender:)))
contents.isUserInteractionEnabled = true
contents.addGestureRecognizer(contentsGestureRecognizer)
}
func setUpWriteDoneIcon(bool : Bool) {
if bool {
//MARK: writeDoneIcon UIImageView
writeDoneIcon = UIImageView()
writeDoneIcon.translatesAutoresizingMaskIntoConstraints = false
let constWrtieDoneIcon : [NSLayoutConstraint] = [
NSLayoutConstraint(item: writeDoneIcon, attribute: .width, relatedBy: .equal, toItem: nil,
attribute: .width, multiplier: 1, constant: 25),
NSLayoutConstraint(item: writeDoneIcon, attribute: .height, relatedBy: .equal, toItem: nil,
attribute: .height, multiplier: 1, constant: 25),
NSLayoutConstraint(item: writeDoneIcon, attribute: .trailing, relatedBy: .equal, toItem: self.navigationController?.navigationBar, attribute: .trailing, multiplier: 1, constant: -12),
NSLayoutConstraint(item: writeDoneIcon, attribute: .bottom, relatedBy: .equal, toItem: self.navigationController?.navigationBar, attribute: .bottom, multiplier: 1, constant: -10)]
navigationController?.navigationBar.addSubview(writeDoneIcon)
navigationController?.navigationBar.addConstraints(constWrtieDoneIcon)
writeDoneIcon.image = UIImage(named: "checked")
writeDoneIcon.layer.cornerRadius = 12
writeDoneIcon.clipsToBounds = true
let tapWriteDonIcon = UITapGestureRecognizer(target: self, action: #selector(writeDone))
writeDoneIcon.addGestureRecognizer(tapWriteDonIcon)
writeDoneIcon.isUserInteractionEnabled = true
} else {
writeDoneIcon.isHidden = true
}
}
}
extension WriteViewController : UIPickerViewDelegate, UIPickerViewDataSource {
@objc fileprivate func addToolBarToTextFieldKeyboard(){
let width = self.view.frame.size.width
let toolBar = UIToolbar()
toolBar.frame = CGRect(x: 0, y: 0, width: width, height: 44)
toolBar.tintColor = .white
toolBar.backgroundColor = UIColor(red: 246/255, green: 252/255, blue: 226/255, alpha: 1)
toolBar.barStyle = .default
let flexibleBtn = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: self, action: nil)
let flexibleLabel = UILabel()
flexibleLabel.frame = CGRect(x: 0, y: 0, width: width / 3, height: 36)
flexibleLabel.backgroundColor = .clear
let downArrow = makeKeyboarkHideBtn()
let keyboardHideBtn = UIBarButtonItem(customView: downArrow)
let flexibleLabelBtn = UIBarButtonItem(customView: flexibleLabel)
toolBar.items = [flexibleLabelBtn,flexibleBtn,flexibleLabelBtn,flexibleBtn,keyboardHideBtn]
let items = toolBar.items
toolBar.setItems(items, animated: true)
toolBar.isTranslucent = true
contentTitle.inputAccessoryView = toolBar
contentTitle.becomeFirstResponder()
}
@objc func contentsTextViewReconiger(sender : UITextView) {
let width = self.view.frame.size.width
let toolBar = UIToolbar()
toolBar.frame = CGRect(x: 0, y: 0, width: width, height: 44)
toolBar.tintColor = .white
toolBar.backgroundColor = UIColor(red: 246/255, green: 252/255, blue: 226/255, alpha: 1)
toolBar.barStyle = .default
let flexibleBtn = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: self, action: nil)
let flexibleLabel = UILabel()
flexibleLabel.frame = CGRect(x: 0, y: 0, width: width / 3, height: 36)
flexibleLabel.backgroundColor = .clear
let downArrow = makeKeyboarkHideBtn()
let keboardHideBtn = UIBarButtonItem(customView: downArrow)
let flexibleLB = UIBarButtonItem(customView: flexibleLabel)
let container = makeAlignView()
let alignView = UIBarButtonItem(customView: container)
toolBar.items = [alignView,flexibleBtn,flexibleLB,flexibleBtn,keboardHideBtn]
let items = toolBar.items
toolBar.sizeToFit()
toolBar.setItems(items, animated: true)
toolBar.isTranslucent = true
contents.inputAccessoryView = toolBar
contents.becomeFirstResponder()
}
fileprivate func makeAlignView() -> UIView{
let viewBox = UIView()
let rightAlignment = UIImageView()
let leftAlignment = UIImageView()
let centerAlignment = UIImageView()
viewBox.addSubview(leftAlignment)
viewBox.addSubview(centerAlignment)
viewBox.addSubview(rightAlignment)
leftAlignment.translatesAutoresizingMaskIntoConstraints = false
centerAlignment.translatesAutoresizingMaskIntoConstraints = false
rightAlignment.translatesAutoresizingMaskIntoConstraints = false
viewBox.translatesAutoresizingMaskIntoConstraints = false
viewBox.widthAnchor.constraint(equalToConstant: 112).isActive = true
viewBox.heightAnchor.constraint(equalToConstant: 26).isActive = true
viewBox.backgroundColor = .clear
leftAlignment.leadingAnchor.constraint(equalTo: viewBox.leadingAnchor, constant: 0).isActive = true
leftAlignment.topAnchor.constraint(equalTo: viewBox.topAnchor, constant: 0).isActive = true
leftAlignment.bottomAnchor.constraint(equalTo: viewBox.bottomAnchor, constant: 0).isActive = true
leftAlignment.widthAnchor.constraint(equalToConstant: 26).isActive = true
leftAlignment.image = UIImage(named: "left-align")
leftAlignment.contentMode = .scaleAspectFit
let leftAlignGestureReconizer = UITapGestureRecognizer(target: self, action: #selector(leftTextAlignment))
leftAlignment.addGestureRecognizer(leftAlignGestureReconizer)
leftAlignment.isUserInteractionEnabled = true
centerAlignment.leadingAnchor.constraint(equalTo: leftAlignment.trailingAnchor, constant: 20).isActive = true
centerAlignment.topAnchor.constraint(equalTo: viewBox.topAnchor, constant: 0).isActive = true
centerAlignment.bottomAnchor.constraint(equalTo: viewBox.bottomAnchor, constant: 0).isActive = true
centerAlignment.widthAnchor.constraint(equalToConstant: 26).isActive = true
centerAlignment.image = UIImage(named: "center-align")
centerAlignment.contentMode = .scaleAspectFit
let centerAlignGestureReconizer = UITapGestureRecognizer(target: self, action: #selector(centerTextAlignment))
centerAlignment.addGestureRecognizer(centerAlignGestureReconizer)
centerAlignment.isUserInteractionEnabled = true
rightAlignment.leadingAnchor.constraint(equalTo: centerAlignment.trailingAnchor, constant: 20).isActive = true
rightAlignment.topAnchor.constraint(equalTo: viewBox.topAnchor, constant: 0).isActive = true
rightAlignment.bottomAnchor.constraint(equalTo: viewBox.bottomAnchor, constant: 0).isActive = true
rightAlignment.widthAnchor.constraint(equalToConstant: 26).isActive = true
rightAlignment.image = UIImage(named: "right-align")
rightAlignment.contentMode = .scaleAspectFit
let rightAlignGestureReconizer = UITapGestureRecognizer(target: self, action: #selector(rightTextAlignment))
rightAlignment.addGestureRecognizer(rightAlignGestureReconizer)
rightAlignment.isUserInteractionEnabled = true
return viewBox
}
fileprivate func makeKeyboarkHideBtn() -> UIView {
let containerView = UIView()
let downArrow = UIImageView()
containerView.addSubview(downArrow)
containerView.translatesAutoresizingMaskIntoConstraints = false
downArrow.translatesAutoresizingMaskIntoConstraints = false
containerView.widthAnchor.constraint(equalToConstant: 36).isActive = true
containerView.heightAnchor.constraint(equalToConstant: 36).isActive = true
downArrow.topAnchor.constraint(equalTo: containerView.topAnchor, constant: 8).isActive = true
downArrow.leadingAnchor.constraint(equalTo: containerView.leadingAnchor, constant: 8).isActive = true
downArrow.trailingAnchor.constraint(equalTo: containerView.trailingAnchor, constant: -8).isActive = true
downArrow.bottomAnchor.constraint(equalTo: containerView.bottomAnchor, constant: -8).isActive = true
downArrow.image = UIImage(named: "downarrow")
downArrow.contentMode = .scaleAspectFit
let downArrowGestureReconizer = UITapGestureRecognizer(target: self, action: #selector(keyboardHide))
containerView.addGestureRecognizer(downArrowGestureReconizer)
containerView.isUserInteractionEnabled = true
return containerView
}
@objc fileprivate func keyboardHide() {
if keyboardShown == true {
view.endEditing(true)
keyboardShown = false
}
}
@objc func rightTextAlignment() {
contents.textAlignment = .right
contentsAlignment = "right"
}
@objc func leftTextAlignment() {
contents.textAlignment = .left
contentsAlignment = "left"
}
@objc func centerTextAlignment() {
contents.textAlignment = .center
contentsAlignment = "center"
}
@objc fileprivate func cleanTextView() {
if contents.text == "글을 입력하세요" {
contents.text = ""
}
contents.textColor = .black
}
@objc fileprivate func textViewState() {
if contents.text == "" {
contents.text = "글을 입력하세요"
contents.textColor = UIColor(red: 208/255, green: 207/255, blue: 208/255, alpha: 1)
}
}
@objc func weatherTextFieldReconiger() {
weatherPicker = UIPickerView()
weatherPicker.delegate = self
weatherPicker.dataSource = self
weatherTF.inputView = weatherPicker
let width = self.view.frame.size.width
let toolBar = UIToolbar()
toolBar.sizeToFit()
toolBar.frame = CGRect(x: 0, y: 0, width: width, height: 36)
toolBar.backgroundColor = UIColor(red: 246/255, green: 252/255, blue: 226/255, alpha: 1)
toolBar.barStyle = .default
let flexibleLabel = UILabel()
flexibleLabel.frame = CGRect(x: 0, y: 0, width: width / 6, height: 36)
flexibleLabel.backgroundColor = .clear
let doneLabel = UILabel()
doneLabel.frame = CGRect(x: 0, y: 0, width: width / 6, height: 36)
doneLabel.backgroundColor = .clear
let doneGesture = UITapGestureRecognizer(target: self, action: #selector(changeWeather))
doneLabel.addGestureRecognizer(doneGesture)
doneLabel.isUserInteractionEnabled = true
doneLabel.text = "확인"
doneLabel.textAlignment = .center
let doneBtn = UIBarButtonItem(customView: doneLabel)
let flexibleBtn = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: self, action: nil)
let label = UILabel(frame: CGRect(x: 0, y: 0, width: width / 3, height: 36))
label.text = "날씨 변경하기"
label.textAlignment = .center
label.font = UIFont.boldSystemFont(ofSize: 14)
let flexibleLB = UIBarButtonItem(customView: flexibleLabel)
let labelBtn = UIBarButtonItem(customView: label)
toolBar.setItems([flexibleLB,flexibleBtn,labelBtn,flexibleBtn,doneBtn], animated: true)
toolBar.isTranslucent = true
weatherTF.inputAccessoryView = toolBar
weatherTF.becomeFirstResponder()
}
@objc func changeWeather() {
weatherTF.resignFirstResponder()
}
@objc func cancelWeaterPickerView() {
}
func numberOfComponents(in pickerView: UIPickerView) -> Int {
return 1
}
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return pickerData.count
}
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
return pickerData[row]
}
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
weather.text = pickerData[row]
}
@objc func popViewController() {
self.navigationController?.popViewController(animated: true)
}
}
//MARK: addImageGessture
extension WriteViewController {
@objc fileprivate func addImageGesture() {
if !isImageLoadingFromiCloud {
let photoViewController = PhotosViewController(nibName: nil, bundle: nil, photosViewControllerDelegate: self)
self.navigationController?.pushViewController(photoViewController, animated: true)
}
}
}
extension WriteViewController {
//MARK: dateTF inputViews
@objc fileprivate func touchUpInsideDateLabel(sender : UILabel) {
let width = self.view.frame.size.width
datePicker = UIDatePicker()
datePicker.datePickerMode = .date
datePicker.minimumDate = stringToDate(in: "20170101", dateFormat: "yyyyMMdd")
datePicker.maximumDate = stringToDate(in: "20211231", dateFormat: "yyyyMMdd")
dateTF.inputView = datePicker
let toolBar = UIToolbar()
toolBar.sizeToFit()
toolBar.frame = CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: 36)
toolBar.barStyle = .default
let doneLabel = UILabel()
doneLabel.frame = CGRect(x: 0, y: 0, width: width / 6, height: 36)
doneLabel.backgroundColor = .clear
let doneGesture = UITapGestureRecognizer(target: self, action: #selector(changedDate(sender:)))
doneLabel.addGestureRecognizer(doneGesture)
doneLabel.isUserInteractionEnabled = true
doneLabel.text = "확인"
doneLabel.textAlignment = .center
let doneBtn = UIBarButtonItem(customView: doneLabel)
let cancelLabel = UILabel()
cancelLabel.frame = CGRect(x: 0, y: 0, width: width / 6, height: 36)
cancelLabel.backgroundColor = .clear
let cancelGesture = UITapGestureRecognizer(target: self, action: #selector(dismissDatePciker(sender:)))
cancelLabel.addGestureRecognizer(cancelGesture)
cancelLabel.isUserInteractionEnabled = true
cancelLabel.text = "취소"
cancelLabel.textAlignment = .center
let cancelBtn = UIBarButtonItem(customView: cancelLabel)
let flexibleBtn = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: self, action: nil)
let label = UILabel(frame: CGRect(x: 0, y: 0, width: width / 3, height: 36))
label.text = "날짜 변경하기"
label.textAlignment = .center
label.font = UIFont.boldSystemFont(ofSize: 14)
let labelBtn = UIBarButtonItem(customView: label)
toolBar.setItems([cancelBtn,flexibleBtn,labelBtn,flexibleBtn,doneBtn], animated: true)
toolBar.isTranslucent = true
dateTF.inputAccessoryView = toolBar
dateTF.becomeFirstResponder()
}
@objc fileprivate func changedDate(sender : UIBarButtonItem) {
setInformation(in: datePicker.date)
dateTF.resignFirstResponder()
}
@objc fileprivate func dismissDatePciker(sender : UIBarButtonItem) {
dateTF.resignFirstResponder()
}
}
extension WriteViewController {
//MARK: UIKeyboard notification
fileprivate func regitsterForTextViewNotification() {
NotificationCenter.default.addObserver(self, selector: #selector(cleanTextView),
name: UITextView.textDidBeginEditingNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(textViewState),
name: UITextView.textDidEndEditingNotification, object: nil)
}
fileprivate func unregisterForTextViewTextNotification() {
NotificationCenter.default.removeObserver(self, name: UITextView.textDidBeginEditingNotification, object: nil)
NotificationCenter.default.removeObserver(self, name: UITextView.textDidEndEditingNotification, object: nil)
}
fileprivate func registerForKeyboardNotification() {
NotificationCenter.default.addObserver(self, selector: #selector(keboardFrameWillHide), name: UIResponder.keyboardWillHideNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(keyboardFrameDidChange), name: UIResponder.keyboardWillShowNotification, object: nil)
}
fileprivate func unregisterForKeyboardNotification() {
NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillHideNotification, object: nil)
NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillShowNotification, object: nil)
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
if keyboardShown == true {
view.endEditing(true)
}
}
@objc fileprivate func keyboardDidShow(notification: NSNotification) {
// adjustingHeight(notification: notification)
}
@objc fileprivate func keyboardFrameDidChange(notification: NSNotification) {
adjustingHeight(notification: notification)
}
@objc fileprivate func keboardFrameWillHide(notification : NSNotification) {
adjustingHide(notification: notification)
}
fileprivate func adjustingHeight(notification: NSNotification) {
guard let userInfo = notification.userInfo else { return }
let keyboardFrame: CGRect = (userInfo[UIResponder.keyboardFrameEndUserInfoKey] as! NSValue).cgRectValue
if keyboardFrame.height == 0 || keyboardShown == true {
return
} else {
self.contentsTextViewCGRect = contents.frame
contents.frame.size.height = contents.frame.size.height - keyboardFrame.height
keyboardShown = true
}
}
fileprivate func adjustingHide(notification : NSNotification) {
guard let userInfo = notification.userInfo else { return }
let keyboardFrame: CGRect = (userInfo[UIResponder.keyboardFrameBeginUserInfoKey] as! NSValue).cgRectValue
self.contents.frame.size.height = self.contentsTextViewCGRect.height
keyboardShown = false
}
}
//MARK: animation contentImgV
extension WriteViewController {
func transformContentImgV(view : UIImageView?) {
if contentImgV == nil {
return
} else {
let transX = (contentImgV.frame.size.width)
UIImageView.animate(withDuration: 0.5) {
view?.transform = CGAffineTransform(translationX: -transX, y: 0)
}
}
}
}
extension WriteViewController: SendDrawingImageDelegate, RSKImageCropViewControllerDelegate, RSKImageCropViewControllerDataSource, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
func sendDrawingImageDelegate(_ image: UIImage) {
}
func imageCropViewControllerDidCancelCrop(_ controller: RSKImageCropViewController) {
controller.dismiss(animated: true, completion: nil)
}
func imageCropViewController(_ controller: RSKImageCropViewController, didCropImage croppedImage: UIImage, usingCropRect cropRect: CGRect, rotationAngle: CGFloat) {
self.contentImgV?.image = croppedImage
self.selectedImageData = croppedImage.pngData()
controller.dismiss(animated: true) {
self.transformContentImgV(view: self.contentImgV)
}
}
func imageCropViewControllerCustomMaskRect(_ controller: RSKImageCropViewController) -> CGRect {
let width = self.view.bounds.width
let height = width * 0.75
let maskRect = CGRect(x: 0, y: 100, width: width, height: height)
return maskRect
}
func imageCropViewControllerCustomMaskPath(_ controller: RSKImageCropViewController) -> UIBezierPath {
let rect = controller.maskRect
let point1 = CGPoint(x: rect.minX, y: rect.maxY)
let point2 = CGPoint(x: rect.maxX, y: rect.maxY)
let point3 = CGPoint(x: rect.maxX, y: rect.minY)
let point4 = CGPoint(x: rect.minX, y: rect.minY)
let rectangle = UIBezierPath()
rectangle.move(to: point1)
rectangle.addLine(to: point2)
rectangle.addLine(to: point3)
rectangle.addLine(to: point4)
rectangle.close()
return rectangle
}
func imageCropViewControllerCustomMovementRect(_ controller: RSKImageCropViewController) -> CGRect {
let rect = controller.maskRect
return rect
}
}
| [
-1
] |
524094db46d0ed851eed3ba59ed8eee087601ee3 | 0d02b1ffb2880b9d4d8320db8815935fd3a82505 | /iOSArchitecturesDemo/Flows/Search/App/Presenter/SearchPresenter.swift | 6915aec59a7dc47c0960f3b64a6a9cac13d08a2f | [] | no_license | therealniks/ArchPatt | 165fd230004786676a657366e8b04535440be123 | 22c1a664ab6520df3afc7ed3afb970b6caab737c | refs/heads/master | 2023-05-14T04:53:48.720806 | 2021-05-29T14:17:54 | 2021-05-29T14:17:54 | 362,568,656 | 0 | 0 | null | 2021-05-29T14:17:55 | 2021-04-28T18:25:42 | Swift | UTF-8 | Swift | false | false | 1,540 | swift | //
// SearchPresenter.swift
// iOSArchitecturesDemo
//
// Created by N!K on 28.04.2021.
// Copyright © 2021 ekireev. All rights reserved.
//
import UIKit
final class SearchPresenter {
weak var viewInput: (UIViewController & SearchViewInput)?
private let searchService = ITunesSearchService()
private func requestApps(with query: String) {
self.searchService.getApps(forQuery: query) { [weak self] result in
guard let self = self else { return }
self.viewInput?.throbber(show: false)
result.withValue { apps in
guard !apps.isEmpty else {
self.viewInput?.showNoResults()
return
}
self.viewInput?.hideNoResults()
self.viewInput?.searchResults = apps
}.withError {
self.viewInput?.showError(error: $0)
}
}
}
private func openAppDetails(with app: ITunesApp) {
let appDetaillViewController = AppDetailViewController(app: app)
self.viewInput?.navigationController?.pushViewController(appDetaillViewController, animated: true)
}
}
// MARK: - SearchViewOutput
extension SearchPresenter: SearchViewOutput {
func viewDidSearch(with query: String) {
self.viewInput?.throbber(show: true)
self.requestApps(with: query)
}
func viewDidSelectApp(_ app: ITunesApp) {
self.openAppDetails(with: app)
}
}
| [
386097,
339482
] |
93050ef83a717e7dd3d2434ac21d04b00d0066f2 | c072197919afc84ddd21cbe853675bbfd58fb06f | /ChatApp/Core/Chat/ViewControllers/ATCChatThreadViewController.swift | 8e21285a88edd05c5b973941e9513435bd34f24a | [
"MIT"
] | permissive | E1io/IOS.chat.github.io | dfe7de660288672b1f239bd7552c0b1f791515e5 | d4e2b37b6a5e8759a2c32cf1bb1c7a444232546a | refs/heads/master | 2023-01-14T09:49:40.157856 | 2020-11-16T13:40:24 | 2020-11-16T13:40:24 | 313,314,575 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 13,119 | swift | //
// ATCChatThreadViewController.swift
// ChatApp
//
// Created by Florian Marcu on 8/26/18.
// Copyright © 2018 Instamobile. All rights reserved.
//
import UIKit
import Photos
import Firebase
import MessageKit
import FirebaseFirestore
import FirebaseStorage
import InputBarAccessoryView
struct ATCChatUIConfiguration {
let primaryColor: UIColor
let secondaryColor: UIColor
let inputTextViewBgColor: UIColor
let inputTextViewTextColor: UIColor
let inputPlaceholderTextColor: UIColor
}
class ATCChatThreadViewController: MessagesViewController, MessagesDataSource, MessageInputBarDelegate {
var user: ATCUser
private var messages: [ATChatMessage] = []
private var messageListener: ListenerRegistration?
private let db = Firestore.firestore()
private var reference: CollectionReference?
private let storage = Storage.storage().reference()
private var isSendingPhoto = false
// This code block doesn't work, as InputItem no longer has .isEnabled property
// how else can this be accomplished?
// {
// didSet {
// DispatchQueue.main.async {
// self.messageInputBar.leftStackViewItems.forEach { item in
// item.isEnabled = !self.isSendingPhoto
//
// }
// }
// }
// }
var channel: ATCChatChannel
var uiConfig: ATCChatUIConfiguration
let remoteData = ATCRemoteData()
init(user: ATCUser, channel: ATCChatChannel, uiConfig: ATCChatUIConfiguration) {
self.user = user
self.channel = channel
self.uiConfig = uiConfig
super.init(nibName: nil, bundle: nil)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
deinit {
messageListener?.remove()
}
override func viewDidLoad() {
super.viewDidLoad()
print("thread view controller did load")
reference = db.collection(["channels", channel.id, "thread"].joined(separator: "/"))
print("reference.path for thread: \(reference?.path)")
self.remoteData.checkPath(path: ["channels", channel.id, "thread"], dbRepresentation: channel.representation)
messageListener = reference?.addSnapshotListener { querySnapshot, error in
guard let snapshot = querySnapshot else {
print("Error listening for channel updates: \(error?.localizedDescription ?? "No error")")
return
}
snapshot.documentChanges.forEach { change in
self.handleDocumentChange(change)
}
}
navigationItem.largeTitleDisplayMode = .never
self.title = channel.name
maintainPositionOnKeyboardFrameChanged = true
let inputTextView = messageInputBar.inputTextView
inputTextView.tintColor = uiConfig.primaryColor
inputTextView.textColor = uiConfig.inputTextViewTextColor
inputTextView.backgroundColor = uiConfig.inputTextViewBgColor
inputTextView.layer.cornerRadius = 14.0
inputTextView.layer.borderWidth = 0.0
inputTextView.font = UIFont.systemFont(ofSize: 16.0)
inputTextView.placeholderLabel.textColor = uiConfig.inputPlaceholderTextColor
inputTextView.placeholderLabel.text = "Start typing..."
inputTextView.textContainerInset = UIEdgeInsets(top: 6, left: 12, bottom: 6, right: 12)
inputTextView.placeholderLabelInsets = UIEdgeInsets(top: 6, left: 15, bottom: 6, right: 15)
let sendButton = messageInputBar.sendButton
sendButton.setTitleColor(uiConfig.primaryColor, for: .normal)
sendButton.setImage(UIImage.localImage("share-icon", template: true), for: .normal)
sendButton.title = ""
sendButton.setSize(CGSize(width: 30, height: 30), animated: false)
messageInputBar.delegate = self
messagesCollectionView.messagesDataSource = self
messagesCollectionView.messagesLayoutDelegate = self
messagesCollectionView.messagesDisplayDelegate = self
let cameraItem = InputBarButtonItem(type: .system)
cameraItem.tintColor = uiConfig.primaryColor
cameraItem.image = UIImage.localImage("camera-filled-icon", template: true)
cameraItem.addTarget(
self,
action: #selector(cameraButtonPressed),
for: .primaryActionTriggered
)
cameraItem.setSize(CGSize(width: 30, height: 30), animated: false)
messageInputBar.leftStackView.alignment = .center
messageInputBar.setLeftStackViewWidthConstant(to: 50, animated: false)
messageInputBar.setRightStackViewWidthConstant(to: 35, animated: false)
messageInputBar.setStackViewItems([cameraItem], forStack: .left, animated: false)
messageInputBar.backgroundColor = .white
messageInputBar.backgroundView.backgroundColor = .white
messageInputBar.separatorLine.isHidden = true
}
// MARK: - Actions
@objc private func cameraButtonPressed() {
let picker = UIImagePickerController()
picker.delegate = self
if UIImagePickerController.isSourceTypeAvailable(.camera) {
picker.sourceType = .camera
} else {
picker.sourceType = .photoLibrary
}
present(picker, animated: true, completion: nil)
}
// MARK: - Helpers
private func save(_ message: ATChatMessage) {
print("saving message: \(message.representation)")
reference?.addDocument(data: message.representation) { error in
if let e = error {
print("Error sending message: \(e.localizedDescription)")
return
}
self.messagesCollectionView.scrollToBottom()
}
}
private func insertNewMessage(_ message: ATChatMessage) {
guard !messages.contains(message) else {
return
}
messages.append(message)
messages.sort()
let isLatestMessage = messages.index(of: message) == (messages.count - 1)
let shouldScrollToBottom = messagesCollectionView.isAtBottom && isLatestMessage
messagesCollectionView.reloadData()
if shouldScrollToBottom {
DispatchQueue.main.async {
self.messagesCollectionView.scrollToBottom(animated: true)
}
}
}
private func handleDocumentChange(_ change: DocumentChange) {
guard var message = ATChatMessage(document: change.document) else {
return
}
switch change.type {
case .added:
if let url = message.downloadURL {
downloadImage(at: url) { [weak self] image in
guard let `self` = self else {
return
}
guard let image = image else {
return
}
message.image = image
self.insertNewMessage(message)
}
} else {
insertNewMessage(message)
}
default:
break
}
}
private func uploadImage(_ image: UIImage, to channel: ATCChatChannel, completion: @escaping (URL?) -> Void) {
guard let scaledImage = image.scaledToSafeUploadSize, let data = scaledImage.jpegData(compressionQuality: 0.4) else {
completion(nil)
return
}
let metadata = StorageMetadata()
metadata.contentType = "image/jpeg"
let imageName = [UUID().uuidString, String(Date().timeIntervalSince1970)].joined()
storage.child(channel.id).child(imageName).putData(data, metadata: metadata) { meta, error in
//completion(meta?.downloadURL() as? URL)
}
}
private func sendPhoto(_ image: UIImage) {
print("is sending photo")
isSendingPhoto = true
uploadImage(image, to: channel) { [weak self] url in
guard let `self` = self else {
print("upload image to channel with url: \(url) failed")
return
}
self.isSendingPhoto = false
guard let url = url else {
return
}
var message = ATChatMessage(user: self.user, image: image)
message.downloadURL = url
self.save(message)
self.messagesCollectionView.scrollToBottom()
}
}
private func downloadImage(at url: URL, completion: @escaping (UIImage?) -> Void) {
let ref = Storage.storage().reference(forURL: url.absoluteString)
let megaByte = Int64(1 * 1024 * 1024)
ref.getData(maxSize: megaByte) { data, error in
guard let imageData = data else {
completion(nil)
return
}
completion(UIImage(data: imageData))
}
}
func currentSender() -> SenderType {
return Sender(id: user.initials, displayName: user.fullName())
}
// MARK: - MessagesDataSource
func currentSender() -> Sender {
return Sender(id: user.uid ?? "noid", displayName: "You")
}
func numberOfMessages(in messagesCollectionView: MessagesCollectionView) -> Int {
return messages.count
}
func messageForItem(at indexPath: IndexPath,
in messagesCollectionView: MessagesCollectionView) -> MessageType {
if indexPath.section < messages.count {
return messages[indexPath.section]
}
return ATChatMessage(user: self.user, image: UIImage.localImage("camera-icon", template: true))
}
func numberOfSections(in messagesCollectionView: MessagesCollectionView) -> Int {
return messages.count
}
func cellTopLabelAttributedText(for message: MessageType,
at indexPath: IndexPath) -> NSAttributedString? {
let name = message.sender.displayName
return NSAttributedString(
string: name,
attributes: [
.font: UIFont.preferredFont(forTextStyle: .caption1),
.foregroundColor: UIColor(white: 0.3, alpha: 1)
]
)
}
}
// MARK: - MessagesLayoutDelegate
extension ATCChatThreadViewController: MessagesLayoutDelegate {
func avatarSize(for message: MessageType, at indexPath: IndexPath,
in messagesCollectionView: MessagesCollectionView) -> CGSize {
return .zero
}
func footerViewSize(for message: MessageType, at indexPath: IndexPath,
in messagesCollectionView: MessagesCollectionView) -> CGSize {
return CGSize(width: 0, height: 8)
}
func heightForLocation(message: MessageType, at indexPath: IndexPath,
with maxWidth: CGFloat, in messagesCollectionView: MessagesCollectionView) -> CGFloat {
return 0
}
}
// MAR: - MessageInputBarDelegate
extension ATCChatThreadViewController {
func inputBar(_ inputBar: InputBarAccessoryView, didPressSendButtonWith text: String) {
let message = ATChatMessage(messageId: UUID().uuidString,
messageKind: MessageKind.text(text),
createdAt: Date(),
atcSender: user,
recipient: user,
seenByRecipient: false)
save(message)
inputBar.inputTextView.text = ""
}
}
// MARK: - MessagesDisplayDelegate
extension ATCChatThreadViewController: MessagesDisplayDelegate {
func backgroundColor(for message: MessageType, at indexPath: IndexPath,
in messagesCollectionView: MessagesCollectionView) -> UIColor {
return isFromCurrentSender(message: message) ? UIColor(hexString: "#0084ff") : UIColor(hexString: "#f0f0f0")
}
func shouldDisplayHeader(for message: MessageType, at indexPath: IndexPath,
in messagesCollectionView: MessagesCollectionView) -> Bool {
return false
}
func messageStyle(for message: MessageType, at indexPath: IndexPath,
in messagesCollectionView: MessagesCollectionView) -> MessageStyle {
let corner: MessageStyle.TailCorner = isFromCurrentSender(message: message) ? .bottomRight : .bottomLeft
return .bubbleTail(corner, .curved)
}
func configureAvatarView(_ avatarView: AvatarView, for message: MessageType, at indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) {
if let message = message as? ATChatMessage {
avatarView.initials = message.atcSender.initials
if let urlString = message.atcSender.profilePictureURL {
avatarView.kf.setImage(with: URL(string: urlString))
}
}
}
}
// MARK: - UIImagePickerControllerDelegate
extension ATCChatThreadViewController: UIImagePickerControllerDelegate, UINavigationControllerDelegate {
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
picker.dismiss(animated: true, completion: nil)
print("picker did finish picking photo")
if let asset = info["phAsset"] as? PHAsset {
let size = CGSize(width: 500, height: 500)
PHImageManager.default().requestImage(for: asset, targetSize: size, contentMode: .aspectFit, options: nil) { result, info in
guard let image = result else {
print("picker image selection had no result")
return
}
self.sendPhoto(image)
}
} else if let image = info["originalImage"] as? UIImage {
sendPhoto(image)
}
}
func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
print("picker did cancel")
picker.dismiss(animated: true, completion: nil)
}
}
| [
177452
] |
58864ccc1eb9693177f7c3ed72bd25f59a23284c | 9b818bc703024d2e103cc2196fc4b89a8a8f7251 | /Sources/Foundation/NSSpecialValue.swift | 4d81869caf9ce5e2c22909c7bd0d975703eeee3d | [
"Apache-2.0",
"Swift-exception"
] | permissive | rmorey/swift-corelibs-foundation | cb471188e7e4ca4f36e0e4bb69666c63130fbac5 | 2e9d97daa69ba81e716e31b76e571f833eb5ed9a | refs/heads/main | 2023-08-31T06:16:33.768032 | 2021-09-27T17:20:13 | 2021-09-27T17:20:13 | 413,566,993 | 2 | 0 | Apache-2.0 | 2021-10-04T20:04:09 | 2021-10-04T20:04:08 | null | UTF-8 | Swift | false | false | 4,878 | swift | // This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
internal protocol NSSpecialValueCoding {
static func objCType() -> String
init(bytes value: UnsafeRawPointer)
func encodeWithCoder(_ aCoder: NSCoder)
init?(coder aDecoder: NSCoder)
func getValue(_ value: UnsafeMutableRawPointer)
// Ideally we would make NSSpecialValue a generic class and specialise it for
// NSPoint, etc, but then we couldn't implement NSValue.init?(coder:) because
// it's not yet possible to specialise classes with a type determined at runtime.
//
// Nor can we make NSSpecialValueCoding conform to Equatable because it has associated
// type requirements.
//
// So in order to implement equality and hash we have the hack below.
func isEqual(_ value: Any) -> Bool
func hash(into hasher: inout Hasher)
var description: String { get }
}
internal class NSSpecialValue : NSValue {
// Originally these were functions in NSSpecialValueCoding but it's probably
// more convenient to keep it as a table here as nothing else really needs to
// know about them
private static let _specialTypes : Dictionary<Int, NSSpecialValueCoding.Type> = [
1 : NSPoint.self,
2 : NSSize.self,
3 : NSRect.self,
4 : NSRange.self,
12 : NSEdgeInsets.self
]
private static func _typeFromFlags(_ flags: Int) -> NSSpecialValueCoding.Type? {
return _specialTypes[flags]
}
private static func _flagsFromType(_ type: NSSpecialValueCoding.Type) -> Int {
for (F, T) in _specialTypes {
if T == type {
return F
}
}
return 0
}
private static func _objCTypeFromType(_ type: NSSpecialValueCoding.Type) -> String? {
for (_, T) in _specialTypes {
if T == type {
return T.objCType()
}
}
return nil
}
internal static func _typeFromObjCType(_ type: UnsafePointer<Int8>) -> NSSpecialValueCoding.Type? {
let objCType = String(cString: type)
for (_, T) in _specialTypes {
if T.objCType() == objCType {
return T
}
}
return nil
}
internal var _value : NSSpecialValueCoding
init(_ value: NSSpecialValueCoding) {
self._value = value
}
required init(bytes value: UnsafeRawPointer, objCType type: UnsafePointer<Int8>) {
guard let specialType = NSSpecialValue._typeFromObjCType(type) else {
NSUnsupported()
}
self._value = specialType.init(bytes: value)
}
override func getValue(_ value: UnsafeMutableRawPointer) {
self._value.getValue(value)
}
convenience required init?(coder aDecoder: NSCoder) {
guard aDecoder.allowsKeyedCoding else {
preconditionFailure("Unkeyed coding is unsupported.")
}
let specialFlags = aDecoder.decodeInteger(forKey: "NS.special")
guard let specialType = NSSpecialValue._typeFromFlags(specialFlags) else {
return nil
}
guard let specialValue = specialType.init(coder: aDecoder) else {
return nil
}
self.init(specialValue)
}
override func encode(with aCoder: NSCoder) {
guard aCoder.allowsKeyedCoding else {
preconditionFailure("Unkeyed coding is unsupported.")
}
aCoder.encode(NSSpecialValue._flagsFromType(type(of: _value)), forKey: "NS.special")
_value.encodeWithCoder(aCoder)
}
override var objCType : UnsafePointer<Int8> {
let typeName = NSSpecialValue._objCTypeFromType(type(of: _value))
return typeName!._bridgeToObjectiveC().utf8String! // leaky
}
override var classForCoder: AnyClass {
// for some day when we support class clusters
return NSValue.self
}
override var description : String {
let desc = _value.description
if desc.isEmpty {
return super.description
}
return desc
}
override func isEqual(_ value: Any?) -> Bool {
switch value {
case let other as NSSpecialValue:
return _value.isEqual(other._value)
case let other as NSObject:
return self === other
default:
return false
}
}
override var hash: Int {
var hasher = Hasher()
_value.hash(into: &hasher)
return hasher.finalize()
}
}
| [
-1
] |
d0977c71462277b03dac730eb0b94081090f6ece | b9980d154e26849abebe18051e619fb31ea3b2c3 | /Networking/Managers/UserProfileData/UpdateUserDataManager.swift | 99018ed91534509ce65f58eec5e6b9d76a3c7bca | [
"MIT"
] | permissive | AgrinobleAGN/Agrinoble-Mobile-App-iOS | acd1040e8b0e3bb4c2bf1efeae6a26462f775de9 | 9c28c53b8f3b74afcf5ba1e280c2f7ac36de2403 | refs/heads/main | 2023-07-18T12:29:44.182492 | 2021-09-02T09:29:13 | 2021-09-02T09:29:13 | 402,361,069 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 6,568 | swift |
import Foundation
import Alamofire
import WoWonderTimelineSDK
class UpdateUserDataManager {
let access_token = "\("?")\("access_token")\("=")\(UserData.getAccess_Token()!)"
func updateUserData(firstName : String, lastName : String ,phoneNumber : String, website : String, address : String, workPlace : String, school : String, gender: String, completionBlock : @escaping (_ Success: UpdateUserDataModel.updateUserData_SuccessModel?, _ AuthError : UpdateUserDataModel.updateUserData_ErrorModel? , Error?)->()){
let params = [APIClient.Params.serverKey : APIClient.SERVER_KEY.Server_Key,APIClient.Params.firstName : firstName, APIClient.Params.phoneNumber : phoneNumber, APIClient.Params.lastName : lastName, APIClient.Params.working : workPlace, APIClient.Params.address : address, APIClient.Params.website : website, APIClient.Params.school : school,APIClient.Params.gender: gender]
AF.request(APIClient.UpdateProfile.updateProfileApi + access_token, method: .post, parameters: params, encoding: URLEncoding.default, headers: nil).responseJSON { (response) in
print(response.value)
if response.value != nil {
guard let res = response.value as? [String:Any] else {return}
guard let apiStatusCode = res["api_status"] as? Any else {return}
let apiCode = apiStatusCode as? Int
if apiCode == 200 {
guard let data = try? JSONSerialization.data(withJSONObject: response.value, options: []) else {return}
guard let result = try? JSONDecoder().decode(UpdateUserDataModel.updateUserData_SuccessModel.self, from: data) else {return}
completionBlock(result,nil,nil)
}
else {
guard let data = try? JSONSerialization.data(withJSONObject: response.value, options: []) else {return}
guard let result = try? JSONDecoder().decode(UpdateUserDataModel.updateUserData_ErrorModel.self, from: data) else {return}
completionBlock(nil,result,nil)
}
}
else {
print(response.error?.localizedDescription)
completionBlock(nil,nil,response.error)
}
}
}
func uploadUserImage(imageType : String ,data : Data?, completionBlock : @escaping (_ Success: UpdateUserDataModel.updateUserData_SuccessModel?, _ AuthError : UpdateUserDataModel.updateUserData_ErrorModel? , Error?)->()){
let headers: HTTPHeaders = ["Content-type": "multipart/form-data"]
let params = [APIClient.Params.serverKey : APIClient.SERVER_KEY.Server_Key]
AF.upload(multipartFormData: { (multipartFormData) in
for (key, value) in params {
multipartFormData.append("\(value)".data(using: String.Encoding.utf8)!, withName: key as String)
}
if let data = data{
multipartFormData.append(data, withName: imageType, fileName: "file.jpg", mimeType: "image/png")
}
}, with: APIClient.UpdateProfile.updateProfileApi + self.access_token as! URLRequestConvertible)
.uploadProgress(queue: .main, closure: { progress in
//Current upload progress of file
print("Upload Progress: \(progress.fractionCompleted)")
})
.responseJSON(completionHandler: { response in
//Do what ever you want to do with response
if (response.value != nil){
guard let res = response.value as? [String:Any] else {return}
guard let apiStatusCode = res["api_status"] as? Any else {return}
if apiStatusCode as? Int == 200{
guard let data = try? JSONSerialization.data(withJSONObject: response.value, options: []) else {return}
guard let result = try? JSONDecoder().decode(UpdateUserDataModel.updateUserData_SuccessModel.self, from: data) else {return}
completionBlock(result,nil,nil)
}
else {
guard let data = try? JSONSerialization.data(withJSONObject: response.value, options: []) else {return}
guard let result = try? JSONDecoder().decode(UpdateUserDataModel.updateUserData_ErrorModel.self, from: data) else {return}
completionBlock(nil,result,nil)
}
}
else{
print(response.error?.localizedDescription)
completionBlock(nil,nil,response.error)
}
})
// },usingThreshold: UInt64.init(),to: APIClient.UpdateProfile.updateProfileApi + self.access_token,method : .post,headers: headers) { (result) in
// switch result{
// case .success(let upload, _, _):
// upload.responseJSON { (response) in
// if (response.value != nil){
// guard let res = response.value as? [String:Any] else {return}
// guard let apiStatusCode = res["api_status"] as? Any else {return}
// if apiStatusCode as? Int == 200{
// guard let data = try? JSONSerialization.data(withJSONObject: response.value, options: []) else {return}
// guard let result = try? JSONDecoder().decode(UpdateUserDataModel.updateUserData_SuccessModel.self, from: data) else {return}
// completionBlock(result,nil,nil)
// }
// else {
// guard let data = try? JSONSerialization.data(withJSONObject: response.value, options: []) else {return}
// guard let result = try? JSONDecoder().decode(UpdateUserDataModel.updateUserData_ErrorModel.self, from: data) else {return}
// completionBlock(nil,result,nil)
// }
// }
// else{
// print(response.error?.localizedDescription)
// completionBlock(nil,nil,response.error)
// }
// }
// case .failure(let error):
// print("Error in upload: \(error.localizedDescription)")
// completionBlock(nil,nil,error)
//
// }
}
static let sharedInstance = UpdateUserDataManager()
private init() {}
}
| [
-1
] |
8bc429f9faf1a997af2044ba2d89189c59bc1f3e | 6c744ab1019b88e32a328d2633344a19a49cae30 | /timeboARd/SaveBoardViewController.swift | e9a2b7e4888ac21e61475c262146505d3124899f | [] | no_license | anthonyanader/timeboARd | 26866d752949ea6992e51b7ef24fe90e409dfc78 | 1bf02de7043a8ed4e2619c9bb595948d806f8d82 | refs/heads/master | 2021-07-19T12:31:39.570750 | 2017-10-28T00:23:38 | 2017-10-28T00:23:38 | 107,744,963 | 12 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 197 | swift | //
// SaveBoardViewController.swift
// timeboARd
//
// Created by Anthony A. Nader on 2017-10-21.
// Copyright © 2017 Anthony A. Nader. All rights reserved.
//
import Foundation
import UIKit
| [
-1
] |
27bf7168048c11e0f95a1ff728a975f6dacc4f03 | 20e7b36782a6b73a06852b4bfd1dbe1bcb8af42c | /RaiseMan/RaiseMan/Person.swift | 73a9901b3db5c87f16443eef6b2e144c3a80ca06 | [
"MIT"
] | permissive | xiaoleixy/Cocoa_swift | b7c2c57a397e7652d53a8c9f576ddfb45693f018 | e73f7d3b4f8649cedaa21c820406c8a91524e374 | refs/heads/master | 2021-01-01T18:33:54.238595 | 2015-03-02T11:55:46 | 2015-03-02T11:55:46 | 30,799,277 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,393 | swift | //
// Person.swift
// RaiseMan
//
// Created by michael on 15/2/16.
// Copyright (c) 2015年 michael. All rights reserved.
//
import Foundation
//@objc() swift 对象转成 Interface 对象
@objc(Person)
class Person: NSObject , NSCoding{
//用!会报错,替换为赋初值
// var personName: String!
// var expectedRaise: Float!
var personName: String = ""
var expectedRaise: Float = 0
override init(){
super.init()
self.personName = "New Person"
self.expectedRaise = 0.05
}
required init(coder decoder: NSCoder) {
super.init()
self.personName = decoder.decodeObjectForKey("personName") as String
self.expectedRaise = decoder.decodeObjectForKey("expectedRaise") as Float
}
func customDescription() -> String {
return "personName : " + personName + ", expectedRasise : \(expectedRaise)"
}
override var description: String {
return customDescription()
}
override func setNilValueForKey(key: String) {
if key == "expectedRaise" {
self.expectedRaise = 0.0
}else {
super.setNilValueForKey(key)
}
}
func encodeWithCoder(coder: NSCoder) {
coder.encodeObject(personName, forKey: "personName")
coder.encodeObject(expectedRaise, forKey: "expectedRaise")
}
}
| [
-1
] |
87cb97470d748a0293f902b4ae2bb790b323b84e | 145193ca60fca3b7bfb30d7198b0b3a58391fa29 | /FacebookPopSwift2.0/FacebookPopSwift2.0/ViewController.swift | 050a5cdc242e2eb04b2c95d4b49de31704eeedb5 | [] | no_license | HeatherConnery/PopAnimationWithFacebookPop | e596de60871ae5fbd824e5da098909928caa43d1 | 74fa1afe9cc40e7aa1b1f0bf41f9f92c7a1fa9fe | refs/heads/master | 2021-01-10T17:47:51.838577 | 2015-11-09T16:58:50 | 2015-11-09T16:58:50 | 45,846,883 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,005 | swift | //
// ViewController.swift
// FacebookPopSwift2.0
//
// Created by Heather Connery on 2015-11-09.
// Copyright © 2015 HConnery. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var myTextField: UITextField!
@IBAction func myButton(sender: AnyObject) {
self.shake()
}
func shake() {
let shake = POPSpringAnimation(propertyNamed: kPOPLayerPositionX)
shake.springBounciness = 20
shake.velocity = 3000
//reference the textField layer property (key is for referencing later if needed)
self.myTextField.layer.pop_addAnimation(shake, forKey: "shake")
}
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.
}
}
| [
-1
] |
ade64a48a3b037998b87d42484f259a588d1507e | 6e8df3ac81838b9d2a0232b5a071ccac89b28b64 | /Event Tracker/TrackListViewController.swift | 58fefa82ac47fe8ff7a287882b52e9a8a98a6660 | [] | no_license | kkvinokk/Event-Tracker | a9c18f0060d5c9ec3d9b153335e620fcc76d6d12 | 658a0867c14a2d822e33bc672dab05ca1998eaaa | refs/heads/master | 2021-01-11T04:45:13.247477 | 2017-09-30T12:28:43 | 2017-09-30T12:28:43 | 71,125,817 | 2 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 6,031 | swift | //
// TrackListViewController.swift
// Event Tracker
//
// Created by aryvart3 on 15/10/16.
// Copyright © 2016 Vinoth. All rights reserved.
//
import UIKit
import CoreData
class TrackListViewController: UIViewController{
var devices = [NSManagedObject]()
@IBOutlet weak var tableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
let rightSwipe = UISwipeGestureRecognizer(target: self, action: #selector(TrackListViewController.handleSwipes(_:)))
rightSwipe.direction = .Right
view.addGestureRecognizer(rightSwipe)
tableView.editing = false
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
func handleSwipes(sender:UISwipeGestureRecognizer) {
self.navigationController?.popViewControllerAnimated(true)
}
// MARK: - Table View
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return Singleton.sharedInstance.dataOfArray.count
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath)
if let theLabel = cell.viewWithTag(1) as? UILabel {
theLabel.text = Singleton.sharedInstance.dataOfArray[indexPath.row]["name"]
}
if let theImageView = cell.viewWithTag(5) as? UIImageView {
theImageView.image = UIImage(imageLiteral: Singleton.sharedInstance.dataOfArray[indexPath.row]["image"]!)
}
if let placeLabel = cell.viewWithTag(2) as? UILabel {
placeLabel.text = Singleton.sharedInstance.dataOfArray[indexPath.row]["location"]
}
if let dateLabel = cell.viewWithTag(3) as? UILabel {
if Singleton.sharedInstance.dataOfArray[indexPath.row]["type"] == "p" {
dateLabel.text = "Paid"
}else{
dateLabel.text = "Free"
}
}
cell.selectionStyle = UITableViewCellSelectionStyle.Blue
return cell
}
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let DetailEventViewControllerrOBJ = self.storyboard!.instantiateViewControllerWithIdentifier("detailEventViewController") as! DetailEventViewController
DetailEventViewControllerrOBJ.selEventDetails = Singleton.sharedInstance.dataOfArray[indexPath.row]
self.navigationController!.pushViewController(DetailEventViewControllerrOBJ, animated: true)
}
func tableView(tableView: UITableView, moveRowAtIndexPath fromIndexPath: NSIndexPath, toIndexPath: NSIndexPath) {
let itemToMove = Singleton.sharedInstance.dataOfArray[fromIndexPath.row]
Singleton.sharedInstance.dataOfArray.removeAtIndex(fromIndexPath.row)
Singleton.sharedInstance.dataOfArray.insert(itemToMove, atIndex: toIndexPath.row)
}
func tableView(tableView: UITableView, canMoveRowAtIndexPath indexPath: NSIndexPath) -> Bool {
return true
}
func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
if editingStyle == UITableViewCellEditingStyle.Delete {
Singleton.sharedInstance.dataOfArray.removeAtIndex(indexPath.row)
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.Automatic)
}
}
// MARK: - Button Action
@IBAction func editButton(sender: UIButton) {
sender.selected = !sender.selected
tableView.editing = !tableView.editing
if !sender.selected {
updateAll()
}
}
func updateAll(){
deleteAll()
let appDelegate =
UIApplication.sharedApplication().delegate as! AppDelegate
let managedContext = appDelegate.managedObjectContext
let entity = NSEntityDescription.entityForName("Device",
inManagedObjectContext:managedContext)
let device = NSManagedObject(entity: entity!,
insertIntoManagedObjectContext: managedContext)
let data = NSKeyedArchiver.archivedDataWithRootObject(Singleton.sharedInstance.dataOfArray)
device.setValue(Singleton.sharedInstance.name, forKey: "name")
device.setValue(data, forKey: "dataOfArray")
do {
try managedContext.save()
devices.append(device)
} catch let error as NSError {
print("Could not save \(error), \(error.userInfo)")
}
}
func deleteAll(){
let appDelegate =
UIApplication.sharedApplication().delegate as! AppDelegate
let managedContext = appDelegate.managedObjectContext
let request = NSFetchRequest(entityName: "Device")
do {
let results =
try managedContext.executeFetchRequest(request)
if results.count != 0 {
for result in results {
if result.valueForKey("name") as! String == Singleton.sharedInstance.name {
managedContext.deleteObject(result as! NSManagedObject)
}
}
do {
try managedContext.save()
} catch {
print(error)
}
}
} catch let error as NSError {
print("Could not fetch \(error), \(error.userInfo)")
}
}
}
| [
-1
] |
0da2d4a6310dde4965d3b52403a74598992952a5 | 89f1cafe33a360158ee990e44c351be9ff938591 | /Just/Request.swift | 830978ad73681eab24793f8e5853be64f6138d97 | [] | no_license | kkapitan/Just | 848060a45a4fff10981c94dd1d78cb91b7e6a6e5 | 93795d98914f65124182c1d613d9e2c6d19201c7 | refs/heads/master | 2021-06-19T21:20:47.420502 | 2017-05-20T18:57:15 | 2017-05-20T18:57:15 | 82,482,914 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,140 | swift | //
// Request.swift
// Just
//
// Created by Krzysztof Kapitan on 14.05.2017.
// Copyright © 2017 CappSoft. All rights reserved.
//
import Alamofire
protocol Request {
var baseURL: URL { get }
var path: String { get }
var method: Alamofire.HTTPMethod { get }
}
extension Request {
var method: Alamofire.HTTPMethod {
return .get
}
var baseURL: URL {
return URL(string: "https://still-woodland-84806.herokuapp.com/api/")!
}
var url: URL {
return URL(string: path, relativeTo: baseURL)!
}
}
struct RegisterRequest: Request {
var method: HTTPMethod {
return .post
}
var path: String {
return "users"
}
}
struct CurrentUserRequest: Request {
var path: String {
return "sessions"
}
}
struct LoginRequest: Request {
var method: HTTPMethod {
return .post
}
var path: String {
return "sessions"
}
}
struct LogoutRequest: Request {
var method: HTTPMethod {
return .delete
}
var path: String {
return "sessions"
}
}
struct FetchListsRequest: Request {
var path: String {
return "lists"
}
}
struct FetchListRequest: Request {
let list: List
var path: String {
return "lists/\(list.id)"
}
}
struct CreateListRequest: Request {
var method: HTTPMethod {
return .post
}
var path: String {
return "lists"
}
}
struct FetchTaskRequest: Request {
let task: Task
var path: String {
return "tasks/\(task.id)"
}
}
struct DeleteTaskRequest: Request {
let task: Task
var method: HTTPMethod {
return .delete
}
var path: String {
return "tasks/\(task.id)"
}
}
struct CreateTaskRequest: Request {
var method: HTTPMethod {
return .post
}
var path: String {
return "tasks"
}
}
struct UpdateTaskRequest: Request {
let task: Task
var method: HTTPMethod {
return .put
}
var path: String {
return "tasks/\(task.id)"
}
}
| [
-1
] |
82fc1590133e301a89788a11a1b0e71bed061f11 | c6d81c378d838f4b3a47461487a228dd1e7656f9 | /Pods/SKWebServiceController/Source/WebServiceController.swift | a0e2692d6335ef80b2988930b55b7e020fdf8dbe | [
"MIT"
] | permissive | skladek/SKImageCache | bbd4b97df5090bec29b5280b7b9a68e03ae3af93 | 54b1c59dd27df5bb159fbb1ffcc483a8b47867c2 | refs/heads/develop | 2022-01-13T05:00:49.950425 | 2018-07-26T21:07:52 | 2018-07-26T21:07:52 | 92,964,159 | 0 | 0 | MIT | 2019-06-06T21:44:29 | 2017-05-31T16:03:24 | Swift | UTF-8 | Swift | false | false | 8,264 | swift | import UIKit
/// Provides a controller for web services.
open class WebServiceController: NSObject {
// MARK: Public Class Types
/// The completion that is returned with image requests.
public typealias ImageCompletion = (UIImage?, URLResponse?, Error?) -> Void
/// The completion that is returned with JSON requests.
public typealias JSONCompletion = (Any?, URLResponse?, Error?) -> Void
// MARK: Static Variables
static let bearerPrefix = "Bearer "
// MARK: Public Properties
/// The base URL used for all requests.
public var baseURL: String {
return requester.urlConstructor.baseURL
}
/// The authorization token appended to all requests.
public var token: String? {
return requester.token
}
/// Provides a toggle to utilize local files instead of making an external URL request. This should only be
/// used for debugging. The local files will be searched for using the last path component. For example, with
/// the URL http://example.com/test, a file with the name test.json would be searched for in the main bundle.
public var useLocalFiles: Bool {
get {
return requester.useLocalFiles
} set {
requester.useLocalFiles = newValue
}
}
// MARK: Internal Class Types
enum HTTPMethod: String {
case delete = "DELETE"
case get = "GET"
case post = "POST"
case put = "PUT"
}
// MARK: Internal Properties
var keychain: KeychainProtocol
var requester: Requesting
// MARK: Init Methods
/// Creates a controller that will perform requests on the base URL with the default parameters appended to each request.
///
/// - Parameters:
/// - baseURL: The URL that all requests are built from.
/// - sessionConfiguration: The session configuration object. The default value is URLSessionConfiguration.default
public init(baseURL: String, sessionConfiguration: URLSessionConfiguration = URLSessionConfiguration.default) {
self.keychain = Keychain()
let jsonHandler = JSONHandler()
let session = URLSession(configuration: sessionConfiguration)
let urlConstructor = URLConstructor(baseURL: baseURL)
self.requester = RequestController(jsonHandler: jsonHandler, session: session, urlConstructor: urlConstructor)
}
init(testRequester: Requesting, keychain: KeychainProtocol) {
self.requester = testRequester
self.keychain = keychain
}
// MARK: Instance Methods
/// Performs a delete request on the url formed from the base URL and endpoint.
///
/// - Parameters:
/// - endpoint: The endpoint to perform the request on.
/// - requestConfiguration: A configuration objects affecting only a single request.
/// - completion: The closure called when the request completes.
/// - Returns: The data task to be performed.
@discardableResult
open func delete(_ endpoint: String? = nil, requestConfiguration: RequestConfiguration? = nil, completion: @escaping JSONCompletion) -> URLSessionDataTask? {
return requester.performRequest(endpoint: endpoint, json: nil, httpMethod: .delete, requestConfiguration: requestConfiguration, completion: { (data, response, error) in
self.requester.jsonCompletion(data: data, response: response, error: error, completion: completion)
})
}
/// Performs a get request on the url formed from the base URL, endpoint, and parameters.
///
/// - Parameters:
/// - endpoint: The endpoint to perform the request on.
/// - requestConfiguration: A configuration objects affecting only a single request.
/// - completion: The closure called when the request completes.
/// - Returns: The data task to be performed.
@discardableResult
open func get(_ endpoint: String? = nil, requestConfiguration: RequestConfiguration? = nil, completion: @escaping JSONCompletion) -> URLSessionDataTask? {
return requester.performRequest(endpoint: endpoint, json: nil, httpMethod: .get, requestConfiguration: requestConfiguration, completion: { (data, response, error) in
self.requester.jsonCompletion(data: data, response: response, error: error, completion: completion)
})
}
/// Performs a get request on the provided URL.
///
/// - Parameters:
/// - url: The URL to perform the GET request on.
/// - completion: The closure called when the request completes.
/// - Returns: The data task to be performed.
@discardableResult
open func getImage(_ url: URL, completion: @escaping ImageCompletion) -> URLSessionDataTask? {
var request = URLRequest(url: url)
request.httpMethod = HTTPMethod.get.rawValue
return requester.performRequest(request, httpMethod: .get, json: nil, completion: { (data, response, error) in
self.requester.imageCompletion(data: data, response: response, error: error, completion: completion)
})
}
/// Performs a post request on the url formed from the base URL, endpoint, and parameters.
///
/// - Parameters:
/// - endpoint: The endpoint to perform the request on.
/// - json: The JSON object to be converted to data. This must be a valid JSON object type.
/// - requestConfiguration: A configuration objects affecting only a single request.
/// - completion: The closure called when the request completes.
/// - Returns: The upload task to be performed.
@discardableResult
open func post(_ endpoint: String? = nil, json: Any?, requestConfiguration: RequestConfiguration? = nil, completion: @escaping JSONCompletion) -> URLSessionDataTask? {
return requester.performRequest(endpoint: endpoint, json: json, httpMethod: .post, requestConfiguration: requestConfiguration, completion: { (data, response, error) in
self.requester.jsonCompletion(data: data, response: response, error: error, completion: completion)
})
}
/// Performs a put request on the url formed from the base URL, endpoint, and parameters.
///
/// - Parameters:
/// - endpoint: The endpoint to perform the request on.
/// - json: The JSON object to be converted to data. This must be a valid JSON object type.
/// - requestConfiguration: A configuration objects affecting only a single request.
/// - completion: The closure called when the request completes.
/// - Returns: The upload task to be performed.
@discardableResult
open func put(_ endpoint: String? = nil, json: Any?, requestConfiguration: RequestConfiguration? = nil, completion: @escaping JSONCompletion) -> URLSessionDataTask? {
return requester.performRequest(endpoint: endpoint, json: json, httpMethod: .put, requestConfiguration: requestConfiguration, completion: { (data, response, error) in
self.requester.jsonCompletion(data: data, response: response, error: error, completion: completion)
})
}
/// Clears any set tokens. This will prevent the authorization token from being set on requests.
open func removeAuthorizationToken() {
keychain.delete(key: Keychain.authTokenKeychainKey)
requester.token = nil
}
/// Sets the input token as a bearer token. If the token is passed in without the "Bearer " prefix, it will be appended.
/// If this is set, it will be passed with every request.
///
/// - Parameter token: The token to be set. This can be passed in with or without the "Bearer " prefix.
/// - Returns: An optional error.
@discardableResult
open func setBearerToken(_ token: String?) -> Error? {
guard var token = token else {
let error = WebServiceError(code: .invalidData, message: "Cannot set bearer token. The input token was nil.")
return error
}
if !token.hasPrefix(WebServiceController.bearerPrefix) {
token = "Bearer \(token)"
}
if let tokenData = token.data(using: .utf8, allowLossyConversion: false) {
keychain.save(key: Keychain.authTokenKeychainKey, data: tokenData)
}
requester.token = token
return nil
}
}
| [
-1
] |
aded6589609fbba9b39da1460c2db4595e7bdaff | b7e2385becee8a4a00eb59ce12a81e280c308ad6 | /eggplan-brownie/ViewController.swift | 6c06711f47efa2db090b3b270a25d58232737015 | [] | no_license | vvgomes/eggplant-brownie | 13981683e4965992ccf5e29de1afbf06a56159e0 | ab4f1d610ee1af9bbafe28b2356291b9b072dd58 | refs/heads/master | 2021-01-09T21:54:46.734182 | 2015-10-15T04:05:02 | 2015-10-15T04:05:02 | 43,927,692 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,820 | swift | import UIKit
protocol AddMealDelegate {
func add(meal: Meal)
}
class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate, AddItemDelegate {
@IBOutlet var nameField: UITextField!
@IBOutlet var happinessField: UITextField!
@IBOutlet var tableView: UITableView!
var delegate: AddMealDelegate?
var items = [
Item(name: "Eggplant Brownie", calories: 10)
]
var selected = Array<Item>()
@IBAction func add() {
let name = nameField.text!
let happiness = Int(happinessField.text!)
if happiness == nil { return }
let meal = Meal(name: name, happiness: happiness!)
meal.items = selected
if delegate != nil {
delegate!.add(meal)
}
if let navigation = self.navigationController {
navigation.popViewControllerAnimated(true)
}
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return items.count
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let item = items[indexPath.row]
let cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: nil)
cell.textLabel?.text = item.name
return cell
}
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let cell = tableView.cellForRowAtIndexPath(indexPath)
if cell == nil { return }
if cell!.accessoryType == UITableViewCellAccessoryType.None {
cell!.accessoryType = UITableViewCellAccessoryType.Checkmark
selected.append(items[indexPath.row])
} else {
cell!.accessoryType = UITableViewCellAccessoryType.None
if let index = selected.indexOf(items[indexPath.row]) {
selected.removeAtIndex(index)
}
}
}
override func viewDidLoad() {
let newItemButton = UIBarButtonItem(
title: "New item",
style: UIBarButtonItemStyle.Plain,
target: self,
action: Selector("showNewItem"))
navigationItem.rightBarButtonItem = newItemButton
}
func showNewItem() {
let newItem = NewItemViewController(delegate: self)
if let navigation = self.navigationController {
navigation.pushViewController(newItem, animated: true)
}
}
// AddItemDelegate
func addItem(item: Item) {
items.append(item)
if let table = tableView {
table.reloadData()
} else {
Alert(controller: self).show("Unexpected error, but the item was added.")
}
}
}
| [
-1
] |
5a751380a10dae45af94af1954575eb9091ce3ca | 0422d588bb38a26756b96198cba311a113f52e2e | /HandyAccess/HandyAccess/SocialServicesTableViewController.swift | 61a3dde582940d204b96fa6c767c2becbf36a466 | [] | no_license | edwardanchundia/HandyAccess | 4c581343954d841925bdd339af78bfc3df0c19a4 | 9166e6948cc98ec505ba4a2efc3a1984529a096e | refs/heads/master | 2021-01-21T11:07:40.966002 | 2017-03-28T19:06:51 | 2017-03-28T19:06:51 | 83,526,161 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 10,868 | swift | //
// SocialServicesTableViewController.swift
// HandyAccess
//
// Created by Ana Ma on 2/18/17.
// Copyright © 2017 NYCHandyAccess. All rights reserved.
//
import UIKit
import SnapKit
class SocialServicesTableViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, UIPickerViewDelegate, UIPickerViewDataSource {
let colorScheme = ColorScheme()
var socialServices1 = [SocialService1]()
let endpoint = "https://data.cityofnewyork.us/resource/386y-9exk.json?Queens=Y&aging=Y"
// var metaViews = [MetaView]()
// var socialServices = [SocialService]()
// let endpoint = "https://data.cityofnewyork.us/api/views/69bm-3bc2/rows.json?accessType=DOWNLOAD"
var pickerSelections = [[String]]()
let boroughsDict = ["Queens":"Queens",
"Brooklyn":"Brooklyn",
"Bronx":"Bronx",
"Manhatttan":"Manhattan",
"Staten Island":"Staten_island",
"All":"All" ]
let categoriesDict = ["Aging" : "aging",
"Counseling Support" : "counseling_support_groups",
"Disabilities" : "disabilities",
"Education" : "education",
"Health" : "health",
"Housing" : "housing",
"Immigration" : "immigration",
"Job Training" : "employment_job_training",
"Legal Services" : "legal_services",
"Veterans" : "veterans_military_families",
"Victim Services" : "victim_services",
"Youth Services" : "youth_services"]
/*
"anti_discrimination_human_rights",
"arts_culture",
"business",
"child_care_parent_information",
"community_service_volunteerism",
"domestic_violence",
"employment_job_training",
"Homelessness" : "homelessness",
"lesbian_gay_bisexual_and_or_transgender",
"new_york_city_agency",
"Nonprofit" : "nonprofit",
"none_of_the_above",
//??"nourl",
"other_government_organization",
"outsideloc",
"personal_finance_financial_education",
"professional_association",
*/
var urlComponents = ["borough": "Queens", "category": "aging"] {
didSet {
let url = buildUrlWithComponent(self.urlComponents)
APIRequestManager.shared.getSocialServices1(endPoint: url) { (socialServices1: [SocialService1]?) in
guard let validSocialServices1 = socialServices1 else { return }
DispatchQueue.main.async {
self.socialServices1 = validSocialServices1
self.socialSourceTableView.reloadData()
}
}
}
}
var titleComponents : [String: String] {
get {
var titleBorough = ""
var titleCategory = ""
for (key, value) in categoriesDict {
if let category = urlComponents["category"], value == category {
titleCategory = key
}
}
for (key, value) in boroughsDict {
if let borough = urlComponents["borough"], value == borough {
titleBorough = key
}
}
return ["borough" : "\(titleBorough)", "category" : "\(titleCategory)"]
}
}
var catagoryKeys : [String] {
get {
return self.categoriesDict.map{$0.key}.sorted(by: <)
}
}
var boroughKeys : [String] {
get {
return self.boroughsDict.map{$0.key}.sorted(by: >)
}
}
override func viewDidLoad() {
super.viewDidLoad()
setupViewHierarchy()
configureConstraints()
self.view.backgroundColor = UIColor.white
self.navigationController?.isNavigationBarHidden = false
if let category = titleComponents["category"], let borough = titleComponents["borough"] {
self.title = "\(borough) \(category)"
}
let url = buildUrlWithComponent(self.urlComponents)
APIRequestManager.shared.getSocialServices1(endPoint: url) { (socialServices: [SocialService1]?) in
guard let validSocialServices = socialServices else { return }
DispatchQueue.main.async {
self.socialServices1 = validSocialServices
self.socialSourceTableView.reloadData()
//dump(self.socialServices1)
}
}
self.socialSourceTableView.register(SocialServiceTableViewCell.self, forCellReuseIdentifier: SocialServiceTableViewCell.cellIdentifier)
pickerSelections = [self.boroughKeys, self.catagoryKeys]
}
private func setupViewHierarchy() {
self.view.addSubview(self.filterPicker)
self.view.addSubview(self.socialSourceTableView)
}
private func configureConstraints() {
self.filterPicker.backgroundColor = self.colorScheme._50
self.filterPicker.snp.makeConstraints{ (view) in
view.top.equalTo(self.topLayoutGuide.snp.bottom)
view.leading.trailing.equalToSuperview()
view.height.equalToSuperview().multipliedBy(0.2)
}
self.socialSourceTableView.snp.makeConstraints { (view) in
view.top.equalTo(self.filterPicker.snp.bottom)
view.leading.trailing.equalToSuperview()
view.bottom.equalTo(self.bottomLayoutGuide.snp.top)
}
}
// MARK: - TableView data source
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
print(self.socialServices1.count)
return self.socialServices1.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: SocialServiceTableViewCell.cellIdentifier, for: indexPath) as! SocialServiceTableViewCell
let socialService = socialServices1[indexPath.row]
cell.organizationNameLabel.text = socialService.organizationname
cell.organizationDescriptionLabel.text = socialService.description
if let urlString = socialService.url,
let url = URL(string: urlString) {
//Do Stuff
}
cell.backgroundColor = self.colorScheme.colorSchemeArr[indexPath.row % self.colorScheme.colorSchemeArr.count]
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let socialServicesDetailViewController = SocialServicesDetailViewController()
socialServicesDetailViewController.socialService1 = socialServices1[indexPath.row]
socialServicesDetailViewController.borough = self.urlComponents["borough"]
self.navigationController?.pushViewController(socialServicesDetailViewController, animated: true)
}
// MARK: - PickerView Delegate
func numberOfComponents(in pickerView: UIPickerView) -> Int {
return self.pickerSelections.count
}
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return self.pickerSelections[component].count
}
func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView {
var pickerLabel = view as? UILabel
if (pickerLabel == nil) {
pickerLabel = UILabel()
pickerLabel?.font = UIFont.systemFont(ofSize: 16)
pickerLabel?.numberOfLines = 0
pickerLabel?.textAlignment = NSTextAlignment.center
}
pickerLabel?.text = pickerSelections[component][row]
switch component {
case 0:
pickerLabel?.backgroundColor = self.colorScheme._100
//pickerLabel?.backgroundColor = self.colorScheme.colorSchemeArrPickerViewBorough[row % self.colorScheme.colorSchemeArrPickerViewBorough.count]
case 1:
pickerLabel?.backgroundColor = self.colorScheme._300
//pickerLabel?.backgroundColor = self.colorScheme.colorSchemeArrPickerViewCategories[row % self.colorScheme.colorSchemeArrPickerViewCategories.count]
default:
break
}
return pickerLabel!
}
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
switch component {
case 0:
self.urlComponents["borough"] = self.boroughsDict[self.boroughKeys[row]]
case 1:
self.urlComponents["category"] = self.categoriesDict[self.catagoryKeys[row]]
default:
break
}
let url = buildUrlWithComponent(self.urlComponents)
APIRequestManager.shared.getSocialServices1(endPoint: url) { (socialServices1: [SocialService1]?) in
guard let validSocialServices1 = socialServices1 else { return }
DispatchQueue.main.async {
self.socialServices1 = validSocialServices1
self.socialSourceTableView.reloadData()
}
}
}
func buildUrlWithComponent(_ dict: [String: String]) -> String {
var base = "https://data.cityofnewyork.us/resource/386y-9exk.json?"
for value in dict.values {
if value != "All" {
base += "\(value)=Y&"
}
}
print(base)
return base
}
lazy var filterBarButton: UIBarButtonItem = {
let barButton = UIBarButtonItem()
barButton.title = "Filter"
return barButton
}()
lazy var containerView: UIView = {
let view = UIView()
return view
}()
lazy var filterPicker: UIPickerView = {
let pickerView = UIPickerView()
pickerView.dataSource = self
pickerView.delegate = self
return pickerView
}()
lazy var socialSourceTableView: UITableView = {
let tableView = UITableView()
tableView.estimatedRowHeight = 100
tableView.rowHeight = UITableViewAutomaticDimension
tableView.delegate = self
tableView.dataSource = self
tableView.backgroundColor = self.colorScheme._50
return tableView
}()
}
| [
-1
] |
39f17bdb0ef804de140ea2c40b991547d0496f57 | 78d42736931aae11ee2afb9aa3f773cc41f7122e | /WEIBO/WEIBO/Classes/Main/View/WBHTabbarView.swift | 8b1ae8c951bc0c746ca16d7503fda1f77a51f242 | [
"Apache-2.0"
] | permissive | wbh1013/wbh_weibo | 4f491a763e0f5f85d6db33c020266acaf5290e95 | 1c92af1a8bd17d05a9824f378d818ff08a2423c2 | refs/heads/master | 2021-05-07T04:01:01.291519 | 2017-12-04T03:39:29 | 2017-12-04T03:39:29 | 111,075,150 | 2 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,803 | swift | //
// WBHTabbarView.swift
// WEIBO
//
// Created by 王宝弘 on 2017/11/19.
// Copyright © 2017年 baohong. All rights reserved.
//
import UIKit
protocol WBHTabbarViewDelegate {
func buttonClick(fromBtn frombutton:WBHTabBarButton , inBtn inButto:WBHTabBarButton)
func addButtonClick()
}
class WBHTabbarView: UIView {
var buttonArray:[WBHTabBarButton]? = nil
var selectButton:WBHTabBarButton? = nil
var delegate:WBHTabbarViewDelegate? = nil
override init(frame: CGRect) {
super.init(frame: frame)
let buttonWidth:CGFloat = self.frame.size.width / 5
let buttonHeight:CGFloat = self.frame.size.height
//加号button
let addButton = UIButton(type: UIButtonType.custom)
addButton .addTarget(self, action: #selector(self.addButtonClick(addButton:)), for: UIControlEvents.touchDown)
addButton.bounds = CGRect(x:0 , y: 0, width: buttonHeight + 8, height: buttonHeight - 5)
addButton.setImage(UIImage.init(named: "tabbar_compose_icon_add"), for: UIControlState.normal)
addButton.setImage(UIImage.init(named: "tabbar_compose_icon_add_highlighted"), for: UIControlState.highlighted)
addButton.center = self.center
addButton.layer.cornerRadius = 3
addButton.layer.masksToBounds = true
addButton.backgroundColor = UIColor.orange
self.addSubview(addButton)
for i in 0...3 {
let button = WBHTabBarButton(type: UIButtonType.custom)
button.setTitle(self.titleArray[i], for: UIControlState.normal)
button.setTitleColor(WBHTools.colorWithHexString(hexString: "818181"), for: UIControlState.normal)
button.setImage(UIImage.init(named: self.buttonNomalImage[i]), for: UIControlState.normal)
button.setImage(UIImage.init(named: self.buttonSelectImage[i]), for: UIControlState.selected)
button.setImage(UIImage.init(named: self.buttonHightlightImage[i]), for: UIControlState.highlighted)
if i >= 2{
button.frame = CGRect(x: CGFloat(i + 1) * buttonWidth , y: 0, width: buttonWidth, height: buttonHeight)
}else{
if i == 0 {
selectButton = button;
selectButton?.isSelected = true
}
button.frame = CGRect(x: CGFloat(i) * buttonWidth , y: 0, width: buttonWidth, height: buttonHeight)
}
button.tag = i;
button.addTarget(self, action: #selector(self.buttonClick(button:)), for: UIControlEvents.touchDown)
self.addSubview(button)
}
}
//MARK - 加号按钮点击
@objc func addButtonClick(addButton:UIButton){
delegate?.addButtonClick()
}
//MARK - 按钮点击
@objc func buttonClick(button btn:WBHTabBarButton) {
if btn == selectButton {
return;
}
btn.isSelected = true
selectButton?.isSelected = false
selectButton = btn
delegate?.buttonClick(fromBtn: selectButton!, inBtn: btn)
}
//MARK - 懒加载
var titleArray:[String] = {
return ["微博","消息","发现","我"]
}()
var buttonNomalImage:[String] = {
return ["tabbar_home","tabbar_message_center","tabbar_discover","tabbar_profile"]
}()
var buttonSelectImage:[String] = {
return ["tabbar_home_selected","tabbar_message_center_selected","tabbar_discover_selected","tabbar_profile_selected"]
}()
var buttonHightlightImage:[String] = {
return ["tabbar_home_highlighted","tabbar_message_center_highlighted","tabbar_discover_highlighted","tabbar_profile_highlighted"]
}()
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
| [
-1
] |
f6acc9e154285e9905fc960d1f8405f862e0d141 | ee8d0918f423853b3a611cf63f00021c5623484f | /17-properties/final/Properties.playground/Contents.swift | 32b8595f846719dd3eb9f7143b082f246f31e6b7 | [] | no_license | nauaros/learn-swift | 1740668b59bd4b596b4460fb4935317a465dda22 | 141fe1e884d3cc95271a875f407c4f6a8090af0d | refs/heads/master | 2021-06-16T07:36:10.753862 | 2017-05-10T22:32:11 | 2017-05-10T22:32:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,699 | swift | import UIKit
struct Car {
let make: String
let color: String
}
enum Type {
case Work, Family, Friend
}
struct Contact {
var fullName: String
let emailAddress: String
var type: Type = .Friend
}
var person = Contact(fullName: "Grace Murray", emailAddress: "[email protected]", type: .Work)
let name = person.fullName // Grace Murray
let email = person.emailAddress // [email protected]
person.fullName = "Grace Hopper"
let grace = person.fullName // Grace Hopper
// Error: cannot assign a constant
// person.emailAddress = "[email protected]"
struct TV {
var height: Double
var width: Double
var diagonal: Int {
// 1
get {
// 2
return Int(round(sqrt(height * height + width * width)))
}
set {
// 3
let ratioWidth: Double = 16
let ratioHeight: Double = 9
// 4
height = Double(newValue) * ratioHeight /
sqrt(ratioWidth * ratioWidth + ratioHeight * ratioHeight)
width = height * ratioWidth / ratioHeight
}
}
}
var tv = TV(height: 53.93, width: 95.87)
let size = tv.diagonal // 110
tv.width = 53.93
let diagonal = tv.diagonal // 76
tv.diagonal = 70
let height = tv.height // 34.32...
let width = tv.width // 61.01...
struct Level {
static var highestLevel = 1
let id: Int
var boss: String
var unlocked: Bool {
didSet {
if unlocked && id > Level.highestLevel {
Level.highestLevel = id
}
}
}
}
let level1 = Level(id: 1, boss: "Chameleon", unlocked: true)
let level2 = Level(id: 2, boss: "Squid", unlocked: false)
let level3 = Level(id: 3, boss: "Chupacabra", unlocked: false)
let level4 = Level(id: 4, boss: "Yeti", unlocked: false)
let highestLevel = Level.highestLevel // 1
class GameManager {
// 1
static let defaultManager = GameManager()
var gameScore = 0
var saveState = 0
// 2
private init() {}
}
struct LightBulb {
static let maxCurrent = 40
var currentCurrent = 0 {
didSet {
if currentCurrent > LightBulb.maxCurrent {
print("Current too high, falling back to previous setting.")
currentCurrent = oldValue
}
}
}
}
var light = LightBulb()
light.currentCurrent = 50
var current = light.currentCurrent // 0
light.currentCurrent = 40
current = light.currentCurrent // 40
class Circle {
lazy var pi = {
return ((4.0 * atan(1.0 / 5.0)) - atan(1.0 / 239.0)) * 4.0
}()
var radius: Double = 0
var circumference: Double {
return pi * radius * 2
}
init (radius: Double) {
self.radius = radius
}
}
let circle = Circle(radius: 5)
let circumference = circle.circumference // 31.42
// also, pi now has a value
let pi = M_PI
| [
-1
] |
e53289feb1b28819c07f832513657e95a4153548 | c024408b0d29ce208b0429018a8676c6fab67b6c | /Splatoon 2 Stages/UITableViewCell+SelectedBackgroundColor.swift | 483e3e0517eac0316fed0811ea41d65107a5537d | [] | no_license | joshbirnholz/Stages-for-Splatoon-2 | adcb6f2cd529151816674711471dce178d1d60b4 | fa91391d080eaa1a363fa1d3f42c0456196e49b8 | refs/heads/master | 2021-01-21T22:39:20.908968 | 2018-10-04T00:34:58 | 2018-10-04T00:34:58 | 102,167,429 | 9 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 539 | swift | //
// UITableViewCell+SelectedBackgroundColor.swift
// Splatoon 2 Stages
//
// Created by Josh Birnholz on 9/8/17.
// Copyright © 2017 Joshua Birnholz. All rights reserved.
//
import UIKit
extension UITableViewCell {
@IBInspectable dynamic var selectedBackgroundColor: UIColor? {
get {
return selectedBackgroundView?.backgroundColor
}
set {
let backgroundView = UIView()
backgroundView.backgroundColor = newValue
backgroundView.layer.masksToBounds = true
self.selectedBackgroundView = backgroundView
}
}
}
| [
-1
] |
b543c440e11513f255ddc62f6e241d5641ac2c09 | d71c1b3b233e11e42574268393fcd6580cff53eb | /Sources/Views/ALKLinkView.swift | 2239c423b4fb0fd97d3f204b0906339ff3133c77 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | djlim0527/ApplozicSwift | 8f2e0919585eb1e0d67172f726303b83b1c152a5 | 409c301bef131bda3ae9e8869d3b6941005079a2 | refs/heads/master | 2020-12-27T13:55:21.231957 | 2020-12-08T02:51:16 | 2020-12-08T02:51:16 | 237,925,817 | 0 | 0 | BSD-3-Clause | 2020-09-23T02:07:55 | 2020-02-03T09:13:10 | Swift | UTF-8 | Swift | false | false | 7,219 | swift | import Foundation
import Kingfisher
class ALKLinkView: UIView, Localizable {
enum CommonPadding {
enum View {
static let height: CGFloat = 90
}
enum PreviewImageView {
static let top: CGFloat = 5
static let leading: CGFloat = 5
static let bottom: CGFloat = 5
static let width: CGFloat = 80
}
enum TitleLabel {
static let top: CGFloat = 5
static let leading: CGFloat = 5
static let trailing: CGFloat = 5
}
enum DescriptionLabel {
static let top: CGFloat = 2
static let leading: CGFloat = 5
static let trailing: CGFloat = 5
}
}
var isViewCellVisible: ((_ identifier: String) -> Bool)?
var localizedStringFileName: String!
func setLocalizedStringFileName(_ localizedStringFileName: String) {
self.localizedStringFileName = localizedStringFileName
}
let loadingIndicator = ALKLoadingIndicator(frame: .zero, color: UIColor.gray)
var titleLabel: UILabel = {
let label = UILabel(frame: CGRect.zero)
label.textColor = UIColor(red: 20, green: 19, blue: 19)
label.font = UIFont.font(.medium(size: 18))
label.numberOfLines = 2
return label
}()
var frontView: ALKTappableView = {
let view = ALKTappableView()
view.isUserInteractionEnabled = true
view.backgroundColor = .clear
return view
}()
var descriptionLabel: UILabel = {
let label = UILabel(frame: CGRect.zero)
label.numberOfLines = 3
label.textColor = UIColor(red: 121, green: 116, blue: 116)
label.font = UIFont.font(.light(size: 14))
return label
}()
let previewImageView: UIImageView = {
let imageView = UIImageView(frame: CGRect.zero)
imageView.image = UIImage(named: "default_image", in: Bundle.applozic, compatibleWith: nil)
imageView.backgroundColor = .clear
return imageView
}()
init() {
super.init(frame: .zero)
setupConstraintAndView()
}
@available(*, unavailable)
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setupConstraintAndView() {
addViewsForAutolayout(views: [titleLabel, descriptionLabel, previewImageView, loadingIndicator, frontView])
isUserInteractionEnabled = true
layer.borderWidth = 0.5
layer.borderColor = UIColor.lightGray.cgColor
clipsToBounds = true
bringSubviewToFront(frontView)
frontView.topAnchor.constraint(equalTo: topAnchor).isActive = true
frontView.leadingAnchor.constraint(equalTo: leadingAnchor).isActive = true
frontView.trailingAnchor.constraint(equalTo: trailingAnchor).isActive = true
frontView.bottomAnchor.constraint(equalTo: bottomAnchor).isActive = true
previewImageView.topAnchor.constraint(equalTo: topAnchor, constant: CommonPadding.PreviewImageView.top).isActive = true
previewImageView.leadingAnchor.constraint(equalTo: leadingAnchor, constant: CommonPadding.PreviewImageView.leading).isActive = true
previewImageView.widthAnchor.constraint(equalToConstant: CommonPadding.PreviewImageView.width).isActive = true
previewImageView.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -CommonPadding.PreviewImageView.bottom).isActive = true
titleLabel.topAnchor.constraint(equalTo: topAnchor, constant: CommonPadding.TitleLabel.top).isActive = true
titleLabel.leadingAnchor.constraint(equalTo: previewImageView.trailingAnchor, constant: CommonPadding.TitleLabel.leading).isActive = true
titleLabel.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -CommonPadding.TitleLabel.trailing).isActive = true
descriptionLabel.topAnchor.constraint(equalTo: titleLabel.bottomAnchor, constant: CommonPadding.DescriptionLabel.top).isActive = true
descriptionLabel.leadingAnchor.constraint(equalTo: previewImageView.trailingAnchor, constant: CommonPadding.DescriptionLabel.leading).isActive = true
descriptionLabel.trailingAnchor.constraint(equalTo: trailingAnchor, constant:
-CommonPadding.DescriptionLabel.trailing).isActive = true
descriptionLabel.bottomAnchor.constraint(lessThanOrEqualTo: bottomAnchor).isActive = true
loadingIndicator.trailingAnchor.constraint(equalTo: trailingAnchor).isActive = true
loadingIndicator.topAnchor.constraint(equalTo: topAnchor).isActive = true
loadingIndicator.leadingAnchor.constraint(equalTo: previewImageView.leadingAnchor).isActive = true
loadingIndicator.bottomAnchor.constraint(equalTo: bottomAnchor).isActive = true
}
func update(url: String?, identifier: String) {
loadingIndicator.startLoading(localizationFileName: localizedStringFileName)
hideViews(true)
guard let linkUrl = url else {
loadingIndicator.stopLoading()
hideViews(false)
return
}
guard let cachelinkPreviewMeta = LinkURLCache.getLink(for: linkUrl) else {
let linkview = ALKLinkPreviewManager()
linkview.makePreview(from: linkUrl, identifier: identifier) { [weak self] result in
guard let weakSelf = self, let isViewCellVisible = weakSelf.isViewCellVisible, isViewCellVisible(identifier) else { return }
switch result {
case let .success(linkPreviewMeta):
weakSelf.updateView(linkPreviewMeta: linkPreviewMeta)
case .failure:
weakSelf.updateFailedStatusInView()
weakSelf.loadingIndicator.stopLoading()
}
}
return
}
updateView(linkPreviewMeta: cachelinkPreviewMeta)
}
func hideViews(_ isHide: Bool) {
previewImageView.isHidden = isHide
titleLabel.isHidden = isHide
descriptionLabel.isHidden = isHide
}
class func height() -> CGFloat {
return ALKLinkView.CommonPadding.View.height + ALKLinkView.CommonPadding.PreviewImageView.top
}
func updateView(linkPreviewMeta: LinkPreviewMeta) {
let placeHolder = UIImage(named: "default_image", in: Bundle.applozic, compatibleWith: nil)
if let stringURL = linkPreviewMeta.image ?? linkPreviewMeta.icon, let url = URL(string: stringURL) {
let resource = ImageResource(downloadURL: url, cacheKey: url.absoluteString)
previewImageView.kf.setImage(with: resource, placeholder: placeHolder)
} else {
previewImageView.image = placeHolder
}
titleLabel.text = linkPreviewMeta.title
descriptionLabel.text = linkPreviewMeta.description ?? linkPreviewMeta.getBaseURl(url: linkPreviewMeta.url.absoluteString)
hideViews(false)
loadingIndicator.stopLoading()
}
func updateFailedStatusInView() {
hideViews(false)
titleLabel.text = localizedString(forKey: "FailedToLoadLink", withDefaultValue: SystemMessage.Information.FailedToLoadLink, fileName: localizedStringFileName)
}
}
| [
-1
] |
1ab1c41792ef96ec16c38a50c1a34ea3c1336d33 | 6491a68fe21982101f980f0c1f2b3304635b9165 | /Groupic/SearchPlaylistTableViewController.swift | f397a10f75f3b51c04a612d8a68397941758e44f | [] | no_license | ajbronson/Groupick | 37fac05b2251c132383f9c5c098b277dde0f6f6a | e514744e234e82e24bb56c6ff2e1befe30ae1fef | refs/heads/master | 2021-01-22T17:33:47.963196 | 2016-08-15T16:40:40 | 2016-08-15T16:40:40 | 62,759,452 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,780 | swift | //
// SearchPlaylistTableViewController.swift
// Groupic
//
// Created by AJ Bronson on 6/17/16.
// Copyright © 2016 PrecisionCodes. All rights reserved.
//
import UIKit
import CloudKit
class SearchPlaylistTableViewController: UITableViewController, UISearchResultsUpdating, UISearchBarDelegate, dismissProtocol {
var searchController: UISearchController?
override func viewDidLoad() {
super.viewDidLoad()
setUpSearchController()
self.navigationController?.toolbarHidden = true
}
func setUpSearchController() {
let resultsController = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("playlistResultsView")
searchController = UISearchController(searchResultsController: resultsController)
guard let searchController = searchController else { return }
searchController.searchResultsUpdater = self
searchController.searchBar.placeholder = "Search"
searchController.definesPresentationContext = true
searchController.searchBar.delegate = self
}
func searchBarCancelButtonClicked(searchBar: UISearchBar) {
navigationController?.popViewControllerAnimated(false)
}
func updateSearchResultsForSearchController(searchController: UISearchController) {
guard let text = searchController.searchBar.text?.lowercaseString,
let resultsViewController = searchController.searchResultsController as? SearchPlaylistResultsTableViewController where text.characters.count > 0 else { return }
UIApplication.sharedApplication().networkActivityIndicatorVisible = true
resultsViewController.delegate = self
resultsViewController.resultPlaylists = [TempPlaylist]()
searchCloudKit(text) { (playlists) in
dispatch_async(dispatch_get_main_queue(), {
resultsViewController.resultPlaylists = playlists
resultsViewController.tableView.reloadData()
})
}
}
func searchCloudKit(searchText: String, completion: ([TempPlaylist]) -> Void) {
if let userRecord = UserController.getUser()?.cloudKitRecord {
let creatorReference = CKReference(record: userRecord, action: .None)
let predicate = NSPredicate(format: "creator != %@ && self contains %@", argumentArray: [creatorReference, searchText])
var arrayPlaylist = [TempPlaylist]()
CloudKitManager.sharedManager.fetchRecordsWithType("Playlist", predicate: predicate, recordFetchedBlock: nil) { (records, error) in
if let records = records {
for record in records {
let tempPlaylist = TempPlaylist(record: record)
if let tempPlaylist = tempPlaylist {
arrayPlaylist.append(tempPlaylist)
}
}
}
completion(arrayPlaylist)
UIApplication.sharedApplication().networkActivityIndicatorVisible = false
}
}
}
// MARK: - Table view data source
override func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let header = UIView()
guard let searchBar = self.searchController?.searchBar else { return UIView() }
header.addSubview(searchBar)
return header
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 0
}
@IBAction func cancelButtonTapped(sender: UIBarButtonItem) {
navigationController?.popViewControllerAnimated(true)
}
func dismiss() {
navigationController?.popViewControllerAnimated(true)
}
}
| [
-1
] |
2f50b0952728730acae4f38f215230bcb15c3d57 | e8c0e70c89128487eba9d31496db17c5582b13c8 | /SwiftBilibili/Sources/Modulars/Home/Views/Live/LiveRoundRoomCell.swift | 82cfe3dd0511042de4c9585250c94a6c87b3ce78 | [
"MIT"
] | permissive | chongbo2013/SwiftBilibili | ea23cc2d7fd8fc00861863bbd51fb4c7817050ae | d6d0197dba285485af1b8c7a3024452895bb3ca7 | refs/heads/master | 2020-12-06T21:43:46.352693 | 2018-09-10T10:08:54 | 2018-09-10T10:08:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,877 | swift | //
// LiveRoundRoomCell.swift
// SwiftBilibili
//
// Created by 罗文 on 2018/3/26.
// Copyright © 2018年 罗文. All rights reserved.
//
import UIKit
import ReactorKit
final class LiveRoundRoomCell: BaseCollectionViewCell,View {
// MARK: UI
private let coverImageView = UIImageView().then{
$0.isUserInteractionEnabled = true
$0.cornerRadius = kCornerRadius
}
private let shadowImageView = UIImageView().then{
$0.image = Image.Home.shadow
}
private let anchorNameLabel = UILabel().then{
$0.textColor = .db_white
$0.font = Font.SysFont.sys_12
}
private let liveTitleLabel = UILabel().then{
$0.font = Font.SysFont.sys_14
$0.textColor = .db_black
}
override func initialize() {
contentView.addSubview(coverImageView)
contentView.addSubview(liveTitleLabel)
coverImageView.addSubview(shadowImageView)
shadowImageView.addSubview(anchorNameLabel)
}
func bind(reactor: LiveRoundRoomCellReactor) {
let placeholderSize = CGSize(width: self.width, height: self.height * 0.6)
reactor.state.map{$0.coverURL}
.bind(to: coverImageView.rx.image(placeholder: .placeholderImage(bgSize:placeholderSize)))
.disposed(by: disposeBag)
reactor.state.map{$0.liveTitle}
.distinctUntilChanged()
.bind(to: liveTitleLabel.rx.text)
.disposed(by: disposeBag)
reactor.state.map{$0.anchorName}
.distinctUntilChanged()
.bind(to: anchorNameLabel.rx.text)
.disposed(by: disposeBag)
reactor.state.map { _ in }
.bind(to: self.rx.setNeedsLayout)
.disposed(by: disposeBag)
}
// MARK: Layout
override func layoutSubviews() {
super.layoutSubviews()
let leftMargin = reactor!.live.isLeft ? kCollectionItemPadding : kCollectionItemPadding/2
let rightMargin = reactor!.live.isLeft ? -kCollectionItemPadding/2 : -kCollectionItemPadding
coverImageView.snp.remakeConstraints { (make) in
make.top.equalTo(10)
make.left.equalTo(leftMargin)
make.right.equalTo(rightMargin)
make.height.equalTo(kLiveItemHeight*0.6)
}
shadowImageView.snp.makeConstraints { (make) in
make.left.right.bottom.equalToSuperview()
make.height.equalTo(kShadowImageHeight)
}
anchorNameLabel.snp.makeConstraints { (make) in
make.left.equalTo(5)
make.bottom.equalTo(-5)
}
liveTitleLabel.snp.makeConstraints { (make) in
make.left.right.equalTo(coverImageView)
make.top.equalTo(coverImageView.snp.bottom).offset(10)
}
}
}
| [
-1
] |
dd99f5b14fd590455b2f370403062cc5d50ec775 | 8854ece662458a8862c5de112061eba473500855 | /SimpleTable/SimpleTable/AppDelegate.swift | 94453d031a8cedea05a1a09faeb9c0dffa5c7bb2 | [] | no_license | choidam/ToyProject | 93c767c88831611aa407a31c700c1d02b2e142ff | d945d5049391063508b528aa6ceb97cf23d75b45 | refs/heads/master | 2022-07-31T11:06:53.257466 | 2020-05-24T18:08:55 | 2020-05-24T18:08:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,417 | swift | //
// AppDelegate.swift
// SimpleTable
//
// Created by 최은지 on 13/03/2020.
// Copyright © 2020 최은지. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
| [
393222,
393224,
393230,
393250,
344102,
393261,
393266,
213048,
376889,
385081,
393275,
376905,
327756,
254030,
286800,
368727,
180313,
368735,
180320,
376931,
286831,
286844,
262283,
286879,
286888,
377012,
327871,
377036,
180431,
377046,
377060,
327914,
205036,
393456,
393460,
418043,
336123,
336128,
385280,
262404,
180490,
368911,
262416,
262422,
377117,
262436,
336180,
262454,
262472,
344403,
213332,
65880,
418144,
262496,
262499,
213352,
246123,
262507,
262510,
213372,
385419,
393612,
262550,
262552,
385440,
385443,
385451,
262573,
393647,
385458,
262586,
344511,
262592,
360916,
369118,
328177,
328179,
328182,
328189,
328192,
164361,
410128,
393747,
254490,
188958,
385570,
33316,
197159,
377383,
352821,
188987,
418363,
369223,
385609,
385616,
352856,
352864,
369253,
262760,
352874,
352887,
254587,
336512,
377472,
148105,
377484,
352918,
98968,
344744,
361129,
336555,
385713,
434867,
164534,
336567,
328378,
164538,
328386,
352968,
344776,
418507,
352971,
385742,
385748,
361179,
139997,
189153,
369381,
361195,
418553,
344831,
336643,
344835,
344841,
361230,
336659,
418580,
418585,
434970,
369435,
418589,
418593,
336675,
328484,
418598,
418605,
336696,
361273,
328515,
336708,
328519,
336711,
336714,
328522,
426841,
254812,
361309,
197468,
361315,
361322,
328573,
377729,
369542,
361360,
222128,
345035,
345043,
386003,
386011,
386018,
386022,
435187,
328702,
328714,
361489,
386069,
336921,
386073,
336925,
345118,
377887,
345133,
345138,
386101,
197707,
189520,
345169,
156761,
361567,
148578,
345199,
386167,
361593,
410745,
361598,
214149,
345222,
386186,
337047,
345246,
214175,
337071,
337075,
386258,
328924,
66782,
222437,
328941,
386285,
386291,
345376,
353570,
345379,
410917,
345382,
337205,
345399,
378169,
369978,
337222,
337229,
337234,
263508,
402791,
345448,
271730,
378227,
271745,
181638,
353673,
181643,
181649,
181654,
230809,
181673,
181681,
337329,
181684,
361917,
181696,
337349,
337365,
271839,
329191,
361960,
329194,
116210,
337398,
329226,
419339,
419343,
419349,
345625,
419355,
370205,
419359,
394786,
419362,
370213,
419368,
419376,
206395,
214593,
419400,
419402,
353867,
419406,
214610,
419410,
345701,
394853,
222830,
370297,
403070,
403075,
345736,
198280,
345749,
345757,
345762,
419491,
345765,
419497,
419501,
370350,
419506,
419509,
419512,
337592,
337599,
419527,
419530,
419535,
272081,
419542,
394966,
419544,
181977,
345818,
419547,
419550,
419559,
337642,
419563,
337645,
337659,
141051,
337668,
362247,
395021,
362255,
116509,
345887,
378663,
345905,
354106,
354111,
247617,
354117,
370503,
329544,
345930,
370509,
354130,
247637,
337750,
370519,
313180,
354142,
345967,
345970,
345974,
403320,
354172,
247691,
337808,
247700,
329623,
436126,
436132,
337833,
362413,
337844,
346057,
247759,
346063,
329697,
354277,
190439,
247789,
354313,
346139,
436289,
378954,
395339,
338004,
100453,
329832,
329855,
329867,
329885,
411805,
346272,
362660,
100524,
387249,
379066,
387260,
256191,
346316,
411861,
411864,
411868,
411873,
379107,
411876,
387301,
346343,
338152,
387306,
387312,
346355,
436473,
321786,
379134,
411903,
379152,
387349,
338199,
387352,
182558,
338211,
395566,
362822,
436555,
190796,
354673,
321910,
248186,
420236,
379278,
354727,
338352,
330189,
338381,
338386,
338403,
338409,
248308,
199164,
330252,
199186,
420376,
330267,
354855,
10828,
199249,
174695,
248425,
191084,
338543,
191092,
346742,
354974,
150183,
174774,
248504,
174777,
223934,
355024,
273108,
355028,
264918,
183005,
256734,
338660,
338664,
264941,
363251,
207619,
264964,
338700,
256786,
199452,
363293,
396066,
346916,
215853,
355122,
355131,
355140,
355143,
338763,
355150,
330580,
355166,
265055,
355175,
355179,
330610,
330642,
355218,
412599,
207808,
379848,
330710,
248792,
248798,
347105,
257008,
183282,
265207,
330748,
330760,
330768,
248862,
396328,
158761,
199728,
330800,
339001,
388154,
388161,
347205,
248904,
330826,
248914,
183383,
339036,
412764,
257120,
248951,
420984,
330889,
347287,
248985,
339097,
44197,
380070,
339112,
249014,
126144,
330958,
330965,
265432,
388319,
388347,
175375,
159005,
175396,
208166,
273708,
372015,
347441,
372018,
199988,
175415,
396600,
437566,
175423,
437570,
437575,
437583,
331088,
437587,
331093,
396633,
175450,
437595,
175457,
208227,
175460,
175463,
265580,
437620,
175477,
249208,
175483,
175486,
249214,
175489,
249218,
249227,
175513,
175516,
396705,
175522,
355748,
380332,
396722,
388542,
372163,
216517,
380360,
216522,
339404,
372176,
208337,
339412,
413141,
339417,
249308,
339420,
339424,
339428,
339434,
249328,
69113,
372228,
339461,
208398,
380432,
175635,
265778,
265795,
396872,
265805,
224853,
224857,
257633,
224870,
372327,
257646,
372337,
224884,
224887,
224890,
224894,
224897,
372353,
216707,
126596,
421508,
224904,
224909,
11918,
159374,
224913,
126610,
339601,
224916,
224919,
126616,
224922,
208538,
224926,
224929,
224932,
224936,
257704,
224942,
257712,
224947,
257716,
257720,
224953,
257724,
224959,
257732,
224965,
224969,
339662,
224975,
257747,
224981,
224986,
257761,
224993,
257764,
224999,
339695,
225012,
257787,
225020,
339710,
257790,
225025,
257801,
339721,
257804,
225038,
257807,
225043,
372499,
167700,
225048,
257819,
225053,
184094,
225058,
339747,
257833,
225066,
257836,
413484,
225070,
225073,
372532,
257845,
225079,
225082,
397115,
225087,
225092,
225096,
323402,
257868,
225103,
257871,
397139,
225108,
257883,
257886,
225119,
257890,
339814,
225127,
257896,
274280,
257901,
225137,
339826,
257908,
225141,
257912,
257916,
225148,
257920,
225155,
339844,
225165,
225170,
380822,
225175,
225180,
118691,
184244,
372664,
372702,
372706,
356335,
380918,
405533,
430129,
421960,
356439,
430180,
421990,
356466,
266362,
381068,
225423,
250002,
250004,
225429,
356506,
225437,
135327,
225441,
438433,
225444,
438436,
225447,
438440,
225450,
258222,
225455,
225458,
225461,
225466,
389307,
225470,
381120,
372929,
430274,
225475,
389320,
225484,
225487,
225490,
225493,
225496,
225499,
225502,
225505,
356578,
225510,
217318,
225514,
225518,
372976,
381176,
389380,
356637,
356640,
356643,
356646,
356649,
356655,
332080,
340275,
356660,
397622,
332090,
225597,
332097,
201028,
348488,
332106,
332117,
348502,
250199,
250202,
332125,
250210,
332152,
389502,
250238,
332161,
356740,
332172,
373145,
340379,
389550,
324030,
340451,
160234,
127471,
340472,
324094,
266754,
324099,
324102,
324111,
340500,
324117,
324131,
332324,
381481,
356907,
324139,
324142,
356916,
324149,
324155,
348733,
324160,
324164,
356934,
348743,
381512,
324170,
324173,
324176,
389723,
332380,
381545,
340627,
184982,
258721,
332453,
332459,
389805,
332463,
381617,
332471,
332483,
332486,
332493,
357069,
357073,
332511,
332520,
340718,
332533,
348924,
389892,
373510,
389926,
152370,
348978,
340789,
348982,
398139,
127814,
357206,
389978,
430939,
357211,
357214,
201579,
201582,
349040,
340849,
201588,
430965,
381813,
324472,
398201,
340858,
324475,
430972,
340861,
324478,
119674,
324481,
373634,
324484,
324487,
381833,
324492,
324495,
324498,
430995,
324501,
324510,
422816,
324513,
201637,
398245,
324524,
340909,
324533,
324538,
324541,
398279,
340939,
340941,
340957,
431072,
398306,
340963,
209895,
201711,
349172,
381946,
349180,
439294,
431106,
209943,
209946,
250914,
185380,
357418,
209965,
209968,
209971,
209975,
209979,
209987,
209990,
341071,
349267,
250967,
210010,
341091,
210025,
210027,
210030,
210039,
341113,
349308,
210044,
349311,
152703,
160895,
210052,
349319,
210055,
210067,
210071,
210077,
210080,
251044,
210084,
185511,
210088,
210095,
210098,
210107,
210115,
332997,
333009,
210131,
333014,
210138,
218354,
218360,
251128,
275712,
275715,
275721,
349459,
333078,
251160,
349484,
349491,
251189,
415033,
251210,
357708,
210260,
365911,
259421,
365921,
333154,
251235,
374117,
333162,
234866,
390516,
333175,
357755,
251271,
136590,
112020,
349590,
357792,
259515,
415166,
415185,
366034,
366038,
423392,
333284,
366056,
366061,
210420,
423423,
366117,
144939,
210487,
349761,
415300,
333386,
333399,
366172,
333413,
423528,
423532,
210544,
415353,
333439,
415361,
267909,
210631,
333511,
358099,
153302,
333534,
366307,
366311,
431851,
366318,
210672,
366321,
366325,
210695,
210698,
366348,
210706,
399128,
333594,
210719,
358191,
366387,
399159,
358200,
325440,
366401,
341829,
325446,
46920,
341834,
341838,
341843,
415573,
341851,
350045,
399199,
259938,
399206,
268143,
358255,
399215,
358259,
341876,
243579,
325504,
333698,
333708,
333724,
382890,
350146,
333774,
358371,
350189,
350193,
333818,
350202,
350206,
350213,
268298,
350224,
350231,
333850,
350237,
350240,
350244,
350248,
178218,
350251,
350256,
350259,
350271,
243781,
350285,
374864,
342111,
342133,
374902,
432271,
333997,
334011,
260289,
260298,
350410,
350416,
350422,
211160,
350425,
268507,
334045,
350445,
375026,
358644,
350458,
350461,
350464,
325891,
350467,
350475,
350480,
432405,
350486,
350490,
325914,
325917,
350493,
350498,
350504,
358700,
350509,
391468,
358704,
358713,
358716,
383306,
383321,
383330,
383333,
391530,
383341,
334203,
268668,
194941,
391563,
366990,
416157,
342430,
268701,
375208,
326058,
375216,
334262,
334275,
326084,
358856,
334304,
334311,
375277,
334321,
350723,
186897,
342545,
334358,
342550,
342554,
334363,
350761,
252461,
334384,
383536,
358961,
334394,
252482,
219718,
334407,
334420,
350822,
375400,
334465,
334468,
162445,
326290,
342679,
342683,
260766,
342710,
244409,
260797,
260801,
350917,
154317,
391894,
154328,
416473,
64230,
113388,
342766,
375535,
203506,
342776,
391937,
391948,
375568,
326416,
375571,
162591,
326441,
326451,
326454,
326460,
244540,
260924,
375612,
326467,
244551,
326473,
326477,
326485,
416597,
326490,
342874,
326502,
375656,
433000,
326507,
326510,
211825,
211831,
351097,
392060,
359295,
351104,
342915,
400259,
236430,
342930,
252822,
392091,
400285,
252836,
359334,
211884,
400306,
351168,
359361,
326598,
359366,
359382,
383967,
343015,
359407,
261108,
244726,
261111,
383997,
261129,
359451,
261147,
211998,
261153,
261159,
359470,
359476,
343131,
384098,
384101,
384107,
367723,
187502,
343154,
384114,
212094,
351364,
384143,
351381,
384160,
384168,
367794,
384181,
384191,
351423,
326855,
244937,
343244,
146642,
359649,
343270,
351466,
351479,
343306,
261389,
359694,
261393,
245020,
245029,
171302,
351534,
376110,
245040,
425276,
384323,
212291,
343365,
212303,
367965,
343393,
343398,
367980,
343409,
253303,
154999,
343417,
327034,
245127,
384397,
245136,
245142,
245145,
343450,
245148,
245151,
245154,
245157,
245162,
327084,
359865,
384443,
146876,
327107,
384453,
327110,
327115,
327117,
359886,
359890,
343507,
368092,
343534,
343539,
368119,
343544,
368122,
409091,
359947,
359955,
359983,
343630,
327275,
245357,
138864,
155254,
155273,
245409,
425638,
425649,
155322,
425662,
155327,
155351,
155354,
212699,
155363,
245475,
245483,
409335,
155393,
155403,
245525,
155422,
360223,
155438,
155442,
155447,
155461,
360261,
376663,
155482,
261981,
425822,
155487,
376671,
155490,
155491,
327531,
261996,
376685,
261999,
262002,
327539,
262005,
147317,
425845,
262008,
262011,
155516,
155521,
155525,
360326,
376714,
155531,
262027,
262030,
262033,
262036,
262039,
262042,
155549,
262045,
262048,
262051,
327589,
155559,
155562,
155565,
393150,
384977,
393169,
155611,
155619,
253923,
155621,
253926,
327654,
393203,
360438,
253943,
393206,
393212,
155646
] |
e82ea82861ce7e0bcd83a62f4f0665730f639ab0 | 82fd1fab5cd96b4a755fd3a8882196ef20ab5f05 | /Roomies/TaskViewController.swift | 95d6d37ffe2c6d08b7d82a9642f075f5e18cc7de | [] | no_license | migue19/Roomies-App | 6cfe52a3d7504b6c840deb66732ef499a4e57ef7 | 883dbb38a84d52051207c9d6cbba387d4c6f72a8 | refs/heads/master | 2020-06-17T04:58:00.040771 | 2019-07-08T12:10:54 | 2019-07-08T12:10:54 | 195,804,670 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 743 | swift | //
// TaskViewController.swift
// Roomies
//
// Created by Miguel Mexicano on 07/07/19.
// Copyright © 2019 Miguel Mexicano. All rights reserved.
//
import UIKit
class TaskViewController: UIViewController {
let task = ["Aseo de Sala".]
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.
}
*/
}
| [
-1
] |
44372b356b06535e62b65334386036761508e386 | 2f705ef194f0e17944477160ce3ce9dd8d44d9fd | /ios/TD MyLevelUp/modules/investing/ui/cells/CandleStickChartCell.swift | ac493b1cf1f896708e6bec249efc62897f7adb83 | [] | no_license | simubank/project13-spaceinvaders | 303156199fb91e28e56da0d38fe28887ab4d91b7 | 21b2bc3d44dc2f1617e3df24a52718f78e7c48ee | refs/heads/master | 2020-03-22T05:52:10.178115 | 2018-07-26T13:56:00 | 2018-07-26T13:56:00 | 139,595,662 | 5 | 0 | null | 2018-07-22T19:06:42 | 2018-07-03T14:29:50 | Kotlin | UTF-8 | Swift | false | false | 2,084 | swift | import Foundation
import Charts
import UIKit
class CandleStickChartCell: TDBaseCell {
public var chartView: CandleStickChartView = {
let chartView = CandleStickChartView()
chartView.chartDescription?.enabled = false
chartView.dragEnabled = false
chartView.setScaleEnabled(true)
chartView.maxVisibleCount = 200
chartView.pinchZoomEnabled = true
chartView.legend.enabled = false
chartView.legend.font = UIFont(name: "HelveticaNeue-Light", size: 10)!
chartView.leftAxis.labelFont = UIFont(name: "HelveticaNeue-Light", size: 10)!
chartView.leftAxis.spaceTop = 0.3
chartView.leftAxis.spaceBottom = 0.3
chartView.leftAxis.drawGridLinesEnabled = false
chartView.rightAxis.enabled = false
chartView.xAxis.labelPosition = .bottom
chartView.xAxis.labelFont = UIFont(name: "HelveticaNeue-Light", size: 10)!
chartView.xAxis.drawGridLinesEnabled = false
return chartView
}()
public override func prepareViews() {
contentView.addSubview(chartView)
chartView.snp.makeConstraints {
$0.top.equalToSuperview().offset(kDefaultPadding)
$0.left.equalToSuperview().offset(kDefaultPadding)
$0.right.equalToSuperview().offset(-kDefaultPadding)
$0.bottom.equalToSuperview().offset(-kDefaultPadding)
}
}
func setData(stockName: String, data: [CandleChartDataEntry]?) {
let set1 = CandleChartDataSet(values: data, label: "\(stockName.uppercased()) Stock")
set1.axisDependency = .left
set1.setColor(UIColor(white: 80/255, alpha: 1))
set1.drawIconsEnabled = false
set1.shadowColor = .darkGray
set1.shadowWidth = 0.7
set1.decreasingColor = .red
set1.decreasingFilled = true
set1.increasingColor = .primary
set1.increasingFilled = true
set1.neutralColor = .blue
set1.drawValuesEnabled = false
let data = CandleChartData(dataSet: set1)
chartView.data = data
}}
| [
-1
] |
92a7a741d116c77756e231acf502852c2d1ee1f8 | 2095836833e7919eb820c0c9e5e5634bf5d6ec5f | /PomodoroTimerTests/PomodoroTimerTests.swift | f1bdb983ae63444f0845f39e9bf8c281131fd1fd | [] | no_license | ma2haru/pomodoroApp | 23ac4d67aa60a283e8ea1aa2f2c0783786c9c4a8 | e12aaff1b9f566421982e8ef19f9bff4041ad0be | refs/heads/master | 2020-05-14T04:12:43.153129 | 2019-04-16T13:35:36 | 2019-04-16T13:35:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 938 | swift | //
// PomodoroTimerTests.swift
// PomodoroTimerTests
//
// Created by matsumoto miharu on 2018/12/26.
// Copyright © 2018年 ポモポモ. All rights reserved.
//
import XCTest
@testable import PomodoroTimer
class PomodoroTimerTests: 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,
306692,
306693,
320516,
323087,
323089,
324625,
175639,
374296,
320536,
317467,
305179,
241692,
333343,
182817,
315434,
102445,
241716,
319542,
325694,
21569,
314436,
243274,
254027,
163917,
311374,
333393,
224851,
242273,
242277,
329829,
244327,
315497,
315498,
243307,
204397,
316526,
325231,
313971,
353397,
337017,
323196,
325245,
337535,
312965,
323207,
330888,
184973,
319629,
241808,
316049,
324760,
332446,
311458,
61101,
318639,
321199,
318130,
321207,
109241,
319162,
339130,
322749,
327358,
333509,
353482,
212685,
283853,
333520,
321745,
242386,
333523,
333011,
241365,
96984,
334042,
318173,
327904,
321249,
325346,
342763,
328940,
322291,
312052,
353523,
323316,
325371,
319233,
320770,
242954,
117517,
312079,
325905,
323346,
338197,
245019,
325404,
241441,
208164,
318250,
325931,
318252,
353069,
321840,
328499,
171317,
326966,
318775,
321337,
345402,
345403,
312634,
312635,
319292,
332089,
315202,
193859,
319813,
325445,
345415,
353095,
159562,
177484,
319821,
325968,
366929,
325457,
318805,
305495,
244568,
244570,
332123,
188251,
322395,
109409,
293730,
242529,
351077,
242023,
333160,
325484,
242029,
306542,
246127,
243056,
327024,
242541,
316787,
116084,
249204,
249205,
109428,
241528,
246137,
269178,
325503,
318848,
339841,
248194,
313727,
188292,
241540,
240518,
243591,
332167,
67463,
316298,
311691,
317323,
308107,
304524,
108944,
326553,
317852,
121245,
240544,
315810,
333220,
333735,
240552,
353195,
377264,
200627,
338356,
150965,
326581,
311738,
326587,
98239,
353216,
330689,
304577,
324039,
326601,
373197,
310748,
242148,
195045,
313319,
311786,
412651,
54765,
320494,
329712,
325619,
333300,
333303,
320507,
318461
] |
60c289ef76ab4f42106cff0a371a21228f7a6c73 | ba02222b45638531b3226b966a37757fdd1c368e | /CarStats/AppDelegate.swift | b84f8f2fb6c6010aa25199211b97d0d6b8d09226 | [] | no_license | theresamhoyt/CarStats | 2490032a041bf86a7fff02ab47707b8748b84d85 | f22b32cbc6f452f3dab977a51c9834d8b39990b2 | refs/heads/master | 2016-09-12T16:18:29.885331 | 2016-05-13T19:59:05 | 2016-05-13T19:59:05 | 57,406,049 | 0 | 0 | null | 2016-05-14T12:33:35 | 2016-04-29T18:49:05 | Swift | UTF-8 | Swift | false | false | 3,486 | swift | //
// AppDelegate.swift
// CarStats
//
// Created by Theresa Hoyt on 4/29/16.
// Copyright © 2016 Theresa Hoyt. All rights reserved.
//
import UIKit
import CoreData
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDelegate{
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
let splitViewController = self.window!.rootViewController as! UISplitViewController
let navigationController = splitViewController.viewControllers[splitViewController.viewControllers.count-1] as! UINavigationController
navigationController.topViewController!.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem()
splitViewController.delegate = self
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:.
// I Andrew added the line below to implement core data.
//saveContext()
}
// MARK: - Split view
func splitViewController(splitViewController: UISplitViewController, collapseSecondaryViewController secondaryViewController:UIViewController, ontoPrimaryViewController primaryViewController:UIViewController) -> Bool {
guard let secondaryAsNavController = secondaryViewController as? UINavigationController else { return false }
guard let topAsDetailController = secondaryAsNavController.topViewController as? DetailViewController else { return false }
if topAsDetailController.detailItem == nil {
// Return true to indicate that we have handled the collapse by doing nothing; the secondary controller will be discarded.
return true
}
return false
}
}
| [
416643,
279173,
276103,
227723,
227728,
289169,
226193,
292240,
311184,
300436,
283416,
129178,
209823,
298916,
278829,
279087,
208048,
279090,
278963,
290870,
228923,
277692,
176450,
284995,
287303,
281547,
300491,
280654,
229595,
226908,
187105,
279159,
277358,
285043,
228212,
279287,
276090
] |
e5e1c67be373cf2863966c97dec84730fac6b4fd | 729fe4482a495b416d6d5ee17594f5f8c8da12d6 | /Apatite/AccountViewController.swift | 29624ed3288099a3812df3f619c414993455aa24 | [] | no_license | Jwienadi/apatiteApp | fa39cae9580a952d7936158e3ebd68713a6a7ba6 | 203dfecc034100a692f6a8cb072ebc3e49a67ce4 | refs/heads/main | 2023-04-10T22:55:53.448012 | 2021-04-14T07:03:22 | 2021-04-14T07:03:22 | 357,013,021 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,730 | swift | //
// AccountViewController.swift
// Apatite
//
// Created by Jonathan Andrei on 12/04/21.
//
import UIKit
class AccountViewController: UIViewController {
@IBOutlet weak var avatar: UIImageView!
@IBOutlet weak var cardOne: UIView!
@IBOutlet weak var cardTwo: UIView!
@IBOutlet weak var signOutButton: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
avatar.layer.cornerRadius = 60
avatar.layer.masksToBounds = true
cardOne.layer.cornerRadius = 10
cardOne.layer.shadowColor = UIColor.darkGray.cgColor
cardOne.layer.shadowOffset = CGSize(width: 0, height: 1.0)
cardOne.layer.shadowRadius = 2.0
cardOne.layer.shadowOpacity = 0.5
cardOne.layer.masksToBounds = false
cardOne.clipsToBounds = false
cardTwo.layer.cornerRadius = 10
cardTwo.layer.shadowColor = UIColor.darkGray.cgColor
cardTwo.layer.shadowOffset = CGSize(width: 0, height: 1.0)
cardTwo.layer.shadowRadius = 2.0
cardTwo.layer.shadowOpacity = 0.5
cardTwo.layer.masksToBounds = false
cardTwo.clipsToBounds = false
signOutButton.layer.cornerRadius = 8
signOutButton.layer.shadowColor = UIColor.darkGray.cgColor
signOutButton.layer.shadowOffset = CGSize(width: 0, height: 1)
signOutButton.layer.shadowRadius = 2.0
signOutButton.layer.shadowOpacity = 0.7
signOutButton.layer.masksToBounds = false
signOutButton.clipsToBounds = false
// Do any additional setup after loading the view.
}
@IBAction func signOutAction(_ sender: UIButton) {
showAlert()
}
/*
// 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.
}
*/
func showAlert() {
let alert = UIAlertController(title: "Signing Out", message: "Are you sure you want to sign out?", preferredStyle: UIAlertController.Style.alert)
alert.addAction(UIAlertAction(title: "Sign Out", style: UIAlertAction.Style.default, handler: { (action) in
alert.dismiss(animated: true, completion: nil)
}))
alert.addAction(UIAlertAction(title: "Cancel", style: UIAlertAction.Style.cancel, handler: { (action) in
alert.dismiss(animated: true, completion: nil)
}))
self.present(alert, animated: true, completion: nil)
}
}
| [
-1
] |
70dfcca5d6d0f1ab325450f7a290e840a02d517e | da9764084b3feed3c7d88127a4b998c15b64e9aa | /BharathAJPlusAppUITests/BharathAJPlusAppUITests.swift | 39432456af7fb14d3178a471347be37845e1fbe1 | [] | no_license | bharaths1410/BharathAjPlusApp | 6505fab84c51d2e9fb05b5c0414162afef310da5 | 480b68e09a43ec1f721317d1f824afe696e1eace | refs/heads/master | 2021-01-23T00:21:28.180860 | 2017-03-19T01:38:11 | 2017-03-19T01:38:11 | 85,724,069 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,279 | swift | //
// BharathAJPlusAppUITests.swift
// BharathAJPlusAppUITests
//
// Created by Bharath Sirangi on 3/18/17.
// Copyright © 2017 Bharath Sirangi. All rights reserved.
//
import XCTest
class BharathAJPlusAppUITests: 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.
}
}
| [
155665,
237599,
229414,
278571,
229425,
180279,
229431,
319543,
213051,
286787,
237638,
311373,
278607,
196687,
311377,
368732,
180317,
278637,
319599,
278642,
131190,
131199,
278669,
278676,
311447,
327834,
278684,
278690,
311459,
278698,
278703,
278707,
180409,
278713,
295099,
139459,
131270,
229591,
147679,
311520,
147680,
319719,
295147,
286957,
319764,
278805,
311582,
278817,
311596,
336177,
98611,
278843,
287040,
319812,
311622,
319816,
229716,
278895,
287089,
139641,
311679,
311692,
106893,
156069,
311723,
377265,
311739,
319931,
278974,
336319,
311744,
278979,
336323,
278988,
278992,
279000,
279009,
369121,
188899,
279014,
319976,
279017,
311787,
319986,
279030,
311800,
279033,
279042,
287237,
377352,
279053,
303634,
303635,
279060,
279061,
279066,
188954,
279092,
377419,
303693,
115287,
189016,
287319,
295518,
287327,
279143,
279150,
287345,
287348,
189054,
287359,
303743,
164487,
311944,
279176,
344714,
311948,
311950,
311953,
287379,
336531,
295575,
303772,
205469,
221853,
279207,
295591,
295598,
279215,
279218,
287412,
164532,
287418,
303802,
66243,
287434,
287438,
164561,
303826,
279249,
369365,
369366,
279253,
230105,
295653,
230120,
279278,
312046,
230133,
279293,
205566,
295688,
312076,
295698,
221980,
336678,
262952,
262953,
279337,
262957,
164655,
328495,
303921,
230198,
295745,
222017,
279379,
295769,
230238,
230239,
279393,
303973,
279398,
295797,
295799,
279418,
336765,
287623,
279434,
320394,
189327,
189349,
279465,
304050,
189373,
213956,
345030,
213961,
279499,
304086,
304104,
123880,
320492,
320495,
287730,
320504,
312313,
214009,
312317,
328701,
328705,
418819,
320520,
230411,
320526,
238611,
140311,
238617,
197658,
336930,
132140,
189487,
312372,
238646,
238650,
320571,
336962,
238663,
296023,
205911,
156763,
214116,
230500,
279659,
238706,
312435,
279666,
230514,
279686,
222344,
337037,
296091,
238764,
279729,
148674,
312519,
279752,
148687,
189651,
279766,
189656,
279775,
304352,
304353,
279780,
279789,
279803,
320769,
312588,
320795,
320802,
304422,
312628,
345398,
222523,
181568,
279872,
279874,
304457,
230730,
345418,
337228,
296269,
222542,
238928,
296274,
230757,
312688,
296304,
230772,
337280,
296328,
296330,
304523,
9618,
279955,
148899,
279979,
279980,
279988,
173492,
280003,
370122,
280011,
337359,
329168,
312785,
222674,
329170,
280020,
280025,
239069,
320997,
280042,
280043,
329198,
337391,
296434,
288248,
288252,
312830,
230922,
304655,
329231,
230933,
222754,
312879,
230960,
288305,
239159,
157246,
288319,
288322,
280131,
124486,
288328,
230999,
239192,
99937,
345697,
312937,
312941,
206447,
288377,
337533,
280193,
239238,
288391,
239251,
280217,
198304,
337590,
280252,
296636,
280253,
321217,
280259,
321220,
239305,
296649,
280266,
9935,
313042,
280279,
18139,
280285,
321250,
337638,
181992,
288492,
34547,
67316,
313082,
288508,
288515,
280326,
116491,
280333,
124691,
116502,
321308,
321309,
280367,
280373,
280377,
321338,
280381,
345918,
280386,
280391,
280396,
18263,
370526,
296807,
296815,
313200,
313204,
124795,
280451,
305032,
67464,
124816,
214936,
337816,
239515,
214943,
313257,
288698,
214978,
280517,
280518,
214983,
231382,
329696,
190437,
313322,
329707,
174058,
296942,
124912,
313338,
239610,
182277,
313356,
305173,
223269,
354342,
354346,
313388,
124974,
321589,
215095,
288829,
288835,
313415,
239689,
354386,
280660,
223317,
329812,
354394,
321632,
280674,
280676,
313446,
215144,
288878,
288890,
215165,
280708,
329884,
215204,
125108,
280761,
223418,
280767,
338118,
280779,
321744,
280792,
280803,
182503,
338151,
125166,
125170,
395511,
313595,
125180,
125184,
125192,
125197,
125200,
125204,
338196,
125215,
125225,
338217,
321839,
125236,
280903,
289109,
379224,
239973,
313703,
280938,
321901,
354671,
199030,
223611,
248188,
313726,
240003,
158087,
313736,
240020,
190870,
190872,
289185,
305572,
289195,
338359,
289229,
281038,
281039,
281071,
322057,
182802,
322077,
289328,
338491,
322119,
281165,
281170,
281200,
313970,
297600,
289435,
314020,
248494,
166581,
314043,
363212,
158424,
322269,
338658,
289511,
330473,
330476,
289517,
215790,
125683,
199415,
322302,
289534,
35584,
322312,
346889,
264971,
322320,
166677,
207639,
281378,
289580,
281407,
289599,
281426,
281434,
322396,
281444,
207735,
314240,
158594,
330627,
240517,
289691,
240543,
289699,
289704,
289720,
289723,
281541,
19398,
191445,
183254,
183258,
207839,
142309,
314343,
183276,
289773,
248815,
240631,
330759,
330766,
281647,
322609,
314437,
207954,
339031,
314458,
281698,
281699,
322664,
314493,
347286,
330912,
339106,
306339,
249003,
208044,
322733,
3243,
339131,
290001,
339167,
298209,
290030,
208123,
322826,
126229,
298290,
208179,
159033,
216387,
372039,
224591,
331091,
314708,
150868,
314711,
314721,
281958,
314727,
134504,
306541,
314734,
314740,
314742,
290170,
224637,
306558,
290176,
306561,
314752,
314759,
298378,
314765,
314771,
306580,
224662,
282008,
314776,
282013,
290206,
314788,
298406,
314790,
282023,
241067,
314797,
306630,
306634,
339403,
191980,
282097,
306678,
191991,
290304,
323079,
323083,
323088,
282132,
282135,
175640,
282147,
306730,
290359,
323132,
282182,
224848,
224852,
290391,
306777,
323171,
282214,
224874,
314997,
290425,
339579,
282244,
323208,
282248,
323226,
282272,
282279,
298664,
298666,
306875,
282302,
323262,
323265,
282309,
306891,
241360,
282321,
241366,
282330,
282336,
12009,
282347,
282349,
323315,
200444,
282366,
249606,
282375,
323335,
282379,
216844,
118549,
282390,
282399,
241440,
282401,
339746,
315172,
216868,
241447,
282418,
282424,
282428,
413500,
241471,
315209,
159563,
307024,
307030,
241494,
307038,
282471,
282476,
339840,
315265,
282503,
315272,
315275,
184207,
282517,
298912,
118693,
298921,
126896,
200628,
282572,
282573,
323554,
298987,
282634,
241695,
315431,
315433,
102441,
102446,
282671,
241717,
307269,
315468,
233548,
315477,
200795,
323678,
315488,
315489,
45154,
233578,
307306,
217194,
241809,
323730,
299166,
233635,
299176,
184489,
323761,
184498,
258233,
299197,
299202,
176325,
299208,
233678,
282832,
356575,
307431,
184574,
217352,
315674,
282908,
299294,
282912,
233761,
282920,
315698,
332084,
307514,
282938,
127292,
168251,
323914,
201037,
282959,
250196,
168280,
323934,
381286,
242027,
242028,
250227,
315768,
315769,
291194,
291193,
291200,
242059,
315798,
291225,
242079,
283039,
299449,
291266,
283088,
283089,
242138,
176602,
160224,
291297,
242150,
283138,
233987,
324098,
340489,
283154,
291359,
283185,
234037,
340539,
234044,
332379,
111197,
242274,
291455,
316044,
184974,
316048,
316050,
340645,
176810,
299698,
291529,
225996,
135888,
242385,
299737,
234216,
234233,
242428,
291584,
299777,
291591,
291605,
283418,
234276,
283431,
242481,
234290,
201534,
283466,
201562,
234330,
275294,
349025,
357219,
177002,
308075,
242540,
242542,
201590,
177018,
308093,
291713,
340865,
299912,
316299,
234382,
308111,
308113,
209820,
283551,
177074,
127945,
340960,
234469,
340967,
324587,
234476,
201721,
234499,
234513,
316441,
300087,
21567,
308288,
160834,
349254,
300109,
234578,
250965,
234588,
250982,
234606,
300145,
300147,
234626,
234635,
177297,
308375,
324761,
119965,
234655,
300192,
234662,
300200,
324790,
300215,
283841,
283846,
283849,
316628,
251124,
234741,
283894,
316661,
292092,
234756,
242955,
177420,
292145,
300342,
333114,
333115,
193858,
300354,
300355,
234830,
283990,
357720,
300378,
300379,
316764,
292194,
284015,
234864,
316786,
243073,
292242,
112019,
234902,
333224,
284086,
259513,
284090,
54719,
415170,
292291,
300488,
300490,
234957,
144862,
300526,
308722,
300539,
210429,
292359,
218632,
316951,
374297,
235069,
349764,
194118,
292424,
292426,
333389,
349780,
128600,
235096,
300643,
300645,
243306,
325246,
333438,
235136,
317102,
300725,
300729,
333508,
333522,
325345,
153318,
333543,
284410,
284425,
300810,
300812,
284430,
161553,
284436,
325403,
341791,
325411,
186148,
186149,
333609,
284460,
300849,
325444,
153416,
325449,
317268,
325460,
341846,
284508,
300893,
284515,
276326,
292713,
292719,
325491,
333687,
317305,
317308,
325508,
333700,
243590,
243592,
325514,
350091,
350092,
350102,
333727,
333734,
219046,
284584,
292783,
300983,
153553,
292835,
6116,
292838,
317416,
325620,
333827,
243720,
292901,
325675,
243763,
325695,
333902,
227432,
194667,
284789,
284790,
292987,
227459,
194692,
235661,
333968,
153752,
284827,
333990,
284840,
284843,
227517,
309443,
227525,
301255,
227536,
301270,
301271,
325857,
334049,
317676,
309504,
194832,
227601,
325904,
334104,
211239,
334121,
317738,
325930,
227655,
383309,
391521,
285031,
416103,
227702,
211327,
227721,
285074,
227730,
317851,
293275,
285083,
227743,
293281,
285089,
301482,
375211,
334259,
293309,
317889,
326083,
129484,
326093,
285152,
195044,
334315,
236020,
293368,
317949,
342537,
309770,
334345,
342560,
227881,
293420,
236080,
23093,
244279,
244280,
301635,
309831,
55880,
301647,
326229,
309847,
244311,
244326,
277095,
301688,
244345,
301702,
334473,
326288,
227991,
285348,
318127,
293552,
342705,
285362,
285360,
154295,
342757,
285419,
170735,
342775,
375552,
228099,
285443,
285450,
326413,
285457,
285467,
326428,
318247,
293673,
318251,
301872,
285493,
285496,
301883,
342846,
293702,
318279,
244569,
301919,
293729,
351078,
310132,
228214,
269179,
228232,
416649,
252812,
293780,
310166,
277404,
310177,
293801,
326571,
326580,
326586,
359365,
211913,
56270,
203758,
277493,
293894,
293911,
326684,
113710,
318515,
203829,
277600,
285795,
228457,
318571,
187508,
302202,
285819,
285823,
285833,
285834,
318602,
228492,
162962,
187539,
326803,
285850,
302239,
302251,
294069,
294075,
64699,
228541,
343230,
310496,
228587,
302319,
228608,
318732,
318746,
245018,
130342,
130344,
130347,
286012,
294210,
286019,
294220,
318804,
294236,
327023,
327030,
310650,
179586,
294278,
318860,
368012,
318876,
343457,
245160,
286128,
286133,
310714,
302523,
228796,
302530,
228804,
310725,
302539,
310731,
310735,
327122,
310747,
286176,
187877,
310758,
40439,
286201,
359931,
286208,
245249,
228868,
302602,
294413,
359949,
302613,
302620,
245291,
130622,
310853,
286281,
196184,
212574,
204386,
204394,
138862,
310896,
294517,
286344,
179853,
286351,
188049,
229011,
179868,
229021,
302751,
245413,
212649,
286387,
286392,
302778,
286400,
212684,
302798,
286419,
278232,
294621,
278237,
278241,
294629,
286457,
286463,
319232,
278273,
278292,
278294,
286507,
294699,
319289,
237397,
188250,
237411,
327556,
188293,
311183,
294806,
294808,
319393,
294820,
294824,
343993,
98240,
294849,
24531,
294887,
278507,
311277,
327666,
278515
] |
5f7f167ba2b824be00f5f24124a1d09e02836bad | dc29ac266fba6c283b599efe795f686c41ccd640 | /Planner App/Planner App/SecondViewController.swift | 032b63617f8a600d156e5e364987a2ff24956a17 | [] | no_license | BallDM3/Planner-App | 9ba3eea1d3ff353c3bda4226641f4bed7de9c789 | 56b973c4f43c9644dd3667c324bc1a9698d995df | refs/heads/master | 2020-05-23T18:09:18.230524 | 2019-05-17T02:56:51 | 2019-05-17T02:56:51 | 186,882,868 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,371 | swift | //
// SecondViewController.swift
// Planner App
//
// Created by user916724 on 5/15/19.
// Copyright © 2019 Bryant. All rights reserved.
//
import UIKit
class tableCell: UITableViewCell{
}
class table: UITableView{
//MARK: Properties
}
class SecondViewController: UIViewController {
//MARK: Properties
@IBOutlet weak var taskTable: UITableView!
@IBOutlet weak var protoCell: UITableViewCell!
override func viewDidLoad() {
super.viewDidLoad()
/*
// 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.
}
*/
}
//MARK: Actions
@IBAction func checkBox(_ sender: UIButton) { UIView.animate(withDuration: 0.5, delay: 0.1, options: .curveLinear, animations: {
sender.transform = CGAffineTransform(scaleX: 0.1, y: 0.1)
}) { (success) in
UIView.animate(withDuration: 0.5, delay: 0.1, options: .curveLinear, animations: {
sender.isSelected = !sender.isSelected
sender.transform = .identity
}, completion: nil)
}
}
}
| [
-1
] |
125a303e07df6d2165c7ef07310c14afc26cd1ea | 6c7a340e39e7b821ff4fefcd74c14a1d17ac99d4 | /todoe/Custom/TOButton.swift | 6a76c09af0d8fb4c391451093a5b0fd68aa6683a | [] | no_license | yashShelatkar/todoe | 5d89095e7c5205c5d99c93f89b5757fd42fedc01 | 5bcd448a2da7efbcffbca24ab4f13b9103f2dcc0 | refs/heads/master | 2020-06-15T13:41:03.841683 | 2019-08-17T11:40:53 | 2019-08-17T11:40:53 | 195,315,424 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,459 | swift | //
// TOButton.swift
// todoe
//
// Created by yash Shelatkar on 5/7/19.
// Copyright © 2019 yash Shelatkar. All rights reserved.
//
import UIKit
class TOButton: UIButton{
var title:String!
var type:ButtonOptions!
var radius:CGFloat!
init(title:String = "button text", frame:CGRect = .zero, type:ButtonOptions = .roundedText, radius:CGFloat = 20) {
super.init(frame: frame)
if frame == .zero {
self.translatesAutoresizingMaskIntoConstraints = false
}
self.title = title
self.type = type
self.radius = radius
self.phaseTwo()
}
func phaseTwo() {
self.backgroundColor = .white
if let titleLabel = self.titleLabel {
titleLabel.font = UIFont(name: "Raleway-v4020-Regular", size: 16)
}
switch self.type {
case ButtonOptions.roundedText:
self.roundedText()
case ButtonOptions.squareIcon:
self.squareIcon()
default: break;
}
}
func squareIcon() {
self.setImage(UIImage(named: "add-icon"), for: .normal)
}
func roundedText() {
self.setTitle(self.title, for: .normal)
self.setTitleColor(.grayZero, for: .normal)
self.layer.cornerRadius = self.radius
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
| [
-1
] |
3457c237c2ec64acd640fbfb740b5114b0cbc552 | 7b61072ed33d6c7ff2f492dd781766956d010547 | /TripPlanner/AppDelegate.swift | 1dd7b10d81c35e6ee9a7e2bb837f099ee2b1a3d7 | [] | no_license | JonKopp99/TripPlanner | 5228ef8fab122986cc004cfb15ab972955ac37bf | b653278f782c20a373f55f8dc321a5f67f9c00e7 | refs/heads/master | 2020-05-20T10:06:02.835627 | 2019-05-25T06:58:39 | 2019-05-25T06:58:39 | 185,518,710 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,309 | swift | //
// AppDelegate.swift
// TripPlanner
//
// Created by Jonathan Kopp on 5/7/19.
// Copyright © 2019 Jonathan Kopp. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
let rootViewController = window!.rootViewController as! ViewController
rootViewController.store = CoreDataStack()
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
294924,
229388,
229391,
327695,
229394,
229397,
229399,
229402,
229405,
229408,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
286774,
286776,
319544,
286778,
204856,
229432,
286791,
237640,
286797,
237646,
311375,
163920,
196692,
319573,
311383,
319590,
311400,
303212,
131192,
237693,
303230,
327814,
303241,
131209,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286922,
286924,
286926,
319694,
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,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
98756,
278980,
319945,
278986,
319947,
278990,
278994,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
172526,
311791,
279023,
172529,
279027,
319989,
172534,
180727,
164343,
311804,
287230,
279040,
303617,
287234,
172550,
303623,
172552,
320007,
287238,
279051,
172558,
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,
295533,
172655,
172656,
352880,
295538,
172660,
287349,
287355,
287360,
295553,
172675,
295557,
311942,
303751,
287365,
352905,
311946,
287371,
279178,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
164509,
287390,
172705,
287394,
172707,
303780,
303773,
287398,
287400,
279208,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
279231,
287427,
312006,
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,
312077,
295695,
230169,
369433,
295707,
328476,
295710,
295720,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
287569,
230237,
230241,
279394,
312163,
303976,
336744,
303981,
303985,
303987,
328563,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
304007,
304009,
213895,
304011,
230284,
304013,
295822,
279438,
189329,
295825,
304019,
189331,
58262,
304023,
304027,
279452,
410526,
279461,
304042,
213931,
230327,
304055,
287675,
197564,
230334,
304063,
304065,
295873,
189378,
156612,
213954,
213963,
197580,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
320505,
312321,
295945,
230413,
197645,
295949,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
296004,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
164973,
312432,
279669,
337018,
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,
214294,
296213,
320792,
230681,
296215,
230689,
320803,
173350,
312622,
296243,
312630,
222522,
296253,
230718,
296255,
312639,
296259,
378181,
230727,
238919,
296264,
320840,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
148843,
230763,
230768,
296305,
312692,
230773,
304505,
304506,
181626,
181631,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
288154,
337306,
173472,
288160,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
312755,
296373,
312759,
279991,
288185,
337335,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
230865,
148946,
370130,
288210,
222676,
280021,
288212,
288214,
329177,
239064,
288217,
288218,
288220,
239070,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
320998,
288234,
370146,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
148990,
296450,
206336,
230916,
312837,
230919,
214535,
230923,
304651,
304653,
222752,
108066,
296486,
296488,
157229,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
280152,
288344,
239194,
181854,
280158,
370272,
403039,
239202,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
190118,
321195,
296622,
321200,
337585,
296634,
296637,
313027,
280260,
206536,
280264,
206539,
206541,
206543,
313044,
280276,
321239,
280283,
313052,
288478,
313055,
321252,
313066,
288494,
280302,
280304,
313073,
321266,
419570,
288499,
288502,
288510,
124671,
67330,
280324,
198405,
198416,
280337,
296723,
321304,
329498,
296731,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
321336,
296767,
288576,
345921,
304968,
280393,
280402,
173907,
313171,
313176,
280419,
321381,
296812,
313201,
1920,
255873,
305028,
247688,
280464,
124817,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
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,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
215123,
354390,
288859,
280669,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
141455,
141459,
280725,
313498,
275608,
100520,
288936,
280747,
288940,
288947,
321717,
280764,
280769,
280771,
280774,
313548,
321740,
280783,
280786,
313557,
280793,
280796,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280825,
280827,
280830,
280831,
125187,
280835,
125191,
321801,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
280891,
289087,
280897,
305480,
239944,
239947,
305485,
305489,
379218,
280919,
354653,
313700,
313705,
280937,
190832,
280946,
223606,
313720,
280956,
280959,
313731,
199051,
240011,
289166,
240017,
190868,
240021,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
289221,
289227,
281045,
281047,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
240132,
281095,
223752,
150025,
338440,
223757,
281102,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
150066,
158262,
158266,
289342,
281154,
322115,
281163,
281179,
199262,
338528,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
133776,
314003,
117398,
314007,
289436,
174754,
330404,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281372,
322341,
215850,
281388,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
240519,
338823,
314249,
322440,
183184,
289687,
240535,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
298292,
298294,
257334,
216376,
380226,
298306,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
298365,
306555,
290174,
224641,
281987,
298372,
314756,
265604,
224647,
281990,
298377,
314763,
298381,
142733,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
290321,
323090,
282130,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282144,
290344,
306731,
290349,
290351,
290356,
224849,
282195,
282199,
282201,
306778,
159330,
314979,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282261,
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,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
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,
241509,
110438,
110445,
282478,
315249,
282481,
315251,
110450,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
44948,
298901,
241560,
241563,
241565,
241567,
241569,
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,
282639,
290835,
282645,
241693,
282654,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
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,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
323763,
184503,
299191,
307385,
176311,
258235,
307388,
307386,
307390,
176316,
184512,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
184579,
282893,
323854,
291089,
282906,
291104,
233766,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
291197,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
283033,
242075,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
127413,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
127434,
315856,
176592,
315860,
176597,
283095,
127447,
299481,
176605,
160221,
242143,
291299,
127463,
242152,
291305,
127466,
176620,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
283142,
135689,
233994,
127497,
127500,
291341,
233998,
127506,
234003,
234006,
127511,
152087,
234010,
135707,
135710,
242206,
291361,
242220,
291378,
152118,
234038,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
225948,
135839,
299680,
225954,
299684,
135844,
242343,
242345,
373421,
299706,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
226005,
226008,
299740,
242396,
201444,
299750,
283368,
234219,
283372,
381677,
226037,
283382,
316151,
234231,
234236,
242431,
209665,
234242,
242436,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
234258,
242450,
242452,
201496,
234264,
234266,
234269,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
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,
234364,
291711,
234368,
291714,
234370,
291716,
234373,
226182,
234375,
308105,
226185,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
226200,
234396,
291742,
234401,
291748,
234405,
291750,
324518,
324520,
234407,
324522,
291754,
291756,
226220,
234414,
324527,
291760,
201650,
324531,
234422,
226230,
275384,
324536,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
234437,
226239,
226245,
234439,
234443,
291788,
234446,
193486,
193488,
234449,
275406,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
234493,
316416,
234496,
234501,
308231,
234504,
234507,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234593,
234595,
234597,
300133,
300139,
234605,
160879,
234607,
275569,
234610,
234614,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
324757,
234647,
226453,
275606,
234650,
308379,
234648,
300189,
324766,
119967,
234653,
324768,
283805,
234657,
242852,
300197,
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,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
275725,
283917,
177424,
349464,
283939,
259367,
283951,
300344,
226617,
243003,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
316768,
218464,
292197,
316774,
243046,
218473,
136562,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
300433,
234899,
300436,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
284076,
144812,
144814,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
316917,
308727,
300537,
316933,
316947,
308757,
308762,
316959,
284194,
284196,
235045,
284199,
235047,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
284223,
284226,
284228,
243268,
292421,
284231,
226886,
284234,
366155,
317004,
276043,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
276053,
284247,
317015,
235097,
243290,
284249,
284253,
243293,
284255,
300638,
284258,
292452,
292454,
177766,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
292479,
284288,
284290,
325250,
284292,
292485,
276098,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
284354,
358083,
284358,
358089,
284362,
276170,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
276187,
358114,
358116,
276197,
317158,
358119,
325353,
358122,
358126,
276206,
358128,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
186151,
358183,
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,
317332,
358292,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
292776,
284585,
276395,
292784,
276402,
358326,
161718,
358330,
276411,
276425,
301009,
301011,
301013,
301015,
358360,
301017,
292828,
153568,
292839,
292843,
178161,
227314,
325624,
317435,
317446,
292876,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
325700,
292934,
350293,
350295,
309337,
227418,
350299,
350302,
227423,
350304,
178273,
309346,
227426,
194660,
350308,
309350,
309348,
292968,
309352,
309354,
301163,
350313,
227430,
276586,
301167,
227440,
350321,
284786,
276595,
350325,
252022,
350328,
292985,
301178,
292989,
301185,
317570,
350339,
292993,
317573,
350342,
333957,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
153765,
284837,
350375,
350379,
350381,
350383,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
276685,
309455,
276689,
309462,
301272,
276699,
194780,
309468,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
309491,
309494,
243960,
227583,
276735,
276739,
211204,
276742,
227596,
325910,
309530,
342298,
211232,
317729,
211241,
325937,
325943,
211260,
260421,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
293227,
276843,
293232,
276848,
186744,
211324,
317833,
178572,
285070,
178583,
227738,
317853,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
293304,
293314,
309707,
293325,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
293346,
276964,
293352,
236013,
293364,
301562,
317951,
309764,
301575,
293387,
236043,
342541,
317963,
113167,
55822,
309779,
317971,
309781,
55837,
227879,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
219714,
301636,
318020,
301639,
301643,
285265,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
121458,
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,
154292,
277173,
342707,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
137946,
113378,
203491,
228069,
277223,
342760,
56041,
285417,
56043,
277232,
228081,
56059,
310015,
285441,
310020,
310029,
228113,
285459,
277273,
293659,
326430,
285474,
228135,
318248,
277291,
318253,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
310080,
277317,
293706,
277329,
162643,
310100,
301911,
277337,
301921,
400236,
236397,
162671,
326514,
310134,
236408,
15224,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277411,
310179,
293798,
293802,
236460,
276579,
293811,
293817,
293820,
203715,
326603,
293849,
293861,
228327,
228328,
318442,
228332,
326638,
277486,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
56313,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
293917,
293939,
318516,
277561,
277564,
310336,
236609,
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,
392326,
294026,
285835,
302218,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
294072,
318651,
277695,
318657,
244930,
302275,
130244,
302277,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
310486,
302296,
384222,
310498,
285927,
318698,
302315,
228592,
294132,
138485,
204026,
228606,
204031,
64768,
310531,
285958,
138505,
228617,
318742,
204067,
277801,
277804,
285997,
285999,
277807,
113969,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
302403,
294211,
384328,
277832,
277836,
294221,
294223,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
277857,
277860,
302436,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
327046,
277892,
277894,
310665,
318858,
253320,
277898,
277903,
310672,
277905,
351633,
277908,
277917,
310689,
277921,
130468,
277928,
277932,
310703,
277937,
310710,
130486,
277944,
310712,
310715,
277947,
302526,
277950,
277953,
302534,
310727,
64966,
245191,
277959,
277963,
302541,
277966,
302543,
310737,
277971,
286169,
228825,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
310780,
286203,
40448,
228864,
286214,
302603,
302614,
286233,
302621,
286240,
146977,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
278057,
310831,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286313,
40554,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
278168,
179870,
327333,
229030,
212648,
302764,
278188,
278192,
319153,
278196,
319163,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
229076,
286425,
319194,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
302852,
278277,
302854,
294664,
311048,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
188252,
237409,
360317,
294785,
327554,
40840,
40851,
294803,
188312,
294811,
237470,
319390,
40865,
319394,
294817,
294821,
311209,
180142,
343983,
188340,
40886,
319419,
294844,
294847,
24528,
393177,
294876,
294879,
294883,
294890,
311279,
278513,
237555,
311283,
278516,
237562
] |
5e4104537959303635baf0fd9a9b86d13c5311a3 | 1353b9b832dd42a588ff19f2c99c9f2d9f31e127 | /FrostKit iOS Tests/Extensions/DateExtensionsTests.swift | 452a6cce8ce62066c07d61c63a5ba50b7f0bddab | [
"MIT"
] | permissive | FrostlightSolutions/FrostKit | 76b7dac5a2c9e1e9eece68c98a5768f595609f73 | eb8e39242163450aab594c13ec2e9cc6f8844511 | refs/heads/master | 2021-03-19T06:29:40.330210 | 2020-11-06T20:03:33 | 2020-11-06T20:03:33 | 24,656,987 | 4 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 19,394 | swift | //
// DateExtensionsTests.swift
// FrostKit
//
// Created by James Barrow on 01/10/2014.
// Copyright © 2014 - 2017 James Barrow - Frostlight Solutions. All rights reserved.
//
import XCTest
@testable import FrostKit
class DateExtensionsTests: 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 testIsYesterday() {
measure { () in
let date = Date(timeIntervalSinceNow: -24 * 60 * 60)
XCTAssert(date.isYesterday, "Pass")
}
}
func testIsToday() {
measure { () in
let date = Date()
XCTAssert(date.isToday, "Pass")
}
}
func testIsTomorrow() {
measure { () in
let date = Date(timeIntervalSinceNow: 24 * 60 * 60)
XCTAssert(date.isTomorrow, "Pass")
}
}
func testIsWeekday() {
measure { () in
var components = DateComponents()
components.calendar = Calendar.iso8601
components.year = 2016
components.month = 2
components.day = 22 // Monday
XCTAssert(components.date?.isWeekday == true)
components.day = 23 // Tuesday
XCTAssert(components.date?.isWeekday == true)
components.day = 24 // Wednesday
XCTAssert(components.date?.isWeekday == true)
components.day = 25 // Thursday
XCTAssert(components.date?.isWeekday == true)
components.day = 26 // Friday
XCTAssert(components.date?.isWeekday == true)
components.day = 27 // Saturday
XCTAssert(components.date?.isWeekday == false)
components.day = 28 // Sunday
XCTAssert(components.date?.isWeekday == false)
}
}
func testIsBeginingOfWeek() {
measure { () in
var components = DateComponents()
components.calendar = Calendar.iso8601
components.year = 2016
components.month = 2
components.day = 22 // Monday
XCTAssert(components.date?.isBeginingOfWeek == true)
components.day = 23 // Tuesday
XCTAssert(components.date?.isBeginingOfWeek == false)
components.day = 24 // Wednesday
XCTAssert(components.date?.isBeginingOfWeek == false)
components.day = 25 // Thursday
XCTAssert(components.date?.isBeginingOfWeek == false)
components.day = 26 // Friday
XCTAssert(components.date?.isBeginingOfWeek == false)
components.day = 27 // Saturday
XCTAssert(components.date?.isBeginingOfWeek == false)
components.day = 28 // Sunday
XCTAssert(components.date?.isBeginingOfWeek == false)
}
}
func testIsEndOfWeek() {
measure { () in
var components = DateComponents()
components.calendar = Calendar.iso8601
components.year = 2016
components.month = 2
components.day = 22 // Monday
XCTAssert(components.date?.isEndOfWeek == false)
components.day = 23 // Tuesday
XCTAssert(components.date?.isEndOfWeek == false)
components.day = 24 // Wednesday
XCTAssert(components.date?.isEndOfWeek == false)
components.day = 25 // Thursday
XCTAssert(components.date?.isEndOfWeek == false)
components.day = 26 // Friday
XCTAssert(components.date?.isEndOfWeek == false)
components.day = 27 // Saturday
XCTAssert(components.date?.isEndOfWeek == false)
components.day = 28 // Sunday
XCTAssert(components.date?.isEndOfWeek == true)
}
}
func testIsBeginingOfMonth() {
measure { () in
var components = DateComponents()
components.calendar = Calendar.iso8601
components.year = 2016
components.month = 2
components.day = 29
XCTAssert(components.date?.isBeginingOfMonth == false)
components.month = 3
components.day = 1
XCTAssert(components.date?.isBeginingOfMonth == true)
components.day = 2
XCTAssert(components.date?.isBeginingOfMonth == false)
}
}
func testIsEndOfMonth() {
measure { () in
var components = DateComponents()
components.calendar = Calendar.iso8601
components.year = 2016
components.month = 2
components.day = 28
XCTAssert(components.date?.isEndOfMonth == false)
components.day = 29
XCTAssert(components.date?.isEndOfMonth == true)
components.month = 3
components.day = 1
XCTAssert(components.date?.isEndOfMonth == false)
}
}
func testDay() {
measure { () in
var components = DateComponents()
components.calendar = Calendar.iso8601
components.day = 26
XCTAssert(components.date?.day == 26)
}
}
func testHour() {
measure { () in
let hour = 19
var components = DateComponents()
components.calendar = Calendar.iso8601
components.hour = hour
XCTAssert(components.date?.hour == hour)
}
}
func testMinute() {
measure { () in
let minute = 47
var components = DateComponents()
components.calendar = Calendar.iso8601
components.minute = minute
XCTAssert(components.date?.minute == minute)
}
}
func testTimeInHours() {
measure { () in
var components = DateComponents()
components.calendar = Calendar.iso8601
components.hour = 15
components.minute = 45
XCTAssert(components.date?.timeInHours == 15.75)
}
}
func testSecondsComponents() {
measure { () in
XCTAssert(Date.minuteInSeconds == 60)
XCTAssert(Date.hourInSeconds == 3600)
XCTAssert(Date.dayInSeconds == 86400)
XCTAssert(Date.weekInSeconds == 604_800)
}
}
func testDaysBetweenDates() {
measure { () in
let daysBetween = 3
var components = DateComponents()
components.calendar = Calendar.iso8601
components.year = 2016
components.month = 2
components.day = 26
let fromDate = components.date
if let day = components.day {
components.day = day + daysBetween
} else {
components.day = daysBetween
}
let toDate = components.date
let calculatedDaysBetween = Date.daysBetween(fromDate!, to: toDate!)!
XCTAssert(calculatedDaysBetween == daysBetween, "Expected: \(daysBetween) but got: \(calculatedDaysBetween)")
}
}
func testDaysRemainingInWeek() {
measure { () in
var components = DateComponents()
components.calendar = Calendar.iso8601
components.year = 2016
components.month = 2
components.day = 26
XCTAssert(components.date?.daysRemainingInWeek == 3)
components.day = 28
XCTAssert(components.date?.daysRemainingInWeek == 1)
}
}
func testDaysInMonth() {
measure { () in
var components = DateComponents()
components.calendar = Calendar.iso8601
components.year = 2016
components.month = 2
components.day = 26
let daysInMonth = 29
let calculatedDaysInMonth = components.date!.daysInMonth
XCTAssert(calculatedDaysInMonth == daysInMonth, "Expected: \(daysInMonth) but got: \(calculatedDaysInMonth)")
}
}
func testDaysRemainingInMonth() {
measure { () in
var components = DateComponents()
components.calendar = Calendar.iso8601
components.year = 2016
components.month = 2
components.day = 26
let daysRemainingInMonth = 3
let calculatedDaysRemainingInMonth = components.date!.daysRemainingInMonth!
XCTAssert(calculatedDaysRemainingInMonth == daysRemainingInMonth, "Expected: \(daysRemainingInMonth) but got: \(calculatedDaysRemainingInMonth)")
}
}
func testCompareDatesWithinMonth() {
measure { () in
var components = DateComponents()
components.calendar = Calendar.iso8601
components.year = 2016
components.month = 2
components.day = 26
let date = components.date!
components.day = 28
XCTAssert(date.isBefore(components.date!) == true)
XCTAssert(date.isAfter(components.date!) == false)
XCTAssert(date.compare(components.date!, option: .before, shouldStripTime: false) == true)
XCTAssert(date.compare(components.date!, option: .after, shouldStripTime: false) == false)
XCTAssert(date.compare(components.date!, option: .equalTo, shouldStripTime: false) == false)
XCTAssert(date.compare(components.date!, option: .beforeOrEqualTo, shouldStripTime: false) == true)
XCTAssert(date.compare(components.date!, option: .afterOrEqualTo, shouldStripTime: false) == false)
components.day = 26
XCTAssert(date.compare(components.date!, option: .equalTo, shouldStripTime: false) == true)
XCTAssert(date.compare(components.date!, option: .beforeOrEqualTo, shouldStripTime: false) == true)
XCTAssert(date.compare(components.date!, option: .afterOrEqualTo, shouldStripTime: false) == true)
components.day = 11
XCTAssert(date.isBefore(components.date!) == false)
XCTAssert(date.isAfter(components.date!) == true)
XCTAssert(date.compare(components.date!, option: .before, shouldStripTime: false) == false)
XCTAssert(date.compare(components.date!, option: .after, shouldStripTime: false) == true)
XCTAssert(date.compare(components.date!, option: .equalTo, shouldStripTime: false) == false)
XCTAssert(date.compare(components.date!, option: .beforeOrEqualTo, shouldStripTime: false) == false)
XCTAssert(date.compare(components.date!, option: .afterOrEqualTo, shouldStripTime: false) == true)
}
}
func testCompareDatesBetweenMonth() {
measure { () in
var components = DateComponents()
components.calendar = Calendar.iso8601
components.year = 2016
components.month = 2
components.day = 26
let date = components.date!
components.month = 3
components.day = 28
XCTAssert(date.isBefore(components.date!) == true)
XCTAssert(date.isAfter(components.date!) == false)
XCTAssert(date.compare(components.date!, option: .before, shouldStripTime: false) == true)
XCTAssert(date.compare(components.date!, option: .after, shouldStripTime: false) == false)
XCTAssert(date.compare(components.date!, option: .equalTo, shouldStripTime: false) == false)
XCTAssert(date.compare(components.date!, option: .beforeOrEqualTo, shouldStripTime: false) == true)
XCTAssert(date.compare(components.date!, option: .afterOrEqualTo, shouldStripTime: false) == false)
components.day = 26
XCTAssert(date.compare(components.date!, option: .equalTo, shouldStripTime: false) == false)
XCTAssert(date.compare(components.date!, option: .beforeOrEqualTo, shouldStripTime: false) == true)
XCTAssert(date.compare(components.date!, option: .afterOrEqualTo, shouldStripTime: false) == false)
components.month = 1
XCTAssert(date.compare(components.date!, option: .equalTo, shouldStripTime: false) == false)
XCTAssert(date.compare(components.date!, option: .beforeOrEqualTo, shouldStripTime: false) == false)
XCTAssert(date.compare(components.date!, option: .afterOrEqualTo, shouldStripTime: false) == true)
components.day = 11
XCTAssert(date.isBefore(components.date!) == false)
XCTAssert(date.isAfter(components.date!) == true)
XCTAssert(date.compare(components.date!, option: .before, shouldStripTime: false) == false)
XCTAssert(date.compare(components.date!, option: .after, shouldStripTime: false) == true)
XCTAssert(date.compare(components.date!, option: .equalTo, shouldStripTime: false) == false)
XCTAssert(date.compare(components.date!, option: .beforeOrEqualTo, shouldStripTime: false) == false)
XCTAssert(date.compare(components.date!, option: .afterOrEqualTo, shouldStripTime: false) == true)
}
}
func testCompareDatesBetweenYears() {
measure { () in
var components = DateComponents()
components.calendar = Calendar.iso8601
components.year = 2016
components.month = 2
components.day = 26
let date = components.date!
components.year = 2017
components.day = 28
XCTAssert(date.isBefore(components.date!) == true)
XCTAssert(date.isAfter(components.date!) == false)
XCTAssert(date.compare(components.date!, option: .before, shouldStripTime: false) == true)
XCTAssert(date.compare(components.date!, option: .after, shouldStripTime: false) == false)
XCTAssert(date.compare(components.date!, option: .equalTo, shouldStripTime: false) == false)
XCTAssert(date.compare(components.date!, option: .beforeOrEqualTo, shouldStripTime: false) == true)
XCTAssert(date.compare(components.date!, option: .afterOrEqualTo, shouldStripTime: false) == false)
components.day = 26
XCTAssert(date.compare(components.date!, option: .equalTo, shouldStripTime: false) == false)
XCTAssert(date.compare(components.date!, option: .beforeOrEqualTo, shouldStripTime: false) == true)
XCTAssert(date.compare(components.date!, option: .afterOrEqualTo, shouldStripTime: false) == false)
components.year = 2015
XCTAssert(date.compare(components.date!, option: .equalTo, shouldStripTime: false) == false)
XCTAssert(date.compare(components.date!, option: .beforeOrEqualTo, shouldStripTime: false) == false)
XCTAssert(date.compare(components.date!, option: .afterOrEqualTo, shouldStripTime: false) == true)
components.day = 11
XCTAssert(date.isBefore(components.date!) == false)
XCTAssert(date.isAfter(components.date!) == true)
XCTAssert(date.compare(components.date!, option: .before, shouldStripTime: false) == false)
XCTAssert(date.compare(components.date!, option: .after, shouldStripTime: false) == true)
XCTAssert(date.compare(components.date!, option: .equalTo, shouldStripTime: false) == false)
XCTAssert(date.compare(components.date!, option: .beforeOrEqualTo, shouldStripTime: false) == false)
XCTAssert(date.compare(components.date!, option: .afterOrEqualTo, shouldStripTime: false) == true)
}
}
func testStripTime() {
measure { () in
var components = DateComponents()
components.calendar = Calendar.iso8601
components.year = 2016
components.month = 2
components.day = 26
components.hour = 19
components.minute = 12
components.second = 43
let date = components.date!
let strippedDate = date.stripTime
components.hour = 0
components.minute = 0
components.second = 0
XCTAssert(strippedDate == components.date, "Should be \"\(components.date!)\" but was \"\(strippedDate!)\"")
}
}
func testDateByAddingDays() {
measure { () in
var components = DateComponents()
components.calendar = Calendar.iso8601
components.year = 2016
components.month = 2
components.day = 26
let date = components.date!
XCTAssert(date.dateByAdding(days: 0) == date)
components.day! += 3
XCTAssert(date.dateByAdding(days: 3) == components.date)
components.day! -= 5
XCTAssert(date.dateByAdding(days: -2) == components.date)
components.day! += 92
XCTAssert(date.dateByAdding(days: 90) == components.date)
components.day! -= 180
XCTAssert(date.dateByAdding(days: -90) == components.date)
components.day! -= 390
XCTAssert(date.dateByAdding(days: -480) == components.date)
components.day! += 960
XCTAssert(date.dateByAdding(days: 480) == components.date)
}
}
func testDateAt() {
measure { () in
var components = DateComponents()
components.calendar = Calendar.iso8601
components.year = 2016
components.month = 2
components.day = 26
components.hour = 19
components.minute = 12
components.second = 43
let date = components.date!
components.hour = 0
components.minute = 0
components.second = 0
XCTAssert(date.dateAtStartOfDay == components.date, "Should be \"\(components.date!)\" but was \"\(date.dateAtStartOfDay)\"")
components.hour = 23
components.minute = 59
components.second = 59
XCTAssert(date.dateAtEndOfDay == components.date, "Should be \"\(components.date!)\" but was \"\(date.dateAtEndOfDay!)\"")
}
}
}
| [
-1
] |
be68c848945a6b19280f4bc7ee44cf787898b29b | 1d9d97b8782b47bb700f63091d03ba6bbb161224 | /InstagramClone/Constants/Fonts.swift | d0c82e40d40d022dfd010f280f281c42b0076af9 | [] | no_license | ahmedattia213/InstagramClone | 825b6d7b72c6de89054cddb29c3241e9b148474c | f403e0bf56c364391db8e7fbd79a394644c68775 | refs/heads/master | 2022-11-08T03:19:14.424053 | 2020-06-21T10:30:37 | 2020-06-21T10:30:37 | 256,516,691 | 3 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 299 | swift | //
// Fonts.swift
// InstagramClone
//
// Created by Ahmed Amr on 7/28/19.
// Copyright © 2019 Ahmed Amr. All rights reserved.
//
import UIKit
extension UIFont {
//Signup Fonts
static let signupTextfield = UIFont.systemFont(ofSize: 14)
static let signupButton = signupTextfield
}
| [
-1
] |
b3322f58c30a6383bcad9770074131ab14e0a41c | b6135dca55c2bca6f873a4646414216f2c28aa67 | /douyuzhibofang/douyuzhibofang/class/live/liveViewController.swift | 7d6a2efe182cd4ce84064aecb6f0f308817c5e85 | [
"Apache-2.0"
] | permissive | ShiGuangBaoHe/douyuswift | 321b8a1704cfd5d5747de50dc76774e8755ed5ed | ac72f2346e9979360654e99f8172d64d059468b7 | refs/heads/master | 2020-03-25T07:51:57.119570 | 2018-08-15T06:05:48 | 2018-08-15T06:05:48 | 143,585,229 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 868 | swift | //
// liveViewController.swift
// douyuzhibofang
//
// Created by MacBook on 2018/8/6.
// Copyright © 2018年 douyumeng. All rights reserved.
//
import UIKit
class liveViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
| [
278016,
278018,
278020,
278021,
279046,
308242,
217109,
277527,
300057,
317473,
284208,
159812,
288332,
292429,
292428,
288847,
292432,
292431,
277602,
276087,
284285,
303242,
226447,
307378,
277696,
285378,
276167,
175826,
298206,
199402,
166642,
286963,
226038,
286456,
276736,
311045,
302865,
329499,
228127,
277796,
292156,
283461,
279380,
279386,
188253,
281959,
228201,
293742,
290160,
280434,
280435,
290166,
280445,
275842,
313222,
234380,
306577,
226705,
226196,
188313,
283034,
285087,
284577,
289190,
289191,
276396,
305582,
291759,
277935,
234423,
10179,
289234,
286162,
163289,
173531,
280029,
280030,
191453,
278015
] |
6ddc9a030c17a130a9896c20004c107398c155fd | 69f9cb7121f7cd7c8025307f61e06add829fd2d6 | /SPAppOS/SceneDelegate.swift | 3deb06aff1b02ae458e66b52df215b54d881f201 | [] | no_license | gooftroop1330/SPAppOS | 5bb70823b1f264dbdfe504c568917f8d34f7d0b7 | 9d93cbd4ced10493a75984bc8fc0193def8b57e7 | refs/heads/master | 2022-04-29T03:20:35.401854 | 2020-04-30T18:29:55 | 2020-04-30T18:29:55 | 259,346,541 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,324 | swift | //
// SceneDelegate.swift
// SPAppOS
//
// Created by Preston Smith on 3/27/20.
// Copyright © 2020 Preston Smith. All rights reserved.
//
import UIKit
import SwiftUI
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
// Get the managed object context from the shared persistent container.
let context = (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext
// Create the SwiftUI view and set the context as the value for the managedObjectContext environment keyPath.
// Add `@Environment(\.managedObjectContext)` in the views that will need the context.
let contentView = ContentView().environment(\.managedObjectContext, context)
// Use a UIHostingController as window root view controller.
if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)
window.rootViewController = UIHostingController(rootView: contentView)
self.window = window
window.makeKeyAndVisible()
}
}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead).
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
// Save changes in the application's managed object context when the application transitions to the background.
(UIApplication.shared.delegate as? AppDelegate)?.saveContext()
}
}
| [
325633,
325637,
163849,
333838,
186388,
346140,
16444,
337980,
254020,
217158,
243782,
337995,
395340,
327757,
200786,
286804,
329816,
217180,
368736,
342113,
180322,
329833,
286833,
252021,
342134,
286845,
286851,
329868,
250008,
329886,
286880,
135328,
192674,
333989,
286889,
356521,
430257,
180418,
350411,
180432,
350417,
350423,
350426,
385243,
334047,
356580,
350436,
346344,
327915,
338161,
350449,
350454,
321787,
336124,
350459,
350462,
336129,
350465,
350469,
325895,
194829,
350477,
43279,
350481,
350487,
356631,
338201,
325915,
350491,
325918,
182559,
350494,
325920,
350500,
194854,
350505,
350510,
248112,
332081,
307507,
340276,
336181,
356662,
332091,
332098,
201030,
332107,
190797,
334162,
332118,
321880,
332126,
258399,
332130,
250211,
340328,
250217,
348523,
348528,
182642,
321911,
332153,
334204,
332158,
250239,
332162,
348548,
332175,
348566,
160152,
340380,
250272,
176545,
326059,
342453,
334263,
338363,
324032,
336326,
393671,
338387,
248279,
369119,
334306,
338404,
334312,
338411,
104940,
375279,
162289,
328178,
328180,
248309,
328183,
340473,
199165,
328190,
324095,
328193,
98819,
324100,
324103,
164362,
248332,
199182,
328207,
324112,
330254,
186898,
342546,
340501,
324118,
334359,
342551,
324122,
334364,
330268,
340512,
191012,
332325,
324134,
197160,
324141,
324143,
334386,
324156,
334397,
152128,
324161,
324165,
219719,
324171,
324174,
324177,
244309,
334425,
326240,
248427,
191085,
346736,
338544,
334466,
336517,
344710,
119432,
148106,
162446,
330384,
326291,
340628,
342685,
340639,
336549,
332460,
336556,
332464,
164535,
336568,
174775,
248505,
174778,
244410,
328379,
332473,
223936,
328387,
332484,
332487,
154318,
332494,
342737,
154329,
183006,
139998,
189154,
338661,
338665,
332521,
330479,
342769,
340724,
332534,
338680,
342777,
344832,
207620,
191240,
346891,
328462,
326417,
336660,
199455,
336676,
336681,
334633,
326444,
215854,
328498,
271154,
326452,
152371,
326455,
340792,
348983,
244542,
326463,
326468,
328516,
336709,
127815,
244552,
328520,
326474,
328523,
336712,
342857,
326479,
355151,
330581,
326486,
136024,
330585,
326494,
326503,
201580,
326508,
201583,
326511,
211826,
340850,
330612,
201589,
340859,
324476,
328574,
340863,
351105,
252801,
324482,
324488,
324496,
330643,
324502,
252823,
324511,
324514,
252838,
201638,
211885,
252846,
324525,
5040,
5047,
324539,
324542,
347082,
340940,
345046,
330711,
248794,
340958,
248799,
340964,
338928,
328690,
359411,
244728,
330750,
328703,
199681,
328710,
330761,
328715,
330769,
209944,
336922,
209948,
248863,
345119,
250915,
357411,
250917,
158759,
328747,
209966,
209969,
330803,
209973,
209976,
339002,
339010,
209988,
209991,
347208,
248905,
330827,
197708,
330830,
248915,
345172,
183384,
156762,
343132,
339037,
322660,
210028,
326764,
326767,
345200,
330869,
361591,
210042,
210045,
152704,
160896,
330886,
351366,
384136,
384140,
337048,
210072,
248986,
384152,
210078,
384158,
210081,
384161,
210085,
210089,
339118,
337072,
337076,
210100,
324792,
367801,
339133,
384189,
343232,
384192,
210116,
337093,
244934,
326858,
322763,
384202,
343246,
384209,
333010,
146644,
330966,
210139,
328925,
66783,
384225,
343272,
351467,
328942,
251123,
384247,
384250,
242947,
206084,
115973,
343307,
384270,
333075,
384276,
333079,
251161,
384284,
245021,
384290,
208167,
171304,
245032,
245042,
345400,
208189,
372035,
343366,
337224,
251211,
337230,
331089,
337235,
331094,
365922,
175458,
208228,
343394,
175461,
343399,
337252,
345449,
175464,
333164,
99692,
343410,
234867,
331124,
175478,
155000,
378232,
249210,
175484,
337278,
249215,
245121,
249219,
245128,
249225,
181644,
249228,
136591,
245137,
181650,
249235,
112021,
181655,
245143,
175514,
245146,
245149,
343453,
245152,
245155,
355749,
40358,
181671,
245158,
333222,
245163,
181679,
327090,
337330,
210357,
146878,
181697,
361922,
327108,
181704,
339401,
327112,
384457,
327118,
208338,
366035,
343509,
337366,
249310,
249313,
333285,
329195,
343540,
343545,
339464,
337416,
249355,
329227,
175637,
345626,
245275,
366118,
339504,
206397,
349762,
333387,
214611,
333400,
339553,
343650,
333415,
245358,
333423,
222831,
138865,
339572,
126597,
126611,
140955,
333472,
245410,
345763,
245415,
337588,
337601,
337607,
333512,
333515,
339664,
358100,
245463,
212700,
181982,
153311,
333535,
225000,
337643,
245487,
339696,
337647,
245495,
141052,
337661,
339711,
225027,
337671,
339722,
249617,
321300,
245528,
333593,
116512,
184096,
339748,
358192,
339773,
399166,
325441,
247618,
325447,
341831,
329545,
341835,
323404,
354124,
339795,
354132,
341844,
247639,
337751,
358235,
341852,
313181,
413539,
339818,
327532,
339827,
358260,
341877,
325494,
182136,
186233,
1914,
333690,
243584,
325505,
333699,
339845,
247692,
333709,
247701,
337814,
329625,
327590,
333737,
337845,
190393,
327613,
333767,
346059,
311244,
358348,
247760,
212945,
333777,
219094,
329699,
358372,
327655,
247790,
333819
] |
cb83c7c3951fac9b596b0c7314bc1d2c25a81ec1 | fd61beed813d37f1c632c7ee209696c2f2abd676 | /区帮/personalpageViewController.swift | 48a784a6505e546127a7e48b5d671c517d46e956 | [] | no_license | jiahonggg/neighbour | 4baea4b1f6fd7e7ef6ac23203bc0960cc641c823 | 57123a204ea4905c181e99ff02919a4d60aea21c | refs/heads/master | 2021-01-12T08:55:34.323506 | 2016-12-17T12:41:10 | 2016-12-17T12:41:10 | 76,720,993 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,269 | swift | //
// personalpageViewController.swift
// 区帮
//
// Created by apple on 2016/9/19.
// Copyright © 2016年 zoujiahong. All rights reserved.
//
import UIKit
import Firebase
import ActionButton
class personalpageViewController: UIViewController {
let namelabel :UILabel = {
let label = UILabel()
label.text = "Name "
return label
}()
let nametextview : UITextView = {
let textview = UITextView()
return textview
}()
let profileimageview :UIImageView = {
let imageview = UIImageView()
imageview.image = UIImage(named:"profileimage")
imageview.layer.cornerRadius = 50
imageview.layer.masksToBounds = true
return imageview
}()
let nameseparatorview: UIView = {
let view = UIView()
view.backgroundColor = UIColor.lightGrayColor()
return view
}()
let emailseparatorview: UIView = {
let view = UIView()
view.backgroundColor = UIColor.lightGrayColor()
return view
}()
let emaillabel :UILabel = {
let label = UILabel()
label.text = "Email "
return label
}()
let emailtextview : UITextView = {
let textview = UITextView()
return textview
}()
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = UIColor.whiteColor()
self.view.addSubview(profileimageview)
self.view.addSubview(namelabel)
self.view.addSubview(nametextview)
self.view.addSubview(nameseparatorview)
self.view.addSubview(emaillabel)
self.view.addSubview(emailtextview)
self.view.addSubview(emailseparatorview)
fetchuser()
setupui()
}
func fetchuser(){
guard let uid = FIRAuth.auth()?.currentUser?.uid else{
return
}
FIRDatabase.database().reference().child("users").child(uid).observeSingleEventOfType(.Value, withBlock: { (snapshot) in
if let dictionary = snapshot.value as? [String:AnyObject]{
self.navigationItem.title = dictionary["name"] as? String
self.nametextview.text = dictionary["name"] as? String
self.emailtextview.text = dictionary["email"] as?String
}
}, withCancelBlock: nil)
}
func setupui(){
profileimageview.snp_makeConstraints { (make) in
make.width.equalTo(100)
make.height.equalTo(100)
make.centerX.equalTo(self.view.snp_centerX)
make.top.equalTo(self.view.snp_top).offset(80)
}
namelabel.snp_makeConstraints { (make) in
make.top.equalTo(profileimageview.snp_bottom).offset(40)
make.left.equalTo(self.view.snp_left).offset(20)
make.height.equalTo(20)
make.width.equalTo(60)
}
nametextview.snp_makeConstraints { (make) in
make.top.equalTo(namelabel.snp_top)
make.left.equalTo(namelabel.snp_right)
make.width.equalTo(self.view.snp_width)
make.height.equalTo(26)
}
nameseparatorview.snp_makeConstraints { (make) in
make.top.equalTo(nametextview.snp_bottom)
make.left.equalTo(namelabel.snp_left)
make.width.equalTo(self.view.snp_width)
make.height.equalTo(1)
}
emaillabel.snp_makeConstraints { (make) in
make.top.equalTo(nametextview.snp_bottom).offset(4)
make.left.equalTo(namelabel.snp_left)
make.width.equalTo(namelabel.snp_width)
make.height.equalTo(namelabel.snp_height)
}
emailtextview.snp_makeConstraints { (make) in
make.top.equalTo(nametextview.snp_bottom).offset(4)
make.width.equalTo(nametextview)
make.height.equalTo(nametextview)
make.left.equalTo(nametextview.snp_left)
}
emailseparatorview.snp_makeConstraints { (make) in
make.top.equalTo(emailtextview.snp_bottom)
make.left.equalTo(emaillabel.snp_left)
make.width.equalTo(self.view.snp_width)
make.height.equalTo(1)
}
}
}
| [
-1
] |
e4a8facbe26cc6ca596910f7e8ff0a6793539c45 | 85652af771495acb0ae7d7022dc1c5a381cb020b | /Patient/Sources/Modules/Auth/Registration/SecretQuestions/InputCell/SuggestionsInputTVCell.swift | 861f291c74018598a36c6efc5442132466a123b2 | [] | no_license | dilames/Caduceus | 92edc609c24a8cbfaaf214dd35d050d26f861910 | 63cb1cabd594b2bc9f278b7b0d17c299eca77ad4 | refs/heads/master | 2023-01-07T16:14:18.533650 | 2020-11-06T14:38:03 | 2020-11-06T14:38:03 | 310,621,067 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 692 | swift | //
// SuggestionsInputTVCell.swift
// Patient
//
// Created by Andrew Chersky on 3/8/18.
//
import UIKit
import ReactiveSwift
import ReactiveCocoa
final class SuggestionsInputTVCell: UITableViewCell, ReusableViewModelContainer {
@IBOutlet weak var textHolderView: DesignableView!
@IBOutlet weak var textField: UITextField!
override func awakeFromNib() {
super.awakeFromNib()
textHolderView.layer.cornerRadius = 25.0
}
func didSetViewModel(_ viewModel: SuggestionsInputCellViewModel, lifetime: Lifetime) {
textField.reactive.text <~ viewModel.text.skipRepeats()
viewModel.text <~ textField.reactive.continuousTextValues
}
}
| [
-1
] |
b85ab2517eb56306a1a2ad0fce96929c0279883f | fc803be9313c425b5a5f3ecac8a5a66cc42c6c65 | /ATM.swift | 6c7d3195189c4cdf2cbe0b45d5425ceaf51c2534 | [] | no_license | sangeethanachiar/Banking-Application | 02f5f65043f865668ca76172a0bc2960d7644948 | beb49054c559668d8ef8927db6f12b3dd8fd3066 | refs/heads/main | 2023-06-03T03:09:28.286177 | 2021-06-16T03:56:38 | 2021-06-16T03:56:38 | 375,620,200 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,076 | swift | //
// ATM.swift
// Banking App
//
// Created by Sangeetha Nachiar on 14/06/21.
//
import Foundation
class ATM : Bank{
var totalCash = 10000
// var car = Card()
var ban = Bank()
var auth = Authentication()
func getScreen(){
while(totalCash>0){
print("\nWelcome To ATM Service")
print("Enter Card No")
let cardNo = Int(readLine()!)!
// getCardsByIndex(cardNo:cardNo)
let index = getCardsByIndex(cardNo:cardNo)
if(index != -1 ){
print("\(ban.cards[index].cardNo)")
if(ban.cards[index].cardStatus){
//if(ban.cards[index + 1].cardStatus){
print("Enter the pin")
let pinNo = Int(readLine()!)!
if(auth.validate(index:index,password:pinNo)){
print("1.Withdrawal\n2.Balance Enquiry\n3.Pin Change \n4.Mini Statement\n 5.exit")
print("Enter choice")
let choice = Int(readLine()!)
switch(choice){
case 1:
withdrawal(index:index)
case 2:
balanceEnquiry(index:index)
case 3 :
print("..3")
// pinChange(index:index)
case 4:
print("4")
// miniStatement(index:index)
case 5:
exit(0)
default:
print("invalid")
}
} // validate pin
else{
ban.cards[index].pinValidationCount += 1
if(!(auth.validatePinInvalidCount(index:index))){
ban.cards[index].cardStatus = false
print("Account has been blocked permanently...Due to three invalid attempts")
}
else{
print("invalid pin.. try again")
}
}
} // card.Status
else{
print("card has been blocked permanently")
}
}
else {
print("Invalid card no .card doesnot exist")
}
}
}
//}
func validateAmount(amount:Int)->Bool{
if(amount % 100 == 0){
return true
}
return false
}
func validateAmountQuantity(amount :Int)->Bool{
if (amount <= 2000){
return true
}
return false
}
func withdrawal(index : Int){
print("Enter amount in multiple of Rs 100")
let amt = Int(readLine()!)!
if(amt <= totalCash){
if(validateAmount(amount: amt)){
if(validateAmountQuantity(amount: amt)){
if( amt > totalCash){
print("Insufficient Balance")
}
else{
ban.cards[index].account.accBalance -= Double(amt)
printTransactionReciept(index :index ,amt:amt)
totalCash = totalCash - amt
}
} // end validateAmountQuantity
else{
print("Maximum amouunt per transaction must not exceed limit of Rs.2000")
}
} // end validateAmount
else{
print("Please enter amount in multiples of Rs 100")
}
} // amt <= cash
else{
print("Insufficient balance in ATM")
}
}
func balanceEnquiry(index: Int){
printBalanceReciept(index:index)
} // end validatePin
func printTransactionReciept(index: Int,amt:Int){
print("----------TRANSACTION RECIEPT--------")
print("Location : Chennai")
print("Amount Debted : \(amt)")
print("Available Balance : \(ban.cards[index].account.accBalance)")
}
func printBalanceReciept(index :Int){
print("----------BALANCE ENQUIRY RECIEPT--------")
print("Location : Chennai ")
print("Available Balance : \(ban.cards[index].account.accBalance )")
}
}
| [
-1
] |
7a05306ddc233133e136814924be18d90b8a584d | e25f7883595558bce8f74e631e2eda7c19ea5376 | /HBGridView/HBGridSidebarClusterViewModel.swift | c95475dd8aa05feb95561b5ae9271464a2dd5081 | [
"MIT",
"BSD-3-Clause"
] | permissive | davelab6/Hibizcus | a9545c0a89e6a7b1033b56d2c6382ee58102b6b8 | 31a1cf3bc50735ed9056b95552602a6acfb246af | refs/heads/main | 2023-06-03T08:19:37.397321 | 2021-06-18T09:41:18 | 2021-06-18T09:41:18 | 378,202,931 | 1 | 0 | NOASSERTION | 2021-06-18T16:07:15 | 2021-06-18T16:07:15 | null | UTF-8 | Swift | false | false | 7,273 | swift | //
// HBGridSidebarClusterViewModel.swift
//
// Created by Muthu Nedumaran on 10/3/21.
//
import Combine
import SwiftUI
import AppKit
class HBGridSidebarClusterViewModel: ObservableObject {
var didChange = PassthroughSubject<Void, Never>()
@Published var currentScript: String = "" {
didSet {
print("script in SidebarClusterViewModel is now \(currentScript)")
initClusterData()
didChange.send()
}
}
// These are used in the UI only
@Published var errorMessage = ""
@Published var baseItems = RadioItems()
@Published var subConsonants = RadioItems()
@Published var vowelSignParts = 1
@Published var selectedBase = "Vowels" {
didSet {
setSelectedBase()
didChange.send()
}
}
@Published var selectedSubConsonant = "None" {
didSet {
setSelectedSubConsonant()
didChange.send()
}
}
@Published var selectedVowelSign = ""
@Published var selectedOtherSign = ""
@Published var addNukta = false
@Published var nukta = ""
@Published var vowelSigns = [String]()
@Published var otherSigns = [String]()
@Published var numbers = [String]()
@Published var usesLakh = true
// These will be populated based on selection
@Published var baseStrings = [String]()
@Published var subConsonantString = ""
@Published var justLoadedFromFile = false
private func clearClusterData() {
errorMessage = ""
baseItems = RadioItems()
subConsonants = RadioItems()
selectedVowelSign = ""
selectedOtherSign = ""
addNukta = false
nukta = ""
vowelSigns = [String]()
otherSigns = [String]()
vowelSignParts = 1
baseStrings = [String]()
subConsonantString = ""//[String]()
}
private func initClusterData() {
clearClusterData()
var errorMessage = ""
if currentScript.count == 0 {
errorMessage = "Script is not set1!"
}
else {
let loadResults = loadClusterData()
errorMessage = loadResults.error
let dictionary = loadResults.dict
// I should not send this to the main thread as grid update
// is done before this is processed in the queue
//DispatchQueue.main.async {
if errorMessage.count > 0 {
self.errorMessage = "Can't load cluster data for \(self.currentScript): \(errorMessage)"
}
else {
if dictionary["BaseNames"] == nil {
self.errorMessage = "Invalid cluster data in file for script \(self.currentScript)"
}
else {
print(">>> Loading cluster data for \(self.currentScript)!")
self.errorMessage = ""
self.baseItems.labels = dictionary["BaseNames"] ?? [String]()
self.nukta = dictionary["Nukta"]?[0] ?? ""
self.subConsonants.labels = dictionary["SubConsonantNames"] ?? [String]()
self.vowelSigns = dictionary["Vowel Signs"] ?? [String]()
self.otherSigns = dictionary["Other Signs"] ?? [String]()
self.numbers = dictionary["Numbers"] ?? [String]()
let usesLakhSetting = dictionary["UsesLakh"]?[0] ?? "true"
self.usesLakh = usesLakhSetting.lowercased() == "true"
// Max parts in a vowel sign
self.vowelSignParts = Int(dictionary["Hibizcus"]![3]) ?? 0
// Currently selected base
self.baseStrings = dictionary[self.selectedBase] ?? [String]()
if dictionary[self.selectedSubConsonant] != nil && self.selectedSubConsonant.count > 0 {
self.subConsonantString = dictionary[self.selectedSubConsonant]![0]
}
self.justLoadedFromFile = true // to initiate a refresh
}
}
//}
}
}
func setSelectedBase() {
// TODO: Handle this better
if selectedBase == "Other Bases" {
baseStrings = [UserDefaults.standard.string(forKey: "ToDoCustomBase") ?? ""]
return
}
let loadResults = loadClusterData()
if loadResults.error.count == 0 {
let dictionary = loadResults.dict
baseStrings = dictionary[selectedBase]!
}
}
func setSelectedSubConsonant() {
let loadResults = loadClusterData()
if loadResults.error.count == 0 {
let dictionary = loadResults.dict
subConsonantString = dictionary[selectedSubConsonant]![0]
}
}
func loadClusterData() -> (dict:[String: [String]], error: String) {
// Initialise local vars
var errorMessage = ""
var clusterFile = "cluster_\(currentScript.lowercased())"
var jsonString = ""
var dictionary = [String: [String]]()
// Exception - Odia
if clusterFile == "cluster_odia (formerly oriya)" {
clusterFile = "cluster_odia"
}
// Exception - Meetei Mayek
if clusterFile.hasPrefix("cluster_meitei mayek") {
clusterFile = "cluster_meeteimayek"
}
print("Initializing cluster view model from: \(clusterFile). Nukta is \(nukta)")
// Read the json string from file
do {
if let fileURL = Bundle.main.url(forResource: clusterFile, withExtension: "json") {
jsonString = try String(contentsOf: fileURL, encoding: .utf8)
// Parse the json into dictionary
do {
dictionary = try JSONSerialization.jsonObject(with: Data(jsonString.utf8), options: []) as? [String: [String]] ?? [String: [String]]()
}
catch {
errorMessage = error.localizedDescription
print("Error while reading cluster data: \(errorMessage)")
}
}
else {
//errorMessage = "File \(clusterFile).json not found!"
errorMessage = "Data not available."
print("Error: \(errorMessage)")
}
}
catch {
errorMessage = error.localizedDescription
print("Error while reading json file from \(clusterFile): \(errorMessage)")
}
return (dict:dictionary, error: errorMessage)
}
}
| [
-1
] |
3f39bf2fe8d65272bd3ea45ec7a080a865552368 | 422bce5f3ce8c5c27080c83a71cb3bc0e2e9e1eb | /Galaxy Shooter/StylesScene.swift | ebede42e390fcc30c6ca62e209b2dfdc2a0a4262 | [] | no_license | mkowaleff/Galaxy-Shooter | 16a44ffa2caddf0d5069f075936e05c2dbd9c28b | fbc048db93c805bc54760f0d7a53d5f742fc6527 | refs/heads/master | 2021-03-30T17:56:30.367995 | 2017-05-03T21:39:18 | 2017-05-03T21:39:18 | 89,964,495 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,687 | swift | //
// StylesScene.swift
// Galaxy Shooter
//
// Created by Martin Kowaleff on 5/1/17.
// Copyright © 2017 Martin Kowaleff. All rights reserved.
//
import Foundation
import SpriteKit
class StylesScene: SKScene{
let backLabel = SKLabelNode(fontNamed: "MarketDeco")
override func didMove(to view: SKView) {
// this code runs as soon as we move to this scene
let background = SKSpriteNode(imageNamed: "bg1")
background.size = self.size
background.position = CGPoint(x: self.size.width/2, y: self.size.height/2)
background.zPosition = 0
self.addChild(background)
backLabel.text = "< Shop"
backLabel.fontSize = 50
backLabel.fontColor = SKColor.white
backLabel.position = CGPoint(x: self.size.width*0.15, y: self.size.height*0.95)
backLabel.zPosition = 1
backLabel.horizontalAlignmentMode = SKLabelHorizontalAlignmentMode.left
self.addChild(backLabel)
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
for touch: AnyObject in touches{
let pointOfTouch = touch.location(in: self)
if backLabel.contains(pointOfTouch){
let sceneToMoveTo = ShopScene(size: self.size)
sceneToMoveTo.scaleMode = self.scaleMode
let myTransition = SKTransition.fade(withDuration: 0.5)
self.view!.presentScene(sceneToMoveTo, transition: myTransition)
}
}
}
}
| [
-1
] |
4b7efabcc8f9267946b4530ddeae3f1da8f124dd | 4ea9e18d13f76e04da07b5beac39f1919134d8bc | /BusanApp/BusanApp/GroundLocationData.swift | 43408ea7d62db3cdb81d1351b99890bea19251b5 | [] | no_license | chansung18/BusanContest | 695a5a593c51d8d5ac3cb200374963c2c4fd5244 | 29bc726c150526530d1ffb5f93952cb9fdf52311 | refs/heads/master | 2021-01-23T20:14:23.208089 | 2015-09-30T08:25:07 | 2015-09-30T08:25:07 | 42,557,990 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 621 | swift | //
// GroundLocationData.swift
// BusanApp
//
// Created by Eunkyo, Seo on 9/28/15.
// Copyright © 2015 Eunkyo. All rights reserved.
//
import Foundation
func ==(lhs: GroundLocationData, rhs: GroundLocationData) -> Bool{
return lhs.hashValue == rhs.hashValue
}
class GroundLocationData: Hashable{
var longitude: Double
var latitude: Double
var hashValue: Int{
return "\(self.longitude),\(self.latitude)".hashValue
}
init(longitude: Double, latitude: Double)
{
self.longitude = latitude
self.latitude = longitude
}
} | [
-1
] |
83853799a443af366d3eb396fd76859fca3b5b80 | e8a05e74fe107145e45e16acae180c8a5783bfe4 | /Is It Prime/Is It Prime/ViewController.swift | 8a18a30d4935cb3565edb5a92077949c4659c24f | [] | no_license | wmadhatterw/IsITPrime | 5e9959cb4050d1de274039dd8073144ee9376f3a | b2770db2746e42df0b8a7bd3c539c46c8f20aa26 | refs/heads/master | 2020-03-25T03:25:02.874764 | 2018-08-02T21:45:24 | 2018-08-02T21:45:24 | 143,340,370 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,849 | swift | //
// ViewController.swift
// Is It Prime
//
// Created by Seth Walton on 8/2/18.
// Copyright © 2018 Seth Walton. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
@IBOutlet var numberTextField: UITextField!
@IBOutlet var resultLabel: UILabel!
@IBAction func isItPrime(_ sender: Any) {
if let userEnteredString = numberTextField.text {
let userEnteredInteger = Int(userEnteredString)
if let number = userEnteredInteger {
var isPrime = true
if number == 1{
isPrime = false
}
var i = 2
while i < number {
if number % i == 0 {
isPrime = false
}
i += 1
}
if isPrime {
resultLabel.text = "\(number) is prime!"
resultLabel.textColor = UIColor.green
} else {
resultLabel.text = "\(number) is not prime"
resultLabel.textColor = UIColor.red
}
} else {
resultLabel.text = "Please enter a Positive whole number!"
resultLabel.textColor = UIColor.red
}// close else enter whole
}// close button pressed
}// closed view
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.
}
}
| [
-1
] |
eefb5caff0e7469eef3e23e3fe67e11d8bc4a7d7 | 730c8c57aa261bf297547420bf07ccc4e71d8977 | /MySalary/SalesTableVC.swift | 9e75ed0fcdd7ce67da6fe413900963e97c1badb8 | [] | no_license | dmgerdes/MySalary | 89ee445805ae2ca83eaa80fed54df903fc40e7d0 | 97c6408af03ec7a589017b3de2f26d6416488fd7 | refs/heads/master | 2021-06-27T10:43:25.481993 | 2017-09-12T16:58:03 | 2017-09-12T16:58:03 | 103,298,116 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 7,119 | swift | //
// SalesTableVC.swift
// MySalary
//
// Created by Mike Gerdes on 7/14/17.
// Copyright © 2017 Mike Gerdes. All rights reserved.
//
import UIKit
import os.log
import CoreData
class SalesTableVC: UITableViewController {
var salesEntrys: [SalesEntry] = []
override func viewDidLoad() {
super.viewDidLoad()
// Uncomment the following line to preserve selection between presentations
// self.clearsSelectionOnViewWillAppear = false
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
self.navigationItem.leftBarButtonItem = self.editButtonItem
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
loadData()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func loadData() {
//retreive all entities from SalesEntry
guard let appDelegate =
UIApplication.shared.delegate as? AppDelegate else {
return
}
let managedContext =
appDelegate.persistentContainer.viewContext
let fetchRequest =
NSFetchRequest<NSManagedObject>(entityName: "SalesEntry")
let sortDescriptor = NSSortDescriptor(key: "date", ascending: false)
let sortDescriptors = [sortDescriptor]
fetchRequest.sortDescriptors = sortDescriptors
do {
salesEntrys = try managedContext.fetch(fetchRequest as! NSFetchRequest<NSFetchRequestResult>) as! [SalesEntry]
} catch let error as NSError {
print("Could not fetch. \(error), \(error.userInfo)")
}
}
// MARK: - Table view data source
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of rows
return salesEntrys.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
// Table view cells are reused and should be dequeued using a cell identifier.
let cellIdentifier = "saleEntryCell"
guard let cell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier, for: indexPath) as? SaleEntryCell else {
fatalError("The dequeued cell is not an instance of saleEntryCell.")
}
//get values
let sale = salesEntrys[indexPath.row]
//let dailySale:Double! = sale.value(forKeyPath: "sales") as? Double
//let dailyDate: NSDate! = sale.value(forKeyPath: "date") as? NSDate
let dailySale:Double! = sale.sales
let dailyDate: NSDate! = sale.date
//format sales
let nbrformatter = NumberFormatter()
nbrformatter.locale = Locale.current // Change this to another locale if you want to force a specific locale, otherwise this is redundant as the current locale is the default already
nbrformatter.numberStyle = .currency
if let s = nbrformatter.string(from: dailySale as NSNumber) {
cell.sale.text = "Sales: \(s)"
}
//format date
let formatter = DateFormatter()
formatter.dateStyle = DateFormatter.Style.short
formatter.timeStyle = .medium
let dateString = formatter.string(from: dailyDate as Date)
cell.date.text = dateString
return cell
}
// Override to support conditional editing of the table view.
override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
// Return false if you do not want the specified item to be editable.
return true
}
// Override to support editing the table view.
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
// Delete the row from the data source
guard let appDelegate =
UIApplication.shared.delegate as? AppDelegate else {
return
}
let managedContext =
appDelegate.persistentContainer.viewContext
managedContext.delete(salesEntrys[indexPath.row])
do {
try managedContext.save()
} catch let error as NSError {
print("Could not save. \(error), \(error.userInfo)")
}
//tableView.deleteRows(at: [indexPath], with: .fade)
loadData()
tableView.reloadData()
} else if editingStyle == .insert {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
/*
// Override to support rearranging the table view.
override func tableView(_ tableView: UITableView, moveRowAt fromIndexPath: IndexPath, to: IndexPath) {
}
*/
/*
// Override to support conditional rearranging of the table view.
override func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool {
// Return false if you do not want the item to be re-orderable.
return true
}
*/
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
super.prepare(for: segue, sender: sender)
switch(segue.identifier ?? "") {
case "AddItem":
os_log("Adding a new sales entry.", log: OSLog.default, type: .debug)
case "ShowDetail":
guard let addSalesEntryVC = segue.destination as? AddSalesEntryVC else {
fatalError("Unexpected destination: \(segue.destination)")
}
guard let selectedSalesCell = sender as? SaleEntryCell else {
fatalError("Unexpected sender: \(String(describing: sender))")
}
guard let indexPath = tableView.indexPath(for: selectedSalesCell) else {
fatalError("The selected cell is not being displayed by the table")
}
let selectedSalesEntry = salesEntrys[indexPath.row]
addSalesEntryVC.salesEntry = selectedSalesEntry as? SalesEntry
default:
fatalError("Unexpected Segue Identifier; \(String(describing: segue.identifier))")
}
}
//Action
@IBAction func unwindToSalesEntryList(sender: UIStoryboardSegue) {
if sender.source is AddSalesEntryVC{
loadData()
tableView.reloadData()
}
}
}
| [
-1
] |
2778a8e3fad40ad3a956fc684a0b60510dbf9afe | 9d121dd6981230a497f725ef6fe64beda70e6eeb | /Englogram/Englogram/Article.swift | 981e21a011ce4bc47a8b4fea3e16ad816deafdbe | [] | no_license | Temirulan/workspace-for-iOS | f9df0ad549d553eb347034609fc838b6b39d74fd | 80d84a7721e1fc89f2309925847c3ef770f249ce | refs/heads/master | 2021-01-20T22:41:14.412677 | 2015-04-29T18:11:35 | 2015-04-29T18:11:35 | 34,810,158 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,180 | swift | //
// Article.swift
// Englogram
//
// Created by Mussayev Temirulan Zamirbekovich on 4/3/15.
// Copyright (c) 2015 Mussayev Temirulan. All rights reserved.
//
import Foundation
extension NSDate
{
convenience
init(dateString:String) {
let dateStringFormatter = NSDateFormatter()
dateStringFormatter.dateFormat = "yyyy-MM-dd"
dateStringFormatter.locale = NSLocale(localeIdentifier: "en_US_POSIX")
let d = dateStringFormatter.dateFromString(dateString)
self.init(timeInterval:0, sinceDate:d!)
}
}
class Article: Printable {
var id: String
var name: String
var title: String
var content: String
var date: String
var category: String
var status: Bool
init(id: String, name: String, title: String, content: String, date: String, category: String, status: Bool) {
self.id = id
self.name = name
self.title = title
self.content = content
self.date = date
self.category = category
self.status = status
}
internal var description: String {
return "title: \(title); content: \(content); category: \(category)"
}
}
| [
-1
] |
73e450722cba7518b7fca5a36f1f8e6e5d9a6c0b | 25f2e99c41c2f2b1d2a103d4a30a690bea0b82ca | /TechMon/AppDelegate.swift | 0c13eefe44f288c575b244aa52e5887f73535ddf | [] | no_license | aibatamako/TechMon | adbc82e2f42197a5ea47a8544ddfab333c06ad4d | 6814cc8df654c436a222559cadc1529d12e11f05 | refs/heads/main | 2023-04-30T23:32:28.565167 | 2021-05-14T17:15:01 | 2021-05-14T17:15:01 | 367,432,109 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,346 | swift | //
// AppDelegate.swift
// TechMon
//
// Created by tmk_cheer on 2021/05/14.
//
import UIKit
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
| [
393222,
393224,
393230,
393250,
344102,
393261,
393266,
213048,
385081,
376889,
393275,
376905,
254030,
286800,
368727,
180313,
368735,
180320,
376931,
286831,
368752,
286844,
417924,
262283,
286879,
286888,
377012,
327871,
180416,
377036,
180431,
377046,
418010,
377060,
327914,
205036,
393456,
393460,
418043,
336123,
385280,
336128,
262404,
180490,
164106,
368911,
262416,
262422,
377117,
262436,
336180,
262454,
393538,
262472,
344403,
213332,
65880,
262496,
418144,
262499,
213352,
246123,
262507,
262510,
213372,
385419,
393612,
262550,
262552,
385440,
385443,
385451,
262573,
393647,
385458,
262586,
344511,
262592,
360916,
369118,
328177,
328179,
328182,
328189,
328192,
164361,
410128,
393747,
254490,
188958,
385570,
33316,
377383,
197159,
352821,
197177,
418363,
188987,
369223,
385609,
385616,
352864,
369253,
262760,
352874,
352887,
254587,
377472,
148105,
377484,
352918,
98968,
344744,
361129,
336555,
385713,
434867,
164534,
336567,
328378,
164538,
328386,
352968,
344776,
352971,
418507,
352973,
385742,
385748,
361179,
189153,
369381,
361195,
418553,
344831,
336643,
344835,
344841,
361230,
336659,
418580,
418585,
434970,
369435,
418589,
262942,
418593,
336675,
328484,
418598,
418605,
336696,
361273,
328515,
336708,
328519,
361288,
336711,
328522,
426841,
254812,
361309,
197468,
361315,
361322,
328573,
377729,
369542,
361360,
222128,
345035,
386003,
345043,
386011,
386018,
386022,
435187,
328702,
328714,
361489,
386069,
386073,
336921,
336925,
345118,
377887,
345133,
345138,
386101,
361536,
189520,
345169,
156761,
361567,
148578,
345199,
386167,
361593,
410745,
361598,
214149,
345222,
386186,
337047,
345246,
214175,
337071,
337075,
345267,
386258,
328924,
66782,
222437,
386285,
328941,
386291,
345376,
353570,
345379,
410917,
345382,
345399,
378169,
369978,
337222,
337229,
337234,
263508,
402791,
345448,
271730,
378227,
271745,
181638,
353673,
181643,
181649,
181654,
230809,
181670,
181673,
181678,
181681,
337329,
181684,
181690,
361917,
181696,
337349,
181703,
337365,
271839,
329191,
361960,
329194,
116210,
337398,
337415,
329226,
419339,
419343,
419349,
345625,
419355,
370205,
419359,
394786,
419362,
370213,
419368,
419376,
206395,
214593,
419400,
419402,
353867,
419406,
419410,
394853,
345701,
222830,
370297,
403070,
353919,
403075,
345736,
198280,
403091,
345749,
419483,
345757,
345762,
419491,
345765,
419497,
419501,
370350,
419506,
419509,
419512,
337592,
419517,
337599,
419527,
419530,
419535,
272081,
419542,
394966,
419544,
181977,
345818,
419547,
419550,
419559,
337642,
419563,
337645,
370415,
337659,
337668,
362247,
395021,
362255,
116509,
345887,
378663,
345905,
354106,
354111,
247617,
354117,
370503,
329544,
345930,
370509,
354130,
247637,
337750,
370519,
313180,
354142,
354150,
354156,
345964,
345967,
345970,
345974,
403320,
354172,
247691,
337808,
247700,
329623,
436126,
436132,
337833,
362413,
337844,
346057,
247759,
346063,
329697,
354277,
190439,
247789,
354313,
346139,
436289,
378954,
395339,
338004,
100453,
329832,
329855,
329867,
329885,
346272,
362660,
100524,
387249,
379066,
387260,
256191,
395466,
346316,
411861,
411864,
411868,
411873,
379107,
411876,
387301,
346343,
338152,
387306,
387312,
346355,
436473,
321786,
379134,
411903,
411916,
379152,
395538,
387349,
338199,
387352,
182558,
338211,
248111,
362822,
436555,
190796,
379233,
354673,
321910,
248186,
420236,
379278,
272786,
354727,
338352,
330189,
338381,
338386,
256472,
338403,
338409,
248308,
199164,
330252,
199186,
420376,
330267,
354855,
10828,
199249,
346721,
174695,
248425,
191084,
338543,
191092,
346742,
330383,
354974,
150183,
174774,
248504,
174777,
223934,
355024,
273108,
355028,
264918,
183005,
256734,
436962,
338660,
338664,
264941,
363251,
207619,
264964,
338700,
256786,
199452,
363293,
396066,
346916,
396069,
215853,
355122,
355131,
355140,
355143,
338763,
355150,
330580,
355166,
265055,
265058,
355175,
387944,
355179,
330610,
330642,
355218,
412599,
207808,
379848,
396245,
330710,
248792,
248798,
347105,
257008,
183282,
265207,
330748,
265214,
330760,
330768,
248862,
396328,
158761,
199728,
396336,
330800,
396339,
339001,
388154,
388161,
347205,
248904,
330826,
248914,
412764,
339036,
257120,
265320,
248951,
420984,
330889,
347287,
339097,
248985,
44197,
380070,
339112,
249014,
126144,
330958,
330965,
265432,
265436,
388319,
388347,
175375,
159005,
175396,
208166,
273708,
347437,
372015,
347441,
372018,
199988,
44342,
175415,
396600,
437566,
175423,
437570,
437575,
437583,
331088,
437587,
331093,
396633,
175450,
437595,
175457,
208227,
175460,
175463,
265580,
437620,
175477,
249208,
175483,
175486,
249214,
175489,
249218,
249224,
249227,
249234,
175513,
175516,
396705,
175522,
355748,
380332,
396722,
208311,
388542,
372163,
216517,
380360,
216522,
339404,
372176,
208337,
339412,
413141,
339417,
339420,
249308,
339424,
249312,
339428,
339434,
249328,
69113,
372228,
208398,
380432,
175635,
265778,
265795,
396872,
265805,
224853,
224857,
257633,
224870,
372327,
257646,
372337,
224884,
224887,
224890,
224894,
224897,
372353,
216707,
126596,
421508,
224904,
11918,
159374,
224913,
126610,
339601,
224916,
224919,
126616,
224922,
208538,
224926,
224929,
224932,
224936,
257704,
224942,
257712,
224947,
257716,
257720,
224953,
257724,
224959,
257732,
224965,
224969,
339662,
224975,
257747,
224981,
224986,
257761,
224993,
257764,
224999,
339695,
225012,
257787,
225020,
339710,
257790,
225025,
257794,
257801,
339721,
257804,
225038,
257807,
225043,
372499,
167700,
225048,
257819,
225053,
184094,
225058,
257833,
225066,
257836,
413484,
225070,
225073,
372532,
257845,
225079,
397112,
225082,
397115,
225087,
225092,
225096,
323402,
257868,
225103,
257871,
397139,
225108,
225112,
257883,
257886,
225119,
257890,
225127,
274280,
257896,
257901,
225137,
257908,
225141,
257912,
225148,
257916,
257920,
225155,
339844,
225165,
397200,
225170,
380822,
225175,
225180,
118691,
184244,
372664,
372702,
372706,
356335,
380918,
372738,
405533,
430129,
266294,
266297,
421960,
356439,
430180,
421990,
266350,
356466,
266362,
381068,
225423,
250002,
250004,
225429,
356506,
225437,
135327,
225441,
438433,
225444,
438436,
225447,
438440,
225450,
258222,
225455,
430256,
225458,
225461,
225466,
389307,
225470,
381120,
372929,
430274,
225475,
389320,
225484,
225487,
225490,
266453,
225493,
225496,
225499,
225502,
225505,
356578,
225510,
217318,
225514,
225518,
372976,
381176,
397571,
389380,
61722,
356637,
356640,
356643,
356646,
266536,
356649,
356655,
332080,
340275,
356660,
397622,
332090,
225597,
332097,
201028,
348488,
332106,
348502,
250199,
250202,
332125,
250210,
348522,
348525,
348527,
332152,
389502,
250238,
356740,
373145,
340379,
389550,
324030,
266687,
160234,
127471,
340472,
324094,
266754,
324111,
340500,
332324,
381481,
356907,
324142,
356916,
324149,
324155,
348733,
324164,
356934,
348743,
381512,
324173,
324176,
389723,
332380,
373343,
381545,
340627,
373398,
184982,
258721,
332453,
332459,
389805,
332463,
381617,
332471,
332483,
332486,
373449,
332493,
357069,
357073,
332511,
332520,
340718,
332533,
348924,
389892,
373510,
389926,
348978,
152370,
340789,
348982,
398139,
127814,
357201,
357206,
389978,
430939,
357211,
357214,
201579,
201582,
349040,
340849,
201588,
430965,
381813,
324472,
398201,
340858,
324475,
430972,
340861,
324478,
119674,
324481,
373634,
398211,
324484,
324487,
381833,
324492,
324495,
324498,
430995,
324501,
324510,
422816,
324513,
398245,
201637,
324524,
340909,
324533,
324538,
324541,
398279,
340939,
340941,
209873,
340957,
431072,
398306,
340963,
209895,
201711,
349172,
381946,
349180,
439294,
431106,
209943,
357410,
250914,
185380,
357418,
209965,
209968,
209971,
209975,
209979,
209987,
209990,
209995,
341071,
349267,
250967,
210010,
341091,
210025,
210027,
210030,
210036,
210039,
349308,
210044,
349311,
160895,
152703,
210052,
349319,
210055,
210067,
210071,
210077,
210080,
251044,
210084,
185511,
210088,
210095,
210098,
210107,
210115,
332997,
210127,
333009,
210131,
333014,
210138,
210143,
218354,
218360,
251128,
275706,
275712,
275715,
275721,
349459,
333078,
251160,
349484,
349491,
251189,
415033,
251210,
357708,
210260,
365911,
259421,
365921,
333154,
251235,
374117,
333162,
234866,
390516,
333175,
357755,
136590,
374160,
112020,
349590,
357792,
259515,
415166,
415185,
366034,
366038,
415191,
415193,
415196,
415199,
423392,
333284,
415207,
366056,
366061,
415216,
210420,
415224,
423423,
415257,
415263,
366117,
415270,
144939,
415278,
415281,
415285,
210487,
415290,
415293,
349761,
415300,
333386,
366172,
333413,
423528,
423532,
210544,
415353,
333439,
415361,
267909,
153227,
333498,
210631,
333511,
259788,
358099,
153302,
333534,
366307,
366311,
431851,
366318,
210672,
366321,
366325,
210695,
268041,
210698,
366348,
210706,
399128,
210719,
358191,
366387,
210739,
399159,
358200,
325440,
366401,
341829,
325446,
46920,
341834,
341838,
341843,
415573,
358234,
341851,
350045,
399199,
259938,
399206,
268143,
358255,
399215,
358259,
341876,
333689,
243579,
325504,
333698,
333708,
333724,
382890,
350146,
333774,
358371,
350189,
350193,
350202,
350206,
350213,
268298,
350224,
350231,
333850,
350237,
350240,
350244,
350248,
178218,
350251,
350256,
350259,
350271,
243781,
350285,
374864,
342111,
374902,
432271,
334011,
260289,
260298,
350410,
350416,
350422,
211160,
350425,
268507,
334045,
350445,
375026,
358644,
350458,
350461,
350464,
325891,
350467,
350475,
375053,
268559,
350480,
432405,
350486,
325914,
350490,
325917,
350493,
350498,
194852,
350504,
358700,
391468,
350509,
358704,
358713,
358716,
383306,
334161,
383321,
383330,
383333,
391530,
383341,
334203,
268668,
194941,
391563,
366990,
416157,
342430,
268701,
375208,
375216,
334262,
334275,
326084,
358856,
195039,
334304,
334311,
375277,
334321,
350723,
186897,
334358,
342550,
342554,
334363,
358941,
350761,
252461,
334384,
383536,
358961,
334394,
252482,
219718,
334407,
334420,
350822,
375400,
334465,
334468,
162445,
326290,
342679,
342683,
260766,
342710,
244409,
260797,
260801,
350917,
391894,
154328,
416473,
64230,
342766,
375535,
203506,
342776,
391937,
391948,
375568,
326416,
375571,
375574,
162591,
326441,
383793,
326451,
326454,
326460,
260924,
375612,
244540,
326467,
244551,
326473,
326477,
326485,
416597,
326490,
342874,
326502,
375656,
433000,
326507,
326510,
211825,
211831,
351097,
392060,
359295,
351104,
342915,
236430,
342930,
252822,
392091,
400285,
252836,
359334,
400306,
351168,
359361,
326598,
359366,
359382,
359388,
383967,
343015,
359407,
261108,
244726,
261111,
383997,
261129,
359451,
261147,
211998,
261153,
261159,
359470,
359476,
343131,
384098,
384101,
384107,
367723,
187502,
343154,
384114,
212094,
351364,
384135,
384139,
384143,
351381,
384160,
384168,
367794,
384181,
367800,
384191,
351423,
384198,
326855,
244937,
253130,
343244,
146642,
359649,
343270,
351466,
351479,
384249,
343306,
261389,
359694,
253200,
261393,
384275,
245020,
245029,
171302,
351534,
376110,
245040,
384314,
425276,
384323,
212291,
343365,
212303,
367965,
343393,
343398,
367980,
425328,
343409,
253303,
154999,
343417,
327034,
245127,
384397,
245136,
245142,
245145,
343450,
245148,
245151,
245154,
245157,
245162,
327084,
359865,
384443,
146876,
327107,
384453,
327110,
327115,
327117,
359886,
359890,
343507,
368092,
343534,
343539,
368119,
343544,
368122,
409091,
359947,
359955,
359983,
343630,
179802,
327275,
245357,
138864,
155254,
155273,
368288,
245409,
425638,
425649,
155322,
425662,
155327,
155351,
155354,
212699,
155363,
245475,
155371,
245483,
409335,
155393,
155403,
155422,
360223,
155438,
155442,
155447,
417595,
155461,
360261,
376663,
155482,
261981,
425822,
155487,
376671,
155490,
155491,
327531,
261996,
376685,
261999,
262002,
327539,
262005,
147317,
425845,
262008,
262011,
155516,
155521,
155525,
360326,
376714,
155531,
262027,
262030,
262033,
262036,
262039,
262042,
155549,
262045,
262048,
262051,
327589,
155559,
155562,
155565,
393150,
393169,
384977,
155611,
155619,
253923,
155621,
253926,
204784,
393203,
360438,
253943,
393206,
393212,
155646
] |
793174061bd05bc4c4edbb0c89eb9940c982a3b1 | 9889ce67004698fec8270fee7c9d548723d0ee38 | /Sencha/Extensions/XCTestCase+Sencha.swift | 1088ce6bf6bfffa8138343efc89a1cf8770c35d8 | [
"Apache-2.0"
] | permissive | sch-devios/Sencha | 0f1df3dddd32ff0c9005b53baec3ad655c5887ac | d9402aaff3074773bfba516f08d27b69ea3d6085 | refs/heads/master | 2021-04-27T18:00:25.853285 | 2018-02-20T14:46:41 | 2018-02-20T14:46:41 | 122,330,512 | 0 | 0 | null | 2018-02-21T11:56:43 | 2018-02-21T11:56:43 | null | UTF-8 | Swift | false | false | 1,259 | swift |
import XCTest
public protocol Sencha: SenchaScrollableAssertion, SenchaTapActions, SenchaEditTextActions, SenchaKeyboardActions, SenchaTableViewAssertions, SenchaSwitchAssertions {}
extension XCTestCase: Sencha {
private var window : UIWindow {
get {
return UIApplication.shared.keyWindow!
}
}
override open func setUp() {
super.setUp()
window.layer.speed = 10.0
}
open func open(viewController: UIViewController, modally: Bool = false, embedInNavigation: Bool = false) {
var viewControllerToOpen = viewController
if embedInNavigation {
viewControllerToOpen = embedInNavigationController(viewController)
}
if modally {
window.set(rootViewController: UIViewController())
window.rootViewController?.present(viewControllerToOpen, animated: true, completion: nil)
} else {
window.set(rootViewController: viewControllerToOpen)
}
}
private func embedInNavigationController(_ viewController: UIViewController) -> UIViewController {
let navigationController = UINavigationController(rootViewController: viewController)
return navigationController
}
}
| [
-1
] |
f581ee30e19227049925f8cdf65e62f1b241e02a | d6f1797151268cc7e10e62859d72648694ce9090 | /controllmemusample/chatOverview/ChatDetailViewController.swift | 1870d6aaf68a5877d8c46730647daf87d9ac7ff0 | [] | no_license | tatsumi44/campus | d058540b1be75a57bf44421ea4bcee54b4c527ed | 7ad4dcd7e6460b377001e507a703653b48ef4368 | refs/heads/master | 2020-03-10T04:58:36.900806 | 2018-04-23T19:59:36 | 2018-04-23T19:59:36 | 129,206,199 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 11,130 | swift | //
// ChatDetailViewController.swift
// controllmemusample
//
// Created by tatsumi kentaro on 2018/02/27.
// Copyright © 2018年 tatsumi kentaro. All rights reserved.
//
import UIKit
import Firebase
import MessageKit
class ChatDetailViewController: MessagesViewController{
var cellOfNum: Int!
var realTimeDB: DatabaseReference!
var db: Firestore!
var getArray = [String]()
var getMainArray = [[String]]()
var commnetArray = [String:String]()
var myName: String!
var cellDetailArray = [ChatList]()
var messagesList: [ChatModel] = []
var sender:Sender!
var sender1:Sender!
let official = Sender(id: "123456", displayName: "official")
let officialAvatar = Avatar(image: UIImage(named:"kanematsu.jpg"), initials: "official")
var contentsArray = [String:Any]()
var uid1:String!
var myImagepath: String!
var otherImagePath: String!
var myPath: URL!
var otherPath: URL!
override func viewDidLoad() {
super.viewDidLoad()
messagesCollectionView.messagesDataSource = self
messagesCollectionView.messagesLayoutDelegate = self
messagesCollectionView.messagesDisplayDelegate = self
messageInputBar.delegate = self
messageInputBar.sendButton.tintColor = UIColor(red: 69/255, green: 193/255, blue: 89/255, alpha: 1)
scrollsToBottomOnKeybordBeginsEditing = true // default false
maintainPositionOnKeyboardFrameChanged = true // default false
// Do any additional setup after loading the view.
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
tabBarController?.tabBar.isHidden = true
realTimeDB = Database.database().reference()
let storage = Storage.storage().reference()
if let uid = Auth.auth().currentUser?.uid{
uid1 = uid
db = Firestore.firestore()
db.collection("users").document(uid).getDocument { (snap, error) in
if let error = error{
self.alert(message: error.localizedDescription)
print("\(error)")
}else{
let data = snap?.data()
self.myName = data!["name"] as! String
if let image: String = data!["profilePath"] as? String {
self.myImagepath = image
}
self.sender = Sender(id: uid, displayName: self.myName)
self.db.collection("users").document(self.cellDetailArray[self.cellOfNum].exhibitorID).getDocument(completion: { (snap, error) in
if let error = error{
self.alert(message: error.localizedDescription)
print(error.localizedDescription)
}else{
let data = snap?.data()
self.otherImagePath = data!["profilePath"] as! String
if let myPath = self.myImagepath,let otherPath = self.otherImagePath{
storage.child("image/profile/\(myPath)").downloadURL(completion: { (url, error) in
if let error = error{
self.alert(message: error.localizedDescription)
print(error.localizedDescription)
}else{
self.myPath = url
self.messagesCollectionView.reloadData()
}
})
storage.child("image/profile/\(otherPath)").downloadURL(completion: { (url, error) in
if let error = error{
self.alert(message: error.localizedDescription)
print(error.localizedDescription)
}else{
self.otherPath = url
self.messagesCollectionView.reloadData()
}
})
}
}
})
}
self.realTimeDB.ref.child("realtimechat").child("message").child(self.cellDetailArray[self.cellOfNum].roomID!).observe(.value) { (snap) in
self.messagesList = [ChatModel]()
for item in snap.children{
let child = item as! DataSnapshot
let dic = child.value as! NSDictionary
let attributedText = NSAttributedString(string: dic["text"] as! String, attributes: [.font: UIFont.systemFont(ofSize: 15), .foregroundColor: UIColor.blue])
self.sender1 = Sender(id: dic["senderID"] as! String, displayName: dic["senderName"] as! String )
let message = ChatModel(attributedText: attributedText, sender: self.sender1, messageId: UUID().uuidString, date: Date())
self.messagesList.append(message)
}
self.messagesCollectionView.reloadData()
self.messagesCollectionView.scrollToBottom()
}
}
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
tabBarController?.tabBar.isHidden = false
}
}
//表示内容系
extension ChatDetailViewController: MessagesDataSource {
func currentSender() -> Sender {
return sender
}
func numberOfMessages(in messagesCollectionView: MessagesCollectionView) -> Int {
return messagesList.count
}
func messageForItem(at indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) -> MessageType {
return messagesList[indexPath.section]
}
func cellTopLabelAttributedText(for message: MessageType, at indexPath: IndexPath) -> NSAttributedString? {
let name = message.sender.displayName
return NSAttributedString(string: name, attributes: [NSAttributedStringKey.font: UIFont.preferredFont(forTextStyle: .caption1)])
}
func cellBottomLabelAttributedText(for message: MessageType, at indexPath: IndexPath) -> NSAttributedString? {
struct ConversationDateFormatter {
static let formatter: DateFormatter = {
let formatter = DateFormatter()
formatter.dateStyle = .medium
return formatter
}()
}
let formatter = ConversationDateFormatter.formatter
let dateString = formatter.string(from: message.sentDate)
return NSAttributedString(string: dateString, attributes: [NSAttributedStringKey.font: UIFont.preferredFont(forTextStyle: .caption2)])
}
}
//レイアウト系
extension ChatDetailViewController: MessagesDisplayDelegate, MessagesLayoutDelegate {
func heightForLocation(message: MessageType, at indexPath: IndexPath, with maxWidth: CGFloat, in messagesCollectionView: MessagesCollectionView) -> CGFloat {
return 200
}
func configureAvatarView(_ avatarView: AvatarView, for message: MessageType, at indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) {
if isFromCurrentSender(message: message){
avatarView.sd_setImage(with: myPath, completed: nil)
}else{
avatarView.sd_setImage(with: otherPath, completed: nil)
}
if message.sender == official{
avatarView.set(avatar: officialAvatar)
}
}
func messagePadding(for message: MessageType, at indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) -> UIEdgeInsets {
if isFromCurrentSender(message: message) {
return UIEdgeInsets(top: 0, left: 30, bottom: 0, right: 4)
} else {
return UIEdgeInsets(top: 0, left: 4, bottom: 0, right: 30)
}
}
func cellTopLabelAlignment(for message: MessageType, at indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) -> LabelAlignment {
if isFromCurrentSender(message: message) {
return .messageTrailing(UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 10))
} else {
return .messageLeading(UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 0))
}
}
func cellBottomLabelAlignment(for message: MessageType, at indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) -> LabelAlignment {
if isFromCurrentSender(message: message) {
return .messageLeading(UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 0))
} else {
return .messageTrailing(UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 10))
}
}
func footerViewSize(for message: MessageType, at indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) -> CGSize {
return CGSize(width: messagesCollectionView.bounds.width, height: 10)
}
}
//打ち込んだ文字をどうにかする系
extension ChatDetailViewController: MessageInputBarDelegate {
func messageInputBar(_ inputBar: MessageInputBar, didPressSendButtonWith text: String) {
// Each NSTextAttachment that contains an image will count as one empty character in the text: String
for component in inputBar.inputTextView.components {
if let image = component as? UIImage {
let imageMessage = ChatModel(image: image, sender: currentSender(), messageId: UUID().uuidString, date: Date())
messagesList.append(imageMessage)
messagesCollectionView.insertSections([messagesList.count - 1])
} else if let text = component as? String {
print(text)
contentsArray = ["text":text,"senderID": uid1,"senderName":self.sender.displayName]
realTimeDB.ref.child("realtimechat").child("message").child(cellDetailArray[cellOfNum].roomID!).childByAutoId().setValue(contentsArray)
let attributedText = NSAttributedString(string: text, attributes: [.font: UIFont.systemFont(ofSize: 15), .foregroundColor: UIColor.blue])
let message = ChatModel(attributedText: attributedText, sender: currentSender(), messageId: UUID().uuidString, date: Date())
messagesList.append(message)
messagesCollectionView.insertSections([messagesList.count - 1])
}
}
inputBar.inputTextView.text = String()
messagesCollectionView.scrollToBottom()
}
}
| [
-1
] |
aca0eddc38a12b449716486e3043cf1f28a8efe3 | 1bfe906d74732e75af4d29cc9e9b6e93d6c4d497 | /Fixtures/Miscellaneous/PkgConfig/CSystemModule/Package.swift | 8719a48e073cf945838f37b92e208191bf7a7621 | [
"Swift-exception",
"Apache-2.0"
] | permissive | erwinmaza/swift-package-manager | f49cb94cb45c99646deb03bf0ca2dd4ff0261292 | 8136f47eac5bf48dad28fc3b8c0538d532b7ac20 | refs/heads/master | 2020-03-19T15:18:07.617737 | 2018-06-26T21:37:55 | 2018-06-26T21:37:55 | 136,665,195 | 0 | 0 | Apache-2.0 | 2018-06-28T16:21:01 | 2018-06-08T20:54:48 | Swift | UTF-8 | Swift | false | false | 149 | swift | import PackageDescription
let package = Package(
name: "CSystemModule",
pkgConfig: "libSystemModule",
providers: [.Brew("SystemModule")]
)
| [
-1
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.