blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
2
625
content_id
stringlengths
40
40
detected_licenses
listlengths
0
47
license_type
stringclasses
2 values
repo_name
stringlengths
5
116
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
643 values
visit_date
timestamp[ns]
revision_date
timestamp[ns]
committer_date
timestamp[ns]
github_id
int64
80.4k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
16 values
gha_event_created_at
timestamp[ns]
gha_created_at
timestamp[ns]
gha_language
stringclasses
85 values
src_encoding
stringclasses
7 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
1 class
length_bytes
int64
4
6.44M
extension
stringclasses
17 values
content
stringlengths
4
6.44M
duplicates
listlengths
1
9.02k
a2e34479cb9632ebfc6312e408cad86a6a0ebe85
3ee5f13524bbc57241dfd87776354bdcab1a1a1d
/HudlTests/HudlRealmManagerTests.swift
170776cae1a3a520ba0723bd86d1d9df56618834
[]
no_license
crisredfi/Hudl
58c2dd380bb4fdce01680204cfd4690ba2d85987
2141731650c71774e34e921937827d731024b0e9
refs/heads/master
2020-04-11T07:28:08.094093
2017-04-07T20:58:54
2017-04-07T20:58:54
71,262,848
0
0
null
null
null
null
UTF-8
Swift
false
false
1,555
swift
// // HudlRealmManagerTests.swift // Hudl // // Created by Aleix Guri on 22/10/2016. // Copyright © 2016 Aleix Guri. All rights reserved. // import XCTest @testable import Hudl class HudlRealmManagerTests: XCTestCase { var videoModel: VideoModel! var thumbnail: ThumbmailModel! override func setUp() { super.setUp() thumbnail = ThumbmailModel.init(url: "url", width: 12, height: 12) videoModel = VideoModel.init(title: "my video", description: "some description", thumbnails: [thumbnail], publishedAt: "today", videoId: "12345") } func test_savRetrieveAndDeleteFromDatabase() { HudlRealmManager.saveViewModelToRealm(videoModel) // we can now know if this has been stored. XCTAssertTrue(HudlRealmManager.isIdAlreadyHighlighted(videoId: videoModel.videoId!)) let savedItems = HudlRealmManager.getViewModelFromRealm() let filteredArray = savedItems.filter { $0.videoId == videoModel.videoId } XCTAssertTrue(filteredArray.count == 1) HudlRealmManager.removeModelFromRealm(videoModel) let newSavedItems = HudlRealmManager.getViewModelFromRealm() let newFilteredArray = newSavedItems.filter { $0.videoId == videoModel.videoId } XCTAssertTrue(newFilteredArray.count == 0) XCTAssertFalse(HudlRealmManager.isIdAlreadyHighlighted(videoId: videoModel.videoId!)) } }
[ -1 ]
d856db45d251de39546f0927450335d98dbc0df4
ea9cd14b8b7cf426af12faf25e41a26caf5b0dd9
/PregnancyTracker/AppDelegate.swift
725ceade2b00ca696b9141fcb655794e39b2db9d
[]
no_license
amanigmtt/CI_Repo
34a36e8aa4c8f1058432401bf636abbfd876df64
783162da0a2d9a1af06e2ed330f45271872c35ea
refs/heads/master
2020-03-31T10:12:11.798328
2018-10-08T19:56:02
2018-10-08T19:56:02
152,126,407
0
0
null
null
null
null
UTF-8
Swift
false
false
4,595
swift
// // AppDelegate.swift // PregnancyTracker // // Created by Racha on 11/8/17. // Copyright © 2017 Racha. All rights reserved. // import UIKit import CoreData @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:. // Saves changes in the application's managed object context before the application terminates. self.saveContext() } // MARK: - Core Data stack lazy var persistentContainer: NSPersistentContainer = { /* The persistent container for the application. This implementation creates and returns a container, having loaded the store for the application to it. This property is optional since there are legitimate error conditions that could cause the creation of the store to fail. */ let container = NSPersistentContainer(name: "PregnancyTracker") container.loadPersistentStores(completionHandler: { (storeDescription, error) in if let error = error as NSError? { // Replace this implementation with code to handle the error appropriately. // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. /* Typical reasons for an error here include: * The parent directory does not exist, cannot be created, or disallows writing. * The persistent store is not accessible, due to permissions or data protection when the device is locked. * The device is out of space. * The store could not be migrated to the current model version. Check the error message to determine what the actual problem was. */ fatalError("Unresolved error \(error), \(error.userInfo)") } }) return container }() // MARK: - Core Data Saving support func saveContext () { let context = persistentContainer.viewContext if context.hasChanges { do { try context.save() } catch { // Replace this implementation with code to handle the error appropriately. // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. let nserror = error as NSError fatalError("Unresolved error \(nserror), \(nserror.userInfo)") } } } }
[ 294405, 243717, 163848, 313353, 320008, 320014, 313360, 288275, 322580, 289300, 290326, 329747, 139803, 103964, 322080, 306721, 229408, 296483, 322083, 229411, 306726, 309287, 308266, 292907, 217132, 322092, 40495, 316465, 288306, 322102, 324663, 164408, 308281, 322109, 286783, 315457, 313409, 313413, 320582, 349765, 309832, 288329, 242250, 215117, 196177, 241746, 344661, 231000, 212571, 300124, 309342, 325220, 306790, 310378, 296043, 311914, 322666, 334446, 307310, 152685, 292466, 314995, 307315, 314487, 291450, 314491, 288383, 318599, 312970, 239252, 311444, 294038, 311449, 323739, 300194, 298662, 233638, 233644, 313005, 286896, 295600, 300208, 286389, 294070, 125111, 234677, 309439, 235200, 284352, 296641, 242371, 302787, 284360, 321228, 319181, 298709, 284374, 189654, 182486, 320730, 241371, 311516, 357083, 179420, 317665, 298210, 311525, 288489, 290025, 229098, 307436, 304365, 323310, 125167, 313073, 286455, 306424, 322299, 319228, 302332, 319231, 184576, 309505, 241410, 311043, 366339, 309509, 318728, 254217, 125194, 234763, 321806, 125201, 296218, 313116, 237858, 326434, 295716, 313125, 300836, 289577, 125226, 133421, 317233, 241971, 316726, 318264, 201530, 313660, 159549, 287038, 292159, 218943, 182079, 288578, 301893, 234828, 292172, 300882, 379218, 321364, 243032, 201051, 230748, 258397, 294238, 298844, 291169, 199020, 293741, 266606, 319342, 292212, 313205, 244598, 316788, 124796, 196988, 305022, 317821, 243072, 314241, 313215, 303999, 242050, 325509, 293767, 316300, 306576, 322448, 308114, 319900, 298910, 313250, 308132, 316327, 306605, 316334, 324015, 324017, 200625, 300979, 316339, 322998, 296888, 316345, 67000, 300987, 319932, 310718, 292288, 317888, 323520, 312772, 298950, 306632, 310733, 289744, 310740, 235994, 286174, 315359, 240098, 323555, 236008, 319465, 248299, 311789, 326640, 188913, 203761, 320498, 314357, 288246, 309243, 300540, 310782 ]
eb4655358864561075e902e40a8131b1881a7b33
969cafc27c2635c19ca30ae0b34860682d09b550
/QDCCustomerApp/Notifications/ViewModel/NotificationClient.swift
513313fb8e09da43f1f06056f35ee6565c3a71df
[]
no_license
maahi22/QDC
147ac1a5911947159da2cbd871a8e8ae49f54c64
6cfe7d7e6a8ccdb125045c54ca1d4c98581df78a
refs/heads/master
2020-04-07T07:59:06.108613
2018-11-19T09:41:27
2018-11-19T09:41:27
150,467,057
0
0
null
null
null
null
UTF-8
Swift
false
false
2,123
swift
// // NotificationClient.swift // QDCCustomerApp // // Created by Maahi on 10/07/18. // Copyright © 2018 QuickDryCleaning. All rights reserved. // import UIKit import Alamofire import Foundation class NotificationClient: NSObject { // MARK: - Injections internal let networkClient = NetworkClient.shared //get getStoreInfo func getNotificationList(completion:@escaping ([NotificationsModel]?,String)->()) { let custId = QDCUserDefaults.getCustomerId() let clientID = QDCUserDefaults.getClientID() let branchID = QDCUserDefaults.getBranchId() let token = QDCUserDefaults.getAccessToken() let apiname = NOTIFICATION_RELATIVE_URL + clientID + "/" + branchID + "/" + custId let headers = ["token": "\(token)"] as [String:String] networkClient.callAPIWithAlamofire(apiname: apiname, requestType: .get, params: nil, headers: headers, success: { (data, httpResponse) in if let notificationsModel = decodeJSON(type: [NotificationsModel].self, from: data) { completion(notificationsModel, "Success") } else if let messageModel = decodeJSON(type: MessageModel.self, from: data) { completion(nil, messageModel.Message ?? "") } else{ completion(nil,"failed") } }) { (error, message) in completion(nil,message) } } }
[ -1 ]
6c2e9994a13f61350c43713cc7b37e9f369dff7d
00e40583e69dea2ae5ab1766dd1010fb1e1da3c0
/Source/APNGKit/APNGImageRenderer.swift
c689913b4d1db0cc150c2549063a3a1401a8024a
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
onevcat/APNGKit
8250b8f3e12db901dd2725d9747193b7be88af37
930dd3a0365a14094d49463362d4ae8ca650cff5
refs/heads/master
2023-08-11T11:04:22.134182
2023-05-04T13:39:57
2023-05-04T13:39:57
41,801,057
2,260
254
MIT
2023-05-04T13:33:27
2015-09-02T12:56:57
Swift
UTF-8
Swift
false
false
21,532
swift
// // APNGImageRenderer.swift // // // Created by Wang Wei on 2022/03/08. // import ImageIO import Foundation // This class is not thread safe. Methods in this class are expected only run on main thread. class APNGImageRenderer { let reader: Reader let decoder: APNGDecoder private let outputBuffer: CGContext private(set) var output: Result<CGImage, APNGKitError>? private(set) var currentIndex: Int = 0 private var currentOutputImage: CGImage? private var previousOutputImage: CGImage? private let renderingQueue = DispatchQueue(label: "com.onevcat.apngkit.renderingQueue", qos: .userInteractive) private var foundMultipleAnimationControl: Bool = false private var expectedSequenceNumber: Int = 0 init(decoder: APNGDecoder) throws { self.decoder = decoder self.reader = try decoder.reader.clone() let imageHeader = decoder.imageHeader guard let outputBuffer = CGContext( data: nil, width: imageHeader.width, height: imageHeader.height, bitsPerComponent: imageHeader.bitDepthPerComponent, bytesPerRow: imageHeader.bytesPerRow, space: imageHeader.colorSpace, bitmapInfo: imageHeader.bitmapInfo.rawValue ) else { throw APNGKitError.decoderError(.canvasCreatingFailed) } self.outputBuffer = outputBuffer if decoder.isFirstFrameLoaded { // The first frame is already loaded by another renderer. try renderFirstFrame() try applyResetStatus() } else { try loadAndRenderFirstFrame() } } private func loadAndRenderFirstFrame() throws { // fcTL and acTL order can be changed in APNG spec. // Try to check if the first `fcTL` is already existing before `acTL`. If there is already a valid `fcTL`, use // it as the first frame control to extract the default image. let first_fcTLReader = DataReader(data: decoder.sharedData) let firstFCTL: fcTL? do { let first_fcTLResult = try first_fcTLReader.readUntil(type: fcTL.self) firstFCTL = first_fcTLResult.chunk } catch { firstFCTL = nil } // Decode the first frame, so the image view has the initial image to show from the very beginning. let firstFrameResult = try loadFirstFrameAndDefaultImage(firstFCTL: firstFCTL) decoder.setFirstFrameLoaded(frameResult: firstFrameResult) // Render the first frame. // It is safe to set it here since this `setup()` method will be only called in init, before any chance to // make another call like `renderNext` to modify `output` at the same time. try renderFirstFrame() // Store the current reader offset. If later we need to reset the image loading state, we can start from here // to make the whole image back to the state of just initialized. decoder.setResetStatus(offset: try reader.offset(), expectedSequenceNumber: expectedSequenceNumber) if decoder.options.contains(.fullFirstPass) { var index = currentIndex while decoder.isDuringFirstPass { index = index + 1 let (frame, data) = try loadFrame() if decoder.options.contains(.preRenderAllFrames) { try renderingQueue.sync { _ = try render(frame: frame, data: data, index: index) } } if foundMultipleAnimationControl { throw APNGKitError.decoderError(.multipleAnimationControlChunk) } decoder.set(frame: frame, at: index) } } if !decoder.isDuringFirstPass { // Animation with only one frame,check IEND. let skipChecksumVerify = decoder.options.contains(.skipChecksumVerify) _ = try reader.readChunk(type: IEND.self, skipChecksumVerify: skipChecksumVerify) // Dispatch to give the user a chance to setup delegate after they get the returned APNG image. DispatchQueue.main.async { self.decoder.onFirstPassDone() } } } private func renderFirstFrame() throws { guard let firstFrameResult = decoder.firstFrameResult else { assertionFailure("First frame is not yet set.") return } // Render the first frame. // It is safe to set it here since this `setup()` method will be only called in init, before any chance to // make another call like `renderNext` to modify `output` at the same time. if !foundMultipleAnimationControl { let cgImage = try renderingQueue.sync { try render(frame: firstFrameResult.frame, data: firstFrameResult.frameImageData, index: 0) } output = .success(cgImage) } else { output = .failure(.decoderError(.multipleAnimationControlChunk)) } } private func applyResetStatus() throws { guard let resetStatus = decoder.resetStatus else { assertionFailure("Reset status is not yet set.") return } try reader.seek(toOffset: resetStatus.offset) expectedSequenceNumber = resetStatus.expectedSequenceNumber } } extension APNGImageRenderer { func reset() throws { if currentIndex == 0 { // It is under the initial state. No need to reset. return } var firstFrame: APNGFrame? = nil var firstFrameData: Data? = nil try renderingQueue.sync { firstFrame = decoder.frame(at: 0) firstFrameData = try firstFrame?.loadData(with: reader) try applyResetStatus() } // The cache is only still valid when all frames are in cache. If there is any `nil` in the cache, reset it. // Otherwise, it is not easy to decide the partial drawing context. if decoder.cachePolicy == .cache, !decoder.isAllFramesCached { try decoder.resetDecodedImageCache() } currentIndex = 0 output = .success(try render(frame: firstFrame!, data: firstFrameData!, index: 0)) } } extension APNGImageRenderer { typealias FirstFrameResult = APNGDecoder.FirstFrameResult private func loadFirstFrameAndDefaultImage(firstFCTL: fcTL?) throws -> FirstFrameResult { var result: FirstFrameResult? var prefixedData = Data() // It is possible there are more shared data between acTL and first frame. while result == nil { try reader.peek { info, action in // Start to load the first frame and default image. There are two possible options. switch info.name.bytes { case fcTL.nameBytes: // Sequence number Chunk // (none) `acTL` // 0 `fcTL` first frame // (none) `IDAT` first frame / default image let frameControl = try action(.read(type: fcTL.self)).fcTL try checkSequenceNumber(frameControl) let (chunks, data) = try loadImageData() let firstFrame = APNGFrame(frameControl: frameControl, data: chunks) result = FirstFrameResult( frame: firstFrame, frameImageData: data, defaultImageChunks: chunks, dataBeforeFirstFrame: prefixedData ) case IDAT.nameBytes: // Sequence number Chunk // (none) `acTL` // (none) `IDAT` default image // 0 `fcTL` first frame // 1 first `fdAT` for first frame _ = try action(.reset) if let firstFCTL = firstFCTL { try checkSequenceNumber(firstFCTL) let (chunks, data) = try loadImageData() let firstFrame = APNGFrame(frameControl: firstFCTL, data: chunks) result = FirstFrameResult( frame: firstFrame, frameImageData: data, defaultImageChunks: chunks, dataBeforeFirstFrame: prefixedData ) } else { let (defaultImageChunks, _) = try loadImageData() let (frame, frameData) = try loadFrame() result = FirstFrameResult( frame: frame, frameImageData: frameData, defaultImageChunks: defaultImageChunks, dataBeforeFirstFrame: prefixedData ) } case acTL.nameBytes: self.foundMultipleAnimationControl = true _ = try action(.read()) default: if case .rawData(let data) = try action(.read()) { prefixedData.append(data) } } } } return result! } private func loadImageData() throws -> ([IDAT], Data) { var chunks: [IDAT] = [] var allData: Data = .init() let skipChecksumVerify = decoder.options.contains(.skipChecksumVerify) var imageDataEnd = false while !imageDataEnd { try reader.peek { info, action in switch info.name.bytes { case IDAT.nameBytes: let peekAction: PeekAction = decoder.options.contains(.loadFrameData) ? .read(type: IDAT.self, skipChecksumVerify: skipChecksumVerify) : .readIndexedIDAT(skipChecksumVerify: skipChecksumVerify) let (chunk, data) = try action(peekAction).IDAT chunks.append(chunk) allData.append(data) case fcTL.nameBytes, IEND.nameBytes: _ = try action(.reset) imageDataEnd = true default: _ = try action(.read()) } } } guard !chunks.isEmpty else { throw APNGKitError.decoderError(.imageDataNotFound) } return (chunks, allData) } private func checkSequenceNumber(_ frameControl: fcTL) throws { let sequenceNumber = frameControl.sequenceNumber guard sequenceNumber == expectedSequenceNumber else { throw APNGKitError.decoderError(.wrongSequenceNumber(expected: expectedSequenceNumber, got: sequenceNumber)) } expectedSequenceNumber += 1 } private func checkSequenceNumber(_ frameData: fdAT) throws { let sequenceNumber = frameData.sequenceNumber guard sequenceNumber == expectedSequenceNumber else { throw APNGKitError.decoderError(.wrongSequenceNumber(expected: expectedSequenceNumber, got: sequenceNumber!)) } expectedSequenceNumber += 1 } // Load the next full fcTL controlled and its frame data from current position private func loadFrame() throws -> (APNGFrame, Data) { var result: (APNGFrame, Data)? while result == nil { try reader.peek { info, action in switch info.name.bytes { case fcTL.nameBytes: let frameControl = try action(.read(type: fcTL.self)).fcTL try checkSequenceNumber(frameControl) let (dataChunks, data) = try loadFrameData() result = (APNGFrame(frameControl: frameControl, data: dataChunks), data) case acTL.nameBytes: self.foundMultipleAnimationControl = true _ = try action(.read()) default: _ = try action(.read()) } } } return result! } private func loadFrameData() throws -> ([fdAT], Data) { var result: [fdAT] = [] var allData: Data = .init() let skipChecksumVerify = decoder.options.contains(.skipChecksumVerify) var frameDataEnd = false while !frameDataEnd { try reader.peek { info, action in switch info.name.bytes { case fdAT.nameBytes: let peekAction: PeekAction = decoder.options.contains(.loadFrameData) ? .read(type: fdAT.self, skipChecksumVerify: skipChecksumVerify) : .readIndexedfdAT(skipChecksumVerify: skipChecksumVerify) let (chunk, data) = try action(peekAction).fdAT try checkSequenceNumber(chunk) result.append(chunk) allData.append(data) case fcTL.nameBytes, IEND.nameBytes: _ = try action(.reset) frameDataEnd = true default: _ = try action(.read()) } } } guard !result.isEmpty else { throw APNGKitError.decoderError(.frameDataNotFound(expectedSequence: expectedSequenceNumber)) } return (result, allData) } } extension APNGImageRenderer { func renderNext() { output = nil renderingQueue.async { do { let (image, index) = try self.renderNextImpl() DispatchQueue.main.async { self.output = .success(image) self.currentIndex = index } } catch { DispatchQueue.main.async { self.output = .failure(error as? APNGKitError ?? .internalError(error)) } } } } func renderNextSync() throws { output = nil do { var result: (CGImage, Int)! try renderingQueue.sync { result = try renderNextImpl() } self.output = .success(result.0) self.currentIndex = result.1 } catch { self.output = .failure(error as? APNGKitError ?? .internalError(error)) } } private func renderNextImpl() throws -> (CGImage, Int) { let image: CGImage var newIndex = currentIndex + 1 if decoder.isDuringFirstPass { let (frame, data) = try loadFrame() if foundMultipleAnimationControl { throw APNGKitError.decoderError(.multipleAnimationControlChunk) } decoder.set(frame: frame, at: newIndex) image = try render(frame: frame, data: data, index: newIndex) if !decoder.isDuringFirstPass { _ = try reader.readChunk(type: IEND.self, skipChecksumVerify: decoder.options.contains(.skipChecksumVerify)) DispatchQueue.main.asyncOrSyncIfMain { self.decoder.onFirstPassDone() } } } else { if newIndex == decoder.framesCount { newIndex = 0 } // It is not the first pass. All frames info should be already decoded and stored in `frames`. image = try renderFrame(frame: decoder.frame(at: newIndex)!, index: newIndex) } return (image, newIndex) } private func renderFrame(frame: APNGFrame, index: Int) throws -> CGImage { guard !decoder.isDuringFirstPass else { preconditionFailure("renderFrame cannot work until all frames are loaded.") } if let cached = decoder.cachedImage(at: index) { return cached } let data = try frame.loadData(with: reader) return try render(frame: frame, data: data, index: index) } private func render(frame: APNGFrame, data: Data, index: Int) throws -> CGImage { // Shortcut for image cache. The cache only be available as a whole bundle. if let cached = decoder.cachedImage(at: index), decoder.isAllFramesCached { return cached } if index == 0 { // Reset for the first frame previousOutputImage = nil currentOutputImage = nil } let pngImageData = try decoder.generateImageData(frameControl: frame.frameControl, data: data) guard let source = CGImageSourceCreateWithData( pngImageData as CFData, [kCGImageSourceShouldCache: true] as CFDictionary ) else { throw APNGKitError.decoderError(.invalidFrameImageData(data: pngImageData, frameIndex: index)) } guard let nextFrameImage = CGImageSourceCreateImageAtIndex(source, 0, nil) else { throw APNGKitError.decoderError(.frameImageCreatingFailed(source: source, frameIndex: index)) } // Dispose if index == 0 { // New frame (rendering frame) is the first frame outputBuffer.clear(decoder.canvasFullRect) } else { let displayingFrame = decoder.frame(at: index - 1)! let displayingRegion = displayingFrame.normalizedRect(fullHeight: decoder.imageHeader.height) switch displayingFrame.frameControl.disposeOp { case .none: previousOutputImage = currentOutputImage case .background: outputBuffer.clear(displayingRegion) previousOutputImage = outputBuffer.makeImage() case .previous: if let previousOutputImage = previousOutputImage { if let cropped = previousOutputImage.cropping(to: displayingFrame.frameControl.cgRect) { outputBuffer.clear(displayingRegion) outputBuffer.draw(cropped, in: displayingRegion) } else { printLog("The previous image cannot be restored to target size. Something goes wrong.") } } else { // Current Frame is the first frame. `.previous` should be treated as `.background` outputBuffer.clear(displayingRegion) } } } // Blend & Draw the new frame switch frame.frameControl.blendOp { case .source: outputBuffer.clear(frame.normalizedRect(fullHeight: decoder.imageHeader.height)) outputBuffer.draw(nextFrameImage, in: frame.normalizedRect(fullHeight: decoder.imageHeader.height)) case .over: outputBuffer.draw(nextFrameImage, in: frame.normalizedRect(fullHeight: decoder.imageHeader.height)) } guard let nextOutputImage = outputBuffer.makeImage() else { throw APNGKitError.decoderError(.outputImageCreatingFailed(frameIndex: index)) } currentOutputImage = nextOutputImage decoder.setCachedImage(nextOutputImage, at: index) return nextOutputImage } } extension DispatchQueue { func asyncOrSyncIfMain(execute block: @escaping () -> Void) { if Thread.isMainThread { block() } else { self.async(execute: block) } } } // Drawing properties for IHDR. extension IHDR { var colorSpace: CGColorSpace { switch colorType { case .greyscale, .greyscaleWithAlpha: return .deviceGray case .trueColor, .trueColorWithAlpha: return .deviceRGB case .indexedColor: return .deviceRGB } } var bitmapInfo: CGBitmapInfo { switch colorType { case .greyscale: return CGBitmapInfo(rawValue: CGImageAlphaInfo.none.rawValue) case .trueColor: return CGBitmapInfo(rawValue: CGImageAlphaInfo.noneSkipLast.rawValue) case .greyscaleWithAlpha, .trueColorWithAlpha, .indexedColor: return CGBitmapInfo(rawValue: CGImageAlphaInfo.premultipliedLast.rawValue) } } var bitDepthPerComponent: Int { // The sample depth is the same as the bit depth except in the case of // indexed-colour PNG images (colour type 3), in which the sample depth is always 8 bits. Int(colorType == .indexedColor ? 8 : bitDepth) } var bitsPerPixel: UInt32 { let componentsPerPixel = colorType == .indexedColor ? 4 /* Draw indexed color as true color with alpha in CG world. */ : colorType.componentsPerPixel return UInt32(componentsPerPixel * bitDepthPerComponent) } var bytesPerPixel: UInt32 { bitsPerPixel / 8 } var bytesPerRow: Int { width * Int(bytesPerPixel) } } extension CGColorSpace { static let deviceRGB = CGColorSpaceCreateDeviceRGB() static let deviceGray = CGColorSpaceCreateDeviceGray() }
[ -1 ]
39ace7c93526caae25c0c8c5f70a2ab0a42d5d24
73a05b7b610e01c6ec99f8ed1631298b89e7325e
/PairProject/View/PokemonCell.swift
9827358c442ea7d29c7549f834d980d29f19cafd
[]
no_license
JabeenCheema/PairProject
2d036fbb784ad2e1bcf9f7275164c66d62a34296
f703124384a9f4bc9efe921d4b6e45b29239875a
refs/heads/master
2020-04-15T19:24:42.288367
2019-01-11T17:49:25
2019-01-11T17:49:25
164,948,548
0
1
null
2019-01-11T17:46:24
2019-01-09T22:32:02
Swift
UTF-8
Swift
false
false
1,327
swift
// // PokemonCell.swift // PairProject // // Created by Jabeen's MacBook on 1/9/19. // Copyright © 2019 Jabeen's MacBook. All rights reserved. // import UIKit class PokemonCell: UICollectionViewCell { @IBOutlet weak var pokemonImage: UIImageView! @IBOutlet weak var pokemonActivityIndicator: UIActivityIndicatorView! //public var urlString = "" // // public func configureCell(pokemon: PokemonCard.PokemonCardWrapper) { // let haveImages = [PokemonCard.PokemonCardWrapper]() // // urlString = pokemon.imageURL?.absoluteString // if let image = ImageHelper.shared.image(forKey: (pokemon.imageURL?.absoluteString)! as NSString) { // pokemonImage.image = image // } else { // pokemonActivityIndicator.startAnimating() // ImageHelper.shared.fetchImage(urlString: (pokemon.imageURL?.absoluteString)!) { (appError, image) in // if let appError = appError { // print(appError.errorMessage()) // } else if let image = image { // if self.urlString == pokemon.imageURL?.absoluteString { // self.pokemonImage.image = image // } // } // self.pokemonActivityIndicator.stopAnimating() // } // } // } }
[ -1 ]
c16debd4aea869aeba8cb805a9cfb9c85c468bb0
ec7d5d0a921abcda68dc336a3f46385819ea7771
/Remind/RelationView/RelationTableViewController.swift
97abd3aabae7b3293a51280ec3d7171e37ad1fb1
[]
no_license
kdanielive/Remind
eff8f56fcbf9b66fb05c1677546fb4ad29b604ba
f9a786cc81788c9ce4a939ab653257cc13b79fff
refs/heads/master
2020-12-20T20:17:33.026811
2020-02-02T16:21:04
2020-02-02T16:21:04
236,198,872
0
0
null
null
null
null
UTF-8
Swift
false
false
8,925
swift
// // RelationTableViewController.swift // Remind // // Created by Daniel Kim on 2/2/20. // Copyright © 2020 Daniel Kim. All rights reserved. // // "Family", "Lover", "Partner in Life", "Close Friend", "Friend", "Work", "School", "Acquaintance" import UIKit import CoreData class RelationTableViewController: UITableViewController { let relationKeys = ["Family", "Lover", "Partner in Life", "Close Friend", "Friend", "Work", "School", "Acquaintance"] var currentRelation = "Family" override func viewDidLoad() { super.viewDidLoad() self.tableView.backgroundColor = UIColor.init(red: 0/255, green: 49/255, blue: 82/255, alpha: 1) NotificationCenter.default.addObserver(self, selector: Selector("reload"), name: Notification.Name("reloadLocalDataCompleted"), object: nil) // 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.rightBarButtonItem = self.editButtonItem } @objc func reload() { self.tableView.reloadData() } // MARK: - Table view data source override func numberOfSections(in tableView: UITableView) -> Int { // #warning Incomplete implementation, return the number of sections return 8 } override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { // #warning Incomplete implementation, return the number of rows if(section==0) { return relationDict["Family"]!.count } else if (section==1) { return relationDict["Lover"]!.count } else if (section==2) { return relationDict["Partner in Life"]!.count } else if (section==3) { return relationDict["Close Friend"]!.count } else if (section==4) { return relationDict["Friend"]!.count } else if (section==5) { return relationDict["Work"]!.count } else if (section==6) { return relationDict["School"]!.count } else { return relationDict["Acquaintance"]!.count } } override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "relationcell", for: indexPath) as! RelationTableViewCell cell.backgroundColor = UIColor.init(red: 0/255, green: 49/255, blue: 82/255, alpha: 1) cell.selectionStyle = .none // Configure the cell... let relationKey = relationKeys[indexPath.section] let tupl = relationDict[relationKey]![indexPath.row] let padding = CGFloat(5) let nameLabel = UILabel() nameLabel.frame = CGRect(x: padding*3, y: padding, width: 0, height: 0) nameLabel.text = tupl.0 nameLabel.textColor = UIColor.white nameLabel.font = UIFont(name: "Noteworthy-Bold", size: 20) nameLabel.sizeToFit() cell.addSubview(nameLabel) let nameLabelHeight = nameLabel.frame.height let nameLabelWidth = nameLabel.frame.width let eventLabel = UILabel() eventLabel.frame = CGRect(x: padding*3, y: padding+nameLabelHeight, width: 0, height: 0) eventLabel.text = tupl.2 eventLabel.textColor = UIColor.white eventLabel.font = UIFont.systemFont(ofSize: 12) eventLabel.sizeToFit() cell.addSubview(eventLabel) let date = tupl.3 let dateFormatter = DateFormatter() dateFormatter.dateFormat = "yyyy" let year = dateFormatter.string(from: date) dateFormatter.dateFormat = "LLLL" let month = dateFormatter.string(from: date) let calendar = Calendar.current let components = calendar.dateComponents([.day], from: date) let day = components.day! let dateLabel = UILabel() dateLabel.frame = CGRect(x: padding*5+eventLabel.frame.width, y: padding+nameLabelHeight, width: 0, height: 0) if(tupl.4) { dateLabel.text = "Annual" } else { dateLabel.text = "\(year) \(month) \(day)" } dateLabel.textColor = UIColor.white dateLabel.font = UIFont.systemFont(ofSize: 12) dateLabel.sizeToFit() cell.addSubview(dateLabel) /* let accessoryButton = UIButton() accessoryButton.tag = indexPath.row accessoryButton.setImage(UIImage(named: "icon9"), for: .normal) accessoryButton.frame = CGRect(x: cell.frame.width-CGFloat(50), y: CGFloat(15), width: CGFloat(30), height: CGFloat(30)) accessoryButton.addTarget(self, action: #selector(buttonTapped), for: .touchUpInside) cell.addSubview(accessoryButton) */ return cell } /* @objc func buttonTapped(sender: UIButton) { deleteTargetTupl = viewTuplList[sender.tag] let storyboard : UIStoryboard = UIStoryboard(name: "Main", bundle: nil) let popVC = storyboard.instantiateViewController(withIdentifier: "PopoverViewController") popVC.modalPresentationStyle = .popover let popOverVC = popVC.popoverPresentationController popOverVC?.delegate = self popOverVC?.permittedArrowDirections = .up popOverVC?.sourceView = sender popOverVC?.sourceRect = CGRect(x: sender.bounds.midX, y: sender.bounds.midY, width: 0, height: 0) popVC.preferredContentSize = CGSize(width: 150, height: 40) self.present(popVC, animated: true) } */ override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { return 60 } /* override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { return relationKeys[section] } */ override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { let header = MainViewHeaderCard() header.backgroundColor = UIColor.init(red: 0/255, green: 49/255, blue: 82/255, alpha: 1) header.titleLabel.textColor = UIColor.white let line = UIView() line.frame = CGRect(x: 0, y: CGFloat(39), width: self.tableView.frame.width-CGFloat(20), height: CGFloat(1)) line.backgroundColor = UIColor.white header.addSubview(line) let monthLabel = UILabel() monthLabel.frame = CGRect(x: 5, y: 5, width: 200, height: 20) monthLabel.font = UIFont.systemFont(ofSize: 20) monthLabel.text = relationKeys[section] monthLabel.textColor = UIColor.white header.addSubview(monthLabel) return header } override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { return 40 } /* // 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: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) { if editingStyle == .delete { // Delete the row from the data source tableView.deleteRows(at: [indexPath], with: .fade) } else if editingStyle == .insert { // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view } } */ /* // 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.destination. // Pass the selected object to the new view controller. } */ } extension RelationTableViewController: UIPopoverPresentationControllerDelegate { func adaptivePresentationStyle(for controller: UIPresentationController) -> UIModalPresentationStyle { return .none } }
[ -1 ]
49ef820ab4908b5be98480c2643b13caf1041c1c
b53798a298b4b0979f9ce86c6598dbb7efc58b77
/AbstractFactory/AbstractFactory/SummerComponentFactory.swift
09f0e74429e6a380349bb0fb6ce65b2bf00ec08a
[]
no_license
mkrzych/abstract-factory-swift
4802da1897030da34bd15dcc824375d85a74e5b7
fb04b5c542d470499da4e518f1ef4e4d15b9cd54
refs/heads/master
2016-09-06T04:13:37.322266
2015-02-18T17:50:45
2015-02-18T17:50:45
30,327,652
1
0
null
null
null
null
UTF-8
Swift
false
false
459
swift
// // SummerComponentFactory.swift // AbstractFactory // // Created by Marcin Krzych on 06/02/15. // Copyright (c) 2015 Marcin Krzych. All rights reserved. // import Foundation class SummerComponentFactory : UIComponentFactory { func createButton() -> Button { return SummerButton(); } func createView() -> View { return SummerView() } func createLabel() -> Label { return SummerLabel() } }
[ -1 ]
bff1ff75f49dfc4b74c3da51b6a678a4d5080c70
12315266a0e8a893a00f14fa336caedc6c0eb37f
/TableViewCourse/Eaters/Eaters/Modules/Rate/Controller/RateViewControllerInput.swift
c619029c98e90dcf1f6e32e7be07c9a97d13e660
[]
no_license
Wishell/Swiftbook
0dba4696c096b28f714b3118e037d760298d848e
36d2fe3cf7924a85544a67c3bbc59eddb182af88
refs/heads/master
2020-04-09T03:33:02.070214
2019-02-13T19:51:15
2019-02-13T19:51:15
159,986,975
0
0
null
null
null
null
UTF-8
Swift
false
false
190
swift
// // RateViewControllerInput.swift // Eaters // // Created by Wishell on 04.12.2018. // Copyright © 2018 Wishell. All rights reserved. // protocol RateViewControllerInput: class {}
[ -1 ]
4684827816892f3aac6430faaf53168e05389835
cc14ff3ccb42db462705eae565237d75e1c77e55
/UCLanTimetable/Misc.swift
9b588a6650ea1a399534f41269a8a810089ff05f
[]
no_license
SalahEddin/UniTimetable
78fad7cc932f68cb64a34a0df1c7725e5e12b383
e0e7a26640584454f06b4aa8a0f0627141dc898e
refs/heads/master
2020-04-12T21:50:41.563223
2016-12-26T21:56:06
2016-12-26T21:56:06
61,298,015
0
0
null
null
null
null
UTF-8
Swift
false
false
4,517
swift
// // Misc.swift // UCLanTimetable // // Created by Salah Eddin Alshaal on 20/07/16. // Copyright © 2016 Salah Eddin Alshaal. All rights reserved. // import Foundation import Keychain import SystemConfiguration open class KEYS { open static let user = "user" open static let username = "username" open static let pass = "pass" open static let offlineTimetableStorageKey = "timetable" open static let offlineExamStorageKey = "exams" open static let studentTypeId = 5 } open class Misc { public enum USER_TYPE { case exam case student case lecturer case room} // MARK: IO static func loadUser() -> AuthenticatedUser? { var user: AuthenticatedUser? = nil let storedUserString = Keychain.load(KEYS.user) if storedUserString != nil { do { let data = storedUserString!.data(using: String.Encoding.utf8) // here "decoded" is the dictionary decoded from JSON data let decoded = try JSONSerialization.jsonObject(with: data!, options: []) as? [String:AnyObject] user = AuthenticatedUser(dictionary: decoded! as NSDictionary) } catch let error as NSError { print(error) } } return user } static func saveUser(_ user: AuthenticatedUser?) -> Bool { var success = false // serialise user as JSON, then save to keychain let dic = user!.dictionaryRepresentation() var userDatastring: String? = nil do { // here "jsonData" is the dictionary encoded in JSON data let jsonData = try JSONSerialization.data(withJSONObject: dic, options: JSONSerialization.WritingOptions.prettyPrinted) userDatastring = NSString(data: jsonData, encoding: String.Encoding.utf8.rawValue)! as String // save to keychain if Keychain.save(userDatastring!, forKey: KEYS.user) { // if saving is successful success = true } } catch let error as NSError { print(error) } return success } } open class Reachability { class func isConnectedToNetwork() -> Bool { var zeroAddress = sockaddr_in() zeroAddress.sin_len = UInt8(MemoryLayout.size(ofValue: zeroAddress)) zeroAddress.sin_family = sa_family_t(AF_INET) let defaultRouteReachability = withUnsafePointer(to: &zeroAddress) { $0.withMemoryRebound(to: sockaddr.self, capacity: 1) {zeroSockAddress in SCNetworkReachabilityCreateWithAddress(nil, zeroSockAddress) } } var flags = SCNetworkReachabilityFlags() if !SCNetworkReachabilityGetFlags(defaultRouteReachability!, &flags) { return false } let isReachable = (flags.rawValue & UInt32(kSCNetworkFlagsReachable)) != 0 let needsConnection = (flags.rawValue & UInt32(kSCNetworkFlagsConnectionRequired)) != 0 return (isReachable && !needsConnection) } } extension UIColor { convenience init(red: Int, green: Int, blue: Int) { assert(red >= 0 && red <= 255, "Invalid red component") assert(green >= 0 && green <= 255, "Invalid green component") assert(blue >= 0 && blue <= 255, "Invalid blue component") self.init(red: CGFloat(red) / 255.0, green: CGFloat(green) / 255.0, blue: CGFloat(blue) / 255.0, alpha: 1.0) } convenience init(netHex: Int) { self.init(red:(netHex >> 16) & 0xff, green:(netHex >> 8) & 0xff, blue:netHex & 0xff) } } extension UIImageView { func downloadedFrom(url: URL, contentMode mode: UIViewContentMode = .scaleAspectFit) { contentMode = mode URLSession.shared.dataTask(with: url) { (data, response, error) in guard let httpURLResponse = response as? HTTPURLResponse, httpURLResponse.statusCode == 200, let mimeType = response?.mimeType, mimeType.hasPrefix("image"), let data = data, error == nil, let image = UIImage(data: data) else { return } DispatchQueue.main.async() { () -> Void in self.image = image } }.resume() } func downloadedFrom(link: String, contentMode mode: UIViewContentMode = .scaleAspectFit) { guard let url = URL(string: link) else { return } downloadedFrom(url: url, contentMode: mode) } }
[ -1 ]
af9bb93189a7f8efbda73138a1b415aae47b0d57
dfe8abc3488786e846e4b9dff5ddd9b5615e8aec
/PhotosSaver/PhotosCollection.swift
2d7d4ad1417dea510f982f3fd8f980e416eb662e
[]
no_license
kkolontay/PhotoSave
ea806f83317f5474eacc7e92dd3bd7c827487b2c
2eab39242f98c2f50ef39037c10f7691ddb3e119
refs/heads/master
2021-01-18T23:16:48.315175
2017-08-17T11:03:21
2017-08-17T11:03:21
100,563,952
0
0
null
null
null
null
UTF-8
Swift
false
false
4,522
swift
// // PhotosCollection.swift // PhotosSaver // // Created by kkolontay on 8/16/17. // Copyright © 2017 kkolontay.com. All rights reserved. // import Photos class PhotosCollection: NSObject { static let albumName = "PhotosSaver" static let instance = PhotosCollection() var imageListCollection: Array<Dictionary<String, AnyObject>>? var assetCollection: PHAssetCollection? var fetchImage: Array<Dictionary<String, AnyObject>> { return imageListCollection! } var delegateObject: FetchedImageDelegate? private override init() { super.init() if PHPhotoLibrary.authorizationStatus() != PHAuthorizationStatus.authorized { PHPhotoLibrary.requestAuthorization({ (status: PHAuthorizationStatus) -> Void in () }) } if PHPhotoLibrary.authorizationStatus() != PHAuthorizationStatus.authorized { PHPhotoLibrary.requestAuthorization(requestAuthorizationHandler) } assetCollection = fetchCollectionForAlbum() } func requestAuthorizationHandler(status: PHAuthorizationStatus) { if PHPhotoLibrary.authorizationStatus() == PHAuthorizationStatus.authorized { self.createAlbum() } fetchImageList() } func createAlbum() { PHPhotoLibrary.shared().performChanges({ PHAssetCollectionChangeRequest.creationRequestForAssetCollection(withTitle: PhotosCollection.albumName) }) { success, error in if success { self.assetCollection = self.fetchCollectionForAlbum() } else { print("error \(String(describing: error))") } } } func fetchCollectionForAlbum() -> PHAssetCollection? { let fetchOptions = PHFetchOptions() fetchOptions.predicate = NSPredicate(format: "title = %@", PhotosCollection.albumName) let collection = PHAssetCollection.fetchAssetCollections(with: .album, subtype: .any, options: fetchOptions) guard let object = collection.firstObject else { return nil } return object } func fetchImageList() { imageListCollection = Array<Dictionary<String, AnyObject>>() if assetCollection == nil { return } let photoAssets = PHAsset.fetchAssets(in: assetCollection!, options: nil) let imageManager = PHImageManager.default() photoAssets.enumerateObjects({ (object: AnyObject!, count: Int, stop: UnsafeMutablePointer<ObjCBool>) in if object is PHAsset { let asset = object as! PHAsset let imageSize = CGSize(width: asset.pixelWidth, height: asset.pixelHeight) let options = PHImageRequestOptions() options.deliveryMode = .fastFormat options.isSynchronous = true imageManager.requestImage(for: asset, targetSize: imageSize, contentMode: .aspectFit, options: options, resultHandler: { (image, info) -> Void in var realPath: String = "" if let path = info?["PHImageFileURLKey"] as? NSURL { print(path) realPath = self.getRealUrl(path, image: image!) } let dictionary = ["image": image!, "path": realPath] as [String : Any] self.imageListCollection?.append(dictionary as [String : AnyObject]) self.delegateObject?.imageListChanged(self.imageListCollection!) print("Info image \(String(describing: (info?["PHImageFileURLKey"])!))") }) } }) } func getRealUrl(_ url: NSURL, image: UIImage) -> String { let imageName = url.lastPathComponent let documentDirectory = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first! let photoURL = NSURL(fileURLWithPath: documentDirectory) let localPath = photoURL.appendingPathComponent(imageName!) if !FileManager.default.fileExists(atPath: localPath!.path) { do { try UIImageJPEGRepresentation(image, 1.0)?.write(to: localPath!) }catch { print("error saving file") } } return (localPath?.absoluteString)! } func save(image: UIImage) { if assetCollection == nil { return } PHPhotoLibrary.shared().performChanges({ let assetChangeRequest = PHAssetChangeRequest.creationRequestForAsset(from: image) let assetPlaceHolder = assetChangeRequest.placeholderForCreatedAsset let albumChangeRequest = PHAssetCollectionChangeRequest(for: self.assetCollection!) let enumeration: NSArray = [assetPlaceHolder!] albumChangeRequest!.addAssets(enumeration) }, completionHandler: { Void in self.fetchImageList() }) } }
[ -1 ]
897e19b3c8f31e75e1d020fe2f8540eb93e1722f
f72e7434d1843e83cc6c18ba8b830417cae5dbf0
/tweet_yo_self/TwitterClient.swift
848139fdfcb26dc3792901e85751f971b11491c4
[]
no_license
zeneric/tweet_yo_self
78adb16bf7390320ebbc702acf1669c0ee3306ac
c87ce741d373bc1cc87f66df58f9c51d0ce82a8f
refs/heads/master
2020-06-01T07:28:45.854559
2015-03-05T04:17:29
2015-03-05T04:17:29
31,186,996
0
0
null
null
null
null
UTF-8
Swift
false
false
5,585
swift
// // TwitterClient.swift // tweet_yo_self // // Created by Eric Huang on 2/19/15. // Copyright (c) 2015 Eric Huang. All rights reserved. // import UIKit let twitterConsumerKey = "a6QXPz0vkI8f5vGInljgcLzf2" let twitterConsumerSecret = "ngUKYMx2omBUkg1XcK9KZoOj4HDZbzKt2EimRjnyaE8FmuZIiw" let twitterBaseURL = NSURL(string: "https://api.twitter.com") class TwitterClient: BDBOAuth1RequestOperationManager { var loginCompletion: ((user: User?, error: NSError?) -> ())? class var sharedInstance: TwitterClient { struct Static { static let instance = TwitterClient(baseURL: twitterBaseURL, consumerKey: twitterConsumerKey, consumerSecret: twitterConsumerSecret) } return Static.instance } func homeTimelineWithParams(params: NSDictionary?, completion: (tweets: [Tweet]?, error: NSError?) -> ()) { GET("1.1/statuses/home_timeline.json", parameters: params, success: { (operation: AFHTTPRequestOperation!, response: AnyObject!) -> Void in var tweets = Tweet.tweetsWithArray(response as [NSDictionary]) completion(tweets: tweets, error: nil) }, failure: { (operation: AFHTTPRequestOperation!, error: NSError!) -> Void in completion(tweets: nil, error: error) }) } func loginWithCompletion(completion: (user: User?, error: NSError?) -> ()) { loginCompletion = completion // Fetch request token & redirect to authorization page TwitterClient.sharedInstance.requestSerializer.removeAccessToken() TwitterClient.sharedInstance.fetchRequestTokenWithPath("oauth/request_token", method: "GET", callbackURL: NSURL(string: "tweetyoself://oauth"), scope: nil, success: { (requestToken: BDBOAuth1Credential!) -> Void in println("Got the req token!") var authURL = NSURL(string: "https://api.twitter.com/oauth/authorize?oauth_token=\(requestToken.token)") UIApplication.sharedApplication().openURL(authURL!) }) { (error: NSError!) -> Void in println("Failed to get token") } } func updateStatus(params: NSDictionary?, completion: (error: NSError?) -> ()) { POST("1.1/statuses/update.json", parameters: params, success: { (operation: AFHTTPRequestOperation!, response: AnyObject!) -> Void in completion(error: nil) }, failure: { (operation: AFHTTPRequestOperation!, error: NSError!) -> Void in completion(error: error) }) } func openURL(url: NSURL) { fetchAccessTokenWithPath("oauth/access_token", method: "POST", requestToken: BDBOAuth1Credential (queryString: url.query), success: { (accessToken: BDBOAuth1Credential!) -> Void in println("Got the access token") TwitterClient.sharedInstance.requestSerializer.saveAccessToken(accessToken) TwitterClient.sharedInstance.GET("1.1/account/verify_credentials.json", parameters: nil, success: { (operation: AFHTTPRequestOperation!, response: AnyObject!) -> Void in var user = User(dictionary: response as NSDictionary) User.currentUser = user self.loginCompletion?(user: user, error: nil) }, failure: { (operation: AFHTTPRequestOperation!, error: NSError!) -> Void in println("Error getting current user") self.loginCompletion?(user: nil, error: error) }) }) { (error:NSError!) -> Void in println("Failed to receive access token") } } func retweet(id: String, completion: (error: NSError?) -> ()) { POST("1.1/statuses/retweet/\(id).json", parameters: nil, success: { (operation: AFHTTPRequestOperation!, response: AnyObject!) -> Void in completion(error: nil) }, failure: { (operation: AFHTTPRequestOperation!, error: NSError!) -> Void in completion(error: error) }) } func favorite(id: String, completion: (error: NSError?) -> ()) { var params = ["id": id] POST("1.1/favorites/create.json?id=\(id)", parameters: nil, success: { (operation: AFHTTPRequestOperation!, response: AnyObject!) -> Void in completion(error: nil) }, failure: { (operation: AFHTTPRequestOperation!, error: NSError!) -> Void in println(error) completion(error: error) }) } func mentions(params: NSDictionary?, completion: (tweets: [Tweet]?, error: NSError?) -> ()) { GET("1.1/statuses/mentions_timeline.json", parameters: params, success: { (operation: AFHTTPRequestOperation!, response: AnyObject!) -> Void in var tweets = Tweet.tweetsWithArray(response as [NSDictionary]) completion(tweets: tweets, error: nil) }, failure: { (operation: AFHTTPRequestOperation!, error: NSError!) -> Void in completion(tweets: nil, error: error) }) } func user(params: NSDictionary?, completion: (user: User?, error: NSError?) -> ()) { GET("1.1/users/show.json", parameters: params, success: { (operation: AFHTTPRequestOperation!, response: AnyObject!) -> Void in var user = User(dictionary: response as NSDictionary) completion(user: user, error: nil) }, failure: { (operation: AFHTTPRequestOperation!, error: NSError!) -> Void in completion(user: nil, error: error) }) } }
[ -1 ]
bdebcc2c30df34f3f52779f559e4397c3cedc640
d1b514ceeebd8bc7a334042893f36776261b1652
/PinGo/SkyFloatingLabelTextField.swift
a807ee29c019c95464afd9274da526fd181dc499
[]
no_license
T2HPinGo/PinGo
28e0633707e04a2656b33a4bd37132534f59749b
e48fdf93990991f7c89be7d6ecc450024b42b474
refs/heads/master
2020-04-06T07:09:31.466218
2016-08-25T10:32:01
2016-08-25T10:32:01
64,582,065
0
1
null
null
null
null
UTF-8
Swift
false
false
19,773
swift
// Copyright 2016 Skyscanner Ltd // // 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 /** A beautiful and flexible textfield implementation with support for title label, error message and placeholder. */ @IBDesignable public class SkyFloatingLabelTextField: UITextField { /// A Boolean value that determines if the language displayed is LTR. Default value set automatically from the application language settings. var isLTRLanguage = UIApplication.sharedApplication().userInterfaceLayoutDirection == .LeftToRight { didSet { self.updateTextAligment() } } private func updateTextAligment() { if(self.isLTRLanguage) { self.textAlignment = .Left } else { self.textAlignment = .Right } } // MARK: Animation timing /// The value of the title appearing duration public var titleFadeInDuration:NSTimeInterval = 0.2 /// The value of the title disappearing duration public var titleFadeOutDuration:NSTimeInterval = 0.3 // MARK: Colors private var cachedTextColor:UIColor? /// A UIColor value that determines the text color of the editable text @IBInspectable override public var textColor:UIColor? { set { self.cachedTextColor = newValue self.updateControl(false) } get { return cachedTextColor } } /// A UIColor value that determines text color of the placeholder label @IBInspectable public var placeholderColor:UIColor = UIColor.lightGrayColor() { didSet { self.updatePlaceholder() } } /// A UIColor value that determines text color of the placeholder label @IBInspectable public var placeholderFont:UIFont? { didSet { self.updatePlaceholder() } } private func updatePlaceholder() { if let placeholder = self.placeholder, font = self.placeholderFont ?? self.font { self.attributedPlaceholder = NSAttributedString(string: placeholder, attributes: [NSForegroundColorAttributeName:placeholderColor, NSFontAttributeName: font]) } } /// A UIColor value that determines the text color of the title label when in the normal state @IBInspectable public var titleColor:UIColor = UIColor.grayColor() { didSet { self.updateTitleColor() } } /// A UIColor value that determines the color of the bottom line when in the normal state @IBInspectable public var lineColor:UIColor = UIColor.lightGrayColor() { didSet { self.updateLineView() } } /// A UIColor value that determines the color used for the title label and the line when the error message is not `nil` @IBInspectable public var errorColor:UIColor = UIColor.redColor() { didSet { self.updateColors() } } /// A UIColor value that determines the text color of the title label when editing @IBInspectable public var selectedTitleColor:UIColor = UIColor.blueColor() { didSet { self.updateTitleColor() } } /// A UIColor value that determines the color of the line in a selected state @IBInspectable public var selectedLineColor:UIColor = UIColor.blackColor() { didSet { self.updateLineView() } } // MARK: Line height /// A CGFloat value that determines the height for the bottom line when the control is in the normal state @IBInspectable public var lineHeight:CGFloat = 0.5 { didSet { self.updateLineView() self.setNeedsDisplay() } } /// A CGFloat value that determines the height for the bottom line when the control is in a selected state @IBInspectable public var selectedLineHeight:CGFloat = 1.0 { didSet { self.updateLineView() self.setNeedsDisplay() } } // MARK: View components /// The internal `UIView` to display the line below the text input. public var lineView:UIView! /// The internal `UILabel` that displays the selected, deselected title or the error message based on the current state. public var titleLabel:UILabel! // MARK: Properties /** The formatter to use before displaying content in the title label. This can be the `title`, `selectedTitle` or the `errorMessage`. The default implementation converts the text to uppercase. */ public var titleFormatter:(String -> String) = { (text:String) -> String in return text.uppercaseString } /** Identifies whether the text object should hide the text being entered. */ override public var secureTextEntry:Bool { set { super.secureTextEntry = newValue self.fixCaretPosition() } get { return super.secureTextEntry } } /// A String value for the error message to display. public var errorMessage:String? { didSet { self.updateControl(true) } } /// The backing property for the highlighted property private var _highlighted = false /// A Boolean value that determines whether the receiver is highlighted. When changing this value, highlighting will be done with animation override public var highlighted:Bool { get { return _highlighted } set { _highlighted = newValue self.updateTitleColor() self.updateLineView() } } /// A Boolean value that determines whether the textfield is being edited or is selected. public var editingOrSelected:Bool { get { return super.editing || self.selected; } } /// A Boolean value that determines whether the receiver has an error message. public var hasErrorMessage:Bool { get { return self.errorMessage != nil && self.errorMessage != "" } } private var _renderingInInterfaceBuilder:Bool = false /// The text content of the textfield @IBInspectable override public var text:String? { didSet { self.updateControl(false) } } /** The String to display when the input field is empty. The placeholder can also appear in the title label when both `title` `selectedTitle` and are `nil`. */ @IBInspectable override public var placeholder:String? { didSet { self.setNeedsDisplay() self.updatePlaceholder() self.updateTitleLabel() } } /// The String to display when the textfield is editing and the input is not empty. @IBInspectable public var selectedTitle:String? { didSet { self.updateControl() } } /// The String to display when the textfield is not editing and the input is not empty. @IBInspectable public var title:String? { didSet { self.updateControl() } } // Determines whether the field is selected. When selected, the title floats above the textbox. public override var selected:Bool { didSet { self.updateControl(true) } } // MARK: - Initializers /** Initializes the control - parameter frame the frame of the control */ override public init(frame: CGRect) { super.init(frame: frame) self.init_SkyFloatingLabelTextField() } /** Intialzies the control by deserializing it - parameter coder the object to deserialize the control from */ required public init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) self.init_SkyFloatingLabelTextField() } private final func init_SkyFloatingLabelTextField() { self.borderStyle = .None self.createTitleLabel() self.createLineView() self.updateColors() self.addEditingChangedObserver() self.updateTextAligment() } private func addEditingChangedObserver() { self.addTarget(self, action: #selector(SkyFloatingLabelTextField.editingChanged), forControlEvents: .EditingChanged) } /** Invoked when the editing state of the textfield changes. Override to respond to this change. */ public func editingChanged() { updateControl(true) updateTitleLabel(true) } // MARK: create components private func createTitleLabel() { let titleLabel = UILabel() titleLabel.autoresizingMask = [.FlexibleWidth, .FlexibleHeight] titleLabel.font = UIFont.systemFontOfSize(13) titleLabel.alpha = 0.0 titleLabel.textColor = self.titleColor self.addSubview(titleLabel) self.titleLabel = titleLabel } private func createLineView() { if self.lineView == nil { let lineView = UIView() lineView.userInteractionEnabled = false self.lineView = lineView self.configureDefaultLineHeight() } lineView.autoresizingMask = [.FlexibleWidth, .FlexibleTopMargin] self.addSubview(lineView) } private func configureDefaultLineHeight() { let onePixel:CGFloat = 1.0 / UIScreen.mainScreen().scale self.lineHeight = 2.0 * onePixel self.selectedLineHeight = 2.0 * self.lineHeight } // MARK: Responder handling /** Attempt the control to become the first responder - returns: True when successfull becoming the first responder */ override public func becomeFirstResponder() -> Bool { let result = super.becomeFirstResponder() self.updateControl(true) return result } /** Attempt the control to resign being the first responder - returns: True when successfull resigning being the first responder */ override public func resignFirstResponder() -> Bool { let result = super.resignFirstResponder() self.updateControl(true) return result } // MARK: - View updates private func updateControl(animated:Bool = false) { self.updateColors() self.updateLineView() self.updateTitleLabel(animated) } private func updateLineView() { if let lineView = self.lineView { lineView.frame = self.lineViewRectForBounds(self.bounds, editing: self.editingOrSelected) } self.updateLineColor() } // MARK: - Color updates /// Update the colors for the control. Override to customize colors. public func updateColors() { self.updateLineColor() self.updateTitleColor() self.updateTextColor() } private func updateLineColor() { if self.hasErrorMessage { self.lineView.backgroundColor = self.errorColor } else { self.lineView.backgroundColor = self.editingOrSelected ? self.selectedLineColor : self.lineColor } } private func updateTitleColor() { if self.hasErrorMessage { self.titleLabel.textColor = self.errorColor } else { if self.editingOrSelected || self.highlighted { self.titleLabel.textColor = self.selectedTitleColor } else { self.titleLabel.textColor = self.titleColor } } } private func updateTextColor() { if self.hasErrorMessage { super.textColor = self.errorColor } else { super.textColor = self.cachedTextColor } } // MARK: - Title handling private func updateTitleLabel(animated:Bool = false) { var titleText:String? = nil if self.hasErrorMessage { titleText = self.titleFormatter(errorMessage!) } else { if self.editingOrSelected { titleText = self.selectedTitleOrTitlePlaceholder() if titleText == nil { titleText = self.titleOrPlaceholder() } } else { titleText = self.titleOrPlaceholder() } } self.titleLabel.text = titleText self.updateTitleVisibility(animated) } private var _titleVisible = false /* * Set this value to make the title visible */ public func setTitleVisible(titleVisible:Bool, animated:Bool = false, animationCompletion: (()->())? = nil) { if(_titleVisible == titleVisible) { return } _titleVisible = titleVisible self.updateTitleColor() self.updateTitleVisibility(animated, completion: animationCompletion) } /** Returns whether the title is being displayed on the control. - returns: True if the title is displayed on the control, false otherwise. */ public func isTitleVisible() -> Bool { return self.hasText() || self.hasErrorMessage || _titleVisible } private func updateTitleVisibility(animated:Bool = false, completion: (()->())? = nil) { let alpha:CGFloat = self.isTitleVisible() ? 1.0 : 0.0 let frame:CGRect = self.titleLabelRectForBounds(self.bounds, editing: self.isTitleVisible()) let updateBlock = { () -> Void in self.titleLabel.alpha = alpha self.titleLabel.frame = frame } if animated { let animationOptions:UIViewAnimationOptions = .CurveEaseOut; let duration = self.isTitleVisible() ? titleFadeInDuration : titleFadeOutDuration UIView.animateWithDuration(duration, delay: 0, options: animationOptions, animations: { () -> Void in updateBlock() }, completion: { _ in completion?() }) } else { updateBlock() completion?() } } // MARK: - UITextField text/placeholder positioning overrides /** Calculate the rectangle for the textfield when it is not being edited - parameter bounds: The current bounds of the field - returns: The rectangle that the textfield should render in */ override public func textRectForBounds(bounds: CGRect) -> CGRect { super.textRectForBounds(bounds) let titleHeight = self.titleHeight() let lineHeight = self.selectedLineHeight let rect = CGRectMake(0, titleHeight, bounds.size.width, bounds.size.height - titleHeight - lineHeight) return rect } /** Calculate the rectangle for the textfield when it is being edited - parameter bounds: The current bounds of the field - returns: The rectangle that the textfield should render in */ override public func editingRectForBounds(bounds: CGRect) -> CGRect { let titleHeight = self.titleHeight() let lineHeight = self.selectedLineHeight let rect = CGRectMake(0, titleHeight, bounds.size.width, bounds.size.height - titleHeight - lineHeight) return rect } /** Calculate the rectangle for the placeholder - parameter bounds: The current bounds of the placeholder - returns: The rectangle that the placeholder should render in */ override public func placeholderRectForBounds(bounds: CGRect) -> CGRect { let titleHeight = self.titleHeight() let lineHeight = self.selectedLineHeight let rect = CGRectMake(0, titleHeight, bounds.size.width, bounds.size.height - titleHeight - lineHeight) return rect } // MARK: - Positioning Overrides /** Calculate the bounds for the title label. Override to create a custom size title field. - parameter bounds: The current bounds of the title - parameter editing: True if the control is selected or highlighted - returns: The rectangle that the title label should render in */ public func titleLabelRectForBounds(bounds:CGRect, editing:Bool) -> CGRect { let titleHeight = self.titleHeight() if editing { return CGRectMake(0, 0, bounds.size.width, titleHeight) } return CGRectMake(0, titleHeight, bounds.size.width, titleHeight) } /** Calculate the bounds for the bottom line of the control. Override to create a custom size bottom line in the textbox. - parameter bounds: The current bounds of the line - parameter editing: True if the control is selected or highlighted - returns: The rectangle that the line bar should render in */ public func lineViewRectForBounds(bounds:CGRect, editing:Bool) -> CGRect { let lineHeight:CGFloat = editing ? CGFloat(self.selectedLineHeight) : CGFloat(self.lineHeight) return CGRectMake(0, bounds.size.height - lineHeight, bounds.size.width, lineHeight); } /** Calculate the height of the title label. -returns: the calculated height of the title label. Override to size the title with a different height */ public func titleHeight() -> CGFloat { if let titleLabel = self.titleLabel, font = titleLabel.font { return font.lineHeight } return 15.0 } /** Calcualte the height of the textfield. -returns: the calculated height of the textfield. Override to size the textfield with a different height */ public func textHeight() -> CGFloat { return self.font!.lineHeight + 7.0 } // MARK: - Layout /// Invoked when the interface builder renders the control override public func prepareForInterfaceBuilder() { super.prepareForInterfaceBuilder() self.selected = true _renderingInInterfaceBuilder = true self.updateControl(false) self.invalidateIntrinsicContentSize() } /// Invoked by layoutIfNeeded automatically override public func layoutSubviews() { super.layoutSubviews() self.titleLabel.frame = self.titleLabelRectForBounds(self.bounds, editing: self.isTitleVisible() || _renderingInInterfaceBuilder) self.lineView.frame = self.lineViewRectForBounds(self.bounds, editing: self.editingOrSelected || _renderingInInterfaceBuilder) } /** Calculate the content size for auto layout - returns: the content size to be used for auto layout */ override public func intrinsicContentSize() -> CGSize { return CGSizeMake(self.bounds.size.width, self.titleHeight() + self.textHeight()) } // MARK: - Helpers private func titleOrPlaceholder() -> String? { if let title = self.title ?? self.placeholder { return self.titleFormatter(title) } return nil } private func selectedTitleOrTitlePlaceholder() -> String? { if let title = self.selectedTitle ?? self.title ?? self.placeholder { return self.titleFormatter(title) } return nil } }
[ -1 ]
a4583d8ff8df1e2e4bad04d1e8f7e65842326ee1
51603e97f1ab409941c88b4ebca452be1d3fe7e2
/Shared/Networking/APIRequest.swift
590fbff39f70192b6c42b5ad4cd18a6cc065f099
[ "MIT" ]
permissive
fishcharlie/Einstein
3874e0f02c9ce48f5e2219688cd364890e0f7781
a6b101d6be4eacea29fd30d6a04c61ca6250e8ab
refs/heads/master
2020-05-30T00:03:42.935366
2019-05-30T23:14:46
2019-05-30T23:14:46
189,450,340
0
0
MIT
2019-05-30T16:52:23
2019-05-30T16:52:23
null
UTF-8
Swift
false
false
4,608
swift
// // APIRequest.swift // // import Foundation /// A protocol for making an API Request. Please see FetchStoriesAPIRequest which is used as an example /// Based off of: https://developer.apple.com/videos/play/wwdc2018/417/ public protocol APIRequest { associatedtype RequestDataType associatedtype ResponseDataType: Decodable /// This will be used to set our base url when building our `URLRequest`. var api: API { get } /// Relevant information for our request. Information that can be substitued into our url, body, path, or headers. This should be passed into the `APIRequest` during initialization var requestPayload: RequestDataType { get } /// The path for our `APIRequest`. This will be used to build our `URL` var path: String { get } /// The query items we want to use to build our url. This will default to nil var queryItems: [URLQueryItem]? { get } /// The `HTTPMethod` for our request. This will default to .get var method: HTTPMethod { get } /// Used to build the headers within our `URLRequest`. Will default to nil var headers: [HTTPHeader]? { get } /// Used to build the body of our `URLRequest`. Will default to nil var body: Data? { get } /// If you want to throttle your network request every X seconds. Return X. If you don't want to throttle, return nil. Will default to nil var throttle: TimeInterval? { get } /// If you want to explicitally build your `URLRequest`, implement this method. Otherwise, the conforming protocol will have a default implementation that derives the URLRequest from the other properties on the protocol /// /// - Returns: A `URLRequest` which will be sent to the server. /// - Throws: A `GrioError` - Such as `GrioError.couldNotCreateRequest` func makeRequest() throws -> URLRequest /// An oppurtunity to parse your response. If you want to use a custom decoder, you can implement this method yourself. Otherwise your `APIRequest` will use the default implementation used in this extension /// /// - Parameter data: Data returned from your service /// - Returns: The type which your protocol declares as its ResponseDataType /// - Throws: A DecodingError if we could not create our ResponseDataType from the data returned func parseResponse(from data: Data) throws -> ResponseDataType } public extension APIRequest { var baseURL: URL { let baseURL = api.baseURL return baseURL } func makeRequest() throws -> URLRequest { var urlComponents = URLComponents() urlComponents.scheme = baseURL.scheme urlComponents.host = baseURL.host urlComponents.path = baseURL.path urlComponents.queryItems = queryItems guard let url = urlComponents.url?.appendingPathComponent(path) else { throw GrioError.couldNotCreateRequest } var urlRequest = URLRequest(url: url) urlRequest.httpMethod = method.rawValue urlRequest.httpBody = body headers?.forEach { urlRequest.addValue($0.value, forHTTPHeaderField: $0.field) } return urlRequest } func parseResponse(from data: Data) throws -> ResponseDataType { return try JSONDecoder().decode(ResponseDataType.self, from: data) } var method: HTTPMethod { return .get } var queryItems: [URLQueryItem]? { return nil } var headers: [HTTPHeader]? { return nil } var body: Data? { return nil } var throttle: TimeInterval? { return nil } } /// MARK: - Example /* // https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty struct FetchStoriesAPIRequest: APIRequest { // MARK: - Types enum StoryType: String { case top case best case new } struct Payload { let storyTypes: StoryType } typealias RequestDataType = Payload typealias ResponseDataType = [Int] var api: API { return HackerNewsAPI.shared } let requestPayload: FetchStoriesAPIRequest.Payload var method: HTTPMethod { return .get } var path: String { return "/v0/\(requestPayload.storyTypes.rawValue)stories.json" } var queryItems: [URLQueryItem]? { return [URLQueryItem(name: "print", value: "pretty")] } var headers: [HTTPHeader]? { return nil } var body: Data? { return nil } } */
[ -1 ]
5e43cc911d5918108a541b57e422a7ec06aa308e
da5cb3fdb95118cb275ad04964869b4f55b2cc62
/AlineaIOS/Helper/Themeing.swift
0d782cbe7e6a5a7751f83dd7f8626ac02939cce4
[]
no_license
Arpit160399/clone_AlineaIOS
c7e3a8f06f7d1c9608ead3a8e5937de61b297cb7
5a58e04145369adc2237be781c35e3c16377d6f8
refs/heads/main
2023-01-04T17:48:25.199331
2020-11-03T03:11:33
2020-11-03T03:11:33
309,555,853
0
0
null
null
null
null
UTF-8
Swift
false
false
1,125
swift
// // Themeing.swift // AlineaIOS // // Created by Arpit Singh on 02/11/20. // import UIKit class Themeing { static let shared = Themeing() let accent : UIColor = { return UIColor(displayP3Red: 64/255, green: 65/255, blue: 205/255, alpha: 1) }() let primary : UIColor = { return UIColor(displayP3Red: 0/255, green: 55/255, blue: 201/255, alpha: 1) }() let secondary: UIColor = { return UIColor(displayP3Red: 250/255, green: 250/255, blue: 251/255, alpha: 1) }() let secondaryDark: UIColor = { return UIColor(displayP3Red: 243/255, green: 245/255, blue: 251/255, alpha: 1) }() let fontPrimary: UIColor = { return .black }() let fontSecondary: UIColor = { return UIColor(displayP3Red: 159/255, green: 159/255, blue: 168/255, alpha: 1) }() let success: UIColor = { return UIColor(displayP3Red: 99/255, green: 221/255, blue: 183/255, alpha: 1) }() let failer: UIColor = { return UIColor(displayP3Red: 239/255, green: 104/255, blue: 106/255, alpha: 1) }() }
[ -1 ]
00f597c60b2a1adda1cae63b63d0862a988468f9
3e4e80a6a75fe4a256d464e8980f743015ce83e3
/Matchismo_Swift/Matchismo_Swift/Matchismo_SwiftTests/Matchismo_SwiftTests.swift
f9bba50e243a930afb7ac316c408a7d2779c4405
[]
no_license
gsulshski/assignment-2-IOS8
eca4740307908a4218e3d6c72d6a4cade4077e38
c1bb607b72530fec0456637606f5d4136203109e
refs/heads/master
2020-05-17T16:22:15.197832
2014-12-29T17:37:58
2014-12-29T17:37:58
null
0
0
null
null
null
null
UTF-8
Swift
false
false
919
swift
// // Matchismo_SwiftTests.swift // Matchismo_SwiftTests // // Created by Gregory Ulsh on 8/7/14. // Copyright (c) 2014 CS193P. All rights reserved. // import UIKit import XCTest class Matchismo_SwiftTests: XCTestCase { override func setUp() { super.setUp() // Put setup code here. This method is called before the invocation of each test method in the class. } override func tearDown() { // Put teardown code here. This method is called after the invocation of each test method in the class. super.tearDown() } func testExample() { // This is an example of a functional test case. XCTAssert(true, "Pass") } func testPerformanceExample() { // This is an example of a performance test case. self.measureBlock() { // Put the code you want to measure the time of here. } } }
[ 276481, 276484, 276489, 278541, 278544, 305179, 276509, 278558, 307231, 313375, 102437, 227370, 360491, 276534, 276543, 159807, 286788, 280649, 223316, 315476, 223318, 288857, 227417, 278618, 194653, 278624, 194656, 309345, 227428, 276581, 276582, 276589, 278638, 227439, 276592, 131189, 227446, 223350, 292992, 141450, 215178, 311435, 311438, 276627, 276632, 184475, 227492, 196773, 129203, 299187, 131256, 176314, 280762, 223419, 299198, 309444, 227528, 276682, 276684, 278742, 278746, 155867, 280802, 196834, 276709, 276710, 276715, 233715, 157944, 211193, 168188, 227585, 276737, 276744, 227592, 276748, 276753, 129301, 276760, 309529, 278810, 276764, 299293, 276774, 282919, 262450, 276787, 276792, 315706, 278846, 164162, 311621, 280902, 227658, 276813, 278862, 278863, 6481, 6482, 276821, 276822, 6489, 276831, 323935, 276835, 321894, 276839, 416104, 276847, 285040, 278898, 278908, 280961, 227725, 178578, 190871, 293274, 61857, 61859, 276900, 278954, 278961, 278965, 276919, 276920, 278969, 293303, 33211, 276925, 278978, 278985, 278993, 279002, 276958, 287198, 227809, 358882, 227813, 279013, 279019, 279022, 281072, 279039, 276998, 287241, 279050, 186893, 279054, 303631, 223767, 277017, 223769, 291358, 277029, 293419, 277048, 301634, 277066, 277083, 295519, 66150, 277094, 166507, 189036, 189037, 277101, 287346, 189043, 277111, 279164, 277118, 291454, 184962, 303746, 152203, 225933, 133774, 277133, 277138, 230040, 164512, 225956, 285353, 209581, 205487, 285361, 303793, 299699, 277172, 293556, 342706, 277175, 285371, 277190, 199366, 225997, 226001, 164563, 277204, 203477, 226004, 279252, 226007, 119513, 201442, 226019, 285415, 342762, 277227, 226033, 230134, 234234, 226043, 279294, 234241, 226051, 277254, 209670, 203529, 226058, 234250, 234253, 285463, 234263, 234268, 105246, 228129, 234277, 279336, 277289, 289576, 234283, 277294, 234286, 226097, 234289, 234294, 230199, 162621, 234301, 289598, 277312, 281408, 293693, 162626, 277316, 234311, 234312, 299849, 234317, 277325, 277327, 293711, 234323, 234326, 277339, 234331, 297822, 301918, 279392, 297826, 349026, 234340, 174949, 234343, 277354, 234346, 234355, 213876, 277366, 234360, 279417, 277370, 226170, 209785, 177019, 234361, 234366, 234367, 158593, 234372, 226181, 213894, 113542, 226184, 234377, 277381, 228234, 226189, 295824, 226194, 234386, 234387, 234392, 324507, 234400, 279456, 277410, 234404, 226214, 289703, 234409, 275371, 236461, 234419, 234425, 277435, 234427, 287677, 234430, 226241, 234436, 234438, 226249, 52172, 234444, 234445, 183248, 275410, 234451, 234454, 234457, 234463, 234466, 277479, 277480, 234472, 234473, 179176, 234477, 234482, 287731, 277492, 314355, 277505, 234498, 234500, 277509, 277510, 277513, 230410, 234506, 277517, 275469, 277518, 197647, 295953, 277523, 230423, 197657, 281625, 281626, 175132, 234531, 234534, 275495, 310317, 277550, 234542, 275505, 275506, 234548, 277563, 234555, 156733, 277566, 230463, 7230, 238651, 207938, 234560, 234565, 277574, 234569, 277579, 300111, 207953, 277585, 296018, 234577, 296019, 234583, 234584, 277603, 230499, 281700, 300135, 275565, 156785, 312434, 275571, 300151, 234616, 398457, 234622, 300158, 285828, 302213, 275590, 275591, 253063, 234632, 234642, 226452, 308372, 119963, 234656, 277665, 330913, 306338, 275620, 234659, 234663, 275625, 300201, 275628, 238769, 226481, 277690, 208058, 230588, 277694, 283840, 279747, 279760, 290000, 189652, 203989, 363744, 195811, 298212, 304356, 285929, 279792, 298228, 204022, 120055, 234742, 228600, 208124, 204041, 292107, 277792, 339234, 259363, 199971, 304421, 277800, 113962, 277803, 277806, 113966, 226608, 277809, 226609, 277814, 277815, 300343, 277821, 277824, 277825, 226624, 15686, 277831, 226632, 277834, 294218, 177484, 142669, 277838, 222541, 277841, 296273, 222548, 277845, 314709, 283991, 357719, 277852, 218462, 224606, 277856, 142689, 230756, 302438, 163175, 277866, 281962, 173420, 277868, 284014, 277871, 279919, 277878, 275831, 275832, 181625, 277882, 142716, 275839, 277890, 277891, 226694, 277896, 277897, 281992, 277900, 230799, 112017, 296338, 277907, 206228, 306579, 226712, 277919, 277920, 310692, 277925, 279974, 282024, 277936, 277939, 279989, 296375, 277943, 277949, 277952, 296387, 415171, 163269, 277957, 296391, 300487, 277965, 280013, 312782, 284116, 277974, 228823, 228824, 277980, 226781, 277983, 277988, 310757, 316902, 277993, 296425, 277994, 277997, 278005, 226805, 306677, 278008, 300542, 306693, 175625, 192010, 280077, 149007, 65041, 282136, 204313, 278056, 278060, 286254, 228917, 226875, 194110, 128583, 226888, 276040, 366154, 276045, 276046, 286288, 276050, 280147, 300630, 226906, 147036, 243292, 282213, 317032, 222832, 276085, 276088, 278140, 276092, 188031, 192131, 276100, 276101, 229001, 310923, 312972, 278160, 278162, 282259, 276116, 276120, 280220, 276126, 276129, 282273, 282276, 278191, 276146, 198324, 286388, 296628, 278201, 276165, 278214, 276173, 302797, 212688, 302802, 276179, 276180, 286423, 216795, 276195, 153319, 313065, 280300, 419569, 276210, 276211, 276219, 194303, 171776, 288512, 311042, 288516, 278285, 276238, 227091, 184086, 294678, 284442, 278299, 276253, 278307, 288547, 159533, 276279, 276282, 276283, 276287, 345919, 276294, 282438, 276298, 296779, 216918, 276311, 307031, 237408, 276325, 227177, 282474, 288619, 276332, 173936, 276344, 194429, 227199, 40853, 44952, 247712, 227238, 294823, 276401, 276408, 290746, 161722, 276413, 276421, 276422, 276430, 231375, 153554, 276444, 280541, 276450, 276451, 276454, 276459, 296941, 276462, 276463, 276468, 276469, 276475, 276478 ]
1b6fc83f172165eb56c8675d41761550327c7712
eaca4d1dc0de01422324da2f27bacad37de17466
/Stonks/Stonks/ArticleTable/Container/ArticleContainer.swift
67f06971e2618f1069f4a2091301ec4b4739e4f7
[]
no_license
Erokha/stonks
100807146a58edf1832d6b070ab42ee63b98ab4c
eead763557dd243e9a74ae510c7270565d4083db
refs/heads/master
2023-05-03T08:53:08.774308
2021-05-19T21:02:14
2021-05-19T21:02:14
300,053,135
0
1
null
2021-05-19T21:02:15
2020-09-30T20:25:48
Swift
UTF-8
Swift
false
false
1,295
swift
import Foundation import UIKit class ArticleContainer { let viewController: ArticleViewController class func assemble(with context: ArticleContext) -> ArticleContainer { // let storyboard = UIStoryboard(name: Storyboard.article.name, bundle: nil) // guard let viewController = storyboard.instantiateViewController(withIdentifier: Storyboard.article.name) as? ArticleViewController else { // fatalError("ArticleContainer: viewController must be type ArticleViewController") // } let viewController = ArticleViewController() let interactor = ArticleInteractor(type: context.type) let presenter = ArticleViewPresenter(interactor: interactor) interactor.output = presenter let router = ArticleRouter() viewController.output = presenter presenter.view = viewController presenter.router = router presenter.tableViewTitle = context.tableViewTitle router.viewController = viewController return ArticleContainer(view: viewController) } private init(view: ArticleViewController) { self.viewController = view } } struct ArticleContext { let tableViewTitle: String let type: ArticleType } enum ArticleType { case learn case news }
[ -1 ]
8f6f9d4c52148242e7a67af4c1311dcd28afc0be
58df00862f130b06876d5891b4ae28ad6b2819d5
/AdjectiveDetailSection.swift
5f287c877235facf2fb8a8a3c44238dee286acd1
[]
no_license
scotius/IrishVocabulary
73c428aab044dd47ba0124c29a4481fa1433fc0b
929afbc3ab687e2964f185eeed9534b49c3d5f2d
refs/heads/master
2021-01-10T22:40:29.892148
2017-07-22T18:26:57
2017-07-22T18:26:57
70,371,020
0
0
null
null
null
null
UTF-8
Swift
false
false
328
swift
// // AdjectiveDetailSection.swift // IrishVocabulary // // Created by Scott on 7/16/17. // Copyright © 2017 Scott. All rights reserved. // import Foundation class AdjectiveDetailSection { var heading : String var item : String init() { heading = "" item = "" } }
[ -1 ]
f31a1713d66747777505261926255f8f761904a2
47eeb782b4a1088b7291a3b0bda296cc81c5e281
/NewsSwiftUI-mvvm/NewsSwiftUI-mvvm/services/container/ServiceContainer.swift
9513c557b2b9dbee169dc1c829dd9c5b9452c007
[]
no_license
anioutkazharkova/swiftui_tutorials_guide
f048400c378f867760328de8881ddbbe738dfca1
8e1b64053a233a98472058a89b6c8148db2caaeb
refs/heads/master
2021-01-05T04:29:54.695842
2020-03-07T14:06:05
2020-03-07T14:06:05
240,879,781
4
1
null
null
null
null
UTF-8
Swift
false
false
578
swift
// // ServiceContainer.swift // MoviesSearch // // Created by 1 on 16.02.2019. // Copyright © 2019 1. All rights reserved. // import Foundation // MARK: DI for services protocol IServiceContainer { var newsService: INewsService { get } } class ServiceContainer: IServiceContainer { var _newsService: INewsService? var newsService: INewsService { get { if (_newsService == nil){ _newsService = NewsService(networkService: DI.container.networkService) } return _newsService! } } }
[ -1 ]
42a5405ac933e80737d142314474edbf95d90406
c1dc87af85caf9f4c83fc906dc17ac0dedaa1f81
/HSwiftProject/Classes/Main/HLive/HLiveRoomCell+HSection0/HLiveRoomCell+HSection0.swift
4b74bd4ade9dbd1bef4e8d031435af27343af466
[]
no_license
dqfStudio/HSwiftProject
a067c1be2b53d4c10e4a97ee20229550c3ed73ab
af567c41ed22e6b0133897732425449644ae8cb4
refs/heads/master
2022-02-06T08:28:33.393934
2022-01-28T11:43:14
2022-01-28T11:43:14
222,070,848
0
1
null
null
null
null
UTF-8
Swift
false
false
18,007
swift
// // HLiveRoomCell+HSection0.swift // HSwiftProject // // Created by Wind on 18/11/2021. // Copyright © 2021 wind. All rights reserved. // import UIKit class HLiveRoomTopHeaderView : UIView, HTupleViewDelegate { override init(frame: CGRect) { super.init(frame: frame) self.tupleView.delegate = self self.addSubview(self.tupleView) //设置tupleView release key self.tupleView.releaseTupleKey = KLiveRoomReleaseTupleKey } required init?(coder: NSCoder) { super.init(coder: coder) } private var _tupleView: HTupleView? var tupleView: HTupleView { if (_tupleView == nil) { _tupleView = HTupleView.init(frame: self.bounds, scrollDirection: .horizontal) _tupleView!.backgroundColor = UIColor.clear _tupleView!.bounceDisenable() } return _tupleView! } func insetForSection(_ section: Any) -> Any { return UIEdgeInsetsMake(0, 10, 0, 10) } func numberOfItemsInSection(_ section: Any) -> Any { return 6 } func edgeInsetsForItemAtIndexPath(_ indexPath: IndexPath) -> Any { switch (indexPath.row) { case 0: return UIEdgeInsetsMake(5, 5, 5, 5) case 1: return UIEdgeInsetsZero case 2: return UIEdgeInsetsMake(5, 5, 5, 5) case 3: return UIEdgeInsetsMake(5, 5, 5, 5) case 4: return UIEdgeInsetsMake(5, 5, 5, 5) case 5: return UIEdgeInsetsMake(5, 5, 5, 5) default: break; } return UIEdgeInsetsZero; } func sizeForItemAtIndexPath(_ indexPath: IndexPath) -> Any { switch (indexPath.row) { case 0: return CGSizeMake(135, self.tupleView.height) case 1: return CGSizeMake(self.tupleView.width-20-135-self.tupleView.height*4, self.tupleView.height) case 2: return CGSizeMake(self.tupleView.height, self.tupleView.height) case 3: return CGSizeMake(self.tupleView.height, self.tupleView.height) case 4: return CGSizeMake(self.tupleView.height, self.tupleView.height) case 5: return CGSizeMake(self.tupleView.height, self.tupleView.height) default: break; } return CGSizeMake(self.tupleView.width, self.tupleView.height) } func tupleItem(_ itemBlock: Any, atIndexPath indexPath: IndexPath) { let itemBlock = itemBlock as! HTupleItem switch (indexPath.row) { case 0: let cell = itemBlock(nil, HTupleViewCell.self, nil, true) as! HTupleViewCell cell.backgroundColor = UIColor.black; cell.cornerRadius = cell.height/2 let frame = cell.layoutViewBounds var tmpFrame = frame tmpFrame.width = tmpFrame.height cell.imageView.frame = tmpFrame cell.imageView.backgroundColor = UIColor.red // [cell.imageView setFillet:YES]; cell.imageView.cornerRadius = tmpFrame.width/2 cell.imageView.setImageWithName("icon_no_server") var tmpFrame2 = frame tmpFrame2.x = tmpFrame2.width - 40; tmpFrame2.width = 40; cell.buttonView.frame = tmpFrame2 cell.buttonView.backgroundColor = UIColor.red cell.buttonView.text = "关注" cell.buttonView.textColor = UIColor.white cell.buttonView.textFont = UIFont.systemFont(ofSize: 12) cell.buttonView.cornerRadius = cell.buttonView.height/2 cell.buttonView.pressed = { (_ sender: Any?, _ data: Any?) in // self.viewController?.present(HAlertController(), animated: true, completion: { // // }) // [[self viewController] presentController:HAlertController.new completion:^(HTransitionType transitionType) { // NSLog(@""); // }]; } var tmpFrame3 = frame tmpFrame3.x = tmpFrame.width + 5; tmpFrame3.width -= tmpFrame.width + tmpFrame2.width + 10; tmpFrame3.height /= 2; cell.label.frame = tmpFrame3 cell.label.font = UIFont.systemFont(ofSize: 9) cell.label.textAlignment = .left cell.label.textColor = UIColor.white cell.label.text = "游客 56738" var tmpFrame4 = tmpFrame3 tmpFrame4.y = tmpFrame4.height cell.detailLabel.frame = tmpFrame4 cell.detailLabel.font = UIFont.systemFont(ofSize: 9) cell.detailLabel.textAlignment = .left cell.detailLabel.textColor = UIColor.white cell.detailLabel.text = "ID 56738" break; case 1: let cell = itemBlock(nil, HTupleLabelCell.self, nil, true) as! HTupleLabelCell cell.label.font = UIFont.systemFont(ofSize: 14) cell.label.textAlignment = .center cell.label.textColor = HColorHex("#0B0A0C") break; case 2: let cell = itemBlock(nil, HTupleButtonCell.self, nil, true) as! HTupleButtonCell cell.buttonView.backgroundColor = UIColor.red cell.buttonView.cornerRadius = cell.buttonView.width/2 cell.buttonView.setImageWithName("icon_no_server") // cell.buttonView setFillet:YES]; cell.buttonView.pressed = { (_ sender: Any?, _ data: Any?) in // self.viewController?.present(HAlertController(), animated: true, completion: { // // }) // [[self viewController] presentController:HAlertController.new completion:^(HTransitionType transitionType) { // NSLog(@""); // }]; } break; case 3: let cell = itemBlock(nil, HTupleButtonCell.self, nil, true) as! HTupleButtonCell cell.buttonView.backgroundColor = UIColor.red cell.buttonView.cornerRadius = cell.buttonView.width/2 cell.buttonView.setImageWithName("icon_no_server") // cell.buttonView setFillet:YES]; cell.buttonView.pressed = { (_ sender: Any?, _ data: Any?) in // self.viewController?.present(HAlertController(), animated: true, completion: { // // }) // [[self viewController] presentController:HAlertController.new completion:^(HTransitionType transitionType) { // NSLog(@""); // }]; } break; case 4: let cell = itemBlock(nil, HTupleButtonCell.self, nil, true) as! HTupleButtonCell cell.buttonView.backgroundColor = UIColor.red cell.buttonView.cornerRadius = cell.buttonView.width/2 cell.buttonView.setImageWithName("icon_no_server") // cell.buttonView setFillet:YES]; cell.buttonView.pressed = { (_ sender: Any?, _ data: Any?) in // self.viewController?.present(HAlertController(), animated: true, completion: { // // }) // [[self viewController] presentController:HAlertController.new completion:^(HTransitionType transitionType) { // NSLog(@""); // }]; } break; case 5: let cell = itemBlock(nil, HTupleButtonCell.self, nil, true) as! HTupleButtonCell cell.buttonView.backgroundColor = UIColor.red cell.buttonView.cornerRadius = cell.buttonView.width/2 cell.buttonView.setImageWithName("icon_no_server") // cell.buttonView setFillet:YES]; cell.buttonView.pressed = { (_ sender: Any?, _ data: Any?) in // self.viewController?.present(HAlertController(), animated: true, completion: { // // }) // [[self viewController] presentController:HAlertController.new completion:^(HTransitionType transitionType) { // NSLog(@""); // }]; } break; default: break; } } } class HLiveRoomTopHonorView : UIView, HTupleViewDelegate { override init(frame: CGRect) { super.init(frame: frame) self.tupleView.delegate = self self.addSubview(self.tupleView) //设置tupleView release key self.tupleView.releaseTupleKey = KLiveRoomReleaseTupleKey } required init?(coder: NSCoder) { super.init(coder: coder) } private var _tupleView: HTupleView? var tupleView: HTupleView { if (_tupleView == nil) { _tupleView = HTupleView.init(frame: self.bounds, scrollDirection: .horizontal) _tupleView!.backgroundColor = UIColor.clear _tupleView!.bounceDisenable() } return _tupleView! } func tuple0_insetForSection(_ section: Any) -> Any { return UIEdgeInsetsMake(0, 0, 0, 10) } func numberOfItemsInSection(_ section: Any) -> Any { return 3 } func edgeInsetsForItemAtIndexPath(_ indexPath: IndexPath) -> Any { return UIEdgeInsetsMake(7.5, 10, 7.5, 0); } func sizeForItemAtIndexPath(_ indexPath: IndexPath) -> Any { switch (indexPath.row) { case 0: return CGSizeMake(100, self.tupleView.height) case 1: return CGSizeMake(100, self.tupleView.height) case 2: return CGSizeMake(self.tupleView.width-200-20, self.tupleView.height) default: break; } return CGSizeMake(self.tupleView.width, self.tupleView.height); } func tupleItem(_ itemBlock: Any, atIndexPath indexPath: IndexPath) { let itemBlock = itemBlock as! HTupleItem switch (indexPath.row) { case 0: let cell = itemBlock(nil, HTupleViewCellHoriValue3.self, nil, true) as! HTupleViewCellHoriValue3 cell.layoutView.backgroundColor = UIColor.black cell.layoutView.cornerRadius = cell.layoutView.height/2 cell.label.font = UIFont.systemFont(ofSize: 10) cell.label.textAlignment = .right cell.label.textColor = UIColor.white cell.label.text = "魅力值 202" cell.detailWidth = 20; cell.detailLabel.font = UIFont.systemFont(ofSize: 18) cell.detailLabel.textAlignment = .right cell.detailLabel.textColor = UIColor.white cell.detailLabelInsets = UILREdgeInsetsMake(0, 5); // cell.detailLabel setTextVerticalAlignment:HTextVerticalAlignmentBottom]; cell.detailLabel.text = "›" break; case 1: let cell = itemBlock(nil, HTupleViewCellHoriValue3.self, nil, true) as! HTupleViewCellHoriValue3 cell.layoutView.backgroundColor = UIColor.black cell.layoutView.cornerRadius = cell.layoutView.height/2 cell.label.font = UIFont.systemFont(ofSize: 10) cell.label.textAlignment = .right cell.label.textColor = UIColor.white cell.label.text = "守护 虚位以待" cell.detailWidth = 18 cell.detailLabel.font = UIFont.systemFont(ofSize: 18) cell.detailLabel.textAlignment = .right cell.detailLabel.textColor = UIColor.white cell.detailLabelInsets = UILREdgeInsetsMake(0, 5) // [cell.detailLabel setTextVerticalAlignment:HTextVerticalAlignmentBottom]; cell.detailLabel.text = "›" break; case 2: let cell = itemBlock(nil, HTupleLabelCell.self, nil, true) as! HTupleLabelCell cell.label.font = UIFont.systemFont(ofSize: 10) cell.label.textAlignment = .center cell.label.textColor = UIColor.white break; default: break; } } } extension HLiveRoomCell { @objc func tupleExa0_numberOfItemsInSection(_ section: Any) -> Any { return 4 } @objc func tupleExa0_sizeForHeaderInSection(_ section: Any) -> Any { return CGSizeMake(self.liveRightView.width, UIScreen.statusBarHeight+5); } @objc func tupleExa0_sizeForItemAtIndexPath(_ indexPath: IndexPath) -> Any { switch (indexPath.row) { case 0: return CGSizeMake(self.liveRightView.width, 35) case 1: return CGSizeMake(self.liveRightView.width, 35) case 2: return CGSizeMake(self.liveRightView.width, 18) case 3: return CGSizeMake(self.liveRightView.width, 35) default: break; } return CGSizeZero; } @objc func tupleExa0_edgeInsetsForItemAtIndexPath(_ indexPath: IndexPath) -> Any { if (indexPath.row == 2) { return UIEdgeInsetsMake(0, 10, 0, 10); }else if (indexPath.row == 3) { return UIEdgeInsetsMake(5, 10, 5, self.liveRightView.width-130); } return UIEdgeInsetsZero; } @objc func tupleExa0_tupleHeader(_ headerBlock: Any, inSection section: Any) { let headerBlock = headerBlock as! HTupleHeader let cell = headerBlock(nil, HTupleBaseApex.self, nil, true) as! HTupleBaseApex cell.backgroundColor = UIColor.clear } @objc func tupleExa0_tupleItem(_ itemBlock: Any, atIndexPath indexPath: IndexPath) { let itemBlock = itemBlock as! HTupleItem switch (indexPath.row) { case 0: let cell = itemBlock(nil, HTupleBaseCell.self, nil, true) as! HTupleBaseCell var topHeaderView = cell.viewWithTag(123456) as? HLiveRoomTopHeaderView if (topHeaderView == nil) { topHeaderView = HLiveRoomTopHeaderView.init(frame: cell.bounds) topHeaderView!.tag = 123456 cell.addSubview(topHeaderView!) } break; case 1: let cell = itemBlock(nil, HTupleBaseCell.self, nil, true) as! HTupleBaseCell var topHonorView = cell.viewWithTag(234567) as? HLiveRoomTopHonorView if (topHonorView == nil) { topHonorView = HLiveRoomTopHonorView.init(frame: cell.bounds) topHonorView!.tag = 234567 cell.addSubview(topHonorView!) } break; case 2: // let cell = itemBlock(nil, HTupleViewMarqueeCell.self, nil, true) as! HTupleViewMarqueeCell // cell.layoutView.backgroundColor = UIColor.black // cell.layoutView.cornerRadius = cell.layoutView.height/2 // cell.msg = "测试通告!!!" // cell.bgColor = UIColor.black // cell.txtColor = UIColor.white // cell.selectedBlock = { () in // NSLog("") // } let cell = itemBlock(nil, HTupleBaseCell.self, nil, true) as! HTupleBaseCell cell.layoutView.backgroundColor = UIColor.black cell.layoutView.cornerRadius = cell.layoutView.height/2 // HNoticeBrowseLabel *noticeBrowse = [cell viewWithTag:345678]; // [noticeBrowse releaseNotice]; // if (!noticeBrowse) { // CGRect frame = cell.layoutViewBounds; // frame.origin.x = 20; // frame.size.width -= 20; // noticeBrowse = [[HNoticeBrowseLabel alloc] initWithFrame:frame]; // [noticeBrowse setTag:345678]; // noticeBrowse.textColor = UIColor.whiteColor; // noticeBrowse.textFont = [UIFont systemFontOfSize:12.f]; // noticeBrowse.durationTime = 4.0; // [cell addSubview:noticeBrowse]; // } // noticeBrowse.texts = @[@"测试通告!!!"]; // [noticeBrowse reloadData]; break; case 3: let cell = itemBlock(nil, HTupleButtonCell.self, nil, true) as! HTupleButtonCell cell.buttonView.cornerRadius = cell.layoutViewFrame.height/2 cell.buttonView.backgroundColor = UIColor.yellow cell.buttonView.text = "测试公告" cell.buttonView.textFont = UIFont.systemFont(ofSize: 14) cell.buttonView.textColor = UIColor.black cell.buttonView.textAlignment = .left cell.buttonView.pressed = { (_ sender: Any?, _ data: Any?) in // [[self viewController] presentController:HLiveRoomNoteVC.new completion:^(HTransitionType transitionType) { // NSLog(@""); // }]; } break; default: break; } } }
[ -1 ]
f5771b11e00c781397f0be63094cdf55f66f96c8
91368eee344f6ace83dfc0cbf15de8073b12b885
/DrawSomething/Models/Line.swift
29f852f5a5a479492db3cd0a90e5cbc064593f05
[]
no_license
theknoosh/DrawSomething
4be4914f2ef7600dd2ece3ae6da15fa23f1cf131
3d483463034ee5eb177161599413cb7f69003db5
refs/heads/master
2020-04-15T07:52:23.731852
2019-01-11T19:19:52
2019-01-11T19:19:52
164,504,830
0
0
null
null
null
null
UTF-8
Swift
false
false
254
swift
// // Model.swift // DrawSomething // // Created by dpayne on 1/11/19. // Copyright © 2019 DARRELL A PAYNE. All rights reserved. // import UIKit struct Line { let strokeWidth: Float let color: UIColor var points: [CGPoint] }
[ -1 ]
2fdfbc9bf7d497b38d23b6dbe042618c1dc3a9df
372efbb4430e6d049b2c7a327c7c9780e75e93c4
/LoyaltyUITests/LoyaltyUITests.swift
6f85992f4b82502ebf74606a21b6a6adab4315e8
[]
no_license
DrewKiino/Loyalty
95cd315acdb1ce0bf8be93d744ee039391d119c0
44698e5ab49260b9f6ed5188f350a6caf61ecd69
refs/heads/master
2020-08-04T02:02:01.117757
2016-11-12T04:10:46
2016-11-12T04:10:46
73,530,507
0
0
null
null
null
null
UTF-8
Swift
false
false
1,249
swift
// // LoyaltyUITests.swift // LoyaltyUITests // // Created by Andrew Aquino on 11/11/16. // Copyright © 2016 Andrew Aquino. All rights reserved. // import XCTest class LoyaltyUITests: 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, 278713, 180409, 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, 188954, 279066, 279092, 377419, 303693, 115287, 189016, 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, 303802, 287418, 66243, 287434, 287438, 279249, 303826, 279253, 369365, 369366, 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, 312315, 312317, 328701, 328705, 418819, 230411, 320526, 238611, 140311, 238617, 197658, 336930, 132140, 189487, 312372, 238646, 238650, 320571, 336962, 238663, 296023, 205911, 156763, 214116, 230500, 279659, 238706, 279666, 312435, 230514, 279686, 222344, 337037, 296091, 238764, 148674, 312519, 148687, 189651, 279766, 189656, 279775, 304352, 304353, 279780, 279789, 279803, 320769, 312588, 320795, 320802, 304422, 312628, 345398, 222523, 279872, 181568, 279874, 304457, 230730, 345418, 337228, 296269, 222542, 238928, 296274, 230757, 296304, 312688, 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, 345697, 312937, 312941, 206447, 288377, 337533, 280193, 239238, 288391, 239251, 280217, 198304, 337590, 280252, 280253, 296636, 321217, 280259, 321220, 239305, 280266, 296649, 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, 280451, 305032, 67464, 214936, 337816, 239515, 214943, 313257, 288698, 214978, 280517, 280518, 214983, 231382, 329696, 190437, 313322, 329707, 174058, 296942, 124912, 239610, 313338, 182277, 313356, 305173, 223269, 354342, 354346, 313388, 124974, 321589, 215095, 288829, 288835, 313415, 239689, 354386, 280660, 223317, 329812, 321632, 280674, 280676, 313446, 215144, 288878, 288890, 215165, 280708, 329884, 215204, 280761, 223418, 280767, 338118, 280779, 321744, 280792, 280803, 338151, 182503, 125166, 125170, 395511, 313595, 125184, 125192, 125197, 125200, 338196, 125204, 125215, 338217, 125225, 321839, 125236, 280903, 289109, 379224, 239973, 313703, 280938, 321901, 354671, 199030, 223611, 248188, 313726, 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, 207839, 142309, 314343, 183276, 289773, 248815, 240631, 330759, 322571, 330766, 281647, 322609, 314437, 207954, 339031, 314458, 281698, 281699, 322664, 314493, 150656, 347286, 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, 134504, 306541, 314740, 314742, 290170, 224637, 306558, 290176, 314752, 306561, 314759, 298378, 314771, 306580, 224662, 282008, 314776, 282013, 290206, 314788, 298406, 282023, 314790, 241067, 314797, 306630, 306634, 339403, 191980, 282097, 306678, 191991, 290304, 323083, 323088, 282132, 282135, 175640, 306730, 290359, 323132, 282182, 224848, 224852, 290391, 306777, 282214, 224874, 314997, 290425, 339579, 282244, 282248, 323208, 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, 102441, 315433, 102446, 282671, 241717, 307269, 233548, 315468, 315477, 200795, 323678, 315488, 315489, 45154, 307306, 233578, 241809, 323730, 299166, 233635, 299176, 184489, 323761, 184498, 258233, 299197, 299202, 176325, 299208, 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, 299449, 291266, 283088, 283089, 176602, 242138, 160224, 291297, 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, 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, 316661, 283894, 292092, 234756, 242955, 177420, 292145, 300342, 333114, 333115, 193858, 300355, 300354, 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, 235096, 128600, 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, 333700, 325508, 243590, 243592, 325514, 350091, 350092, 350102, 333727, 219046, 333734, 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, 227730, 285074, 285083, 293275, 317851, 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, 244311, 309847, 244326, 277095, 301688, 244345, 301702, 334473, 326288, 227991, 285348, 318127, 285360, 342705, 285362, 293552, 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, 310177, 293801, 326571, 326580, 326586, 359365, 211913, 56270, 203758, 293894, 293911, 326684, 113710, 318515, 203829, 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, 245018, 318746, 130342, 130344, 130347, 286012, 294210, 294220, 318804, 294236, 327023, 327030, 310650, 179586, 294278, 368012, 318860, 318876, 343457, 245160, 286128, 286133, 310714, 302523, 228796, 302530, 228804, 310725, 310731, 302539, 310735, 327122, 310747, 286176, 187877, 310758, 40439, 286201, 359931, 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, 278237, 294621, 278241, 294629, 286457, 286463, 319232, 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 ]
380ac11b5bda384bb61ca27f4303507aaf85f5ef
10afe98fd8fcc932bd34c4fab433aec5a69abc9b
/BookShelf/Commponents/ContentView.swift
20655c1c51898715a1ac4c078f50d84ca107b7e8
[]
no_license
ymurao4/BookShelf
a5715d49a04ae5563d3c31c5e8baf5b596167df4
3573758e7caf8dc17be5c32c378b737664c53bc7
refs/heads/master
2022-12-14T20:07:08.246114
2020-09-15T05:39:01
2020-09-15T05:39:01
null
0
0
null
null
null
null
UTF-8
Swift
false
false
884
swift
// // TabView.swift // BookShelf // // Created by 村尾慶伸 on 2020/07/08. // Copyright © 2020 村尾慶伸. All rights reserved. // import SwiftUI struct ContentView: View { var body: some View { TabView { BookListView() .tabItem { Image(systemName: "book") .resizable() .frame(width: 20, height: 20) Text("BookShelf") } SearchBookView() .tabItem { Image(systemName: "magnifyingglass") .resizable() .frame(width: 20, height: 20) Text("Search") } } .accentColor(.orange) } } struct TabView_Previews: PreviewProvider { static var previews: some View { ContentView() } }
[ -1 ]
338eeeb1892c2bdecc8aea3474980522b70d7f35
fec14e65ead87866fb0fdb8bbd62bfb618ff2655
/Collabs/loginViewController.swift
568dc9f1f4dcad4eba15b7fe190c874953eed142
[]
no_license
MalikGJ/hgp
be594931fa0e18c17cea4bcbab3656f8af77c8e0
bf52ed2586b3f8e011422bcc921436039b79b8e1
refs/heads/master
2020-03-22T22:22:33.861733
2018-08-03T21:12:02
2018-08-03T21:12:02
140,748,379
0
0
null
null
null
null
UTF-8
Swift
false
false
1,911
swift
// // loginViewController.swift // Collabs // // Created by Malik Garcia on 8/1/18. // Copyright © 2018 Malik Garcia. All rights reserved. // import UIKit import FirebaseAuth class loginViewController: UIViewController { /* func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error?) { // ... if error != nil { // ... return } guard let authentication = user.authentication else { return } let = GoogleAuthProvider.credential(withIDToken: authentication.idToken, accessToken: authentication.accessToken) // ... } */ @IBOutlet weak var email: UITextField! @IBOutlet weak var password: UITextField! @IBAction func LOGINBTN(_ sender: Any) { Auth.auth().signIn(withEmail: email.text!, password: password.text!) { (user, error) in if user != nil{ self.performSegue(withIdentifier: "login", sender: self) print("user logged in") }else{ print("error") let alert = UIAlertController(title: "Email or password is incorrect", message: nil, preferredStyle: .alert) let okButton = UIAlertAction(title: "ok", style: .default, handler: nil) alert.addAction(okButton) self.present(alert, animated: true,completion: nil) } } } override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } /* // MARK: - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepare(for segue: UIStoryboardSegue, sender: Any?) { // Get the new view controller using segue.destinationViewController. // Pass the selected object to the new view controller. } */ }
[ -1 ]
2c8bca37aef4d633116acada8e7d3ad23f945203
6725d6dc1c130dd41518b4b538e1b27f40830c00
/QuizApp/QuizApp/App/AppViewController.swift
10ae42791063174f7c12362ff7d3abcd716c8d3c
[ "MIT" ]
permissive
PatrikDurdevic/FER-Ruazosi
0ed2c5a2fa6bafd30fb9a448a7b216dc15578573
ad84e8c557854c49595ee4c98bfd00abd02adb83
refs/heads/master
2022-11-14T00:43:20.451738
2020-06-22T16:31:05
2020-06-22T16:31:05
254,644,791
0
0
null
null
null
null
UTF-8
Swift
false
false
1,482
swift
// // AppViewController.swift // QuizApp // // Created by Patrik Durdevic on 08/06/2020. // Copyright © 2020 Patrik Đurđević. All rights reserved. // import UIKit class AppViewController: UITabBarController { override func viewDidLoad() { super.viewDidLoad() modalTransitionStyle = .crossDissolve modalPresentationStyle = .fullScreen let quizVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(identifier: "Quiz") as! QuizViewController let quizNC = UINavigationController(rootViewController: quizVC) quizNC.navigationBar.prefersLargeTitles = true quizNC.tabBarItem = UITabBarItem(tabBarSystemItem: .featured, tag: 0) quizNC.tabBarItem.title = "Quiz" addChild(quizNC) let searchVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(identifier: "Search") as! SearchViewController let searchNC = UINavigationController(rootViewController: searchVC) searchNC.navigationBar.prefersLargeTitles = true searchNC.tabBarItem = UITabBarItem(tabBarSystemItem: .search, tag: 1) searchNC.tabBarItem.title = "Search" addChild(searchNC) let settingsVC = SettingsViewController(nibName: "SettingsViewController", bundle: nil) settingsVC.tabBarItem = UITabBarItem(tabBarSystemItem: .more, tag: 2) settingsVC.tabBarItem.title = "Settings" addChild(settingsVC) } }
[ -1 ]
98cbf2d551b6b80c37cbb7c872a48380121bf799
c4555c50ebb66676909fa005929e9f84c66c43bb
/WeeklyKakeibo/InputView.swift
7e859814ce3b567c2930ee3ea155a40128f4887b
[]
no_license
mi729/WeeklyKakeibo
7f22c0bb2d8277c8d3ca44273974e9b13da9b42a
6e0435e2a7a6799d62d9e71d2bcfdb303b95112b
refs/heads/master
2023-05-29T21:08:23.780296
2021-06-05T10:02:21
2021-06-05T10:02:21
372,222,526
0
0
null
null
null
null
UTF-8
Swift
false
false
4,098
swift
// // InputView.swift // WeeklyKakeibo // // Created by nyagoro on 2020/10/18. // import SwiftUI struct InputView: View { @Environment(\.managedObjectContext) private var viewContext @State private var ratio: CGFloat = 1.2 @State private var itemName: String = "" @State private var selectedDate = Date() @State private var selectedWeek: Int = 1 @State private var price: String = "" @State private var showingAlert = false // ダークモードかどうかの検知用 @Environment(\.colorScheme) var colorScheme var body: some View { ZStack { Color.white .opacity(colorScheme == .dark ? 0.01 : 0.4) .edgesIgnoringSafeArea(.all) .onTapGesture { UIApplication.shared.closeKeyboard() } VStack { VStack(alignment: .center, spacing: 10, content: { HStack { Image("calendarIcon") .resizable() .frame(width: 25, height: 25) // Text("月") DatePicker("日付", selection: $selectedDate, displayedComponents: .date) } HStack { Text("週").padding() Picker(selection: $selectedWeek, label: Text("週"), content: { ForEach(1 ..< 6) { num in Text("\(num)") }.frame(width: 50) }).labelsHidden() } HStack { Image("moneyIcon") .resizable() .frame(width: 25, height: 25) Text("金額") TextField("いくら使いましたか?", text: $price) .textFieldStyle(RoundedBorderTextFieldStyle()) .keyboardType(.numberPad) .multilineTextAlignment(.trailing) } HStack { Image("pencilIcon") .resizable() .frame(width: 25, height: 25) Text("内容") TextField("何に使いましたか?", text: $itemName) .textFieldStyle(RoundedBorderTextFieldStyle()) .multilineTextAlignment(.trailing) } }) .frame(alignment: .center) .padding(.horizontal, 40) .padding(.vertical, 24) .font(Font.system(size: 20, design: .default)) Button(action: { self.showingAlert = true UIApplication.shared.closeKeyboard() self.addItem() self.clearTextBox() }, label: { Text("登録") .font(Font.system(size: 20, design: .default)) .frame(width: 330, height: 48, alignment: .center) .foregroundColor(Color.white) .background(Color.red) .cornerRadius(10) }).alert(isPresented: $showingAlert) { Alert(title: Text("登録しました")) } } } } private func addItem() { let newItem = KakeiboItem(context: viewContext) newItem.date = selectedDate newItem.week = Int16(selectedWeek) newItem.itemName = itemName newItem.itemPrice = Int16(price) ?? 0 do { try viewContext.save() } catch { print(error) } } private func clearTextBox() { //テキストボックスをクリアする } } struct InputView_Previews: PreviewProvider { static var previews: some View { InputView() } } extension UIApplication { func closeKeyboard() { sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil) } }
[ -1 ]
5e2fe506e10b06d61be9be1e65021eb548d6e704
96cfb623aeeb9b413b0e5e4b6441caa01f718fab
/Scout24AGProject/Modules/PropertyList/Entity/Image.swift
abf3594c64400f9d051e0d0adb0f8d31f7c7ed6e
[]
no_license
Zulqurnain24/Scout24AGProject
b9c0e03e9c37ee432b85c73d7cef30d37df7124f
2153470ff591768e1809755ffd27acc31c627677
refs/heads/master
2020-07-10T07:34:39.520867
2019-08-24T19:59:41
2019-08-24T19:59:41
204,206,115
0
0
null
null
null
null
UTF-8
Swift
false
false
522
swift
// // image.swift // Scout24AGProject // // Created by Mohammad Zulqarnain on 02/06/2019. // Copyright © 2019 Mohammad Zulqarnain. All rights reserved. // import Foundation import Freddy import CoreLocation struct Image { let id: Int let url: String? init(id: Int, url: String) { self.id = id self.url = url } } extension Image: JSONDecodable { init(json: JSON) throws { id = try json.getInt(at: "id") url = try json.getString(at: "url") } }
[ -1 ]
baf5ea56759e89f9c29d856fc5ff3e85f1e0c072
3e9296baf5192af745ce5e3e8e62412b7ccbec78
/Quizzler/QuestionBank.swift
be31ba7c41a59df727f332cb30b5c8b9224dfa80
[]
no_license
hayjay/Quiz
4daaa7798c6163f828d3b0abf97f22cd0027b03a
35608d7e26295995c43fe027b32ceff31839b010
refs/heads/master
2020-05-26T13:52:32.241550
2019-09-23T13:47:19
2019-09-23T13:47:19
188,254,310
1
0
null
null
null
null
UTF-8
Swift
false
false
2,585
swift
// // QuestionBank.swift // Quizzler // // Created by new on 22/05/2019. // Copyright © 2019 London App Brewery. All rights reserved. //s import Foundation //the purpose of this class is to store all of the questions we gonna have in this quiz app class QuestionBank { //create a property list that contains an array of question var list = [Question]() init(){ //basically instantiating new Question class and passing the parameter // Creating a quiz item and appending it to the list let item = Question(text: "Valentine\'s day is banned in Saudi Arabia. Yes or No ?", correctAnswer: true) // Add the Question to the list of questions //push data to the list array list.append(item) // skipping one step and just creating the quiz item inside the append function list.append(Question(text: "A slug\'s blood is green.", correctAnswer: true)) list.append(Question(text: "Approximately one quarter of human bones are in the feet.", correctAnswer: true)) list.append(Question(text: "The total surface area of two human lungs is approximately 70 square metres.", correctAnswer: true)) list.append(Question(text: "In West Virginia, USA, if you accidentally hit an animal with your car, you are free to take it home to eat.", correctAnswer: true)) list.append(Question(text: "In London, UK, if you happen to die in the House of Parliament, you are technically entitled to a state funeral, because the building is considered too sacred a place.", correctAnswer: false)) list.append(Question(text: "It is illegal to pee in the Ocean in Portugal.", correctAnswer: true)) list.append(Question(text: "You can lead a cow down stairs but not up stairs.", correctAnswer: false)) list.append(Question(text: "Google was originally called \"Backrub\".", correctAnswer: true)) list.append(Question(text: "Buzz Aldrin\'s mother\'s maiden name was \"Moon\".", correctAnswer: true)) list.append(Question(text: "The loudest sound produced by any animal is 188 decibels. That animal is the African Elephant.", correctAnswer: false)) list.append(Question(text: "No piece of square dry paper can be folded in half more than 7 times.", correctAnswer: false)) list.append(Question(text: "Chocolate affects a dog\'s heart and nervous system; a few ounces are enough to kill a small dog.", correctAnswer: true)) } }
[ 302279 ]
42f15cbe8af71c2abfc69707c97f61ca9166383b
afa44dfceb5dc70db76af0c8ee8e9262408dab43
/Joey/DetectEmotion/Controllers/DetectEmotionAdviceViewController.swift
e8f8e809366f83c7f2946cefafd268452d0d0bf3
[]
no_license
rahmanfadhil/Joey
25dc04010f52a26b0ea7a109a920a92af59a4ade
f4e394a7de65e624ef360a00e468aee362cc516e
refs/heads/main
2023-01-18T19:22:48.441181
2020-11-24T04:35:36
2020-11-24T04:35:36
304,020,604
0
1
null
null
null
null
UTF-8
Swift
false
false
1,738
swift
// // DetectEmotionAdviceViewController.swift // Joey // // Created by Rahman Fadhil on 26/10/20. // import UIKit class DetectEmotionAdviceViewController: UIViewController { var data: FollowUp? @IBOutlet weak var navBar: NavigationBar! @IBOutlet weak var backgroundImage: UIImageView! @IBOutlet weak var adviceLabel: UILabel! override func viewDidLoad() { super.viewDidLoad() navBar.delegate = self navBar.labelIndicator.isHidden = false if let isDetectionValid = data?.isDetectionResultValid, isDetectionValid { navBar.labelIndicator.text = "3/4" } else { navBar.labelIndicator.text = "4/5" } adviceLabel.text = data?.getAdvice() let singleTap = UITapGestureRecognizer(target: self, action: #selector(onBackgroundTapped)) backgroundImage.addGestureRecognizer(singleTap) backgroundImage.isUserInteractionEnabled = true } func saveEmotion() { if let data = data { EmotionHelper.save(data: data) {_ in DispatchQueue.main.async { self.performSegue(withIdentifier: "toSuggestActivity", sender: nil) } } } } @objc func onBackgroundTapped(sender: UITapGestureRecognizer) { if sender.state == .ended { saveEmotion() } } // 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?) { if let vc = segue.destination as? DetectEmotionSuggestActivityViewController { vc.data = data } } }
[ -1 ]
c66d9fc94c391647a70b4c96cc0026693c8130db
22b23e61ec2e9bb31103be4b25d402a6f58e8375
/JHSwiftProject/JHSwiftProject/JHARCStudy.swift
efdc88fabd932fd71de65858584c21703016c71f
[]
no_license
Shenjinghao/JHSwiftProject
8c4f70e2db7effeb53a18d5dee04861e61bad174
9696ff428d1974d3e1e857f8195114375cbb660c
refs/heads/master
2021-01-01T05:14:17.920015
2018-06-02T03:43:22
2018-06-02T03:43:22
56,820,563
1
0
null
null
null
null
UTF-8
Swift
false
false
3,546
swift
// // JHARCStudy.swift // JHSwiftProject // // Created by 作业帮 on 2017/10/25. // Copyright © 2017年 Shenjinghao. All rights reserved. // import UIKit class JHARCStudy: NSObject { override init() { super.init() arcStudy() } func arcStudy() { // 值会被自动初始化为nil,目前还不会引用到Person类的实例 var reference1: Person? var reference2: Person? var reference3: Person? // 创建Person类的新实例 reference1 = Person(name: "Runoob") //赋值给其他两个变量,该实例又会多出两个强引用 reference2 = reference1 reference3 = reference1 //断开第一个强引用 reference1 = nil //断开第二个强引用 reference2 = nil //断开第三个强引用,并调用析构函数 reference3 = nil //弱引用实例 var toc: Module? var list: SubModule? toc = Module(name: "ARC") list = SubModule(number: 4) toc!.sub = list list!.topic = toc toc = nil list = nil //无主引用实例 var module: Student? module = Student(name: "ARC") module!.section = Marks(marks: 98, stname: module!) module = nil //创建并打印HTMLElement实例 var paragraph: HTMLElement? = HTMLElement(name: "p", text: "hello, world") print(paragraph!.asHTML()) // HTMLElement实例将会被销毁,并能看到它的析构函数打印出的消息 paragraph = nil } class Person { let name: String init(name: String) { self.name = name print("\(name) 开始初始化") } deinit { print("\(name) 被析构") } } class Module { let name: String init(name: String) { self.name = name } var sub: SubModule? deinit { print("\(name) 主模块") } } class SubModule { let number: Int init(number: Int) { self.number = number } //弱引用实例 weak var topic: Module? deinit { print("submodule 弱引用实例 析构函数调用成功") } } class Student { let name: String var section: Marks? init(name: String) { self.name = name } deinit { print("\(name)") } } class Marks { let marks: Int //无主引用实例 unowned let stname: Student init(marks: Int, stname: Student) { self.marks = marks self.stname = stname } deinit { print("Student 无主引用实例 析构函数调用成功") } } class HTMLElement { let name: String let text: String? lazy var asHTML: () -> String = { [unowned self] in if let text = self.text { return "<\(self.name)>\(text)</\(self.name)>" } else { return "<\(self.name) />" } } init(name: String, text: String? = nil) { self.name = name self.text = text } deinit { print("闭包引起的循环强引用 被析构") } } }
[ -1 ]
04be667a2d4d4cb37e6ecf5c88aa6095a4c5afc4
44b3da696ce1dd0ecafef738f527478f46dfc028
/OneUp/SelectedChallengeTableViewCell.swift
3e1109029360439681dff1e74d65eabc21c94df0
[]
no_license
dgolman/OneUp
3d2d4a7d93f052f5e0634490272e715e35c91187
9cc2962f4a2af52d013c0e9bc09d552e326c303d
refs/heads/master
2020-12-26T20:11:03.674833
2015-05-04T15:24:22
2015-05-04T15:24:22
34,552,269
0
0
null
null
null
null
UTF-8
Swift
false
false
2,003
swift
// // SelectedChallengeTableViewCell.swift // OneUp // // Created by Daniel Golman on 5/3/15. // Copyright (c) 2015 Daniel Golman. All rights reserved. // import UIKit class SelectedChallengeTableViewCell: UITableViewCell { @IBOutlet weak var cardView: UIView! @IBOutlet weak var selfieImageView: UIImageView! override func awakeFromNib() { super.awakeFromNib() // Initialization code } override func layoutSubviews() { self.cardSetup() self.imageSetup() } func cardSetup() { self.cardView.alpha = 1 self.cardView.layer.masksToBounds = false self.cardView.layer.cornerRadius = 1 // if you like rounded corners self.cardView.layer.shadowOffset = CGSizeMake(-0.2, 0.2) //%%% this shadow will hang slightly down and to the right self.cardView.layer.shadowRadius = 1 //%%% I prefer thinner, subtler shadows, but you can play with this self.cardView.layer.shadowOpacity = 0.2 //%%% same thing with this, subtle is better for me //%%% This is a little hard to explain, but basically, it lowers the performance required to build shadows. If you don't use this, it will lag var path: UIBezierPath = UIBezierPath(rect: self.cardView.bounds) self.cardView.layer.shadowPath = path.CGPath; self.backgroundColor = UIColor(red:0.9, green:0.9, blue:0.9, alpha:1)//%%% I prefer choosing colors programmatically than on the storyboard } func imageSetup() { // selfieImageView.layer.cornerRadius = selfieImageView.frame.size.width/2 selfieImageView.clipsToBounds = true selfieImageView.contentMode = UIViewContentMode.ScaleAspectFit selfieImageView.backgroundColor = UIColor.whiteColor() } override func setSelected(selected: Bool, animated: Bool) { super.setSelected(selected, animated: animated) // Configure the view for the selected state } }
[ -1 ]
0225f0cd7fbeae4bed23da963186fe67e3994cf3
a4b9271c5ffc9145b847cd63d7c60f0d39e23517
/Hackfest-swvl/Classes/Helper/JFServerManager.swift
88e8d432d9f93079ceeeb80bf9abf3d54d61843a
[]
no_license
ZaeemZafar/hackfest-swvl
74f18a6acdb9c0038485c8fa96ce48ad053d0656
cc429b940e53d50891481209c38dbea128127148
refs/heads/main
2023-07-31T10:03:07.222582
2021-09-19T11:43:23
2021-09-19T11:43:23
407,683,637
0
0
null
null
null
null
UTF-8
Swift
false
false
12,765
swift
// // JFServerManager.swift // Hackfest-swvl // // Created by Umair on 02/04/2018. // Copyright © 2018 maskers. All rights reserved. // import Foundation import UIKit import Alamofire import AlamofireNetworkActivityIndicator import SwiftyJSON // MARK: - enum JFServerRequestMethod: Int { case get = 0 case post case put case delete case patch func toHTTPMethod() -> HTTPMethod { switch self { case .get: return .get case .post: return .post case .put: return .put case .delete: return .delete case .patch: return .patch } } } // MARK: - struct JFServerSettings { static let ExpiryTime: TimeInterval = 30 // in second static let ErrorCode = 1234567 static let ErrorMessage = NSLocalizedString("An error occured. Please Try again.", comment: "") static let APIDomain = "com.maskers.Hackfest-swvl.app.servermanager" } // MARK: - typealias JFServerManagerCompletionBlock = (_ response: JFServerResponse) -> Void // MARK: - class JFServerManager: SessionManager { // MARK: - fileprivate var baseURL: URL? // MARK: - static let shared: JFServerManager = { let baseURL = URL(string: JFAppTarget.current.serverBasePath()) let instance = JFServerManager(baseURL: baseURL) return instance }() init(baseURL: URL?) { super.init(configuration: JFServerManager.createSessionConfiguration(), delegate: SessionDelegate(), serverTrustPolicyManager: nil) var url = baseURL // Ensure terminal slash for baseURL path, so that NSURL relativeToURL works as expected if (((url?.path.count)! > 0) && !((url?.absoluteString.hasSuffix("/"))!)) { url = baseURL?.appendingPathComponent("") } self.baseURL = url NetworkActivityIndicatorManager.shared.isEnabled = true } // MARK: - class var isConnectedToInternet:Bool { return NetworkReachabilityManager()!.isReachable } // func sendRequest(requestPath: String, // parameters: [String: Any]?, // method: JFServerRequestMethod, // headers: [String: String]?, // setAuth: Bool = true, // completion: @escaping JFServerManagerCompletionBlock) -> DataRequest { @discardableResult func sendRequest(apiConfig: JFAPIConfig, completion: @escaping JFServerManagerCompletionBlock) -> DataRequest { let fullURL = URL(string: apiConfig.path, relativeTo: baseURL) var requestHeaders = [String: String]() requestHeaders["device_type"] = "ios" requestHeaders["device_os"] = UIDevice.current.systemVersion requestHeaders["build_version"] = Bundle.main.appVersion if apiConfig.setAuth == true { requestHeaders["Authorization"] = JFAuthTokenManager.shared.getAuthToken() } if apiConfig.headers?.isEmpty == false { for key in (apiConfig.headers?.keys)! { requestHeaders[key] = apiConfig.headers![key] } } let request = self.request(fullURL!, method: apiConfig.method, parameters: apiConfig.parameters, encoding: (apiConfig.method == .get) ? URLEncoding.default : JSONEncoding.default, headers: requestHeaders).responseJSON { (response) in print("Calling Endpoint: \(response.request?.url?.absoluteString ?? "EmptyURL")") print("Passed Parameters: \(String(describing: apiConfig.parameters))") print("raw response: \(response)") var serverResponse: JFServerResponse! switch response.result { case .success(let value): var hasError = true var status = false var message = "" var resultError: Error? = nil var data: Any? = nil var serverStatusCode = 0 var metaData = [String: Any]() let serverDataJson = JSON(value) if serverDataJson != JSON.null { status = true hasError = false if let serverMessage = serverDataJson["message"].string { message = serverMessage } if let authToken = serverDataJson["token"].string { JFAuthTokenManager.shared.saveToken(authToken) JFAuthTokenManager.shared.saveLastFetchDate(Date()) } data = serverDataJson["data"].dictionaryObject if let meta = serverDataJson["metadata"].dictionaryObject { metaData = meta } if data is NSNull { data = nil } // Developer's Note: We are expecting token to be available inside the 'data' object as well if let dataObject = data, let authToken = JSON(dataObject)["token"].string { JFAuthTokenManager.shared.saveToken(authToken) JFAuthTokenManager.shared.saveLastFetchDate(Date()) } if let statusCode = serverDataJson["statusCode"].int { serverStatusCode = statusCode } } if hasError == true { var userInfo = [String: Any]() userInfo[NSLocalizedDescriptionKey] = JFServerSettings.ErrorMessage let anError = NSError.init(domain: JFServerSettings.APIDomain, code: JFServerSettings.ErrorCode, userInfo: userInfo) resultError = anError as Error } serverResponse = JFServerResponse(status: status, serverStatusCode: serverStatusCode, response: response, metaData: metaData, result: data, error: resultError, message: message) case .failure(let error): serverResponse = JFServerResponse(status: false, serverStatusCode: 0, response: response, metaData: [String: Any](), result: nil, error: error, message: "") } // Authentication token is either expired or not sent so if (serverResponse.isUnauthorized()) { // let prevApiConfig = apiConfig // let prevCompletion = completion // JFAuthTokenManager.shared.forceFetchAuthToken(completion: { [weak self] (success, _) in // guard let strongSelf = self else { return } // // if success { // strongSelf.sendRequest(apiConfig: prevApiConfig, // completion: prevCompletion) // // } else { // completion(serverResponse) // } // }) // Logout app because session expired NotificationCenter.default.post(name: JFConstants.Notifications.logout, object: nil) } else { completion(serverResponse) } } return request } func uploadImage(imageFile: UIImage, completion: ((_ success: Bool, _ fileName: String, _ : String?) -> ())?) { guard let imgData = UIImagePNGRepresentation(imageFile) else { completion?(false, "", "Image file currupted") return } print("Uploading image of size \(imgData.count / 1000) KB") let fullURL = URL(string: JFUserEndpoint.uploadS3Image.path, relativeTo: baseURL)! Alamofire.upload(multipartFormData: { multipartFormData in multipartFormData.append(imgData, withName: "image",fileName: "image.jpg", mimeType: "image/jpg") }, to:fullURL) { (result) in switch result { case .success(let upload, _, _): upload.uploadProgress(closure: { (progress) in print("Upload Progress: \(progress.fractionCompleted)") }) upload.responseJSON { response in print(response.result.value) if let dict = response.result.value as? [String: Any] { if let uploadedFileName = (dict["data"] as? [String: Any])?["imageName"] as? String { print("name found\(uploadedFileName)") completion?(true, uploadedFileName, nil) } else { completion?(false, "", "Unable to parse response data") } } else { completion?(false, "", "Unable to parse response data") } } case .failure(let encodingError): print(encodingError) completion?(false, "", encodingError.localizedDescription) } } } // MARK: - class func createSessionConfiguration() -> URLSessionConfiguration { let configuration = URLSessionConfiguration.default configuration.timeoutIntervalForRequest = JFServerSettings.ExpiryTime configuration.httpAdditionalHeaders = SessionManager.defaultHTTPHeaders return configuration } }
[ -1 ]
f333dd30a5019fdff5b217ecfff677a2730f86a9
48388634c3957cc9768840a67bd8f6af7cc181c0
/TTT/ViewController.swift
eca67d6ff9928629d6f1e374484426af0e0dde60
[]
no_license
emily-u/tic-tac-toe
ed4ef07c520c6f9cefedc0d23b193aadc1cb3fe2
2b23fed94a4cd64ebe4b889a40bdfb2fad4d58d9
refs/heads/master
2021-09-04T00:42:08.594017
2018-01-13T13:34:54
2018-01-13T13:34:54
null
0
0
null
null
null
null
UTF-8
Swift
false
false
2,914
swift
// // ViewController.swift // TTT // // Created by Emily on 1/11/18. // Copyright © 2018 Emily. All rights reserved. // import UIKit class ViewController: UIViewController { @IBOutlet weak var winnerlabel: UILabel! // @IBOutlet weak var button0: UIButton! // @IBOutlet weak var button1: UIButton! // @IBOutlet weak var button2: UIButton! // @IBOutlet weak var button3: UIButton! // @IBOutlet weak var button4: UIButton! // @IBOutlet weak var button5: UIButton! // @IBOutlet weak var button6: UIButton! // @IBOutlet weak var button7: UIButton! // @IBOutlet weak var button8: UIButton! var gamestate = [0,0,0,0,0,0,0,0,0,0] var buttonEnabled = true var counter = 0 @IBAction func btn(_ sender: UIButton) { if buttonEnabled == true{ if counter % 2 != 0 { sender.backgroundColor = .blue // print("here\(counter)") counter += 1 sender.isEnabled = false gamestate[sender.tag] = 1 print("blue here\(gamestate)") }else{ sender.backgroundColor = .red counter += 1 sender.isEnabled = false gamestate[sender.tag] = -1 print("red here\(gamestate)") } let one = gamestate[0] + gamestate[1] + gamestate[2] let two = gamestate[3] + gamestate[4] + gamestate[5] let three = gamestate[6] + gamestate[7] + gamestate[8] let four = gamestate[0] + gamestate[3] + gamestate[6] let five = gamestate[1] + gamestate[4] + gamestate[7] let six = gamestate[2] + gamestate[5] + gamestate[8] let seven = gamestate[0] + gamestate[4] + gamestate[8] let eight = gamestate[2] + gamestate[4] + gamestate[6] if (one == 3 || two == 3 || three == 3 || four == 3 || five == 3 || six == 3 || seven == 3 || eight == 3){ winnerlabel.text = "blue wins" buttonEnabled = false }else if(one == -3 || two == -3 || three == -3 || four == -3 || five == -3 || six == -3 || seven == -3 || eight == -3){ sender.isEnabled = false winnerlabel.text = "red wins" buttonEnabled = false }else if (counter == 9){ winnerlabel.text = "u guys suck" } } } @IBAction func reset(_ sender: UIButton) { buttonEnabled = true counter = 0 gamestate = [0,0,0,0,0,0,0,0,0,0] winnerlabel.text = "" loadView() } 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 ]
10cb5b558ef09175a5339eea828e0529971252b4
0cc465853d289e141eba1c304fe16f8bcc2e327d
/PersistentPage/PageSettings.swift
305cfe5da0964cd9877cec639297bf5851506d73
[ "BSD-2-Clause" ]
permissive
fluffware/PersistentPage
afb84a4bf9bb53e56b2337c91d20fdab5905708d
14aefe7e8a1d6a3565e13d1a00bb560da4bf8636
refs/heads/master
2020-04-23T16:39:43.652365
2019-08-19T18:44:47
2019-08-19T18:44:47
171,305,205
0
0
null
null
null
null
UTF-8
Swift
false
false
1,186
swift
// // PageSettings.swift // PersistentPage // // Created by Simon on 2019-02-15. // Copyright © 2019 Simon Berg, Elektro-Kapsel AB. // import WebKit class PageSettings :NSObject, NSCoding { // MARK: Properties var url: URL var timeout: Int // In seconds init(url: URL, timeout: Int) { self.url = url self.timeout = timeout } func encode(with coder: NSCoder) { coder.encode(url, forKey: PropertyKey.URL) coder.encode(timeout,forKey: PropertyKey.timeout) } // MARK: NSCoder required convenience init?(coder aDecoder: NSCoder) { // guard let url = aDecoder.decodeObject(forKey:PropertyKey.URL) as? URL else { return nil } let timeout = aDecoder.decodeInteger(forKey:PropertyKey.timeout) self.init(url: url, timeout: timeout) } static let DocumentsDirectory = FileManager().urls(for: .documentDirectory, in: .userDomainMask).first! static let ArchiveURL = DocumentsDirectory.appendingPathComponent("settings") } struct PropertyKey { static let URL = "URL" static let timeout = "timeout" }
[ -1 ]
e4d7d00b1298dc17976e172aa766698a3b2a416e
0219ade506833a135dacb507bf1379bef537bdd3
/Quiz/QuizTableViewCell.swift
44b9522fcf5385fdba7a8d7d6fd712a989e96ada
[]
no_license
danicrg/Quiz-Swift
f73986f633d244b826e322fc32605681f32e7094
3112ca678d4201567eb956f9c725ae90b6d7bfe2
refs/heads/master
2022-11-19T16:05:47.222536
2020-06-24T21:45:07
2020-06-24T21:45:07
158,004,532
0
0
null
null
null
null
UTF-8
Swift
false
false
568
swift
// // QuizTableViewCell.swift // Quiz // // Created by Daniel Carlander on 17/11/2018. // Copyright © 2018 Daniel Carlander. All rights reserved. // import UIKit class QuizTableViewCell: UITableViewCell { @IBOutlet weak var questionLabel: UILabel! @IBOutlet weak var authorLabel: UILabel! @IBOutlet weak var quizImage: UIImageView! override func awakeFromNib() { super.awakeFromNib() } override func setSelected(_ selected: Bool, animated: Bool) { super.setSelected(selected, animated: animated) } }
[ 348933, 163946, 253197, 336657, 348952, 330425 ]
f7147a1694811026670c1fcb30c9215f2c6d8431
34a399a0a4dc8ec94c2c144071f0b2adcec47a8c
/Sources/TagExtractor/View+extractTag.swift
f0dace0fa2ab6551289828462e004619966df164
[]
no_license
GeorgeElsham/TagExtractor
5e11e52e6ae4549e2acfd9044620d07b6c3a3400
4a9db6a6725fd1d3c396944da392893edaa50cc7
refs/heads/main
2023-06-24T13:06:56.867603
2021-07-27T20:47:16
2021-07-27T20:47:16
390,122,466
11
1
null
null
null
null
UTF-8
Swift
false
false
1,022
swift
// // File.swift // File // // Created by George Elsham on 27/07/2021. // import SwiftUI public extension View { /// Extracts the tag of the view. This can be used as a view modifier where /// the closure contains the tag's value. See `getTag()` for documentation. /// /// Example usage: /// /// Text("Hello world!") /// .tag("some tag") /// .extractTag { (getTag: () throws -> String) in /// // Method #1 /// do { /// let tag = try getTag() /// print("tag: \(tag)") /// } catch { /// print("Tag error: \(error)") /// } /// /// // Method #2 /// let tag = try? getTag() /// print("tag: \(tag)") /// } /// /// - Returns: Self. func extractTag<TagType: Hashable>(_ closure: (() throws -> TagType) -> Void) -> Self { closure(getTag) return self } }
[ -1 ]
2296ddf8a15ad2ebb2f14696705ce311f04caec0
c0bc04998e8ee3d2f9958f79905b3fbfa02a9769
/Sources/SBD/Daemon.swift
3f4379cca634cbdf3300c34afb642d31d0993a60
[ "MIT" ]
permissive
dedeexe/SBD
16b147c08488691fc07bc9bfe770c20c5bfe0161
4a6d82ad7e51793c70a7ffbaaa4c47d71b9c4f11
refs/heads/master
2020-12-05T20:09:51.576160
2020-10-05T20:37:40
2020-10-05T20:37:40
232,234,143
0
0
null
null
null
null
UTF-8
Swift
false
false
2,171
swift
import Foundation final class Daemon: KernelHandler { fileprivate let kernel: Kernel fileprivate let argv: [String] fileprivate let argc: Int32 fileprivate var environment: [String:String] = [:] fileprivate var timer: Timer = Timer() fileprivate var running: Bool = false fileprivate let signalTrap: SignalTrap = SignalTrap() fileprivate var exitStatus: Int32 = 0 init(argc: Int32, argv: [String], kernel: Kernel) { self.argc = argc self.argv = argv self.kernel = kernel __SignalTransfer.shared(daemon: self) bindSignal() } private func bindSignal() { signalTrap.handle(sender: self, signal: SIGHUP) { value in __SignalTransfer.shared().send(signal: value) } } private func wait() { while running { sleep(50) } } @discardableResult func execute() -> Int32 { if running { return -1 } running = true kernel.execute(argc: argc, argv: argv, env: environment) wait() return exitStatus } @discardableResult func shutdown() -> Int32 { exitStatus = -1 if running { running = false exitStatus = 0 } return exitStatus } func trap(signal:Int32) { kernel.trap(signal: signal) } func exit(status: Int32) { exitStatus = status shutdown() } } private class __SignalTransfer { private static var selfRef: __SignalTransfer? private var daemon: Daemon private init(daemon:Daemon) { self.daemon = daemon } @discardableResult static func shared(daemon:Daemon? = nil) -> __SignalTransfer { if let ref = selfRef { return ref } if let daemon = daemon { selfRef = __SignalTransfer(daemon: daemon) return selfRef! } fatalError("Fail. No daemon defined") } func send(signal: Int32) { daemon.trap(signal: signal) } }
[ -1 ]
9e508db0ea2eff245a297cc1c1f0f58b05525c9d
21789be17e0ddedc7c50919a20144a56ffe6ae4d
/App/Classes/Logic/Data Access/Persistence/KeyStore.swift
26f47da4dd1bd7644c29108b93da09651cf7c87f
[]
no_license
attilat85/PopcornApp
682e928cb00ff9c77d9e16f321ef880c18047b6e
e4a51a52f2ae59c590484798c2531c33d22166c1
refs/heads/master
2021-04-17T16:07:09.279770
2020-03-24T15:10:29
2020-03-24T15:10:29
249,457,873
1
0
null
null
null
null
UTF-8
Swift
false
false
286
swift
// // KeyStore.swift // Core // // Created by Botond Magyarosi on 16/10/2019. // import Foundation private enum Key { static let suggestions = "suggestions" } enum KeyStore { @UserDefaultCodable(Key.suggestions) public static var suggestions: [String]? }
[ -1 ]
aee849baa5d0a05306496b3e32516af669d01d3d
6552ff4397c65ba4eabb7f8fdf6427506bf1aa78
/Tenderloin/Application/AppDelegate.swift
a0b993469b3459b4053de351befd01ff4fc2893e
[]
no_license
mohsinalimat/Tenderloin
2e4137f6f4f42350482dfcf53dfc58e6dc760b50
093df02f674903bddabbbf6fe7efb4e150cc0947
refs/heads/master
2020-07-04T15:11:41.731271
2018-09-10T11:04:39
2018-09-10T11:04:39
202,321,651
1
0
null
2019-08-14T09:45:15
2019-08-14T09:45:14
null
UTF-8
Swift
false
false
2,651
swift
// // AppDelegate.swift // Tenderloin // // Created by Zulwiyoza Putra on 07/09/18. // Copyright © 2018 Wiyoza. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? private func getWindow(with viewController: UIViewController) -> UIWindow { let window = UIWindow(frame: UIScreen.main.bounds) window.makeKeyAndVisible() window.rootViewController = UINavigationController(rootViewController: viewController) return window } func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // let networkController = NetworkController() // let viewController = TenderloinViewController(networkController: networkController, layout: UICollectionViewFlowLayout()) self.window = getWindow(with: HomeViewController()) 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, 229426, 237618, 229428, 311349, 286774, 229432, 286776, 319544, 286791, 237640, 237646, 311375, 163920, 196692, 319573, 311383, 319590, 311400, 303212, 131192, 237693, 327814, 303241, 303244, 311436, 319633, 286873, 286876, 311460, 311469, 32944, 327862, 286906, 180413, 286910, 131264, 286916, 286922, 286924, 286926, 319694, 131281, 278743, 278747, 295133, 155872, 319716, 237807, 303345, 286962, 131314, 229622, 327930, 278781, 278783, 278785, 237826, 319751, 278792, 286987, 319757, 311569, 286999, 287003, 287006, 287009, 287012, 287014, 287016, 287019, 311598, 287023, 311601, 295220, 287032, 155966, 319809, 319810, 278849, 319814, 311628, 229709, 287054, 319822, 278865, 229717, 196963, 196969, 139638, 213367, 106872, 319872, 311683, 319879, 65943, 311719, 278952, 139689, 278957, 311728, 278967, 180668, 311741, 278975, 319938, 98756, 278980, 319945, 278986, 319947, 278990, 278994, 172512, 279010, 279015, 172520, 319978, 172526, 311791, 279023, 172529, 279027, 319989, 164343, 180727, 311804, 287230, 279040, 303617, 287234, 172550, 320007, 172552, 303623, 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, 172618, 303690, 33357, 287309, 279124, 172634, 262752, 172644, 311911, 295533, 172655, 172656, 352880, 295538, 172660, 287349, 287355, 287360, 295553, 287365, 311942, 303751, 352905, 311946, 279178, 287371, 311951, 287377, 172691, 311957, 287386, 221850, 230045, 172702, 303773, 164509, 172705, 287394, 172707, 287390, 303780, 287398, 205479, 279208, 287400, 172714, 295595, 279212, 189102, 172721, 287409, 66227, 303797, 189114, 287419, 303804, 328381, 287423, 328384, 279231, 287427, 312006, 172748, 107212, 287436, 172751, 295633, 172755, 303827, 279255, 172760, 279258, 303835, 287450, 189149, 303838, 213724, 312035, 279267, 295654, 279272, 230128, 312048, 312050, 230131, 205564, 230146, 295685, 230154, 312077, 295695, 230169, 369433, 295707, 328476, 295710, 230175, 303914, 279340, 205613, 279353, 230202, 312124, 328508, 222018, 295755, 377676, 148302, 287569, 303959, 230237, 230241, 279394, 303976, 336744, 303985, 303987, 328563, 279413, 303991, 303997, 295806, 295808, 295813, 304005, 304007, 320391, 304009, 213895, 304011, 230284, 304013, 279438, 295822, 189329, 304019, 189331, 58262, 304027, 279452, 410526, 279461, 304042, 213931, 304055, 230327, 230334, 304063, 295873, 213954, 189378, 304065, 213963, 312272, 304084, 304090, 320481, 304106, 320490, 312302, 328687, 320496, 304114, 295928, 312321, 295945, 230413, 197645, 295949, 140312, 295961, 238620, 197663, 304164, 304170, 304175, 238641, 312374, 238652, 238655, 230465, 238658, 336964, 296004, 238666, 296021, 402518, 336987, 230497, 296036, 296040, 361576, 164973, 312432, 279669, 337018, 304258, 222340, 205968, 296084, 238745, 304285, 238756, 205991, 222377, 337067, 165035, 238766, 165038, 304311, 230592, 279750, 230600, 230607, 148690, 320727, 279769, 304348, 279777, 304354, 296163, 320740, 279781, 304360, 320748, 279788, 279790, 304370, 320771, 312585, 296205, 230674, 320786, 296213, 230677, 296215, 320792, 230681, 230689, 173350, 312622, 296243, 312630, 222522, 230718, 296255, 312639, 378181, 230727, 238919, 320840, 222545, 230739, 312663, 222556, 337244, 312676, 230760, 173418, 148843, 230763, 230768, 296305, 312692, 230773, 304505, 304506, 181631, 148865, 312711, 296331, 288140, 288144, 230800, 304533, 288154, 337306, 288160, 288162, 279975, 304555, 370092, 279983, 288176, 173488, 312755, 296373, 312759, 279991, 337335, 222652, 312766, 173507, 296389, 222665, 230860, 288208, 230865, 370130, 148946, 222676, 288210, 280021, 288212, 288214, 239064, 288217, 288218, 329177, 288220, 239070, 288224, 280034, 288226, 280036, 288229, 280038, 288230, 288232, 320998, 288234, 370146, 288238, 288240, 288242, 296435, 288244, 288250, 296446, 148990, 206336, 321022, 296450, 402942, 230916, 230919, 214535, 230923, 304651, 304653, 230940, 222752, 108066, 296488, 157229, 230961, 157236, 288320, 288325, 124489, 280140, 280145, 288338, 280149, 288344, 280152, 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, 280260, 206536, 280264, 280276, 313044, 321239, 280283, 313052, 288478, 313055, 321252, 313066, 280302, 288494, 280304, 313073, 419570, 288499, 288502, 288510, 67330, 280324, 198405, 198416, 280337, 296723, 321304, 329498, 296731, 321311, 313121, 313123, 304932, 321316, 280363, 141101, 165678, 321336, 296767, 288576, 345921, 304968, 280393, 280402, 173907, 313176, 280419, 321381, 296809, 296812, 313201, 1920, 255873, 305028, 247688, 280464, 124817, 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, 313340, 239612, 288764, 239617, 313347, 288773, 313358, 305176, 313371, 354338, 305191, 313386, 354348, 124978, 215090, 124980, 288824, 288826, 313406, 288831, 288836, 67654, 280651, 354382, 288848, 215123, 354390, 280669, 149599, 223327, 149601, 321634, 149603, 280671, 329830, 280681, 313451, 280687, 215154, 313458, 280691, 313464, 321659, 280702, 288895, 321670, 215175, 141446, 141455, 141459, 280725, 313498, 100520, 288936, 280747, 288940, 321717, 280764, 280769, 280771, 280774, 321740, 280783, 280786, 280793, 280796, 338147, 280804, 280807, 157930, 280811, 280817, 125171, 157940, 280825, 280827, 280830, 280831, 125187, 280835, 125191, 125207, 125209, 321817, 321842, 223539, 125239, 280888, 289087, 280897, 305480, 239944, 239947, 305485, 305489, 379218, 280919, 354653, 313700, 280937, 190832, 280946, 223606, 313720, 280956, 280959, 313731, 199051, 240011, 289166, 240017, 297363, 190868, 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, 240132, 223749, 305668, 281095, 223752, 338440, 150025, 223757, 281102, 223765, 281113, 322074, 281116, 281121, 182819, 281127, 150066, 158262, 158266, 281154, 322115, 281163, 281179, 338528, 281190, 199273, 281196, 19053, 158317, 313973, 297594, 281210, 158347, 133776, 117398, 314007, 289436, 174754, 330404, 289448, 174764, 314033, 240309, 133817, 314045, 314047, 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, 183172, 158596, 338823, 322440, 314249, 240519, 183184, 240535, 289687, 289694, 289696, 289724, 52163, 281567, 289762, 322534, 297961, 183277, 322550, 134142, 322563, 314372, 175134, 322599, 322610, 314421, 281654, 314427, 314433, 207937, 314441, 207949, 322642, 281691, 314461, 281702, 281704, 314474, 281708, 281711, 248995, 306341, 306344, 306347, 306354, 142531, 199877, 289991, 306377, 289997, 249045, 363742, 363745, 298216, 126190, 216303, 322801, 257302, 363802, 199976, 199978, 298292, 298294, 257334, 298306, 380226, 224584, 224587, 224594, 216404, 150870, 314714, 224603, 314718, 265568, 314723, 281960, 150890, 306539, 314732, 314736, 290161, 216436, 306549, 298358, 314743, 306552, 290171, 306555, 314747, 290174, 298365, 224641, 281987, 298372, 314756, 265604, 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, 191992, 290298, 151036, 290302, 282111, 290305, 175621, 192008, 323084, 257550, 290321, 282130, 323090, 290325, 282133, 241175, 290328, 282137, 290332, 241181, 282144, 290344, 290349, 290351, 290356, 224849, 282195, 282199, 282201, 306778, 159330, 314979, 298598, 224875, 241260, 323181, 257658, 315016, 282249, 290445, 282261, 298651, 282269, 323229, 298655, 323231, 61092, 282277, 306856, 282295, 282300, 323260, 323266, 282310, 323273, 282319, 306897, 241362, 306904, 282328, 298714, 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, 241450, 282410, 306991, 315184, 323376, 315190, 241464, 159545, 282425, 307009, 241475, 307012, 315211, 282446, 315221, 323414, 315223, 241496, 241498, 307035, 307040, 110433, 241509, 110438, 298860, 110445, 282478, 282481, 110450, 315249, 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, 299006, 282623, 315396, 241669, 315397, 282632, 282639, 290835, 282645, 241693, 282654, 102438, 217127, 282669, 323630, 282681, 290877, 282687, 159811, 315463, 315466, 192589, 192596, 176213, 307287, 315482, 217179, 315483, 192605, 233567, 200801, 217188, 299109, 307303, 307307, 45163, 315502, 192624, 307314, 323700, 299126, 233591, 299136, 307329, 307338, 233613, 307352, 299164, 299167, 315557, 184486, 307370, 307372, 184492, 307374, 307376, 323763, 176311, 184503, 307385, 307386, 258235, 307388, 176316, 307390, 299200, 184512, 307394, 299204, 307396, 184518, 307399, 323784, 307409, 307411, 176343, 299225, 233701, 307432, 184572, 184579, 282893, 291089, 282906, 291104, 233766, 176435, 315701, 307510, 168245, 332086, 307515, 282942, 307518, 323917, 282957, 110926, 233808, 323921, 315733, 323926, 233815, 315739, 323932, 299357, 242018, 242024, 299373, 315757, 250231, 242043, 315771, 299388, 299391, 291202, 299398, 242057, 291212, 299405, 291222, 315801, 283033, 242075, 291231, 61855, 283042, 291238, 291241, 127403, 127405, 127407, 291247, 299440, 127413, 291254, 127417, 291260, 127421, 127424, 299457, 127429, 315856, 315860, 176597, 127447, 299481, 176605, 242143, 127457, 291299, 127463, 242152, 291305, 127466, 176620, 127469, 127474, 291314, 291317, 135672, 233979, 291323, 291330, 127494, 283142, 127497, 135689, 233994, 291341, 233998, 127506, 234003, 234006, 127511, 152087, 234010, 135707, 135710, 242206, 242208, 291361, 242220, 291378, 152118, 234038, 234041, 315961, 70213, 111193, 242275, 299620, 168562, 184952, 135805, 135808, 291456, 299655, 373383, 316051, 225941, 316054, 299672, 135834, 225948, 373404, 135839, 299680, 225954, 135844, 299684, 242343, 242345, 373421, 135870, 135873, 135876, 135879, 299720, 299723, 299726, 225998, 226002, 226005, 226008, 242396, 299740, 201444, 299750, 283368, 234219, 283372, 226037, 283382, 234231, 234236, 242431, 209665, 299778, 234242, 242436, 234246, 226056, 234248, 291593, 242443, 242445, 234254, 291601, 234258, 242450, 242452, 201496, 234264, 234269, 234272, 234274, 152355, 299814, 234278, 283432, 234281, 234284, 234287, 283440, 185138, 242483, 234292, 234296, 160572, 283452, 234302, 234307, 242499, 234309, 234313, 316235, 234316, 283468, 234319, 242511, 234321, 234324, 201557, 234329, 185180, 234333, 308063, 234336, 242530, 349027, 234338, 234344, 177004, 234350, 324464, 234353, 152435, 177011, 234356, 234358, 234362, 291711, 234368, 234370, 201603, 291714, 234373, 291716, 226182, 234375, 226185, 324490, 308105, 234384, 234388, 234390, 324504, 226200, 234393, 308123, 234396, 324508, 291742, 234401, 291747, 291748, 234405, 291750, 324518, 234407, 324520, 324522, 291754, 291756, 226220, 234414, 291760, 201650, 324531, 226230, 234422, 324536, 275384, 234428, 291773, 242623, 324544, 226239, 324546, 234431, 324548, 234434, 226245, 234437, 234439, 234443, 291788, 193486, 234446, 193488, 234449, 275406, 234452, 234455, 234459, 234461, 234464, 234467, 234470, 168935, 5096, 324585, 234478, 316400, 234481, 234484, 234485, 234487, 234493, 316416, 234496, 234501, 308231, 234504, 234507, 234515, 300054, 234519, 234520, 316439, 234523, 234526, 234528, 300066, 234532, 234535, 234537, 234540, 234543, 275508, 300085, 234549, 300088, 234553, 234558, 316479, 234561, 308291, 316483, 234563, 234568, 234570, 316491, 234572, 300108, 234574, 300115, 234580, 234581, 234585, 242777, 275545, 234595, 234597, 300133, 300139, 234605, 160879, 234607, 275569, 234610, 316530, 300148, 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, 324768, 275608, 234653, 283805, 242852, 300197, 234657, 275626, 234667, 316596, 234687, 300226, 234692, 300229, 283844, 308420, 300234, 283850, 300238, 283854, 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, 177419, 300299, 242957, 275725, 283917, 177424, 349464, 283939, 259367, 283951, 300344, 226617, 243003, 226628, 300357, 177482, 283983, 316758, 357722, 316766, 292192, 316768, 218464, 292197, 316774, 243046, 218473, 136562, 275834, 333178, 275836, 275840, 316806, 226696, 316811, 226699, 316814, 300433, 234899, 357783, 316826, 300448, 144810, 144812, 144814, 144820, 284084, 292279, 284087, 144826, 144828, 144830, 144832, 144835, 144837, 144839, 144841, 144844, 144847, 144852, 144855, 103899, 300507, 333280, 218597, 292329, 300523, 259565, 300527, 259567, 292338, 316917, 292343, 308727, 300537, 308757, 308762, 316959, 284194, 284196, 235045, 284199, 284204, 284206, 284209, 284211, 284213, 194101, 284215, 194103, 284218, 226877, 292414, 284223, 284226, 284228, 292421, 226886, 284231, 284234, 276043, 317004, 366155, 284238, 226895, 284241, 292433, 284243, 194130, 284245, 276053, 284247, 317015, 284249, 243290, 284253, 243293, 284255, 300638, 284258, 292452, 292454, 177766, 292458, 284267, 292461, 284272, 284274, 284278, 292470, 276086, 292473, 284283, 276093, 284286, 292479, 284288, 292481, 284290, 325250, 284292, 276098, 292485, 284297, 317066, 284299, 317068, 284301, 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, 276175, 284368, 276177, 284370, 317138, 284372, 358098, 284377, 358114, 358116, 276197, 358119, 325353, 358122, 358126, 276206, 358128, 358133, 358135, 276216, 358138, 300795, 358140, 284413, 358142, 358146, 284418, 317187, 317189, 317191, 284428, 300816, 300819, 317207, 300828, 300830, 276255, 300832, 317221, 227109, 358183, 186151, 276268, 243504, 284469, 276280, 325436, 358206, 276291, 366406, 276295, 300872, 153417, 284499, 276308, 178006, 317271, 284502, 276315, 292700, 284511, 227175, 292715, 292721, 284529, 300915, 284533, 292729, 317306, 284540, 292734, 325512, 169868, 358292, 350106, 284572, 276386, 284579, 276388, 358312, 292776, 284585, 276395, 292784, 276402, 358326, 161718, 358330, 276411, 276425, 301009, 301011, 301013, 292823, 301015, 358360, 301017, 292828, 153568, 292843, 227314, 325624, 317435, 292876, 317456, 276496, 317458, 178195, 243733, 243740, 317468, 317472, 325666, 243751, 292904, 276528, 243762, 309298, 325685, 325689, 235579, 276539, 235581, 325692, 178238, 243785, 350293, 350295, 309337, 227418, 350302, 227423, 178273, 309346, 227426, 194660, 309348, 309350, 350308, 292968, 350313, 309354, 301163, 350316, 227430, 309352, 276586, 227440, 350321, 284786, 276595, 350325, 350328, 292985, 301178, 350332, 292989, 292993, 301185, 350339, 333957, 350342, 350345, 350349, 301199, 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, 276689, 301272, 276699, 194780, 309468, 301283, 317672, 317674, 325867, 243948, 194801, 309494, 243960, 227583, 276735, 276739, 211204, 276742, 227596, 325910, 342298, 309530, 211232, 317729, 211241, 325937, 325943, 260421, 285002, 276811, 276816, 235858, 276829, 276833, 391523, 276836, 293227, 276843, 293232, 276848, 186744, 211324, 317833, 178572, 285070, 178583, 227738, 317853, 342434, 317858, 285093, 317864, 285098, 276907, 235955, 293304, 293307, 293314, 293325, 317910, 293336, 235996, 317917, 293343, 358880, 276961, 293346, 276964, 293352, 236013, 293364, 293370, 317951, 309764, 301575, 236043, 317963, 342541, 55822, 113167, 309779, 317971, 309781, 55837, 227879, 293417, 227882, 293421, 105007, 236082, 285236, 23094, 277054, 244288, 301636, 318020, 301639, 301643, 285265, 309844, 277080, 309849, 285277, 285282, 326244, 277100, 121458, 170618, 170619, 309885, 309888, 277122, 227975, 277128, 285320, 301706, 318092, 326285, 334476, 318094, 277136, 277139, 227992, 285340, 318108, 318110, 227998, 383658, 285357, 318128, 277170, 293555, 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, 326430, 293666, 228135, 318248, 277291, 293677, 318253, 285489, 293685, 285494, 301880, 285499, 301884, 293696, 310080, 277317, 277329, 162643, 310100, 301911, 277337, 301921, 400236, 236397, 162671, 326514, 236408, 15224, 277368, 416639, 416640, 113538, 310147, 416648, 39817, 187274, 277385, 301972, 424853, 310179, 293798, 293802, 236460, 276579, 293811, 293817, 293820, 203715, 326603, 293849, 293861, 228327, 228328, 318442, 277486, 326638, 318450, 293876, 293877, 285686, 302073, 121850, 293882, 302075, 293887, 277504, 277507, 277511, 293899, 277519, 293908, 302105, 293917, 293939, 318516, 277561, 277564, 310336, 7232, 293956, 277573, 228422, 293960, 277577, 310344, 277583, 203857, 310355, 293971, 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, 302233, 285852, 302237, 285854, 285856, 302241, 285862, 277671, 302248, 64682, 277678, 294063, 294065, 302258, 294072, 318651, 277695, 318657, 302275, 302282, 310476, 302285, 302288, 310481, 302290, 203987, 302292, 302294, 302296, 384222, 310498, 285927, 318698, 302315, 228592, 294132, 138485, 204026, 228606, 204031, 64768, 310531, 138505, 228617, 318742, 204067, 277801, 277804, 285997, 285999, 277807, 113969, 277811, 318773, 318776, 277816, 286010, 277819, 294204, 277822, 417086, 302403, 294211, 277832, 277836, 294221, 326991, 277839, 277842, 277847, 277850, 179547, 277853, 277857, 277860, 302436, 294246, 327015, 310632, 277864, 351594, 327017, 277869, 277872, 351607, 277880, 310648, 310651, 277884, 277888, 310657, 310659, 277892, 294276, 277894, 327046, 253320, 310665, 318858, 277898, 351619, 277903, 310672, 277905, 351633, 277908, 277917, 310689, 277921, 130468, 277928, 277932, 310703, 277937, 310710, 130486, 310712, 277944, 277947, 310715, 277950, 228799, 277953, 64966, 245191, 310727, 277959, 302534, 277963, 277966, 302543, 277971, 228825, 277978, 310749, 277981, 277984, 310755, 277989, 277991, 277995, 286188, 310764, 278000, 228851, 278003, 278006, 40440, 212472, 278009, 40443, 286203, 40448, 228864, 286214, 302603, 302614, 286233, 302621, 286240, 146977, 187939, 40484, 294435, 286246, 294439, 294440, 40488, 40486, 40491, 294443, 294445, 286248, 310831, 40499, 40502, 212538, 40507, 40511, 40513, 327240, 40521, 286283, 40525, 40527, 212560, 228944, 400976, 40533, 40537, 40539, 40541, 278109, 40544, 40548, 40550, 40552, 286313, 40554, 310892, 40557, 40560, 188022, 122488, 294521, 343679, 294537, 310925, 286354, 278163, 302740, 278168, 327333, 229030, 212648, 278188, 302764, 319153, 278196, 302781, 319171, 302789, 294599, 278216, 294601, 212690, 319187, 229076, 286425, 319194, 229086, 286432, 294625, 294634, 302838, 319226, 286460, 302852, 302854, 294664, 311048, 319243, 311053, 294682, 278306, 294701, 278320, 319280, 319290, 229192, 302925, 188252, 237409, 360317, 327554, 40840, 40851, 294803, 188312, 294811, 319390, 237470, 40865, 319394, 294817, 294821, 311209, 163755, 180142, 188340, 40886, 319419, 294844, 294847, 393177, 294876, 294879, 294883, 294890, 311279, 278513, 237555, 311283, 278516, 237562 ]
762e9f778bf5713ce52240d546a409fe64310592
c0d7448a4a73948b2d951a4960cd32fd7247a733
/Feedmin/Feedmin/seturlTableViewController.swift
57a87aaab441dbbf1590ba6f1eff319961d42ded
[]
no_license
togamin/NewFeedmin
6908b3b3a8bf1e2846cd23bd7c8f8f7a1c7a48b2
786c84bab2cbe96e82f131b9c52dffc46514ceb9
refs/heads/master
2020-03-21T04:36:33.470760
2018-08-15T09:56:53
2018-08-15T09:56:53
138,117,729
0
0
null
null
null
null
UTF-8
Swift
false
false
4,239
swift
// // seturlTableViewController.swift // Feedmin // // Created by 戸上 祐希 on 2018/06/21. // Copyright © 2018年 Togami Yuki. All rights reserved. // /* このプログラムの概要 ・urlの登録 ・RSSデータを取得できれば記事情報取得しCoreDataに登録. ・取得できなければ、対応していないURLであると通知. ・インジケーター上手く行っていない */ import UIKit import CoreData class seturlTableViewController: UITableViewController,XMLParserDelegate { //TableView @IBOutlet var urlTableView: UITableView! override func viewDidLoad() { super.viewDidLoad() //Info全削除 //deleteAllArticleInfo() //deleteAllSiteInfo() siteInfoList = readSiteInfo() } //画面が表示されるたびに呼ばれる override func viewWillAppear(_ animated: Bool) { siteInfoList = readSiteInfo() self.urlTableView.reloadData() } //行数を決める override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return siteInfoList.count } //セルの内容 override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "urlCell",for:indexPath) cell.textLabel?.text = siteInfoList[indexPath.row]?.siteTitle cell.detailTextLabel?.text = siteInfoList[indexPath.row]?.siteURL return cell } //セルを横にスライドさせた時に呼ばれる override func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? { let deleteSite: UITableViewRowAction = UITableViewRowAction(style: .normal, title: "削除"){ (action, index) -> Void in print("サイトを削除します") if siteInfoList.count > 1{ //削除したURLの記事情報を削除 deleteArticleInfo(siteID: indexPath.row) deleteSiteInfo(Index: indexPath.row) //tableから削除 siteInfoList.remove(at: indexPath.row) //index.rowより大きいIDを1減らす。 for i in indexPath.row + 1..<siteInfoList.count+1{ updateSiteInfo(siteID: i) updateArticleInfo(siteID: i) } self.urlTableView.reloadData() }else{ let alert = UIAlertController(title: "エラー", message: "登録しているサイトが1つの場合、削除できません。", preferredStyle: .alert) alert.addAction(UIAlertAction(title: "OK", style: .cancel, handler: {action in print("OK")})) alert.view.layer.cornerRadius = 25 //角丸にする。 self.present(alert,animated: true,completion: {()->Void in print("URL削除時のエラー")}) } } deleteSite.backgroundColor = UIColor(red: 1, green: 0, blue: 0, alpha: 0.6) return [deleteSite] } //セルをタップしたら発動する処理 override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { performSegue(withIdentifier: "goEditSite",sender:nil) } //画面遷移時に呼び出される override func prepare(for segue:UIStoryboardSegue,sender:Any?){ print("画面遷移中") if let indexPath = self.urlTableView.indexPathForSelectedRow{ //遷移先のViewControllerを格納 let controller = segue.destination as! EditSiteTableViewController print(siteInfoList[indexPath.row]?.siteTitle) //遷移先の変数に代入 controller.siteTitle = siteInfoList[indexPath.row]?.siteTitle controller.siteID = siteInfoList[indexPath.row]?.siteID controller.siteURL = siteInfoList[indexPath.row]?.siteURL } } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() } }
[ -1 ]
befc0adb6960149063e7e9c30bffef194b3d6008
a158020454ef3968b24a03bc20e49bcd71476dda
/swift_03_集合篇/subscript2.playground/section-1.swift
2bf16e514edee86710ef79a65660bc812680720e
[]
no_license
jtlai0921/HU1718-Sample
c9cc2ca9a27ee6143336f6abc2004e4dba72cb81
cadd1c2f409f25d84c74fad5a6afc788b918da08
refs/heads/master
2021-01-05T07:09:09.492233
2020-02-16T16:32:41
2020-02-16T16:32:41
240,925,422
0
0
null
2020-11-03T08:44:56
2020-02-16T16:32:44
Swift
UTF-8
Swift
false
false
515
swift
// Playground - noun: a place where people can play import UIKit class Matrix { //若有需要, //下標可以在小括號中以逗號","隔開多個參數 subscript(x:Int, y:Int) -> Int { //只有get取值式, //表示此下標是唯讀的 get { return x * y } } } //建立Matrix物件 let m = Matrix() //在使用多個參數的下標時, //只需在中括號"[]"中以逗號","隔開多個參數即可 println(m[10, 20])
[ -1 ]
25fc54e34bc37e9d40af8c2993737ca4fb21c90f
8eea3946f35175dd8a1976e6f9e3c00bc2e39304
/Covid19App/URLInfo.swift
89ebb27b87b9db7a8f1c231ff5ce89b323aa4a44
[]
no_license
beans2/iosSwiftCovid19App
f9783c3d3131a19665ef93710211c4175ab35479
4d525ab3b798bdc974702b0eb79506e07efc6bfd
refs/heads/main
2023-03-21T13:59:48.380451
2021-03-08T07:28:23
2021-03-08T07:28:23
null
0
0
null
null
null
null
UTF-8
Swift
false
false
414
swift
// // URLInfo.swift // Covid19App // // Created by Mac Mini on 2021/03/05. // import Foundation enum URLInfos { case decideAPI } extension URLInfos { var url : String { var selectedUrl = "" switch self { case .decideAPI: selectedUrl = "http://openapi.data.go.kr/openapi/service/rest/Covid19/getCovid19InfStateJson" return selectedUrl } } }
[ -1 ]
57766bd08ac8c0359754b35be97c799a11c7219c
10efea21db4e158963f2b7716922abaf671eb4ad
/Models/BindableType.swift
3cc7ec9e20e72f166edacee9284f39d6bac6feca
[]
no_license
DerCSpringer/RedditTop50Viewer
77712aa024aab627aedb171c6199c8dce28cf10c
43dc4f88defbe9c8ea0d1728c3dc033210c9607e
refs/heads/master
2021-01-20T22:14:32.870529
2017-08-29T20:52:34
2017-08-29T20:52:34
101,705,000
0
0
null
null
null
null
UTF-8
Swift
false
false
730
swift
// // BindableType.swift // RedditTop50Viewer // // Created by Daniel Springer on 8/28/17. // Copyright © 2017 Daniel Springer. All rights reserved. // import UIKit protocol BindableType { //All view models must abide by this protocol. It allows for a binding between VC-VM associatedtype ViewModelType var viewModel: ViewModelType! { get set } func bindViewModel() } extension BindableType where Self: UIViewController { mutating func bindViewModel(to model: Self.ViewModelType) { //This function in the VCs to VMs //We don't use ViewDidLoad, becuase our viewmodel must be assigned before viewDidLoad viewModel = model loadViewIfNeeded() bindViewModel() } }
[ -1 ]
2abdcea264c4cc0b75bc5ba73cce05ccb25d4701
a1dcaf0b7b56b63ef68b4f3d3e8fcd0804862d52
/EdalCustomer/MVC/Home/Controller/HomeVC.swift
7e1bf874e14a2f46071b227b02d1ff58924c0796
[]
no_license
knight6700/edalCustomer
8593f604a036d2d5406267696861a30922ef1ba3
b470816c7c3f2a9d19af41c21a46f60bc5a05f76
refs/heads/master
2023-01-07T11:01:41.014596
2020-11-07T12:13:23
2020-11-07T12:13:23
301,764,859
0
0
null
2020-11-07T12:13:24
2020-10-06T15:03:29
Swift
UTF-8
Swift
false
false
4,007
swift
// // HomeVC.swift // edal-IosCustomerApp // // Created by Mohamed Kelany on 8/26/18. // Copyright © 2018 hesham ghalaab. All rights reserved. // import UIKit class HomeVC: UIViewController, UITabBarDelegate { @IBOutlet weak var tabBar: UITabBar! @IBOutlet weak var containerView: UIView! override func viewDidLoad() { super.viewDidLoad() self.tabBar.shadowImage = UIImage() self.tabBar.backgroundImage = UIImage() self.tabBar.backgroundColor = .clear self.tabBar.tintColor = .red self.tabBar.barTintColor = .white self.tabBar.isTranslucent = true if let items = self.tabBar.items { for item in items { if let image = item.image { item.image = image.withRenderingMode( .alwaysOriginal ) } } } // Load the first screen by default. performSegue(withIdentifier: "exploreSegue", sender: nil) // Do any additional setup after loading the view. } override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if segue is TabBarItemSegue { // This is an example of how to use the UIViewController containment APIs. // If we're starting, there is not yet a child view controller added, so // just add it. if children.count == 0 { self.addChild(segue.destination) segue.destination.view.frame = containerView.bounds self.containerView.addSubview(segue.destination.view) segue.destination.didMove(toParent: self) // If there is already a child, swap it with the segue's destination view controller. } else { let oldViewController = self.children[0] segue.destination.view.frame = oldViewController.view.frame oldViewController.willMove(toParent: nil) self.addChild(segue.destination) self.transition(from: oldViewController, to: segue.destination, duration: 0, options: .transitionCrossDissolve, animations: nil) { completed in oldViewController.removeFromParent() segue.destination.didMove(toParent: self) } } } } func tabBar(_ tabBar: UITabBar, didSelect item: UITabBarItem) { guard let index = tabBar.items?.index(of: item) else { return } switch index { case 0: if let image = item.image { item.image = image.withRenderingMode( .alwaysOriginal ) } //item.image = image.withRenderingMode( .alwaysOriginal ) performSegue(withIdentifier: "exploreSegue", sender: nil) case 1: if let image = item.image { item.image = image.withRenderingMode( .alwaysOriginal ) } performSegue(withIdentifier: "searchSegue", sender: nil) case 2: if let image = item.image { item.image = image.withRenderingMode( .alwaysOriginal ) } performSegue(withIdentifier: "myEdalSegue", sender: nil) case 3: if let image = item.image { item.image = image.withRenderingMode( .alwaysOriginal ) } performSegue(withIdentifier: "alertSegue", sender: nil) case 4: if let image = item.image { item.image = image.withRenderingMode( .alwaysOriginal ) } performSegue(withIdentifier: "moreSegue", sender: nil) default: break } } } class TabBarItemSegue: UIStoryboardSegue { override func perform() { // Leave empty (we override prepareForSegue) } }
[ -1 ]
34cf83c9f6e85658c8a21806926522525fb8c6cc
cab409588036247f9c5552151cf1a483de605898
/iOU/AppDelegate.swift
e1355907ce8a46e3cc3e778d30341d7684fe045a
[]
no_license
7OOTnegaTerces/iOU
40301792e856cd049f7d08a7ffd3b5f9f36a1450
e042f737166fdd0dbf5940c0937583ef81b3c814
refs/heads/master
2021-01-19T17:13:38.741301
2016-09-21T23:51:50
2016-09-21T23:51:50
26,900,919
0
0
null
null
null
null
UTF-8
Swift
false
false
5,805
swift
// // AppDelegate.swift // iOU // // Created by Tateni Urio on 11/19/14. // Copyright (c) 2014 Tateni Urio. All rights reserved. // import UIKit import CoreData @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Override point for customization after application launch. return true } func applicationWillResignActive(application: UIApplication) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. } func applicationDidEnterBackground(application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } func applicationWillEnterForeground(application: UIApplication) { // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. } func applicationDidBecomeActive(application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } func applicationWillTerminate(application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. // Saves changes in the application's managed object context before the application terminates. self.saveContext() } // MARK: - Core Data stack lazy var applicationDocumentsDirectory: NSURL = { // The directory the application uses to store the Core Data store file. This code uses a directory named "retsamypsapps-site-com.google.sites.iOU" in the application's documents Application Support directory. let urls = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask) return urls[urls.count-1] }() lazy var managedObjectModel: NSManagedObjectModel = { // The managed object model for the application. This property is not optional. It is a fatal error for the application not to be able to find and load its model. let modelURL = NSBundle.mainBundle().URLForResource("iOU", withExtension: "momd")! return NSManagedObjectModel(contentsOfURL: modelURL)! }() lazy var persistentStoreCoordinator: NSPersistentStoreCoordinator = { // The persistent store coordinator for the application. This implementation creates and returns a coordinator, having added the store for the application to it. This property is optional since there are legitimate error conditions that could cause the creation of the store to fail. // Create the coordinator and store let coordinator = NSPersistentStoreCoordinator(managedObjectModel: self.managedObjectModel) let url = self.applicationDocumentsDirectory.URLByAppendingPathComponent("SingleViewCoreData.sqlite") var failureReason = "There was an error creating or loading the application's saved data." do { try coordinator.addPersistentStoreWithType(NSSQLiteStoreType, configuration: nil, URL: url, options: nil) } catch { // Report any error we got. var dict = [String: AnyObject]() dict[NSLocalizedDescriptionKey] = "Failed to initialize the application's saved data" dict[NSLocalizedFailureReasonErrorKey] = failureReason dict[NSUnderlyingErrorKey] = error as NSError let wrappedError = NSError(domain: "YOUR_ERROR_DOMAIN", code: 9999, userInfo: dict) // Replace this with code to handle the error appropriately. // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. NSLog("Unresolved error \(wrappedError), \(wrappedError.userInfo)") abort() } return coordinator }() lazy var managedObjectContext: NSManagedObjectContext = { // Returns the managed object context for the application (which is already bound to the persistent store coordinator for the application.) This property is optional since there are legitimate error conditions that could cause the creation of the context to fail. let coordinator = self.persistentStoreCoordinator var managedObjectContext = NSManagedObjectContext(concurrencyType: .MainQueueConcurrencyType) managedObjectContext.persistentStoreCoordinator = coordinator return managedObjectContext }() // MARK: - Core Data Saving support func saveContext () { if managedObjectContext.hasChanges { do { try managedObjectContext.save() } catch { // Replace this implementation with code to handle the error appropriately. // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. let nserror = error as NSError NSLog("Unresolved error \(nserror), \(nserror.userInfo)") abort() } } } }
[ 283144, 277514, 277003, 280085, 278551, 278042, 276510, 281635, 194085, 277030, 228396, 277038, 223280, 278577, 280132, 162394, 282203, 189025, 292450, 285796, 279148, 285296, 227455, 278656, 228481, 276611, 278665, 280205, 225934, 278674, 188050, 276629, 283803, 278687, 282274, 277154, 278692, 228009, 287402, 227499, 278700, 284845, 278705, 276149, 278711, 279223, 278718, 283838, 228544, 279753, 229068, 227533, 280273, 278751, 201439, 226031, 159477, 280312, 279304, 203532, 181516, 277262, 280335, 284432, 278289, 278801, 284434, 321296, 276751, 278287, 276755, 278808, 278297, 282910, 281379, 282915, 280370, 277306, 278844, 280382, 282433, 237382, 164166, 226634, 276313, 278877, 280415, 277344, 276321, 227687, 334185, 279405, 278896, 277363, 281972, 275828, 278902, 280439, 276347, 228220, 279422, 278916, 284557, 293773, 191374, 277395, 283028, 288147, 214934, 278943, 282016, 283554, 230320, 230322, 281011, 283058, 286130, 278971, 276923, 282558, 299970, 280007, 288200, 284617, 287689, 286157, 326096, 281041, 283091, 282585, 294390, 282616 ]
6352ad416c0bc799f8b40dab9866286ea113325d
d42c630dd1497b863d1adc08bba63f613d22d4d7
/LandscapeController_Swift/LandscapeController_Swift/AppDelegate.swift
08f8ce9ea0c5e81ec2d581c8724b1286825f4bf9
[ "MIT" ]
permissive
johncodeos-forks/SingleLandscapeController
411b8b20641223a6bdd5cde34fd011d470a987ea
534d7d7635b9ca6e076b82a8e639892ac6baae12
refs/heads/master
2021-03-30T21:19:35.590396
2018-03-12T23:05:09
2018-03-12T23:05:09
null
0
0
null
null
null
null
UTF-8
Swift
false
false
1,595
swift
// // AppDelegate.swift // LandscapeController_Swift // // Created by olxios on 20/06/16. // Copyright © 2016 olxios. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? // MARK: Application State private func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Override point for customization after application launch. return true } func applicationWillResignActive(_ application: UIApplication) {} func applicationDidEnterBackground(_ application: UIApplication) {} func applicationWillEnterForeground(_ application: UIApplication) {} func applicationDidBecomeActive(_ application: UIApplication) {} func applicationWillTerminate(_ application: UIApplication) {} // MARK: Orientation func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask { if self.window?.rootViewController?.presentedViewController is SecondViewController { let secondController = self.window!.rootViewController!.presentedViewController as! SecondViewController if secondController.isPresented { return UIInterfaceOrientationMask.all; } else { return UIInterfaceOrientationMask.portrait; } } else { return UIInterfaceOrientationMask.portrait; } } }
[ -1 ]
d687304ebad11d8659a5b4bf98817c322748acca
694b15a352f690907e6900b1228edc54e4dfbdba
/Yelp/Switch.swift
2f9ee69245b87760fe2c4d12a9e092ac28e283c0
[ "Apache-2.0" ]
permissive
dawa/ios_yelp_swift
ee1ccac2ebd6c558d53dcc754903da0988460471
611b273e32406da39140949cad9a076148f8464a
refs/heads/master
2021-01-19T04:40:58.052082
2017-04-10T04:53:51
2017-04-10T04:53:51
87,387,179
0
0
null
null
null
null
UTF-8
Swift
false
false
2,880
swift
// Copyright © 2016 C4 // // 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 C4 import UIKit @IBDesignable class Switch: UISwitch { var thumb: SwitchThumb? var background: SwitchBackground? required init?(coder: NSCoder) { super.init(coder: coder) thumb = SwitchThumb() background = SwitchBackground() replaceViews() setup() toggle() } override init(frame: CGRect) { super.init(frame: frame) thumb = SwitchThumb() background = SwitchBackground() replaceViews() setup() toggle() } init(thumb aThumb: SwitchThumb? = SwitchThumb(), background aBackground: SwitchBackground? = SwitchBackground()) { super.init(frame: CGRect()) thumb = aThumb background = aBackground replaceViews() setup() } internal func replaceViews() { let subviews = self.subviews let mainView = subviews[0] let imageView = subviews[0].subviews[3] as! UIImageView // swiftlint:disable:this force_cast thumb?.center = Point(Double(imageView.bounds.size.width-28.66666), Double(imageView.bounds.midY-0.66666)) imageView.addSubview(thumb!.view) imageView.image = UIImage() self.addTarget(self, action: #selector(Switch.toggle), for: UIControlEvents.valueChanged) mainView.add(background) mainView.bringToFront(imageView) let sv0 = mainView.subviews[0] let sv1 = mainView.subviews[1] let sv2 = mainView.subviews[2] mainView.remove(sv0) mainView.remove(sv1) mainView.remove(sv2) } func setup() { } func toggle() { self.thumb?.toggle(force: isOn) self.background?.toggle(force: isOn) } }
[ -1 ]
986b6bdbd498b0d14977a307167ca08f2be5dedf
9cc606e8d5bf6558cac1582af40535fa021a9735
/CompanyMembersList/CompanyMembersListTests/CompanyMembersListTests.swift
17023a6e11ad4e1acf9955d0cf65bc1a905eddfd
[ "MIT" ]
permissive
harshal-wani/company-member-list
73de4fe309954d7b1d40fb607339f9a2b6f1183d
5dcf9b9c87b6a78274b2a491031c827663fec603
refs/heads/master
2022-12-24T03:14:25.391102
2020-10-14T06:48:49
2020-10-14T06:48:49
280,876,249
1
0
null
null
null
null
UTF-8
Swift
false
false
504
swift
// // CompanyMembersListTests.swift // CompanyMembersListTests // // Created by Harshal Wani on 19/07/20. // Copyright © 2020 Harshal Wani. All rights reserved. // import XCTest @testable import CompanyMembersList class CompanyMembersListTests: XCTestCase { func test_IsInternetAvailable() { if Utilities.isInternetAvailable() { XCTAssertTrue(Utilities.isInternetAvailable()) } else { XCTAssertFalse(Utilities.isInternetAvailable()) } } }
[ -1 ]
1dffcd10ecc821feda1b2d4bdc470dd6d87d6cde
bec07b464566a80269979e5775f9fc512e4ef67f
/Exams/View/ResultCell.swift
ffbb7b59c9517e75977f6a144f9353905a327e8e
[]
no_license
blackjack-js/Exams
684aae9b8b5d840b50de33d3b18791a1ae1d93b3
7511b2a1a4a946c48ed5caae2d2a15e502aac105
refs/heads/master
2021-09-18T09:19:36.535480
2018-07-12T15:05:12
2018-07-12T15:05:12
null
0
0
null
null
null
null
UTF-8
Swift
false
false
570
swift
// // ResultCell.swift // Quiz // // Created by mac on 5/26/18. // Copyright © 2018 Devstorm. All rights reserved. // import UIKit class ResultCell: UICollectionViewCell { @IBOutlet weak var questionLabel: UILabel! @IBOutlet weak var answerLabel: UILabel! override func layoutSubviews() { super.layoutSubviews() self.layer.cornerRadius = 6 layer.shadowRadius = 10 layer.shadowOpacity = 0.2 layer.shadowOffset = CGSize(width: 5, height: 10) self.clipsToBounds = false } }
[ -1 ]
e8e670f9c12771899d9296e2fc0f00561d6d6c83
c507252762211d32e518531a5b07d600260772f7
/Photos-Demo/Photos-DemoUITests/Photos_DemoUITests.swift
2b41884aaa7e343dee0df40df0528a5d7970a3e0
[ "MIT" ]
permissive
jkiley129/Photos
27b8b72b29e6cad809a0a27c40b19d4863bf69d7
269e5d53c33a3a00ba0e130b222620b314c5bda8
refs/heads/master
2021-04-09T11:58:08.352602
2016-06-14T23:08:58
2016-06-14T23:08:58
60,570,268
0
0
null
null
null
null
UTF-8
Swift
false
false
1,257
swift
// // Photos_DemoUITests.swift // Photos-DemoUITests // // Created by Joseph Kiley on 6/6/16. // Copyright © 2016 Joseph Kiley. All rights reserved. // import XCTest class Photos_DemoUITests: XCTestCase { override func setUp() { super.setUp() // Put setup code here. This method is called before the invocation of each test method in the class. // In UI tests it is usually best to stop immediately when a failure occurs. continueAfterFailure = false // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. XCUIApplication().launch() // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. } override func tearDown() { // Put teardown code here. This method is called after the invocation of each test method in the class. super.tearDown() } func testExample() { // Use recording to get started writing UI tests. // Use XCTAssert and related functions to verify your tests produce the correct results. } }
[ 333827, 243720, 282634, 155665, 305173, 237599, 241695, 223269, 354342, 229414, 292901, 102441, 354346, 278571, 315433, 325675, 102446, 282671, 124974, 229425, 313388, 243763, 241717, 321589, 180279, 229431, 215095, 319543, 213051, 288829, 325695, 286787, 288835, 307269, 237638, 313415, 239689, 315468, 311373, 278607, 196687, 311377, 354386, 280660, 223317, 315477, 323678, 315488, 321632, 280674, 45154, 280676, 315489, 313446, 227432, 215144, 233578, 194667, 278637, 288878, 319599, 278642, 284789, 131190, 288890, 292987, 215165, 131199, 227459, 194692, 280708, 235661, 278669, 241809, 323730, 278676, 311447, 153752, 327834, 284827, 299166, 278690, 233635, 311459, 215204, 284840, 299176, 184489, 284843, 278698, 278703, 323761, 184498, 278707, 125108, 278713, 223418, 280761, 295099, 299197, 180409, 280767, 258233, 227517, 299202, 139459, 309443, 227525, 131270, 176325, 301255, 280779, 227536, 282832, 301270, 301271, 280792, 311520, 325857, 280803, 182503, 319719, 295147, 317676, 286957, 125166, 125170, 313595, 125180, 184574, 125184, 309504, 125192, 125197, 125200, 227601, 125204, 278805, 319764, 334104, 315674, 282908, 311582, 299294, 282912, 233761, 278817, 125215, 211239, 282920, 125225, 317738, 311596, 321839, 315698, 98611, 125236, 282938, 168251, 278843, 307514, 287040, 319812, 280903, 319816, 227655, 323914, 201037, 282959, 229716, 289109, 168280, 379224, 323934, 391521, 239973, 381286, 285031, 416103, 313703, 280938, 242027, 242028, 321901, 278895, 354671, 287089, 199030, 227702, 291193, 291194, 139641, 223611, 248188, 313726, 311679, 291200, 211327, 240003, 158087, 313736, 227721, 242059, 311692, 227730, 285074, 240020, 315798, 190870, 190872, 291225, 285083, 293275, 317851, 227743, 242079, 283039, 285089, 293281, 305572, 289185, 156069, 301482, 289195, 311723, 377265, 299449, 311739, 319931, 293309, 311744, 317889, 291266, 278979, 278988, 326093, 281038, 281039, 278992, 283089, 283088, 289229, 279000, 176602, 285152, 160224, 279009, 291297, 188899, 195044, 279014, 242150, 319976, 279017, 311787, 281071, 319986, 236020, 279030, 311800, 279033, 317949, 283138, 279042, 233987, 287237, 322057, 309770, 342537, 279053, 283154, 303634, 303635, 279060, 279061, 182802, 279066, 188954, 322077, 291359, 227881, 293420, 289328, 283185, 236080, 279092, 23093, 234037, 244279, 244280, 338491, 234044, 301635, 309831, 55880, 377419, 281165, 303693, 281170, 326229, 287319, 309847, 115287, 189016, 111197, 295518, 287327, 242274, 244326, 277095, 279143, 279150, 281200, 287345, 287348, 301688, 189054, 303743, 287359, 291455, 297600, 301702, 279176, 311944, 311948, 316044, 184974, 311950, 316048, 311953, 287379, 227991, 295575, 289435, 303772, 205469, 221853, 285348, 314020, 279207, 295598, 279215, 285360, 342705, 285362, 299698, 287412, 166581, 293552, 154295, 279218, 303802, 314043, 287418, 66243, 291529, 287434, 225996, 363212, 287438, 242385, 303826, 279249, 279253, 158424, 299737, 230105, 322269, 342757, 295653, 289511, 234216, 330473, 230120, 285419, 289517, 312046, 279278, 215790, 170735, 125683, 230133, 199415, 234233, 242428, 279293, 205566, 322302, 289534, 299777, 291584, 228099, 285443, 291591, 295688, 322312, 285450, 312076, 285457, 295698, 166677, 291605, 283418, 285467, 221980, 281378, 234276, 283431, 262952, 262953, 279337, 293673, 289580, 262957, 318247, 164655, 301872, 318251, 234290, 303921, 285493, 230198, 285496, 301883, 201534, 281407, 295745, 222017, 293702, 318279, 283466, 281426, 279379, 295769, 234330, 201562, 281434, 322396, 230238, 230239, 301919, 279393, 349025, 293729, 281444, 303973, 279398, 177002, 242540, 310132, 295797, 228214, 295799, 177018, 279418, 269179, 308093, 314240, 291713, 158594, 240517, 287623, 228232, 299912, 320394, 279434, 416649, 316299, 234382, 308111, 189327, 308113, 293780, 310166, 289691, 209820, 240543, 283551, 310177, 289699, 189349, 289704, 279465, 293801, 177074, 304050, 289720, 289723, 189373, 213956, 281541, 19398, 345030, 279499, 56270, 191445, 304086, 183254, 142309, 234469, 314343, 304104, 324587, 183276, 289773, 203758, 320492, 320495, 287730, 240631, 320504, 312313, 214009, 312317, 234499, 293894, 320520, 230411, 320526, 234513, 238611, 238617, 197658, 316441, 132140, 113710, 189487, 281647, 322609, 312372, 203829, 300087, 238650, 320571, 21567, 308288, 318127, 160834, 336962, 314437, 349254, 238663, 300109, 207954, 234578, 296023, 205911, 314458, 234588, 281698, 281699, 285795, 230500, 322664, 228457, 279659, 318571, 234606, 300145, 230514, 300147, 312435, 238706, 279666, 187508, 302202, 285819, 314493, 285823, 234626, 279686, 222344, 285834, 234635, 228492, 337037, 318602, 177297, 162962, 187539, 308375, 324761, 285850, 296091, 119965, 234655, 302239, 330912, 300192, 306339, 339106, 234662, 300200, 249003, 302251, 208044, 3243, 322733, 238764, 294069, 300215, 294075, 64699, 228541, 283841, 148674, 283846, 312519, 279752, 283849, 148687, 290001, 189651, 316628, 279766, 189656, 279775, 310496, 298209, 304353, 304352, 279780, 228587, 279789, 290030, 316661, 234741, 283894, 208123, 279803, 292092, 228608, 234756, 322826, 242955, 312588, 177420, 318732, 126229, 318746, 320795, 320802, 304422, 130342, 130344, 298290, 312628, 300342, 222523, 286012, 279872, 181568, 279874, 300354, 300355, 294210, 193858, 372039, 304457, 230730, 296269, 234830, 222542, 238928, 224591, 296274, 314708, 318804, 283990, 357720, 300378, 300379, 294236, 316764, 292194, 230757, 281958, 134504, 306541, 284015, 296304, 327023, 234864, 316786, 230772, 314742, 290170, 310650, 224637, 306558, 290176, 314752, 243073, 179586, 306561, 294278, 296328, 298378, 296330, 368012, 304523, 318860, 314771, 306580, 234902, 224662, 282008, 318876, 282013, 290206, 148899, 298406, 282023, 279979, 279980, 241067, 314797, 286128, 173492, 279988, 286133, 284090, 310714, 228796, 302523, 415170, 280003, 292291, 310725, 306630, 302530, 228804, 300488, 306634, 280011, 300490, 234957, 302539, 310731, 310735, 312785, 222674, 280020, 280025, 310747, 239069, 144862, 286176, 187877, 310758, 320997, 280042, 280043, 191980, 300526, 337391, 282097, 308722, 296434, 306678, 191991, 288248, 40439, 286201, 300539, 288252, 312830, 290304, 228868, 292359, 218632, 302602, 230922, 323083, 294413, 304655, 323088, 282132, 302613, 230933, 282135, 316951, 374297, 302620, 313338, 282147, 222754, 306730, 312879, 230960, 288305, 239159, 290359, 323132, 157246, 130622, 288319, 288322, 280131, 349764, 310853, 194118, 124486, 288328, 286281, 292426, 282182, 224848, 224852, 230999, 239192, 306777, 290391, 128600, 235096, 212574, 345697, 204386, 300643, 300645, 282214, 312937, 224874, 243306, 312941, 310896, 294517, 288377, 290425, 325246, 333438, 235136, 280193, 282244, 239238, 288391, 282248, 323208, 286344, 179853, 188049, 229011, 239251, 323226, 179868, 229021, 302751, 198304, 282272, 282279, 298664, 212649, 298666, 317102, 286387, 300725, 286392, 302778, 306875, 296636, 280253, 282302, 323262, 286400, 280252, 323265, 280259, 321217, 282309, 239305, 280266, 306891, 296649, 212684, 302798, 9935, 241360, 282321, 313042, 286419, 241366, 280279, 278232, 282330, 18139, 278237, 280285, 294621, 282336, 278241, 294629, 153318, 12009, 282347, 288492, 282349, 323315, 34547, 67316, 284410, 200444, 288508, 282366, 286463, 319232, 288515, 280326, 282375, 323335, 284425, 300810, 116491, 216844, 280333, 284430, 282379, 161553, 124691, 284436, 118549, 116502, 278294, 278292, 282390, 321308, 321309, 282399, 241440, 282401, 186148, 186149, 315172, 241447, 333609, 294699, 284460, 286507, 280367, 300849, 282418, 280373, 282424, 280377, 319289, 321338, 282428, 280381, 413500, 241471, 280386, 325444, 280391, 153416, 315209, 159563, 280396, 307024, 317268, 237397, 307030, 18263, 241494, 188250, 425820, 300893, 284508, 307038, 237411, 276326, 282471, 296807, 292713, 282476, 292719, 296815, 313200, 317305, 124795, 317308, 339840, 315265, 327556, 188293, 282503, 315272, 243592, 305032, 315275, 67464, 325514, 184207, 311183, 124816, 282517, 294806, 214936, 294808, 124826, 239515, 214943, 298912, 319393, 294820, 219046, 333734, 294824, 298921, 284584, 313257, 292783, 126896, 200628, 300983, 343993, 288698, 98240, 294849, 214978, 280517, 280518, 214983, 282572, 282573, 153553, 24531, 231382, 323554, 292835, 190437, 292838, 294887, 317416, 313322, 278507, 298987, 311277, 296942, 124912, 278515, 325620, 239610 ]
ff39cfb65337a7b356ed097ca9bcfc55a0878fbf
9bf7027cd65188acee827d7938188b3b92fe0dcc
/PassengerApp/Cells/UFXJekIconTVC.swift
d48c4f6e6dd49a22479c588ccebf639404a8952c
[]
no_license
amenalseady11/passageiro-ios-uber-clone
21d9e2986cd60c6284501a82461fbacbbaea7f14
7ca6668e168c263714c6e1c2e103a2c97f0ea42e
refs/heads/master
2023-03-19T03:20:14.673231
2020-02-25T19:46:15
2020-02-25T19:46:15
null
0
0
null
null
null
null
UTF-8
Swift
false
false
635
swift
// // UFXJekIconTVC.swift // PassengerApp // // Created by Tarwinder Singh on 20/04/18. // Copyright © 2018 V3Cube. All rights reserved. // import UIKit class UFXJekIconTVC: UITableViewCell { @IBOutlet weak var categoryImgView: UIImageView! @IBOutlet weak var categoryLbl: MyLabel! @IBOutlet weak var bookNowLbl: MyLabel! override func awakeFromNib() { super.awakeFromNib() // Initialization code } override func setSelected(_ selected: Bool, animated: Bool) { super.setSelected(selected, animated: animated) // Configure the view for the selected state } }
[ 350050, 213097, 276756, 334231, 123451 ]
cb87b7876c05f57ad9778e03984609ebdf13cf1a
116f17c8cf1ad739b0e914627c758dddd57ff131
/Lists/Source/RestaurantDetail/RestaurantDetailViewController.swift
60846ec413d982cc51c8593464b6a8f8163f724a
[]
no_license
tonyalbor/lists
0ccdf6c3562a61c680aa316277478228dd5dd255
58a8d2175372039ddc339aecd3a220a17b0dee4b
refs/heads/master
2020-03-15T18:47:00.593803
2018-08-19T00:26:09
2018-08-19T00:26:09
132,292,379
0
0
null
null
null
null
UTF-8
Swift
false
false
5,333
swift
// // RestaurantDetailViewController.swift // Lists // // Created by Tony Albor on 5/6/18. // Copyright © 2018 Tony Albor. All rights reserved. // import CoreLocation import UIKit class RestaurantDetailViewController: UIViewController { override func loadView() { view = RestaurantDetailView() } var contentView: RestaurantDetailView { return view as! RestaurantDetailView } private let context: RestaurantDetailContext private let searchResult: Restaurant private let allResults: [Restaurant] init(context: RestaurantDetailContext, searchResult: Restaurant, allResults: [Restaurant]) { self.context = context self.searchResult = searchResult self.allResults = allResults super.init(nibName: nil, bundle: nil) } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } override func viewDidLoad() { super.viewDidLoad() contentView.imageView.af_setImage(withURL: searchResult.imageUrl) setUpNavBar() setUpActions() // context.getDetails(id: searchResult.id) { result in // // } } private func setUpNavBar() { navigationItem.title = searchResult.name navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(didPressAdd)) } private func setUpActions() { setUpImageViewTap() setUpViewOnMapTap() } private func setUpImageViewTap() { let tap = UITapGestureRecognizer(target: self, action: #selector(handleImageViewTap)) contentView.imageView.addGestureRecognizer(tap) } private func setUpViewOnMapTap() { contentView.viewOnMap.addTarget(self, action: #selector(handleViewOnMapTap), for: .touchUpInside) } @objc private func handleImageViewTap() { let imageViewController = ImageViewController(image: contentView.imageView.image) imageViewController.transitioningDelegate = self present(imageViewController, animated: true, completion: nil) } @objc private func handleViewOnMapTap() { // TODO: get manager from central dependencies let manager = CoreLocationManager(manager: CLLocationManager()) // TODO: move this elsewhere. maybe as an extension? func toAnnotation(restaurant: Restaurant) -> MapAnnotation { return MapAnnotation(coordinate: restaurant.coordinates, title: restaurant.name, subtitle: nil) } let annotation = toAnnotation(restaurant: searchResult) let mapContext = MapContext(locationManager: manager, annotations: [annotation]) let map = MapViewController(context: mapContext) let navigation = UINavigationController(rootViewController: map) present(navigation, animated: true, completion: nil) } @objc private func didPressAdd() { let saveToContext = SaveToContext(detail: searchResult, searchResults: allResults) let saveTo = SaveToViewController(context: saveToContext) saveTo.modalPresentationStyle = .custom saveTo.transitioningDelegate = self present(saveTo, animated: true, completion: nil) } } extension RestaurantDetailViewController: UIViewControllerTransitioningDelegate { func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? { switch presented { case is ImageViewController: return ImageViewAnimator(isPresenting: true) case is SaveToViewController: return SaveToAnimator(isPresenting: true) default: return nil } } func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? { switch dismissed { case is ImageViewController: return ImageViewAnimator(isPresenting: false) case is SaveToViewController: return SaveToAnimator(isPresenting: false) default: return nil } } func interactionControllerForPresentation(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? { return nil } func interactionControllerForDismissal(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? { guard let presented = presentedViewController as? ImageViewController else { return nil } return presented.interactionController } func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController? { guard presented is SaveToViewController else { return nil } return HalfModalPresentationController(presentedViewController: presented, presenting: presenting) } }
[ -1 ]
b958a6fec989bae348392cab80170a190e9cbb5e
ab1c8fc149e9fd21f3db0b93205df3816218e2e3
/IMOnline/IMOnline/IMOperation.swift
d4be57b4ffc05b81f347188b0640335b724fe5cc
[]
no_license
Pradnya2689/IMonlineNew
bfba5d2cfefa9fa7ac54204f0cfc8b9fb8e7becc
82184843ea22b77b2a2185d0f6feb4e021fb7356
refs/heads/master
2021-01-19T09:37:43.252469
2017-05-03T12:39:24
2017-05-03T12:39:24
87,774,296
0
0
null
null
null
null
UTF-8
Swift
false
false
306
swift
// // IMOperation.swift // IMOnline // // Created by pradnya on 17/04/17. // Copyright © 2017 IngramMicro. All rights reserved. // import UIKit class IMOperation: NSObject { var appVersion: String! var contractName: String! var contractMethod: String! var contractURI: String! }
[ -1 ]
e5f1309cc003e08cd81644660c316ae38bc7fbf0
d57b10771851edf318bf46187dd1e561afed6996
/quicklookTests/quicklookTests.swift
84a427abd08a0f4a1116aa4a3d590f288720b9b3
[]
no_license
abhoi/quicklook
bcba70726c34cd591507a724c6809fb03c37955e
e06dfe28f9c5808a2dd11c8a5cc6744377c40a35
refs/heads/master
2020-03-31T15:37:59.563875
2018-10-10T01:30:33
2018-10-10T01:38:08
152,344,691
1
0
null
null
null
null
UTF-8
Swift
false
false
907
swift
// // quicklookTests.swift // quicklookTests // // Created by CH-ABHOI-MBP on 10/6/18. // Copyright © 2018 Octabit. All rights reserved. // import XCTest @testable import quicklook class quicklookTests: 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. } } }
[ 360462, 229413, 204840, 344107, 155694, 229424, 229430, 163896, 180280, 376894, 352326, 254027, 311372, 311374, 196691, 180311, 180312, 385116, 237663, 254048, 319591, 221290, 131178, 319598, 204916, 131191, 131198, 319629, 311438, 278677, 196760, 426138, 278704, 377009, 180408, 295098, 139479, 229597, 311519, 205035, 286958, 327929, 344313, 147717, 368905, 278797, 254226, 319763, 368916, 262421, 377114, 237856, 237857, 278816, 311597, 98610, 180535, 336183, 278842, 287041, 139589, 319821, 344401, 377169, 368981, 155990, 368984, 106847, 98657, 270701, 246127, 270706, 139640, 246136, 311685, 106888, 385417, 311691, 385422, 213403, 246178, 385454, 311727, 377264, 311738, 33211, 319930, 336320, 311745, 278978, 254406, 188871, 278989, 278993, 328152, 369116, 287198, 279008, 279013, 279018, 311786, 319981, 319987, 279029, 254456, 377338, 377343, 254465, 287241, 279050, 139792, 303636, 279062, 393751, 279065, 377376, 377386, 197167, 385588, 115270, 377418, 385615, 426576, 369235, 295519, 139872, 279146, 295536, 287346, 139892, 287352, 344696, 279164, 311941, 336518, 311945, 369289, 344715, 311949, 287374, 377489, 311954, 352917, 230040, 271000, 377497, 303771, 377500, 295576, 221852, 205471, 344738, 139939, 279206, 205487, 295599, 303793, 336564, 164533, 287417, 287422, 377539, 164560, 385747, 279252, 361176, 418520, 287452, 295652, 369385, 312052, 312053, 172792, 344827, 221948, 279294, 205568, 295682, 197386, 434957, 312079, 295697, 426774, 197399, 426775, 197411, 279336, 295724, 312108, 197422, 353070, 164656, 295729, 328499, 197431, 230199, 336702, 295746, 353095, 353109, 377686, 230234, 189275, 435039, 295776, 303972, 385893, 230248, 246641, 246643, 295798, 246648, 361337, 254850, 369538, 287622, 58253, 295824, 353195, 140204, 377772, 304051, 230332, 377790, 353215, 189374, 353216, 213957, 345033, 279498, 386006, 418776, 50143, 123881, 287731, 271350, 295927, 312314, 328700, 328706, 410627, 320516, 295942, 386056, 353290, 377869, 320527, 238610, 418837, 140310, 320536, 197657, 189474, 369701, 238639, 312373, 238651, 377926, 214086, 296019, 353367, 156764, 304222, 230499, 173166, 312434, 377972, 353397, 337017, 377983, 402565, 279685, 386189, 296086, 238743, 296092, 238765, 279728, 238769, 402613, 337077, 230588, 353479, 353481, 402634, 189652, 189653, 419029, 279765, 148696, 296153, 279774, 304351, 304356, 222440, 328940, 279792, 353523, 386294, 386301, 320770, 386306, 328971, 353551, 320796, 222494, 115998, 279854, 353584, 345396, 386359, 378172, 312648, 337225, 304456, 230729, 238927, 353616, 296273, 222559, 378209, 386412, 296303, 312689, 296307, 116084, 181625, 337281, 148867, 296329, 304524, 296335, 9619, 370071, 173491, 304564, 279989, 353719, 280004, 361927, 296392, 312782, 329173, 271843, 329200, 296433, 321009, 280055, 230913, 329225, 296461, 304656, 329232, 370197, 230943, 402985, 394794, 230959, 312880, 288309, 312889, 288318, 280130, 288327, 280147, 239198, 157281, 99938, 312940, 222832, 247416, 337534, 337535, 263809, 312965, 288392, 239250, 419478, 206504, 321199, 337591, 321207, 296632, 280251, 280257, 321219, 280267, 403148, 9936, 9937, 313041, 370388, 272085, 345814, 18138, 345821, 321247, 321249, 345833, 345834, 280300, 67315, 173814, 288512, 288516, 321295, 321302, 345879, 116505, 321310, 255776, 313120, 247590, 362283, 378668, 296755, 321337, 345919, 436031, 403267, 280392, 345929, 18262, 362327, 280410, 345951, 362337, 345955, 296806, 296814, 214895, 313199, 362352, 280430, 182144, 305026, 67463, 329622, 337815, 436131, 313254, 436137, 362417, 288697, 362431, 214977, 280514, 214984, 362443, 231375, 280541, 329695, 436191, 313319, 247785, 436205, 296941, 329712, 223218, 313339, 43014, 354316, 313357, 239650, 329765, 354343, 223274, 346162, 288828, 436285, 288833, 288834, 436292, 403525, 436301, 338001, 354385, 338003, 280661, 329814, 354393, 280675, 280677, 43110, 321637, 329829, 436329, 313447, 288879, 223350, 280694, 288889, 215164, 215166, 280712, 215178, 346271, 436383, 362659, 239793, 182456, 280762, 379071, 280768, 149703, 346314, 321745, 280795, 387296, 280802, 379106, 338150, 346346, 321772, 125169, 436470, 149760, 411906, 321800, 272658, 338197, 305440, 338218, 321840, 379186, 321860, 182597, 280902, 289110, 215385, 354655, 321894, 313713, 354676, 436608, 362881, 240002, 436611, 108944, 190871, 149916, 420253, 141728, 289189, 289194, 108972, 272813, 338356, 436661, 281037, 289232, 281040, 256477, 330218, 109042, 174593, 420369, 289304, 322078, 207393, 289332, 174648, 338489, 338490, 322120, 281166, 281171, 297560, 436832, 436834, 420463, 346737, 313971, 346740, 420471, 330379, 330387, 117396, 346772, 330388, 117397, 264856, 289434, 346779, 289462, 314040, 109241, 158394, 248517, 363211, 363230, 289502, 264928, 330474, 289518, 199414, 191235, 264968, 322313, 322316, 117517, 322319, 166676, 207640, 281377, 289576, 191283, 273207, 289598, 281427, 281433, 322395, 109409, 330609, 174963, 207732, 109428, 158593, 240518, 109447, 224145, 355217, 256922, 289690, 289698, 420773, 289703, 240552, 363438, 347055, 289722, 289727, 273344, 330689, 363458, 379844, 19399, 248796, 347103, 52200, 289774, 347123, 240630, 314362, 257024, 330754, 134150, 330763, 281626, 175132, 248872, 322612, 314448, 339030, 281697, 314467, 257125, 281706, 273515, 207979, 404593, 363641, 363644, 150657, 248961, 330888, 363669, 339100, 380061, 429214, 199839, 339102, 265379, 249002, 306346, 3246, 421048, 208058, 322749, 265412, 290000, 298208, 298212, 298213, 290022, 330984, 298221, 298228, 216315, 208124, 437505, 322824, 257305, 126237, 339234, 372009, 412971, 298291, 306494, 216386, 224586, 372043, 331090, 314709, 314710, 372054, 159066, 134491, 314720, 314726, 314728, 134506, 306542, 380271, 314739, 208244, 249204, 249205, 290169, 290173, 306559, 314751, 224640, 306560, 298374, 314758, 314760, 142729, 388487, 314766, 224661, 290207, 314783, 314789, 314791, 396711, 396712, 241066, 314798, 380337, 380338, 150965, 380357, 339398, 306631, 306639, 413137, 429542, 191981, 282096, 191990, 290301, 372227, 323080, 323087, 323089, 175639, 388632, 396827, 282141, 134686, 347694, 290358, 265798, 282183, 265804, 224847, 118353, 396882, 290390, 306776, 44635, 396895, 323172, 282213, 224883, 314998, 323196, 175741, 339584, 282246, 290443, 282259, 282273, 257699, 323236, 298661, 61101, 224946, 110268, 224958, 282303, 323264, 274115, 306890, 282318, 241361, 241365, 298720, 282339, 12010, 282348, 282358, 339715, 323331, 323332, 216839, 339720, 372496, 323346, 282400, 339745, 241441, 241442, 315171, 257830, 421672, 282417, 200498, 315202, 307011, 282434, 282438, 323406, 413521, 216918, 241495, 307039, 282474, 282480, 241528, 315264, 339841, 241540, 315273, 315274, 110480, 372626, 380821, 118685, 298909, 323507, 282549, 290745, 290746, 274371, 151497, 372701, 298980, 380908, 282633, 241692, 315432, 315434, 102445, 233517, 176175, 282672, 241716, 225351, 315465, 315476, 307289, 200794, 315487, 356447, 307299, 438377, 315498, 233589, 266357, 233590, 422019, 241808, 381073, 299174, 323762, 299187, 405687, 258239, 389313, 299203, 299209, 372941, 282831, 266449, 356576, 307435, 438511, 381172, 184575, 381208, 315673, 299293, 151839, 233762, 217380, 151847, 282919, 332083, 332085, 332089, 282939, 438596, 332101, 323913, 348492, 282960, 323920, 348500, 168281, 332123, 332127, 323935, 242023, 242029, 160110, 242033, 291192, 315773, 291198, 340357, 225670, 332167, 242058, 373134, 291224, 242078, 61857, 315810, 315811, 381347, 61859, 340398, 299441, 283064, 291265, 127427, 291267, 127428, 283075, 324039, 373197, 160225, 127465, 291311, 233978, 291333, 340490, 258581, 291358, 234036, 315960, 348732, 242237, 70209, 348742, 70215, 348749, 381517, 332378, 201308, 111208, 184940, 373358, 389745, 209530, 291454, 373375, 152195, 348806, 184973, 316049, 111253, 316053, 111258, 111259, 176808, 299699, 299700, 422596, 422599, 291530, 225995, 242386, 422617, 422626, 299746, 234217, 299759, 299776, 291585, 430849, 242433, 291592, 62220, 422673, 430865, 291604, 422680, 291612, 152365, 422703, 422709, 152374, 160571, 430910, 160575, 160580, 381773, 201549, 201551, 242529, 349026, 357218, 275303, 177001, 201577, 308076, 242541, 209783, 177019, 185211, 308092, 398206, 291712, 381829, 316298, 349072, 308112, 209817, 390045, 127902, 185250, 185254, 316333, 373687, 316343, 373706, 316364, 340961, 324586, 316405, 349175, 201720, 127992, 357379, 324625, 308243, 316437, 300068, 357414, 300084, 308287, 21569, 218186, 341073, 439384, 300135, 316520, 357486, 316526, 144496, 300150, 291959, 300151, 160891, 300158, 349316, 349318, 373903, 169104, 177296, 185493, 324760, 119962, 300187, 300188, 283802, 300201, 300202, 373945, 259268, 283847, 283852, 259280, 316627, 333011, 333022, 234733, 234742, 128251, 292091, 234755, 439562, 292107, 414990, 251153, 177428, 349462, 333090, 382258, 300343, 382269, 333117, 193859, 300359, 177484, 406861, 259406, 234831, 120148, 357719, 374109, 316765, 234850, 333160, 243056, 316787, 111993, 357762, 112017, 234898, 259475, 275859, 112018, 357786, 251298, 333220, 316842, 374191, 284089, 292283, 300487, 300489, 284107, 210390, 210391, 210393, 144867, 103909, 316902, 251378, 308723, 333300, 333303, 300536, 300542, 292356, 259599, 308756, 398869, 374296, 374299, 308764, 333343, 431649, 169518, 431663, 194110, 349763, 292423, 218696, 292425, 243274, 128587, 333388, 128599, 235095, 333408, 300644, 415338, 243307, 54893, 325231, 333430, 325245, 194180, 415375, 153251, 300714, 210603, 415420, 333503, 259781, 333509, 333517, 333520, 333521, 325346, 153319, 325352, 284401, 325371, 194303, 194304, 284431, 243472, 161554, 366360, 284442, 325404, 333610, 399147, 431916, 284459, 300848, 259899, 325439, 325445, 153415, 341836, 415567, 325457, 317269, 341847, 284507, 350044, 128862, 300894, 276327, 292712, 325484, 423789, 292720, 325492, 276341, 300918, 341879, 317304, 333688, 112509, 194429, 55167, 325503, 333701, 243591, 325515, 243597, 325518, 333722, 350109, 292771, 300963, 415655, 284587, 292782, 317360, 243637, 284619, 301008, 153554, 292836, 292837, 317415, 325619, 432116, 333817, 292858, 415741, 333828, 358410, 399373, 145435, 317467, 292902, 325674, 129076, 243767, 358456, 325694, 309345, 194666, 260207, 432240, 333955, 415881, 104587, 235662, 325776, 317587, 284826, 333991, 227513, 301251, 227524, 309444, 194782, 301279, 317664, 243962, 375039, 194820, 325905, 325912, 309529, 227616, 211235, 432421, 211238, 358703, 358709, 325968, 366929, 366930, 6481, 334171, 391520, 383332, 383336, 317820, 211326, 317831, 227725, 252308, 178582, 293274, 285084, 121245, 317852, 342450, 334260, 293303, 293310, 416197, 129483, 342476, 317901, 285150, 342498, 358882, 334309, 391655, 432618, 375276, 301571, 342536, 416286, 375333, 293419, 244269, 375343, 23092, 375351, 244281, 301638, 309830, 293448, 55881, 416341, 416351, 268899, 244327, 39530, 301689, 244347, 326287, 375440, 334481, 318106, 318107, 342682, 318130, 383667, 293556, 342706, 39614, 154316, 375526, 342762, 342763, 293612, 129773, 154359, 432893, 162561, 285444, 383754, 326414, 285458, 310036, 326429, 293664, 326433, 400166, 293672, 318250, 318252, 285487, 301871, 375609, 285497, 293693, 252741, 318278, 293711, 244568, 244570, 301918, 351077, 342887, 400239, 310131, 269178, 400252, 359298, 359299, 260996, 113542, 416646, 228233, 392074, 236428, 56208, 293781, 318364, 310176, 310178, 310182, 293800, 236461, 293806, 326581, 326587, 326601, 359381, 433115, 343005, 326635, 203757, 187374, 383983, 277492, 318461, 293886, 293893, 433165, 384016, 433174, 326685, 252958, 203830, 359478, 302139, 392290, 253029, 228458, 318572, 15471, 351344, 285814, 285820, 392318, 384131, 302213, 302216, 228491, 228493, 162961, 326804, 285851, 351390, 253099, 253100, 318639, 367799, 113850, 294074, 228540, 228542, 302274, 367810, 228563, 195808, 310497, 302325, 261377, 228609, 245019, 253216, 261425, 351537, 171317, 318775, 286013, 146762, 294218, 294219, 318805, 425304, 163175, 327024, 327025, 327031, 318848, 294275, 179587, 253317, 384393, 368011, 318864, 318868, 318875, 310692, 245161, 286129, 286132, 228795, 425405, 302531, 425418, 302540, 310732, 64975, 310736, 327121, 286172, 187878, 245223, 286202, 359930, 286205, 302590, 253451, 359950, 146964, 253463, 187938, 286244, 245287, 245292, 196164, 56902, 228943, 179801, 343647, 286306, 310889, 204397, 138863, 188016, 294529, 286343, 229001, 188048, 302739, 425626, 229020, 302754, 40613, 40614, 40615, 229029, 384695, 327358, 212685, 384720, 245457, 302802, 286423, 229088, 212716, 212717, 360177, 278272, 319233, 360195, 294678, 286494, 294700, 409394, 319292, 360252, 360264, 376669, 245599, 237408, 425825, 302946, 425833, 417654, 188292, 327557, 294807, 294809, 376732, 311199, 319392, 294823, 327596, 294843, 188348, 237504, 294850, 384964, 344013, 212942, 24532, 294886, 278512, 311281, 311282 ]
999dea7575e3d2da8ca1c68d7799d92ae8ab939c
d32f98ca0e22a40fb40b6fd98c3fc49c2046828a
/ChuckNorris/Controller/PiadaViewController.swift
df31ad601f2f573a5b92898989797c9d8f4f0d94
[]
no_license
juniorobici/ChuckNorris
88160f31cd890c18bbaadd255555e5046ebba3df
3c68e334ab640b1f67dee335bd47da397f2db89a
refs/heads/master
2020-09-06T05:54:27.255241
2019-11-07T23:07:44
2019-11-07T23:07:44
220,343,921
0
0
null
null
null
null
UTF-8
Swift
false
false
2,601
swift
// // PiadaViewController.swift // ChuckNorris // // Created by Junior Obici on 10/09/19. // Copyright © 2019 Junior Obici. All rights reserved. // import UIKit import Alamofire import AlamofireImage class PiadaViewController: UIViewController { // MARK: - Variaveis var piada: Piada? let urlPiadas: String = "https://api.chucknorris.io/jokes/random?category=" let urlPiadaAleatoria: String = "https://api.chucknorris.io/jokes/random" var categoriaSelecionada: String = "" typealias jsonStandard = [String : AnyObject] // MARK: - Componentes @IBOutlet weak var imagePiada: UIImageView! @IBOutlet weak var labelPiada: UILabel! @IBOutlet weak var activityLoading: UIActivityIndicatorView! override func viewDidLoad() { super.viewDidLoad() loadPiada(categoria: categoriaSelecionada) self.navigationItem.title = categoriaSelecionada.capitalized } // MARK: - Funcoes func loadPiada(categoria: String) { var url: String = "" if categoria != "" { url = self.urlPiadas+categoria } else { url = self.urlPiadaAleatoria } DispatchQueue.main.async { Alamofire.request(url).responseJSON(completionHandler: {(response) in let jsonData = response.data! do { var JSON = try JSONSerialization.jsonObject(with: jsonData, options: .mutableContainers) as! jsonStandard let piadaJson = Piada(categoria: ((JSON["categories"] as? [String])!), id: (JSON["id"] as? String)!, iconeUrl: (JSON["icon_url"] as? String)!, url: (JSON["url"] as? String)!, valor: (JSON["value"] as? String)!, dataInclusao: (JSON["created_at"] as? String)!, dataAtualizacao: (JSON["updated_at"] as? String)!) self.piada = piadaJson self.loadDados() } catch { print (error.localizedDescription) } }) } } func loadDados() { guard let iconeUrl = piada?.iconeUrl, let valor = piada?.valor else { return } getImage(urlImage: iconeUrl) self.labelPiada.text = valor self.activityLoading.stopAnimating() } func getImage(urlImage: String) { Alamofire.request(urlImage).responseImage { response in if let image = response.result.value { self.imagePiada.image = image } else { self.imagePiada.image = UIImage(named: "chuck-norris") } } } }
[ -1 ]
d6a70579eddadabc7ad8b279034640153251b38d
24cdb171aecabf10d763f8578ef7eebb2afdc1fc
/hacknyu/ViewController.swift
2084c6a8c76670b755bc92262ebb6dfca4dec5af
[ "MIT" ]
permissive
ishanhanda/WalkSafeiOS
17cb02673c1148195893eee8f624ac5de087e0dc
a73c4fe37fa6cca894d8ddfb61825e83552806df
refs/heads/master
2020-05-26T13:01:59.931867
2017-02-19T17:59:54
2017-02-19T17:59:54
82,478,251
0
0
null
null
null
null
UTF-8
Swift
false
false
10,462
swift
// // ViewController.swift // hacknyu // // Created by Ishan Handa on 19/02/17. // Copyright © 2017 Ishan Handa. All rights reserved. // import UIKit import GoogleMaps import LFHeatMap import GooglePlaces import SVProgressHUD class ViewController: UIViewController { @IBOutlet var mapView: MKMapView! @IBOutlet var imageView: UIImageView! // var mapView: GMSMapView! var directionsResponse: DirectionsResponse? @IBOutlet var fromField: UITextField! @IBOutlet var toField: UITextField! @IBOutlet var animationSwitch: UISwitch! var activeTextField: UITextField! var animates = false @IBAction func goButtonTapped(_ sender: Any) { mapView.removeOverlays(mapView.overlays) let from = self.fromField.text! let to = self.toField.text! SVProgressHUD.show() DispatchQueue.global(qos: .userInitiated).async { NYTimesAPIWrapper.sharedInstance.getDirections(to: to, from: from) { (apiResponse) in if let error = apiResponse.errorMsg { print(error) } else { DispatchQueue.main.async { SVProgressHUD.dismiss() self.directionsResponse = apiResponse.responseObject self.drawPaths(zoom: true) } } } } } override func viewDidLoad() { super.viewDidLoad() SVProgressHUD.setDefaultStyle(.dark) SVProgressHUD.setDefaultMaskType(.black) mapView.mapType = .standard let region = MKCoordinateRegion( center: CLLocationCoordinate2D.init(latitude: 40.754223, longitude: -73.982161), span: MKCoordinateSpan.init(latitudeDelta: 0.1, longitudeDelta: 0.1)) mapView.region = region mapView.delegate = self imageView.contentMode = .center self.fromField.delegate = self self.toField.delegate = self view.bringSubview(toFront: imageView) view.bringSubview(toFront: animationSwitch) self.animationSwitch.isOn = animates } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) } var primaryRoute: Route? = nil func drawPaths(zoom: Bool = false) { guard let response = directionsResponse else { return } for route in response.routes! { let path = GMSPath(fromEncodedPath: route.polyline!)! var coordinates: [CLLocationCoordinate2D] = [] for i in 0..<Int(path.count()) { coordinates += [path.coordinate(at: UInt(i))] } let line = MKPolyline(coordinates: coordinates, count: coordinates.count) line.title = route.polyline! self.mapView.add(line) if primaryRoute == nil { primaryRoute = route } } self.plotHeatMap(routes: response.routes!) if zoom { let path = GMSPath(fromEncodedPath: primaryRoute!.polyline!)! var coordinates: [CLLocationCoordinate2D] = [] for i in 0..<Int(path.count()) { coordinates += [path.coordinate(at: UInt(i))] } let polylines = MKPolyline(coordinates: coordinates, count: coordinates.count) let rect = MKCoordinateRegionForMapRect(polylines.boundingMapRect) self.mapView.setRegion(rect, animated: true) } } func plotHeatMap(routes: [Route]) { SVProgressHUD.show() DispatchQueue.global(qos: .userInitiated).async { var locations: [CLLocation] = [] for route in routes { let locs = route.crimeLocations!.map { (location) -> CLLocation in let location = CLLocation.init(latitude: location.lat!, longitude: location.long!) return location } locations += locs } let weights = Array.init(repeating: 1, count: locations.count) if self.animates { var heatmaps: [UIImage] = [] for i in stride(from: 0.2, to: 0.8, by: 0.01) { let heatmap = LFHeatMap.heatMap(for: self.mapView, boost: Float(i), locations: locations, weights: weights)! heatmaps += [heatmap] } let rev = heatmaps.reversed() heatmaps += rev DispatchQueue.main.async { SVProgressHUD.dismiss() self.imageView.animationImages = heatmaps self.imageView.animationDuration = 1 self.imageView.animationRepeatCount = 0 self.imageView.startAnimating() } } else { self.imageView.layer.removeAllAnimations() let heatmap = LFHeatMap.heatMap(for: self.mapView, boost: 0.4, locations: locations, weights: weights)! DispatchQueue.main.async { SVProgressHUD.dismiss() self.imageView.image = heatmap } } // Bounce back to the main thread to update the UI } } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } func polyLineWithEncodedString(encodedString: String) -> MKPolyline { let bytes = (encodedString as NSString).utf8String let length = encodedString.lengthOfBytes(using: String.Encoding.utf8) var idx: Int = 0 var count = length / 4 var coords = UnsafeMutablePointer<CLLocationCoordinate2D>.allocate(capacity: count) var coordIdx: Int = 0 var latitude: Double = 0 var longitude: Double = 0 while (idx < length) { var byte = 0 var res = 0 var shift = 0 repeat { idx += 1 byte = Int(bytes![idx] - Int8(0x3F)) res |= (byte & 0x1F) << shift shift += 5 } while (byte >= 0x20) let deltaLat = ((res & 1) != 0x0 ? ~(res >> 1) : (res >> 1)) latitude += Double(deltaLat) shift = 0 res = 0 repeat { idx += 1 byte = Int(bytes![idx] - Int8(0x3F)) res |= (byte & 0x1F) << shift shift += 5 } while (byte >= 0x20) let deltaLon = ((res & 1) != 0x0 ? ~(res >> 1) : (res >> 1)) longitude += Double(deltaLon) let finalLat: Double = latitude * 1E-5 let finalLon: Double = longitude * 1E-5 let coord = CLLocationCoordinate2DMake(finalLat, finalLon) coordIdx += 1 coords[coordIdx] = coord if coordIdx == count { let newCount = count + 10 let temp = coords // coords.deallocate(capacity: count) coords = UnsafeMutablePointer<CLLocationCoordinate2D>.allocate(capacity: newCount) for index in 0..<count { coords[index] = temp[index] } temp.deinitialize() count = newCount } } let polyLine = MKPolyline(coordinates: coords, count: coordIdx) coords.deinitialize() return polyLine } @IBAction func animateSwithcChanged(_ sender: Any) { self.animates = (sender as! UISwitch).isOn if let response = self.directionsResponse { self.plotHeatMap(routes: response.routes!) } } } extension ViewController: MKMapViewDelegate { func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer { if let line = overlay as? MKPolyline { let render = MKPolylineRenderer(overlay: line) render.strokeColor = UIColor.blue render.lineWidth = 5 return render } return MKPolylineRenderer() } func mapView(_ mapView: MKMapView, regionWillChangeAnimated animated: Bool) { self.imageView.isHidden = true self.animates = false } func mapView(_ mapView: MKMapView, regionDidChangeAnimated animated: Bool) { if let response = self.directionsResponse { self.plotHeatMap(routes: response.routes!) } self.imageView.isHidden = false } } extension ViewController: UITextFieldDelegate { public func textFieldDidBeginEditing(_ textField: UITextField) { let acController = GMSAutocompleteViewController() acController.delegate = self present(acController, animated: true, completion: nil) self.activeTextField = textField } } extension ViewController: GMSAutocompleteViewControllerDelegate { func viewController(_ viewController: GMSAutocompleteViewController, didAutocompleteWith place: GMSPlace) { (viewController as UIViewController).dismiss(animated: true, completion: nil) activeTextField.text = place.formattedAddress } func viewController(_ viewController: GMSAutocompleteViewController, didFailAutocompleteWithError error: Error) { (viewController as UIViewController).dismiss(animated: true, completion: nil) } // func viewController(_ viewController: GMSAutocompleteViewController, didSelect prediction: GMSAutocompletePrediction) -> Bool { // return true // self.dismiss(animated: viewController, completion: nil) // activeTextField.text = place.formattedAddress // } func wasCancelled(_ viewController: GMSAutocompleteViewController) { (viewController as UIViewController).dismiss(animated: true, completion: nil) } }
[ -1 ]
7410c4e1e4e89c286c0e4c7c6e5ddf1b5fab7549
d8da6829a91f45f59782422980ed51b37aebd3c8
/BlueCap/Configure/ConfigureScanNameViewController.swift
f2e0b7e1ad7b2da21345bcebb5ff7749e2270594
[ "MIT" ]
permissive
aircable/BlueCap
d23bbf40bb96317a4fcd34b07aa4a780521cdb53
5b563327202bcb5ceb20cebe8f863cbdbe11c7d3
refs/heads/master
2021-01-14T10:39:45.061912
2014-11-15T03:25:32
2014-11-15T03:25:32
null
0
0
null
null
null
null
UTF-8
Swift
false
false
2,346
swift
// // ConfigureScanNameViewController.swift // BlueCap // // Created by chris clogg on 2014-11-14. // Copyright (c) 2014 gnos.us. All rights reserved. // import UIKit import CoreBluetooth class ConfigureScanNameViewController : UIViewController, UITextFieldDelegate { @IBOutlet var nameTextField : UITextField! @IBOutlet var doNotDisplayWithoutNameSwitch : UISwitch! var serviceName : String? required init(coder aDecoder:NSCoder) { super.init(coder:aDecoder) } override func viewDidLoad() { super.viewDidLoad() if let serviceName = self.serviceName { self.nameTextField.text = serviceName if let doNotDisplayWithoutName = ConfigStore.getScannedNameBool(serviceName) { self.doNotDisplayWithoutNameSwitch.on = doNotDisplayWithoutName } } } // UITextFieldDelegate func textFieldShouldReturn(textField: UITextField!) -> Bool { self.nameTextField.resignFirstResponder() return true } @IBAction func toggleDoNotDisplayDeviceWithoutName(sender:AnyObject) { } @IBAction func doneTapped(sender:AnyObject) { let enteredName = self.nameTextField.text let doNotDisplayDevicesWithoutName = self.doNotDisplayWithoutNameSwitch.on if enteredName != nil { if !enteredName!.isEmpty { if let serviceName = self.serviceName { // updating ConfigStore.addScannedName(enteredName!, doNotDisplayWithoutName: doNotDisplayDevicesWithoutName) if serviceName != enteredName! { ConfigStore.removeScannedService(self.serviceName!) } } else { // new entry ConfigStore.addScannedName(enteredName!, doNotDisplayWithoutName: doNotDisplayDevicesWithoutName) } self.navigationController?.popViewControllerAnimated(true) } else { self.presentViewController(UIAlertController.alertOnErrorWithMessage("Need to enter a name!"), animated:true, completion:nil) } } } }
[ -1 ]
56653f42f4839c52a14a9d644a7dce8bbf98b084
5f162c5676a8f48fe5057d9e51d7d7a16aec6c4c
/solus/Koleda/Koleda/Modules/Setup/SmartScheduling/SmartScheduleList/TabContentRouter.swift
efc2d73d5a7a7268be091b6f91b6622a173cdfd8
[]
no_license
oanhtranha/Korelda_re
6b4996e7818dfbacdd9eea33f00736ef4a09ee7f
aa76fb6d1ad3dfd82ea220319c9dfdefcaa2ddd9
refs/heads/master
2023-04-21T18:54:38.281155
2021-05-07T07:06:28
2021-05-07T07:06:28
365,144,776
0
0
null
null
null
null
UTF-8
Swift
false
false
949
swift
// // TabContentRouter.swift // Koleda // // Created by Oanh tran on 10/31/19. // Copyright © 2019 koleda. All rights reserved. // import Foundation import UIKit class TabContentRouter: BaseRouterProtocol { weak var baseViewController: UIViewController? enum RouteType { } func dismiss(animated: Bool, context: Any?, completion: ((Bool) -> Void)?) { } func enqueueRoute(with context: Any?, animated: Bool, completion: ((Bool) -> Void)?) { guard let routeType = context as? RouteType else { assertionFailure("The route type missmatches") return } guard let baseViewController = baseViewController else { assertionFailure("baseViewController is not set") return } } func present(on baseVC: UIViewController, animated: Bool, context: Any?, completion: ((Bool) -> Void)?) { } }
[ -1 ]
e9bbe0e159ac2942de2d6158099cb988e03ec94b
ffb40975ffd62f5609b293eba57024c1bd50faf6
/Sources/AST/Decl.swift
4e2012426d7d87e714dfbd16bfb7e910230d3fbe
[ "MIT" ]
permissive
MaxDesiatov/trill
b4f1a16c3dde918b45a6a4b037e5a5a763c61d94
568e2b37786f3fcefb4b9d47bfabc32b4f401ac4
refs/heads/master
2020-05-09T19:11:06.668826
2019-04-14T21:18:03
2019-04-14T21:18:03
181,370,094
0
0
MIT
2019-04-14T21:17:17
2019-04-14T21:17:17
null
UTF-8
Swift
false
false
1,052
swift
/// /// Decl.swift /// /// Copyright 2016-2017 the Trill project authors. /// Licensed under the MIT License. /// /// Full license text available at https://github.com/trill-lang/trill /// import Source public enum DeclKind { case function case variable case type case `extension` case `protocol` case diagnostic } public enum DeclModifier: String { case foreign = "foreign" case `static` = "static" case mutating = "mutating" case indirect = "indirect" case noreturn = "noreturn" case implicit = "implicit" public var description: String { return self.rawValue } public func isValid(on kind: DeclKind) -> Bool { switch (self, kind) { case (.foreign, .function), (.static, .function), (.mutating, .function), (.noreturn, .function), (.indirect, .type), (.implicit, .function), (.implicit, .type), (.implicit, .variable), (.foreign, .type), (.foreign, .variable): return true default: return false } } }
[ -1 ]
bce7cc774e995cb278f4314a399e2bf1537595de
8622b3772ad53972c8ea006defec07d2b77f33f4
/StretchHeaderTutirial/Model/Sections.swift
264bb2a85c9d7a6896438ebea2e0d0b7d0c36576
[]
no_license
kimtaesu/StretchHeader
7197f2c99c8f57e80c46bedd61ac24ae4ec3437a
9e1c0d195db1e751a636309017acce716f0e7bbf
refs/heads/master
2020-07-10T05:44:33.743026
2019-09-02T21:10:06
2019-09-02T21:10:06
204,181,525
10
0
null
null
null
null
UTF-8
Swift
false
false
602
swift
// // Sections.swift // StretchHeaderTutirial // // Created by tskim on 25/08/2019. // Copyright © 2019 hucet. All rights reserved. // import Foundation struct WeatherDaySlotSection: SectionModelType { var items: [WeatherDaySlot] var identity: String { return "daysection" } init(items: [WeatherDaySlot]) { self.items = items } } struct WeatherTimeSlotSection: SectionModelType { var items: [WeatherTimeSlot] var identity: String { return "timesection" } init(items: [WeatherTimeSlot]) { self.items = items } }
[ -1 ]
bba14db666cb351299bdfb8165cad42455f35569
42d11f1c513f127d6013ac751daaa57d7cc84b9f
/TableViewAppUITests/TableViewAppUITests.swift
c013027c4a1cfc40ceae99c32047e8b8575d141b
[]
no_license
skrall3119/TableViewApp
139fece53b62e6dd9e5ff6c6deedb229627f975c
962a7491abd5ad144c5a6777f717ef7f1000e940
refs/heads/main
2022-12-31T10:17:47.928407
2020-10-06T06:40:31
2020-10-06T06:40:31
301,636,781
0
0
null
null
null
null
UTF-8
Swift
false
false
1,426
swift
// // TableViewAppUITests.swift // TableViewAppUITests // // Created by Alex Janci on 10/6/20. // import XCTest class TableViewAppUITests: XCTestCase { override func setUpWithError() throws { // Put setup code here. This method is called before the invocation of each test method in the class. // In UI tests it is usually best to stop immediately when a failure occurs. continueAfterFailure = false // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. } override func tearDownWithError() throws { // Put teardown code here. This method is called after the invocation of each test method in the class. } func testExample() throws { // UI tests must launch the application that they test. let app = XCUIApplication() app.launch() // Use recording to get started writing UI tests. // Use XCTAssert and related functions to verify your tests produce the correct results. } func testLaunchPerformance() throws { if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) { // This measures how long it takes to launch your application. measure(metrics: [XCTApplicationLaunchMetric()]) { XCUIApplication().launch() } } } }
[ 360463, 155665, 376853, 344106, 253996, 385078, 180279, 163894, 352314, 213051, 376892, 32829, 286787, 352324, 237638, 352327, 385095, 393291, 163916, 368717, 311373, 196687, 278607, 311377, 254039, 426074, 368732, 180317, 32871, 352359, 221292, 278637, 319599, 385135, 376945, 131190, 385147, 131199, 426124, 196758, 49308, 65698, 311459, 49317, 377010, 180409, 295099, 377025, 377033, 164043, 417996, 254157, 368849, 368850, 139478, 229591, 385240, 254171, 147679, 147680, 311520, 205034, 254189, 286957, 254193, 344312, 336121, 147716, 368908, 180494, 368915, 254228, 319764, 278805, 262419, 377116, 254250, 311596, 131374, 418095, 336177, 180534, 155968, 287040, 311622, 270663, 368969, 254285, 180559, 377168, 344402, 229716, 368982, 139641, 385407, 385409, 106893, 270733, 385423, 385433, 213402, 385437, 254373, 156069, 385448, 385449, 115116, 385463, 319931, 278974, 336319, 336323, 188870, 278988, 278992, 377309, 377310, 369121, 369124, 279014, 270823, 279017, 311787, 213486, 360945, 279030, 139766, 393719, 279033, 377337, 254459, 410108, 410109, 262657, 279042, 377346, 279053, 410126, 393745, 385554, 303635, 279060, 279061, 262673, 254487, 279066, 410138, 188957, 377374, 385569, 385578, 377388, 197166, 393775, 418352, 352831, 33344, 385603, 377419, 385612, 303693, 426575, 369236, 385620, 115287, 189016, 270938, 287327, 279143, 279150, 287345, 352885, 352886, 344697, 189054, 287359, 369285, 311944, 344714, 311950, 377487, 311953, 287379, 336531, 180886, 426646, 352921, 377499, 221853, 344737, 295591, 352938, 295598, 279215, 418479, 279218, 164532, 336565, 287418, 303802, 377531, 377534, 377536, 66243, 385737, 287434, 279249, 303826, 385745, 369365, 369366, 385751, 230105, 361178, 352989, 352990, 295649, 418529, 385763, 295653, 369383, 230120, 361194, 312046, 344829, 279293, 205566, 197377, 312076, 434956, 295698, 418579, 426772, 197398, 426777, 221980, 344864, 197412, 336678, 262952, 189229, 262957, 164655, 328495, 197424, 197428, 336693, 230198, 377656, 197433, 426809, 222017, 295745, 377669, 197451, 369488, 279379, 385878, 385880, 295769, 197467, 230238, 435038, 279393, 303973, 279398, 197479, 385895, 385901, 197489, 295799, 164730, 336765, 254851, 369541, 172936, 320394, 426894, 377754, 140203, 172971, 304050, 377778, 189362, 189365, 189373, 377789, 345030, 345034, 279499, 418774, 386007, 418781, 386016, 123880, 418793, 320495, 222193, 435185, 271351, 214009, 312313, 435195, 328701, 312317, 328705, 386049, 418819, 410629, 377863, 189448, 230411, 361487, 386068, 254997, 336928, 336930, 410665, 345137, 361522, 312372, 238646, 238650, 320571, 386108, 410687, 336962, 238663, 377927, 361547, 205911, 156763, 361570, 214116, 230500, 214119, 402538, 279659, 173168, 230514, 238706, 279666, 312435, 377974, 66684, 279686, 222344, 402568, 140426, 337037, 386191, 222364, 418975, 124073, 402618, 148674, 402632, 148687, 189651, 419028, 279766, 189656, 304353, 279780, 222441, 279789, 386288, 66802, 271607, 369912, 369913, 386296, 279803, 419066, 386300, 386304, 369929, 419097, 320795, 115997, 222496, 320802, 304422, 369964, 353581, 116014, 66863, 312628, 345397, 345398, 222523, 386363, 345418, 337226, 353611, 353612, 230730, 337228, 296269, 353617, 222542, 238928, 296274, 378201, 230757, 296304, 312688, 337280, 353672, 296328, 296330, 263561, 9618, 279955, 370066, 411028, 370072, 148899, 148900, 361928, 337359, 329168, 312785, 329170, 222674, 353751, 280025, 239069, 361958, 280042, 280043, 271850, 271853, 329198, 337391, 411119, 116209, 296434, 386551, 288252, 271880, 198155, 329231, 304655, 370200, 222754, 157219, 157220, 394793, 312879, 288305, 288319, 288322, 280131, 288328, 353875, 312937, 271980, 206447, 403057, 42616, 337533, 280193, 370307, 419462, 149127, 149128, 288391, 419464, 411275, 239251, 345753, 198304, 255651, 337590, 370359, 280252, 280253, 321217, 239305, 296649, 403149, 313042, 345813, 370390, 272087, 345817, 337638, 181992, 345832, 345835, 288492, 141037, 313082, 288508, 288515, 173828, 395018, 116491, 395019, 395026, 116502, 435993, 345882, 411417, 255781, 362281, 378666, 403248, 378673, 182070, 182071, 345910, 436029, 345918, 337734, 280396, 272207, 272208, 337746, 395092, 345942, 362326, 370526, 345950, 362336, 255844, 296807, 214894, 362351, 313200, 214896, 313204, 182145, 280451, 67464, 305032, 337816, 329627, 239515, 354210, 436130, 436135, 313257, 10153, 362411, 370604, 362418, 411587, 280517, 362442, 346066, 231382, 354268, 403421, 436189, 329696, 354273, 403425, 354279, 436199, 174058, 247787, 329707, 354283, 247786, 296942, 337899, 436209, 239610, 182277, 346117, 354310, 354312, 354311, 43016, 403463, 313356, 436235, 419857, 305173, 436248, 223269, 346153, 354346, 313388, 272432, 403507, 378933, 378934, 436283, 288835, 403524, 436293, 313415, 239689, 436304, 329812, 223317, 411738, 272477, 280676, 313446, 395373, 288878, 346237, 215165, 436372, 329884, 378186, 362658, 215204, 436388, 133313, 395458, 338118, 436429, 346319, 379102, 387299, 18661, 379110, 338151, 149743, 379120, 436466, 411892, 395511, 436471, 313595, 436480, 272644, 338187, 338188, 395536, 338196, 272661, 379157, 157973, 338217, 321839, 362809, 379193, 395591, 289109, 272730, 436570, 215395, 239973, 280938, 321901, 354671, 362864, 354672, 272755, 354678, 199030, 223611, 436609, 436613, 395653, 395660, 264591, 420241, 240020, 190870, 190872, 289185, 436644, 289195, 272815, 436659, 338359, 436677, 289229, 281038, 281039, 256476, 420326, 166403, 420374, 322077, 289328, 330291, 322119, 191065, 436831, 420461, 346739, 346741, 420473, 297600, 166533, 346771, 363155, 264855, 363161, 289435, 436897, 248494, 166581, 355006, 363212, 363228, 322269, 436957, 436960, 264929, 338658, 289511, 330473, 346859, 330476, 289517, 215790, 199415, 289534, 322302, 35584, 133889, 322312, 346889, 166677, 207639, 363295, 355117, 191285, 355129, 273209, 273211, 355136, 355138, 420680, 355147, 355148, 355153, 281426, 387927, 363353, 281434, 363354, 420702, 363361, 363362, 281444, 355173, 355174, 412516, 207724, 355182, 207728, 420722, 314240, 158594, 330627, 240517, 265094, 387977, 396171, 355216, 224146, 224149, 256918, 256919, 256920, 240543, 256934, 289720, 273336, 289723, 273341, 330688, 379845, 363462, 19398, 273353, 191445, 207839, 347104, 314343, 134124, 412653, 248815, 257007, 347122, 437245, 257023, 125953, 396292, 330759, 347150, 330766, 412692, 330789, 248871, 281647, 412725, 257093, 404550, 207954, 339031, 257126, 265318, 322664, 404582, 265323, 404589, 273523, 363643, 248960, 363658, 404622, 224400, 347286, 265366, 339101, 429216, 265381, 380069, 3243, 208044, 322733, 421050, 339131, 265410, 183492, 273616, 339167, 298209, 421102, 52473, 363769, 208123, 52476, 412926, 437504, 322826, 388369, 380178, 429332, 126229, 412963, 257323, 273713, 298290, 208179, 159033, 347451, 372039, 257353, 257354, 109899, 437585, 331091, 150868, 314708, 372064, 429410, 437602, 281958, 388458, 265579, 306541, 421240, 224637, 388488, 298378, 306580, 282008, 396697, 282013, 290206, 396709, 298406, 241067, 380331, 314797, 380335, 355761, 421302, 134586, 380348, 216510, 216511, 380350, 306630, 200136, 273865, 306634, 339403, 372172, 413138, 437726, 429540, 3557, 3559, 191980, 282097, 265720, 216575, 290304, 437766, 323083, 208397, 323088, 413202, 388630, 413206, 175640, 372261, 347693, 323120, 396850, 200245, 323126, 290359, 134715, 323132, 421437, 396865, 282182, 413255, 265800, 273992, 421452, 265809, 396885, 290391, 265816, 306777, 396889, 388699, 396896, 388712, 388713, 314997, 290425, 339579, 396927, 282248, 224907, 405140, 274071, 323226, 208547, 208548, 405157, 282279, 388775, 364202, 421556, 224951, 224952, 306875, 282302, 323262, 241366, 224985, 282330, 159462, 397040, 12017, 323315, 274170, 200444, 175874, 249606, 282379, 216844, 372497, 397076, 421657, 339746, 216868, 257831, 241447, 167720, 421680, 282418, 421686, 274234, 339782, 315209, 159563, 339799, 307038, 274276, 282471, 274288, 372592, 274296, 339840, 372625, 282517, 298912, 118693, 438186, 126896, 380874, 372699, 323554, 380910, 380922, 380923, 274432, 372736, 241695, 430120, 102441, 315433, 282671, 430127, 405552, 241717, 249912, 225347, 307269, 233548, 176209, 315477, 53334, 381013, 200795, 356446, 323678, 438374, 176231, 233578, 438378, 422000, 249976, 266361, 422020, 168069, 381061, 168070, 381071, 241809, 430231, 200856, 422044, 192670, 192671, 299166, 258213, 299176, 323761, 184498, 430263, 266427, 299208, 266447, 372943, 356575, 307431, 438512, 372979, 389364, 381173, 135416, 356603, 184574, 217352, 266504, 61720, 381210, 282908, 389406, 282912, 233761, 438575, 315698, 266547, 332084, 397620, 438583, 127292, 438592, 332100, 323914, 201037, 397650, 348499, 250196, 348501, 389465, 332128, 242027, 242028, 110955, 160111, 250227, 315768, 291193, 438653, 291200, 266628, 340356, 242059, 225684, 373141, 291225, 389534, 397732, 373196, 176602, 242138, 184799, 291297, 201195, 324098, 233987, 340489, 397841, 283154, 258584, 291359, 348709, 348710, 397872, 283185, 234037, 340539, 266812, 348741, 381515, 348748, 430681, 332379, 242274, 184938, 373357, 184942, 176751, 389744, 356983, 356984, 209529, 356990, 291455, 373377, 422529, 152196, 201348, 356998, 348807, 356999, 316044, 275102, 340645, 176805, 176810, 160441, 422591, 291529, 225996, 135888, 242385, 234216, 373485, 373486, 21239, 348921, 234233, 275193, 242428, 299777, 430853, 430860, 62222, 430880, 234276, 234290, 152372, 160569, 430909, 160576, 348999, 283466, 439118, 234330, 275294, 381791, 127840, 357219, 439145, 177002, 308075, 381811, 201590, 177018, 398205, 340865, 291713, 349066, 316299, 349068, 234382, 308111, 381840, 308113, 390034, 373653, 430999, 209820, 381856, 398244, 185252, 422825, 381872, 177074, 398268, 349122, 398275, 127945, 373705, 340960, 398305, 340967, 398313, 234476, 127990, 349176, 201721, 349179, 234499, 357380, 398370, 357413, 357420, 300087, 21567, 308288, 398405, 349254, 250955, 218187, 300109, 234578, 250965, 439391, 250982, 398444, 62574, 357487, 300147, 119925, 349304, 234626, 349315, 349317, 234635, 373902, 234655, 234662, 373937, 373939, 324790, 300215, 218301, 283841, 283846, 259275, 316628, 259285, 357594, 414956, 251124, 316661, 292092, 439550, 242955, 439563, 414989, 349458, 259346, 382243, 382246, 292145, 382257, 382264, 333115, 193853, 193858, 251212, 234830, 406862, 259408, 283990, 357720, 300378, 300379, 374110, 234864, 382329, 259449, 243073, 357763, 112019, 398740, 234902, 333224, 374189, 251314, 284086, 259513, 54719, 292291, 300490, 300526, 259569, 251379, 300539, 398844, 210429, 366081, 316951, 374297, 153115, 431646, 349727, 431662, 374327, 210489, 235069, 349764, 292424, 292426, 128589, 333389, 333394, 349780, 128600, 235096, 300643, 300645, 415334, 54895, 366198, 210558, 210559, 325246, 415360, 210569, 415369, 431754, 267916, 415376, 259741, 153252, 399014, 210601, 202413, 415419, 259780, 333508, 267978, 333522, 325345, 333543, 325357, 431861, 284410, 161539, 284425, 300812, 284430, 366358, 169751, 431901, 341791, 186148, 186149, 284460, 399148, 202541, 431918, 153392, 431935, 415555, 325444, 153416, 325449, 341837, 415566, 431955, 325460, 341846, 300893, 259937, 382820, 276326, 415592, 292713, 292719, 325491, 341878, 333687, 350072, 276343, 112510, 325508, 333700, 243590, 325514, 350091, 350092, 350102, 350108, 333727, 219046, 284584, 292783, 300983, 128955, 219102, 292835, 6116, 317416, 432114, 325620, 415740, 268286, 415744, 243720, 399372, 358418, 153618, 178215, 325675, 243763, 358455, 399433, 333902, 104534, 194667, 260206, 432241, 284789, 374913, 374914, 415883, 333968, 153752, 333990, 104633, 227517, 260285, 268479, 374984, 301270, 301271, 334049, 325857, 268515, 383208, 317676, 260337, 260338, 432373, 375040, 309504, 260355, 432387, 375052, 194832, 325904, 391448, 268570, 178459, 186660, 334121, 317738, 325930, 358698, 260396, 358707, 432435, 178485, 358710, 14654, 268609, 227655, 383309, 383327, 391521, 366948, 416101, 416103, 383338, 432503, 211327, 432511, 227721, 285074, 252309, 39323, 285083, 317851, 285089, 375211, 334259, 129461, 342454, 358844, 293309, 317889, 326083, 416201, 129484, 326093, 154061, 416206, 285152, 432608, 391654, 432616, 334315, 375281, 293368, 317949, 334345, 309770, 342537, 432650, 342549, 342560, 416288, 350758, 350759, 358951, 358952, 293420, 219694, 219695, 375345, 244279, 309831, 375369, 375373, 416334, 301647, 416340, 244311, 260705, 416353, 375396, 268901, 244345, 334473, 375438, 326288, 285348, 293552, 342705, 285362, 383668, 342714, 39616, 383708, 342757, 269036, 432883, 342775, 203511, 383740, 432894, 162559, 375552, 228099, 285443, 285450, 383755, 326413, 285467, 326428, 318247, 342827, 318251, 391980, 301883, 342846, 416577, 416591, 244569, 375644, 252766, 293729, 351078, 342888, 392057, 211835, 392065, 260995, 400262, 392071, 424842, 236427, 252812, 400271, 392080, 400282, 7070, 211871, 359332, 359333, 293801, 326571, 252848, 326580, 261045, 261046, 326586, 359365, 211913, 326602, 252878, 342990, 56270, 433104, 359380, 433112, 433116, 359391, 343020, 187372, 203758, 383980, 383994, 384004, 433166, 384015, 433173, 293911, 326684, 252959, 384031, 375848, 318515, 203829, 261191, 375902, 375903, 392288, 253028, 351343, 187505, 138354, 187508, 384120, 302202, 285819, 343166, 285823, 384127, 392320, 285833, 285834, 318602, 228492, 253074, 326803, 187539, 359574, 285850, 351389, 302239, 253098, 302251, 367791, 367792, 367798, 64699, 294075, 228541, 343230, 367809, 253124, 113863, 351445, 310496, 195809, 253168, 351475, 351489, 367897, 367898, 245018, 130342, 130344, 130347, 261426, 212282, 294210, 359747, 359748, 114022, 253288, 425327, 425331, 327030, 163190, 384379, 253316, 294278, 384391, 318860, 253339, 253340, 318876, 343457, 245160, 359860, 359861, 343480, 310714, 228796, 228804, 425417, 310731, 327122, 425434, 310747, 310758, 253431, 359931, 187900, 343552, 245249, 228868, 409095, 294413, 359949, 253456, 302613, 253462, 146976, 245290, 245291, 343606, 163385, 425534, 138817, 147011, 147020, 196184, 179800, 212574, 343646, 204386, 155238, 204394, 138862, 310896, 294517, 188021, 286351, 188049, 425624, 229021, 245413, 286387, 384693, 376502, 286392, 302778, 409277, 286400, 409289, 425682, 286419, 294621, 245471, 155360, 294629, 212721, 163575, 286457, 286463, 319232, 360194, 409355, 155408, 417556, 294699, 204600, 319289, 384826, 409404, 360253, 409416, 237397, 376661, 368471, 425820, 368486, 384871, 409446, 40809, 368489, 425832, 417648, 417658, 360315, 253828, 327556, 311183, 425875, 294806, 294808, 253851, 376733, 204702, 319393, 294820, 253868, 204722, 188349, 98240, 212947, 212953, 360416, 294887, 253930, 327666, 385011 ]
07be8abbf5c7d070b37d9518cb40351630ef1f43
b3b1ccbf1c163135d8ef8d417d8bb622e5031c17
/NewsDemo/ViewModel/UserInfoViewModel.swift
f5d06e375c490194a71591cd64e2701ecb34aa80
[ "MIT" ]
permissive
youinmyheart/NewsDemo
8517f34cef237d39d741f19802fe61493f36bb0e
570e0835a6b6651b8463fdc2a5f0bfd9e6b1478a
refs/heads/master
2021-02-05T18:35:53.295630
2020-03-04T17:15:09
2020-03-04T17:15:09
243,813,382
0
0
null
null
null
null
UTF-8
Swift
false
false
413
swift
// UserInfoViewModel.swift // Created on 3/4/20.
 import UIKit class UserInfoViewModel: NSObject { private var userInfo: UserInfo var name: String? { return userInfo.name } var image: UIImage? { return userInfo.image } var email: String? { return userInfo.email } init(userInfo: UserInfo) { self.userInfo = userInfo } }
[ -1 ]
4f397a05ec2e73281836a2106918e1a642ac64ff
0e60231383a0b8455b43e2181c21bcac4ae10ec8
/TabProject/account/DataModel.swift
3bd5f76b537de0ac05b1d1da52bc60f4a009b8fc
[]
no_license
infrasanti/iOSfirstApp
4d7c4581d49853055fbebfaa8611f874c3d1c05f
ad437da5a109cf677d68c9a9a382ad3a6be0442c
refs/heads/master
2022-06-21T02:14:40.071654
2020-05-11T15:25:03
2020-05-11T15:25:03
261,488,553
0
0
null
null
null
null
UTF-8
Swift
false
false
1,919
swift
// // Model.swift // TableMultiCell // // Created by Santiago Ramirez on 28/04/2020. // Copyright © 2020 Santiago Ramirez. All rights reserved. // import Foundation public func dataFromFile(_ filename: String) -> Data? { @objc class TestClass: NSObject { } let bundle = Bundle(for: TestClass.self) if let path = bundle.path(forResource: filename, ofType: "json") { return (try? Data(contentsOf: URL(fileURLWithPath: path))) } return nil } class Profile { var fullName: String? var pictureUrl: String? var email: String? var about: String? var friends = [Friend]() var profileAttributes = [Attribute]() init?(data: Data) { do { if let json = try JSONSerialization.jsonObject(with: data) as? [String: Any], let body = json["data"] as? [String: Any] { self.fullName = body["fullName"] as? String self.pictureUrl = body["pictureUrl"] as? String self.about = body["about"] as? String self.email = body["email"] as? String if let friends = body["friends"] as? [[String: Any]] { self.friends = friends.map { Friend(json: $0) } } if let profileAttributes = body["profileAttributes"] as? [[String: Any]] { self.profileAttributes = profileAttributes.map { Attribute(json: $0) } } } } catch { print("Error deserializing JSON: \(error)") return nil } } } class Friend { var name: String? var pictureUrl: String? init(json: [String: Any]) { self.name = json["name"] as? String self.pictureUrl = json["pictureUrl"] as? String } } class Attribute { var key: String? var value: String? init(json: [String: Any]) { self.key = json["key"] as? String self.value = json["value"] as? String } }
[ -1 ]
4c0d4d86593bdf920998b2e989d97948ea21cd20
cf4d24c4f15d82b2719d358f5b35aff2f73468ec
/Ambassadoor Business/Statistics/StatisticsStruct.swift
41b1cc47805b5c572c18aa9379b0d78a8716a303
[]
no_license
anushram/Ambassadoor
09993d738e7f9595bd3aee05e0f1fafa6fa74413
1dcb5e4781842b66801c24199e42fe88d053d78e
refs/heads/master
2020-08-13T18:05:18.286688
2019-10-14T10:29:05
2019-10-14T10:29:05
215,012,753
0
0
null
null
null
null
UTF-8
Swift
false
false
452
swift
// // StatisticsStruct.swift // Ambassadoor Business // // Created by Marco Gonzalez Hauger on 10/1/19. // Copyright © 2019 Tesseract Freelance, LLC. All rights reserved. // import Foundation import UIKit //Refer to Ambassadoor Documentation on use cases. struct StatInfluencer { var username: String var OfferStatus: String } struct StatisticsStruct { var TotalLikes: Double var TotalComments: Double var influencers: [StatInfluencer] }
[ -1 ]
9953b5db244a0e4dfe837e86daf2f174cb9bf52e
591795d164c5e32ec8267116a1d2323dd6d06e3b
/SRMMegaStore/Controllers/CartTableViewCell.swift
040fdabf4319d66e8a747f50efafb277c7d3cca7
[]
no_license
sagarmusale8/SRMMegaStore
68e149a1a95a851f39eeceb24eb264a1541cbaf5
1c1845c617d15518f4e845ecdfd1f46ce88f5a0f
refs/heads/master
2020-09-16T15:00:59.072075
2017-10-13T12:18:44
2017-10-13T12:18:44
67,340,822
1
1
null
2017-10-13T12:18:45
2016-09-04T11:23:45
Swift
UTF-8
Swift
false
false
1,030
swift
// // CartTableViewCell.swift // SRMMegaStore // // Created by Sagar Musale on 23/08/16. // Copyright © 2016 SRM. All rights reserved. // import UIKit class CartTableViewCell: UITableViewCell { @IBOutlet weak var imgView: UIImageView! @IBOutlet weak var lblName: UILabel! @IBOutlet weak var lblPrice: UILabel! override func awakeFromNib() { super.awakeFromNib() // Initialization code } override func setSelected(selected: Bool, animated: Bool) { super.setSelected(selected, animated: animated) // Configure the view for the selected state } // Cleaning UI for reuse override func prepareForReuse() { lblPrice.text = "" lblName.text = "" imgView.image = nil } // setting up cell UI func setupCellUI(){ lblName.setProperties(UIColor.blackColor(), textFont: Fonts.Regular_16) lblPrice.setProperties(UIColor.grayColor(), textFont: Fonts.Regular_14) selectionStyle = .None } }
[ 380362 ]
4c075bf3b4a248ba3f0a9dff76dc8e8ac3705618
3e8f692d849f36872008739f324e81654d1eeb1e
/View/SimpleDetailView.swift
6d729cc32dcc14d1887f77e11955e25c5033f76c
[]
no_license
devoxx/SwiftMobileApp
c6b2e12d36b44605f239d22f8772040c3dcca55b
61f32c53ebb951e78a2149dcdcfbd57e6beeddaf
refs/heads/develop
2021-01-21T23:53:33.754081
2016-11-04T03:17:49
2016-11-04T03:17:49
53,817,136
3
5
null
2016-11-04T03:17:49
2016-03-14T01:15:35
Swift
UTF-8
Swift
false
false
1,833
swift
// // SimpleDetailView.swift // devoxxApp // // Created by got2bex on 2016-02-24. // Copyright © 2016 maximedavid. All rights reserved. // import Foundation import UIKit class SimpleDetailView : UIView { let iconView = UIImageView() let textView = TopInfoDetailView() override init(frame: CGRect) { super.init(frame: frame) //backgroundColor = UIColor.redColor() iconView.translatesAutoresizingMaskIntoConstraints = false iconView.contentMode = .Top iconView.tintColor = ColorManager.grayImageColor textView.translatesAutoresizingMaskIntoConstraints = false //iconView.backgroundColor = UIColor.purpleColor() //textView.backgroundColor = UIColor.grayColor() addSubview(iconView) addSubview(textView) let views = ["iconView": iconView, "textView" : textView] let constH = NSLayoutConstraint.constraintsWithVisualFormat("H:|-0-[iconView(50)]-0-[textView]-0-|", options: .AlignAllCenterY, metrics: nil, views: views) let constV = NSLayoutConstraint.constraintsWithVisualFormat("V:|-0-[iconView]-0-|", options: .AlignAllCenterX, metrics: nil, views: views) let constV1 = NSLayoutConstraint.constraintsWithVisualFormat("V:|-0-[textView]-0-|", options: .AlignAllCenterX, metrics: nil, views: views) addConstraints(constH) addConstraints(constV) addConstraints(constV1) //self.layoutIfNeeded() //textView.configure() } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } }
[ -1 ]
3a960a634a0177eb2cde68bd6d5a60c264dba4fd
8e60a6ed613f536278d1106d370d7e5d24c01047
/ios/Runner/AppDelegate.swift
0e3f7d9cdebe08a8e5e9569cbd77d1ee01112c4c
[ "MIT" ]
permissive
narakai/pinger
2e5843f06373b029fe72b730b635ca5e19ad6784
5ab706c482502abb41a6616ec9ac38689f2ad17b
refs/heads/master
2023-01-08T20:29:28.556216
2020-11-09T11:13:32
2020-11-09T11:13:43
null
0
0
null
null
null
null
UTF-8
Swift
false
false
554
swift
import UIKit import Flutter @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { override func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { UIApplication.shared.isStatusBarHidden = false GeneratedPluginRegistrant.register(with: self) SimplePingChannel().register(controller: window.rootViewController as! FlutterViewController) return super.application(application, didFinishLaunchingWithOptions: launchOptions) } }
[ -1 ]
e4dbdbf90ac6448a32feb8dd10c90e52a5bc3ff3
074eeaca97ede0d28668c2205670504af512907d
/RoverpassDemo/CampgroundViewController.swift
8e2282353a86c3265819dc107a20f4fd150fc244
[]
no_license
jimmypocock/Demo
e27ceb79b084be42042fea1541330a33d05601b2
3f73724aec31b7c10574971a9d393499c9c38820
refs/heads/master
2021-01-11T17:52:46.564125
2017-01-27T04:18:38
2017-01-27T04:18:38
79,858,021
0
0
null
null
null
null
UTF-8
Swift
false
false
1,141
swift
// // CampgroundViewController.swift // RoverpassDemo // // Created by Jimmy Pocock on 1/26/17. // Copyright © 2017 Jimmy Pocock. All rights reserved. // // // CampgroundListViewController.swift // RoverpassDemo // // Created by Jimmy Pocock on 1/25/17. // Copyright © 2017 Jimmy Pocock. All rights reserved. // import UIKit class CampgroundViewController: UIViewController { @IBOutlet var nameLabel: UILabel! @IBOutlet var pictureView: UIImageView! var campground: Campground! { didSet { navigationItem.title = campground.name } } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) nameLabel.text = campground.name PictureStore.fetchImage(for: campground.picture) { (imageResult) -> Void in switch imageResult { case let .success(image): OperationQueue.main.addOperation { self.pictureView.image = image } case let .failure(error): print("Error downloading image: \(error)") } } } }
[ -1 ]
30382858455045de57f9632f1ddc86ba51ac2346
b98edd9c2f322121020894b0037e6853468c696e
/LaunchXIV/AppDelegate.swift
97f8eaee57142b2c4b98a87fdb9788143d2a9530
[ "MIT" ]
permissive
ggscott/LaunchXIV
3db2a04d3a5c6ee5e071f13cc80c829c868672ec
f4f8247f4a9f2da773ba2c70d1e100ec80f7ee53
refs/heads/master
2023-08-31T12:14:07.241032
2021-11-02T07:56:51
2021-11-02T07:56:51
null
0
0
null
null
null
null
UTF-8
Swift
false
false
2,584
swift
// // AppDelegate.swift // LaunchXIV // // Created by Tyrone Trevorrow on 13/3/17. // Copyright © 2017 Tyrone Trevorrow. All rights reserved. // import Cocoa @NSApplicationMain class AppDelegate: NSObject, NSApplicationDelegate { var mainWC: MainWindowController? func applicationDidFinishLaunching(_ aNotification: Notification) { var settings: FFXIVSettings if NSEvent.modifierFlags.contains(.option) { settings = FFXIVSettings() } else { settings = FFXIVSettings.storedSettings() } startApplication(settings: settings) } func applicationWillTerminate(_ aNotification: Notification) { // Insert code here to tear down your application } func startApplication(settings: FFXIVSettings) { mainWC = MainWindowController(windowNibName: "MainWindowController") mainWC?.settings = settings if mainWC?.initialState() == .loading { // All settings are good to go, attempt to autologin doLogin(settings: settings) } else { mainWC?.showWindow(self) } } func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { return true } func applicationShouldTerminate(_ sender: NSApplication) -> NSApplication.TerminateReply { mainWC?.saveSettings() return .terminateNow } func doLogin(settings: FFXIVSettings) { let queue = OperationQueue() let op = LoginOperation(settings: settings) op.completionBlock = { switch op.loginResult { case .success(let sid, let updatedSettings)?: DispatchQueue.main.async { self.startGame(sid: sid, settings: updatedSettings) } default: DispatchQueue.main.async { settings.credentials!.deleteLogin() var updatedSettings = settings updatedSettings.credentials = nil self.mainWC?.settings = updatedSettings self.mainWC?.showWindow(self) } } } queue.addOperation(op) } func startGame(sid: String, settings: FFXIVSettings) { let queue = OperationQueue() let op = StartGameOperation(settings: settings, sid: sid) op.completionBlock = { DispatchQueue.main.async { NSApp.terminate(nil) } } queue.addOperation(op) } }
[ -1 ]
447ef05088029a123e5d7992214c90f754528bbe
90e48db1c9a1ab61c880deca111825925516cb85
/KAI Membership/Extensions/UICollectionViewCell+Extensions.swift
ae4c6b7ea3fe8586d6f9e926e6a783a75babb3c5
[ "MIT" ]
permissive
trungthaihieu93-dev/kai-membership-swift
dceb4a7653644591b52f9d5ae15b56b45a874c03
aa56a7ac2f64f8d7da74c5826aaa4f4dd0ba34ba
refs/heads/main
2023-04-07T02:12:19.101313
2021-04-11T15:13:22
2021-04-11T15:13:22
359,314,723
0
1
MIT
2021-04-19T03:15:36
2021-04-19T03:15:36
null
UTF-8
Swift
false
false
246
swift
// // UICollectionViewCell+Extensions.swift // KAI Membership // // Created by Anh Kiệt on 05/03/2021. // import UIKit extension UICollectionViewCell { class var identifier: String { return NSStringFromClass(self) } }
[ -1 ]
26b6aee80c7ef320fb8b15559e6683b91d9872cf
50f9ce0985845c7b6e4d43c9c704f4246991e7db
/Sources/Intramodular/Typography/FontFamily.swift
6136c834b4541333a8abb573fd2b2bec8c90bbad
[ "MIT" ]
permissive
JohnMarcos/SwiftUIX
28dfc614a248e33d32cb256f42ee09ce980448f2
d93ba4ba82e7e0a51af72acd265f5e05293e174a
refs/heads/master
2023-08-17T22:02:13.019038
2021-09-18T14:26:00
2021-09-18T14:26:00
null
0
0
null
null
null
null
UTF-8
Swift
false
false
1,569
swift
// // Copyright (c) Vatsal Manot // import Swift import SwiftUI /// A font family. public protocol FontFamily: CaseIterable, RawRepresentable { var rawValue: String { get } /// The font weight that corresponds to this font. var weight: Font.Weight? { get } } // MARK: - API - extension FontFamily { public func callAsFunction(size: CGFloat) -> Font { Font.custom(rawValue, size: size) } } extension Font { public static func custom<F: FontFamily>(_ family: F.Type, size: CGFloat, weight: Weight) -> Font { guard let font = family.allCases.first(where: { $0.weight == weight }) else { assertionFailure("The font family \(family) does not support \(weight) as a valid weight") return Font.system(size: size, weight: weight) } return custom(font.rawValue, size: size) } #if canImport(UIKit) public static func custom<F: FontFamily>(_ family: F.Type, style: Font.TextStyle) -> Font { let metrics = style.defaultMetrics return .custom(family, size: metrics.size, weight: metrics.weight) } #endif } extension Text { /// Sets the default font for text in the view. public func font<F: FontFamily>(_ font: F, size: CGFloat) -> Text { self.font(.custom(font.rawValue, size: size)) } } extension View { /// Sets the default font for text in this view. public func font<F: FontFamily>(_ font: F, size: CGFloat) -> some View { self.font(.custom(font.rawValue, size: size)) } }
[ -1 ]
9bfc7ed7a18c81224e856e7d7f9edac56b72117e
964aaaccf0f0cd79c00b76f4a6f80ba717cbadda
/MyCV/View/Views/InitialViewController.swift
982b2b17655ac84fcf70a7f0b5e9c0920db84a0f
[ "MIT" ]
permissive
angel-eduardo-vazquez-alvarez/myCV
ce003926fe09b0d733d5f836c90e5a3ee3e19cd8
bfe257a4da9332ad2f160dab6f161d7bac09450f
refs/heads/master
2020-06-06T17:56:57.960498
2019-06-19T22:21:32
2019-06-26T23:39:50
192,814,241
0
1
null
null
null
null
UTF-8
Swift
false
false
2,176
swift
// // ViewController.swift // MyCV // // Created by Angel Eduardo Vazquez Alvarez on 6/19/19. // Copyright © 2019 Globant. All rights reserved. // import UIKit class InitialViewController: UIViewController { let viewModel = InitialViewModel(locator: UseCaseLocator.main) @IBOutlet weak var errorLabel: BoundLabel? @IBOutlet weak var errorContainerView: UIView? @IBOutlet weak var retryButton: UIButton? override func viewDidLoad() { super.viewDidLoad() configureUI() configureBinding() viewModel.start() } @IBAction func didTapRetry(_ sender: UIButton) { viewModel.start() } } // MARK: - InitialViewController Configuration extension InitialViewController { func configureUI() { guard let retryButton = retryButton else { return } retryButton.layer.cornerRadius = 3 retryButton.layer.borderWidth = 1 retryButton.layer.borderColor = UIColor.purple.cgColor } @objc func handleContainerView(isHidden: Bool) { guard let errorContainerView = errorContainerView, let retryButton = retryButton else { return } errorContainerView.isHidden = isHidden retryButton.isHidden = isHidden } func configureBinding() { guard let errorLabel = errorLabel else { return } errorLabel.bind(to: viewModel.currentState) viewModel.onFinishHandler = { [weak self] in guard let strongSelf = self else { return } switch strongSelf.viewModel.appState { case .finished: strongSelf.performSelector(onMainThread: #selector(UIViewController.performSegue), with: Identifiers.Segues.ShowCV, waitUntilDone: false) case .inProgress: strongSelf.performSelector(onMainThread: #selector(InitialViewController.handleContainerView), with: true, waitUntilDone: false) case .error: strongSelf.performSelector(onMainThread: #selector(InitialViewController.handleContainerView), with: false, waitUntilDone: false) default: break } } } }
[ -1 ]
01c30d053e12b3106df26507913af355f79a6ec1
fe7caa574d17d1ca4f23612328b9effefe7a3f1a
/HobbyApp/BusinessLogicLayer/NetworkLayer/MappingType.swift
d2758ebb7bc81954535269bd717174a172939585
[]
no_license
oleizer/HobbyApp
d639be7910776be6bd34528b26c29bfbe033dede
ea8bb03541b42634b90ca46d9141bf64d8a29375
refs/heads/master
2021-05-07T08:47:59.655077
2017-11-11T17:06:45
2017-11-11T17:06:45
109,415,645
0
0
null
2017-11-11T17:06:46
2017-11-03T16:05:01
Swift
UTF-8
Swift
false
false
1,232
swift
// // MappingType.swift // HobbyApp // // Created by Олег Лейзер on 05.11.2017. // Copyright © 2017 Олег Лейзер. All rights reserved. // import Foundation typealias FromJSONClosure = ([String: Any]) -> JSONAble enum MappingType: String { case errorType = "error" case errorsType = "Message" case noContentType = "204" case user = "user" case interest = "interest" case city = "city" case activity = "activity" var fromJSON: FromJSONClosure { switch self { case .user: return User.fromJSON case .noContentType: return UnknownJSONAble.fromJSON case .errorType: return City.fromJSON case .city: return City.fromJSON case .errorsType: return AppNetworkError.fromJSON case .interest: return Interest.fromJSON case .activity: return Activity.fromJSON } } } let UnknownJSONAbleVersion = 1 class UnknownJSONAble: JSONAble { convenience init() { self.init(version: UnknownJSONAbleVersion) } override class func fromJSON(_ data: [String: Any]) -> JSONAble { return UnknownJSONAble() } }
[ -1 ]
4b6c1f5e004beb18e8e905c0280a0298929993ac
e52b5a44e34326c83ea4c40194ae9df14187b905
/LandmarksUITests/LandmarksUITests.swift
ecde95cee947cc1d4b0f2644a4020891d717e5a2
[ "MIT" ]
permissive
nipapadak/Landmarks
dfb57dc059c6fc5aa6496dac334d95e37bb131ce
99d74a924a6356156ccceea260acc9879e1830e7
refs/heads/master
2020-06-04T15:57:47.289945
2019-06-22T13:34:25
2019-06-22T13:34:25
192,093,123
0
0
null
null
null
null
UTF-8
Swift
false
false
1,190
swift
// // LandmarksUITests.swift // LandmarksUITests // // Created by Nikolaos Papadakis on 6/4/19. // Copyright © 2019 Optimal Mobile Solutions Inc. All rights reserved. // import XCTest class LandmarksUITests: XCTestCase { override func 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. } func testExample() { // Use recording to get started writing UI tests. // Use XCTAssert and related functions to verify your tests produce the correct results. } }
[ 237599, 229414, 344106, 278571, 229425, 180279, 229431, 319543, 352314, 376892, 32829, 286787, 237638, 311373, 196687, 278607, 311377, 368732, 319599, 278642, 131190, 131199, 278669, 278676, 311447, 327834, 278684, 278690, 311459, 278698, 278703, 278707, 278713, 180409, 295099, 139459, 131270, 229591, 385240, 311520, 319719, 295147, 286957, 262403, 180494, 319764, 278805, 311582, 278817, 311596, 98611, 368949, 278843, 287040, 319812, 319816, 254285, 344402, 229716, 278895, 287089, 139641, 311679, 311692, 106893, 254373, 156069, 311723, 377265, 311739, 319931, 278974, 336319, 311744, 278979, 278988, 278992, 279000, 279009, 369121, 188899, 279014, 319976, 279017, 311787, 360945, 319986, 279030, 311800, 279033, 279042, 287237, 377352, 279053, 303634, 303635, 279061, 254487, 279066, 188954, 279092, 352831, 377419, 303693, 369236, 115287, 189016, 295518, 287327, 279143, 279150, 287345, 344697, 189054, 287359, 303743, 164487, 311944, 279176, 311948, 311950, 311953, 287379, 180886, 295575, 352921, 303772, 205469, 221853, 279207, 295591, 295598, 279215, 279218, 164532, 287412, 303802, 66243, 287434, 287438, 279253, 230105, 361178, 295653, 369383, 230120, 361194, 312046, 279278, 230133, 279293, 205566, 295688, 312076, 295698, 221980, 262952, 279337, 262953, 262957, 164655, 328495, 303921, 336693, 230198, 295745, 222017, 279379, 295769, 230238, 230239, 435038, 279393, 303973, 279398, 295797, 295799, 279418, 287623, 279434, 320394, 189327, 189349, 279465, 140203, 304050, 189373, 213956, 345030, 213961, 279499, 304086, 304104, 123880, 320492, 320495, 287730, 320504, 312313, 214009, 312317, 328701, 328705, 418819, 320520, 230411, 320526, 361487, 238611, 140311, 238617, 197658, 132140, 189487, 345137, 361522, 312372, 238646, 238650, 320571, 336962, 238663, 361547, 205911, 296023, 156763, 361570, 214116, 230500, 214119, 279659, 279666, 312435, 230514, 238706, 279686, 222344, 140426, 337037, 296091, 238764, 312519, 148687, 189651, 279766, 189656, 279775, 304352, 304353, 279780, 279789, 279803, 320769, 312588, 320795, 320802, 304422, 353581, 116014, 312628, 345397, 222523, 279872, 181568, 279874, 304457, 230730, 337226, 296269, 238928, 296274, 230757, 296304, 312688, 230772, 296328, 296330, 304523, 9618, 148899, 148900, 279979, 279980, 173492, 279988, 280003, 370122, 280011, 337359, 329168, 312785, 222674, 329170, 280020, 353751, 280025, 239069, 329181, 320997, 280042, 280043, 329198, 337391, 296434, 288248, 288252, 312830, 230922, 304655, 329231, 230933, 222754, 312879, 230960, 288305, 239159, 157246, 288319, 280131, 124486, 288328, 239192, 99937, 345697, 312937, 312941, 206447, 288377, 337533, 239238, 288391, 239251, 280217, 345753, 198304, 255651, 337590, 280252, 280253, 296636, 321217, 280259, 321220, 239305, 296649, 280266, 9935, 313042, 345813, 18139, 321250, 337638, 181992, 345832, 288492, 141037, 34547, 67316, 288508, 288515, 280326, 116491, 280333, 124691, 116502, 321308, 321309, 255781, 280367, 280373, 280377, 321338, 280381, 345918, 280386, 280391, 280396, 362326, 18263, 345942, 345950, 370526, 362336, 296807, 362351, 313200, 296815, 313204, 124795, 280451, 67464, 305032, 337816, 214936, 124826, 239515, 329627, 214943, 354210, 313257, 288698, 214978, 280517, 280518, 214983, 362442, 346066, 231382, 354268, 329696, 190437, 313322, 354283, 329707, 247786, 296942, 337899, 124912, 239610, 313338, 354312, 313356, 305173, 223269, 354342, 346153, 354346, 313388, 124974, 321589, 215095, 288829, 288835, 313415, 239689, 354386, 329812, 223317, 321632, 280676, 313446, 215144, 288878, 288890, 215165, 329884, 215204, 125108, 280761, 223418, 280767, 280779, 346319, 321744, 280792, 280803, 182503, 125166, 125170, 313595, 125184, 125192, 125197, 125200, 125204, 272661, 125215, 125216, 125225, 338217, 321839, 125236, 362809, 280903, 289109, 379224, 272730, 215395, 239973, 313703, 280938, 321901, 354671, 354672, 199030, 223611, 248188, 313726, 240003, 158087, 313736, 240020, 190870, 190872, 289185, 436644, 305572, 289195, 338359, 289229, 281038, 281039, 256476, 281071, 322057, 182802, 322077, 330291, 338491, 281165, 281170, 436831, 281200, 313970, 297600, 346771, 363155, 289435, 314020, 248494, 166581, 314043, 355006, 363212, 158424, 322269, 338658, 289511, 330473, 330476, 289517, 215790, 125683, 199415, 322302, 289534, 322312, 346889, 264971, 322320, 166677, 207639, 281378, 289580, 355129, 281407, 289599, 355136, 355138, 355147, 355148, 355153, 281426, 281434, 322396, 281444, 355173, 355174, 314240, 158594, 240517, 355216, 256920, 289691, 240543, 289699, 256934, 289704, 289720, 289723, 330688, 281541, 19398, 191445, 183254, 314343, 183276, 289773, 248815, 347122, 240631, 330759, 330766, 347150, 330789, 281647, 322609, 314437, 257093, 207954, 314458, 281698, 281699, 257126, 322664, 363643, 314493, 150656, 248960, 347286, 339101, 339106, 306339, 249003, 208044, 322733, 3243, 290001, 339167, 298209, 290030, 208123, 322826, 126229, 257323, 298290, 208179, 159033, 216387, 372039, 109899, 224591, 331091, 314708, 150868, 314711, 314721, 281958, 314727, 134504, 306541, 314734, 314740, 314742, 314745, 290170, 224637, 306558, 314752, 306561, 290176, 314759, 388488, 298378, 314765, 314771, 306580, 224662, 282008, 314776, 282013, 290206, 314788, 298406, 314790, 282023, 241067, 314797, 134586, 380350, 306630, 200136, 306634, 339403, 3559, 191980, 282097, 306678, 191991, 290304, 323079, 323083, 208397, 323088, 282132, 282135, 372261, 306730, 290359, 134715, 323132, 282182, 224848, 224852, 290391, 306777, 323171, 282214, 224874, 314997, 290425, 282244, 282248, 323208, 224907, 323226, 282272, 282279, 298664, 298666, 224951, 224952, 306875, 282302, 323262, 323265, 282309, 241360, 282321, 241366, 224985, 282330, 282336, 12009, 282347, 282349, 323315, 200444, 282366, 175874, 323335, 282375, 282379, 216844, 118549, 282390, 282399, 241440, 282401, 315172, 241447, 282418, 282424, 282428, 413500, 241471, 339782, 315209, 159563, 307024, 241494, 307030, 339799, 307038, 282471, 282476, 339840, 315265, 282503, 315272, 315275, 184207, 282517, 298912, 118693, 126896, 200628, 282572, 282573, 323554, 298987, 282634, 241695, 315431, 315433, 102441, 102446, 282671, 241717, 249912, 307269, 315468, 176209, 315477, 53334, 200795, 356446, 323678, 315488, 315489, 45154, 233578, 307306, 217194, 381071, 241809, 323730, 299166, 299176, 184489, 323761, 184498, 258233, 299197, 299202, 176325, 299208, 282832, 307431, 356603, 184574, 217352, 61720, 315674, 282908, 299294, 282912, 233761, 282920, 315698, 332084, 282938, 168251, 307514, 332100, 323914, 282959, 348499, 348501, 168280, 323934, 332128, 381286, 242027, 242028, 160111, 315768, 315769, 291194, 291193, 291200, 340356, 242059, 315798, 291225, 242079, 283039, 299449, 291266, 283088, 283089, 242138, 176602, 291297, 283138, 233987, 324098, 283154, 291359, 348709, 348710, 283185, 234037, 234044, 332379, 111197, 242274, 176751, 356990, 291455, 152196, 316044, 184974, 316048, 316050, 176810, 299698, 291529, 225996, 242385, 299737, 234216, 234233, 242428, 291584, 299777, 291591, 291605, 283418, 234276, 283431, 234290, 201534, 348999, 201562, 234330, 275294, 127840, 349025, 177002, 308075, 242540, 242542, 201590, 177018, 308093, 291713, 340865, 299912, 349066, 316299, 234382, 308111, 308113, 209820, 283551, 177074, 127945, 340960, 234469, 324587, 234476, 201721, 234499, 357380, 234513, 316441, 300087, 21567, 308288, 160834, 349254, 250955, 300109, 234578, 234606, 300145, 349317, 177297, 324761, 119965, 234655, 300192, 234662, 300200, 373937, 300215, 283846, 259275, 316628, 259285, 357594, 251124, 316661, 283894, 234741, 292092, 234756, 242955, 177420, 292145, 300342, 333114, 333115, 193858, 300354, 300355, 234830, 259408, 283990, 357720, 300378, 300379, 316764, 284015, 234864, 316786, 243073, 292242, 112019, 234902, 333224, 374189, 284090, 54719, 415170, 292291, 300488, 300490, 234957, 144862, 300526, 259569, 308722, 251379, 300539, 210429, 366081, 292359, 218632, 316951, 374297, 349727, 374327, 210489, 235069, 349764, 194118, 292426, 333389, 128589, 333394, 128600, 235096, 300643, 300645, 415334, 243306, 54895, 325246, 333438, 235136, 317102, 300729, 333508, 259780, 325345, 153318, 333543, 284410, 300810, 300812, 284430, 161553, 284436, 169751, 325403, 341791, 325411, 186148, 186149, 333609, 284460, 300849, 325444, 153416, 325449, 317268, 325460, 341846, 284508, 300893, 259937, 284515, 276326, 292713, 292719, 325491, 333687, 350072, 317305, 317308, 333700, 325508, 243590, 243592, 325514, 350102, 333727, 219046, 333734, 284584, 292783, 300983, 153553, 292835, 6116, 292838, 317416, 325620, 333827, 243720, 292901, 178215, 325675, 243763, 325695, 333902, 194667, 284789, 284790, 292987, 194692, 235661, 153752, 284827, 284840, 284843, 227517, 309443, 227525, 301255, 227536, 301270, 301271, 325857, 334049, 317676, 309504, 194832, 227601, 325904, 334104, 211239, 317738, 227655, 383309, 391521, 366948, 285031, 416103, 227702, 211327, 227721, 227730, 285074, 293275, 285083, 317851, 39323, 227743, 293281, 285089, 301482, 342454, 293309, 317889, 326083, 285152, 195044, 236020, 317949, 342537, 309770, 334345, 342560, 227881, 293420, 236080, 23093, 244279, 244280, 301635, 309831, 55880, 301647, 326229, 309847, 375396, 244326, 301688, 244345, 301702, 334473, 326288, 227991, 285348, 318127, 293552, 342705, 285360, 285362, 154295, 342714, 342757, 285419, 170735, 359166, 228099, 285443, 285450, 326413, 285457, 285467, 326428, 318247, 293673, 318251, 301872, 285493, 285496, 301883, 342846, 293702, 318279, 244569, 252766, 301919, 293729, 351078, 342888, 310132, 228214, 269179, 211835, 228232, 416649, 252812, 293780, 310166, 400282, 310177, 359332, 359333, 293801, 326571, 252848, 326580, 326586, 56270, 252878, 359380, 343020, 203758, 293894, 384015, 293911, 326684, 384031, 113710, 203829, 285795, 253028, 228457, 318571, 187508, 302202, 285819, 318602, 228492, 162962, 187539, 326803, 359574, 285850, 351389, 253098, 302251, 367798, 294075, 64699, 228541, 343230, 310496, 228587, 302319, 351475, 228608, 318732, 245018, 318746, 130342, 130344, 130347, 286012, 294210, 359747, 359748, 294220, 318804, 294236, 327023, 327030, 310650, 179586, 294278, 318860, 318876, 245160, 286128, 286133, 310714, 302523, 228796, 302530, 228804, 310725, 302539, 310731, 310735, 327122, 310747, 286176, 187877, 310758, 40439, 253431, 286201, 245249, 228868, 302602, 294413, 359949, 253456, 302620, 146976, 245291, 425534, 310853, 286281, 196184, 212574, 204386, 204394, 138862, 310896, 294517, 286344, 188049, 229011, 229021, 302751, 212649, 286387, 286392, 302778, 286400, 319176, 212684, 286419, 294621, 294629, 286457, 286463, 319232, 360194, 278292, 278294, 286507, 294699, 319289, 237397, 188250, 237411, 327556, 188293, 311183, 294806, 294808, 253851, 319393, 294820, 294824, 253868, 343993, 188349, 98240, 294849, 24531, 212953, 360416, 294887, 253930, 278507, 311277, 327666, 278515 ]
d937651eae4c390ff6d6c2ac882a0d5e82de51ed
133bb0cf59d7b221f6e84b0ac9368f0185eb7504
/TagListView/TagListView.swift
7b2e0ddbb7a281a34d22ebf43dca814e5b60c8e5
[]
no_license
alidiepuit/wassup
39b5379e804f852c03396687e225e768b209ff79
db122ae5fce21ce9503582e45c65057d2370b8e1
refs/heads/master
2020-07-22T22:38:51.267744
2016-10-11T08:01:26
2016-10-11T08:01:26
67,001,849
1
0
null
null
null
null
UTF-8
Swift
false
false
12,024
swift
// // TagListView.swift // TagListViewDemo // // Created by Dongyuan Liu on 2015-05-09. // Copyright (c) 2015 Ela. All rights reserved. // import UIKit @objc public protocol TagListViewDelegate { optional func tagPressed(title: String, tagView: TagView, sender: TagListView) -> Void optional func tagRemoveButtonPressed(title: String, tagView: TagView, sender: TagListView) -> Void } //@IBDesignable public class TagListView: UIView { @IBInspectable public dynamic var textColor: UIColor = UIColor.whiteColor() { didSet { for tagView in tagViews { tagView.textColor = textColor } } } @IBInspectable public dynamic var selectedTextColor: UIColor = UIColor.whiteColor() { didSet { for tagView in tagViews { tagView.selectedTextColor = selectedTextColor } } } @IBInspectable public dynamic var tagBackgroundColor: UIColor = UIColor.grayColor() { didSet { for tagView in tagViews { tagView.tagBackgroundColor = tagBackgroundColor } } } @IBInspectable public dynamic var tagHighlightedBackgroundColor: UIColor? { didSet { for tagView in tagViews { tagView.highlightedBackgroundColor = tagHighlightedBackgroundColor } } } @IBInspectable public dynamic var tagSelectedBackgroundColor: UIColor? { didSet { for tagView in tagViews { tagView.selectedBackgroundColor = tagSelectedBackgroundColor } } } @IBInspectable public dynamic var cornerRadius: CGFloat = 0 { didSet { for tagView in tagViews { tagView.cornerRadius = cornerRadius } } } @IBInspectable public dynamic var borderWidth: CGFloat = 0 { didSet { for tagView in tagViews { tagView.borderWidth = borderWidth } } } @IBInspectable public dynamic var borderColor: UIColor? { didSet { for tagView in tagViews { tagView.borderColor = borderColor } } } @IBInspectable public dynamic var selectedBorderColor: UIColor? { didSet { for tagView in tagViews { tagView.selectedBorderColor = selectedBorderColor } } } @IBInspectable public dynamic var paddingY: CGFloat = 2 { didSet { for tagView in tagViews { tagView.paddingY = paddingY } rearrangeViews() } } @IBInspectable public dynamic var paddingX: CGFloat = 5 { didSet { for tagView in tagViews { tagView.paddingX = paddingX } rearrangeViews() } } @IBInspectable public dynamic var marginY: CGFloat = 2 { didSet { rearrangeViews() } } @IBInspectable public dynamic var marginX: CGFloat = 5 { didSet { rearrangeViews() } } @objc public enum Alignment: Int { case Left case Center case Right } @IBInspectable public var alignment: Alignment = .Left { didSet { rearrangeViews() } } @IBInspectable public dynamic var shadowColor: UIColor = UIColor.whiteColor() { didSet { rearrangeViews() } } @IBInspectable public dynamic var shadowRadius: CGFloat = 0 { didSet { rearrangeViews() } } @IBInspectable public dynamic var shadowOffset: CGSize = CGSizeZero { didSet { rearrangeViews() } } @IBInspectable public dynamic var shadowOpacity: Float = 0 { didSet { rearrangeViews() } } @IBInspectable public dynamic var enableRemoveButton: Bool = false { didSet { for tagView in tagViews { tagView.enableRemoveButton = enableRemoveButton } rearrangeViews() } } @IBInspectable public dynamic var removeButtonIconSize: CGFloat = 12 { didSet { for tagView in tagViews { tagView.removeButtonIconSize = removeButtonIconSize } rearrangeViews() } } @IBInspectable public dynamic var removeIconLineWidth: CGFloat = 1 { didSet { for tagView in tagViews { tagView.removeIconLineWidth = removeIconLineWidth } rearrangeViews() } } @IBInspectable public dynamic var removeIconLineColor: UIColor = UIColor.whiteColor().colorWithAlphaComponent(0.54) { didSet { for tagView in tagViews { tagView.removeIconLineColor = removeIconLineColor } rearrangeViews() } } public dynamic var textFont: UIFont = UIFont.systemFontOfSize(12) { didSet { for tagView in tagViews { tagView.textFont = textFont } rearrangeViews() } } @IBOutlet public weak var delegate: TagListViewDelegate? public private(set) var tagViews: [TagView] = [] private(set) var tagBackgroundViews: [UIView] = [] private(set) var rowViews: [UIView] = [] private(set) var tagViewHeight: CGFloat = 0 private(set) var rows = 0 { didSet { invalidateIntrinsicContentSize() } } // MARK: - Interface Builder public override func prepareForInterfaceBuilder() { addTag("Welcome") addTag("to") addTag("TagListView").selected = true } // MARK: - Layout public override func layoutSubviews() { super.layoutSubviews() rearrangeViews() } private func rearrangeViews() { let views = tagViews as [UIView] + tagBackgroundViews + rowViews for view in views { view.removeFromSuperview() } rowViews.removeAll(keepCapacity: true) var currentRow = 0 var currentRowView: UIView! var currentRowTagCount = 0 var currentRowWidth: CGFloat = 0 for (index, tagView) in tagViews.enumerate() { tagView.frame.size = tagView.intrinsicContentSize() tagViewHeight = tagView.frame.height if currentRowTagCount == 0 || currentRowWidth + tagView.frame.width > frame.width { currentRow += 1 currentRowWidth = 0 currentRowTagCount = 0 currentRowView = UIView() currentRowView.frame.origin.y = CGFloat(currentRow - 1) * (tagViewHeight + marginY) rowViews.append(currentRowView) addSubview(currentRowView) } let tagBackgroundView = tagBackgroundViews[index] tagBackgroundView.frame.origin = CGPoint(x: currentRowWidth, y: 0) tagBackgroundView.frame.size = tagView.bounds.size tagBackgroundView.layer.shadowColor = shadowColor.CGColor tagBackgroundView.layer.shadowPath = UIBezierPath(roundedRect: tagBackgroundView.bounds, cornerRadius: cornerRadius).CGPath tagBackgroundView.layer.shadowOffset = shadowOffset tagBackgroundView.layer.shadowOpacity = shadowOpacity tagBackgroundView.layer.shadowRadius = shadowRadius tagBackgroundView.addSubview(tagView) currentRowView.addSubview(tagBackgroundView) currentRowTagCount += 1 currentRowWidth += tagView.frame.width + marginX switch alignment { case .Left: currentRowView.frame.origin.x = 0 case .Center: currentRowView.frame.origin.x = (frame.width - (currentRowWidth - marginX)) / 2 case .Right: currentRowView.frame.origin.x = frame.width - (currentRowWidth - marginX) } currentRowView.frame.size.width = currentRowWidth currentRowView.frame.size.height = max(tagViewHeight, currentRowView.frame.height) } rows = currentRow invalidateIntrinsicContentSize() } // MARK: - Manage tags public override func intrinsicContentSize() -> CGSize { var height = CGFloat(rows) * (tagViewHeight + marginY) if rows > 0 { height -= marginY } return CGSizeMake(frame.width, height) } public func addTag(title:String, id:String, selected: Bool = false) -> TagView { let tagView = self.addTag(title) tagView.id = id tagView.selected = selected return tagView } public func addTag(title: String) -> TagView { let tagView = TagView(title: title) tagView.textColor = textColor tagView.selectedTextColor = selectedTextColor tagView.tagBackgroundColor = tagBackgroundColor tagView.highlightedBackgroundColor = tagHighlightedBackgroundColor tagView.selectedBackgroundColor = tagSelectedBackgroundColor tagView.cornerRadius = cornerRadius tagView.borderWidth = borderWidth tagView.borderColor = borderColor tagView.selectedBorderColor = selectedBorderColor tagView.paddingX = paddingX tagView.paddingY = paddingY tagView.textFont = textFont tagView.removeIconLineWidth = removeIconLineWidth tagView.removeButtonIconSize = removeButtonIconSize tagView.enableRemoveButton = enableRemoveButton tagView.removeIconLineColor = removeIconLineColor tagView.addTarget(self, action: #selector(tagPressed(_:)), forControlEvents: .TouchUpInside) tagView.removeButton.addTarget(self, action: #selector(removeButtonPressed(_:)), forControlEvents: .TouchUpInside) // Deselect all tags except this one tagView.onLongPress = { this in for tag in self.tagViews { tag.selected = (tag == this) } } return addTagView(tagView) } public func addTagView(tagView: TagView) -> TagView { tagViews.append(tagView) tagBackgroundViews.append(UIView(frame: tagView.bounds)) rearrangeViews() return tagView } public func removeTag(title: String) { // loop the array in reversed order to remove items during loop for index in (tagViews.count - 1).stride(through: 0, by: -1) { let tagView = tagViews[index] if tagView.currentTitle == title { removeTagView(tagView) } } } public func removeTagView(tagView: TagView) { tagView.removeFromSuperview() if let index = tagViews.indexOf(tagView) { tagViews.removeAtIndex(index) tagBackgroundViews.removeAtIndex(index) } rearrangeViews() } public func removeAllTags() { let views = tagViews as [UIView] + tagBackgroundViews for view in views { view.removeFromSuperview() } tagViews = [] tagBackgroundViews = [] rearrangeViews() } public func selectedTags() -> [TagView] { return tagViews.filter() { $0.selected == true } } // MARK: - Events func tagPressed(sender: TagView!) { sender.onTap?(sender) delegate?.tagPressed?(sender.currentTitle ?? "", tagView: sender, sender: self) } func removeButtonPressed(closeButton: CloseButton!) { if let tagView = closeButton.tagView { delegate?.tagRemoveButtonPressed?(tagView.currentTitle ?? "", tagView: tagView, sender: self) } } }
[ 179361, 305626 ]
1664c5879f778a64acc32956328cec6150fceb2b
f31571cfaa542077555976999e7cd694ed227abc
/To Do List/SceneDelegate.swift
2fd211bd633d91a532d2201648851f61775a2b30
[]
no_license
nickmerc15/To-Do-List
5d2b0101564edbe9f00d11fc0c5d9ae1e9c6f2df
22631b78ebea4e84f93899692bab5712da3bf5c0
refs/heads/master
2021-02-09T06:18:43.421018
2020-03-02T02:26:36
2020-03-02T02:26:36
244,251,590
0
0
null
null
null
null
UTF-8
Swift
false
false
2,364
swift
// // SceneDelegate.swift // To Do List // // Created by Nicholas Mercadante on 2/19/20. // Copyright © 2020 Nicholas Mercadante. All rights reserved. // import UIKit class SceneDelegate: UIResponder, UIWindowSceneDelegate { var window: UIWindow? func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). guard let _ = (scene as? UIWindowScene) else { return } } func sceneDidDisconnect(_ scene: UIScene) { // Called as the scene is being released by the system. // This occurs shortly after the scene enters the background, or when its session is discarded. // Release any resources associated with this scene that can be re-created the next time the scene connects. // The scene may re-connect later, as its session was not 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. } }
[ 393221, 163849, 393228, 393231, 393251, 352294, 344103, 393260, 393269, 213049, 376890, 385082, 16444, 393277, 376906, 327757, 254032, 286804, 368728, 254045, 368736, 180322, 376932, 286833, 286845, 286851, 417925, 262284, 360598, 286880, 286889, 377003, 377013, 164029, 327872, 180418, 377030, 377037, 180432, 377047, 418008, 385243, 418012, 377063, 327915, 205037, 393457, 393461, 393466, 418044, 336124, 385281, 336129, 262405, 180491, 336140, 164107, 262417, 368913, 262423, 377118, 377121, 262437, 254253, 336181, 262455, 393539, 262473, 344404, 213333, 418135, 270687, 262497, 418145, 262501, 213354, 246124, 262508, 262512, 213374, 385420, 262551, 262553, 385441, 385444, 262567, 385452, 262574, 393649, 385460, 262587, 344512, 262593, 336326, 360917, 369119, 328178, 328180, 328183, 328190, 254463, 328193, 98819, 164362, 328207, 410129, 393748, 377372, 188959, 385571, 377384, 197160, 33322, 352822, 270905, 197178, 418364, 188990, 369224, 385610, 270922, 352844, 385617, 352865, 262761, 352875, 344694, 352888, 336513, 377473, 336517, 344710, 385671, 148106, 377485, 352919, 98969, 336549, 344745, 361130, 336556, 434868, 164535, 336568, 164539, 328379, 328387, 352969, 418508, 385743, 385749, 189154, 369382, 361196, 344832, 336644, 344837, 344843, 328462, 361231, 394002, 336660, 418581, 418586, 434971, 369436, 262943, 369439, 418591, 418594, 336676, 418600, 418606, 271154, 328498, 369464, 361274, 328516, 336709, 328520, 336712, 361289, 328523, 336715, 361300, 213848, 426842, 361307, 197469, 361310, 254813, 361318, 344936, 361323, 361335, 328574, 369544, 222129, 345036, 115661, 386004, 345046, 386012, 386019, 386023, 328690, 435188, 328703, 328710, 418822, 377867, 328715, 361490, 386070, 271382, 336922, 345119, 377888, 328747, 214060, 345134, 345139, 361525, 361537, 377931, 197708, 189525, 156762, 402523, 361568, 148580, 345200, 361591, 361594, 410746, 214150, 345224, 386187, 337048, 345247, 361645, 337072, 345268, 337076, 402615, 361657, 402636, 328925, 165086, 165092, 328933, 222438, 328942, 386286, 386292, 206084, 115973, 328967, 345377, 345380, 353572, 345383, 337207, 345400, 378170, 369979, 386366, 337224, 337230, 337235, 263509, 353634, 337252, 402792, 345449, 99692, 271731, 378232, 337278, 271746, 181639, 353674, 181644, 361869, 181650, 181655, 230810, 181671, 181674, 181679, 181682, 337330, 181687, 370105, 181691, 181697, 361922, 337350, 181704, 337366, 271841, 329192, 361961, 329195, 116211, 337399, 402943, 337416, 329227, 419341, 419345, 329234, 419351, 345626, 419357, 345631, 419360, 370208, 394787, 419363, 370214, 419369, 394796, 419377, 419386, 206397, 419401, 353868, 419404, 173648, 419408, 214611, 419412, 403040, 345702, 222831, 370298, 353920, 403076, 345737, 198282, 403085, 403092, 345750, 419484, 345758, 345763, 419492, 345766, 419498, 419502, 370351, 419507, 337588, 419510, 419513, 403139, 337607, 419528, 419531, 272083, 394967, 419543, 419545, 345819, 419548, 181982, 419551, 345829, 419560, 337643, 419564, 337647, 370416, 141052, 337661, 337671, 362249, 362252, 395022, 362256, 321300, 345888, 116512, 378664, 354107, 354112, 247618, 370504, 329545, 345932, 354124, 370510, 247639, 337751, 370520, 313181, 182110, 354143, 354157, 345965, 345968, 345971, 345975, 182136, 403321, 1914, 354173, 395148, 247692, 337809, 247701, 329625, 436127, 436133, 247720, 337834, 362414, 337845, 190393, 247760, 346064, 346069, 329699, 354275, 190440, 247790, 354314, 346140, 337980, 436290, 395340, 378956, 436307, 338005, 329816, 100454, 329833, 329853, 329857, 329868, 411806, 329886, 346273, 362661, 100525, 387250, 379067, 387261, 256193, 395467, 346317, 411862, 411865, 411869, 411874, 379108, 411877, 387303, 346344, 395496, 338154, 387307, 346350, 338161, 436474, 321787, 379135, 411905, 411917, 43279, 379154, 395539, 387350, 387353, 338201, 182559, 338212, 248112, 362823, 436556, 321880, 362844, 379234, 354674, 182642, 321911, 420237, 379279, 272787, 354728, 338353, 338363, 338382, 272849, 248279, 256474, 182755, 338404, 338411, 330225, 248309, 199165, 248332, 330254, 199182, 199189, 420377, 330268, 191012, 330320, 199250, 191069, 346722, 248427, 191085, 338544, 191093, 346743, 330384, 346769, 150184, 174775, 248505, 174778, 363198, 223936, 355025, 273109, 264919, 256735, 338661, 338665, 264942, 330479, 363252, 338680, 207620, 264965, 191240, 338701, 199455, 396067, 346917, 396070, 215854, 355123, 355141, 355144, 338764, 330581, 330585, 387929, 355167, 265056, 265059, 355176, 355180, 355185, 330612, 330643, 412600, 207809, 379849, 347082, 396246, 330711, 248794, 248799, 437219, 257009, 265208, 330750, 199681, 338951, 330761, 330769, 330775, 248863, 158759, 396329, 347178, 404526, 396337, 330803, 396340, 339002, 388155, 339010, 347208, 248905, 330827, 330830, 248915, 183384, 339037, 412765, 257121, 322660, 265321, 330869, 248952, 420985, 330886, 347288, 248986, 44199, 380071, 339118, 249018, 339133, 126148, 322763, 330959, 330966, 265433, 265438, 388320, 363757, 339199, 396552, 175376, 175397, 208167, 273709, 372016, 437553, 347442, 199989, 175416, 396601, 208189, 437567, 175425, 437571, 437576, 437584, 331089, 396634, 175451, 437596, 429408, 175458, 208228, 175461, 175464, 265581, 331124, 175478, 249210, 175484, 175487, 249215, 175491, 249219, 249225, 249228, 249235, 175514, 175517, 396703, 396706, 175523, 355749, 396723, 388543, 380353, 216518, 339401, 380364, 339406, 372177, 339414, 249303, 413143, 339418, 339421, 249310, 339425, 249313, 339429, 339435, 249329, 69114, 372229, 339464, 249355, 208399, 380433, 175637, 134689, 339504, 265779, 421442, 413251, 265796, 265806, 224854, 224858, 339553, 257636, 224871, 372328, 257647, 372338, 339572, 224885, 224888, 224891, 224895, 372354, 126597, 421509, 224905, 11919, 224911, 224914, 126611, 224917, 224920, 126618, 208539, 224923, 224927, 224930, 224933, 257705, 224939, 224943, 257713, 224949, 257717, 257721, 224954, 257725, 224960, 257733, 224966, 224970, 257740, 224976, 257745, 257748, 224982, 257752, 224987, 257762, 224996, 225000, 339696, 225013, 257788, 225021, 339711, 257791, 225027, 257796, 339722, 257802, 257805, 225039, 257808, 249617, 225044, 167701, 372500, 257815, 225049, 257820, 225054, 184096, 397089, 257825, 225059, 339748, 225068, 257837, 413485, 225071, 225074, 257843, 225077, 257846, 225080, 397113, 225083, 397116, 257853, 225088, 225094, 225097, 323404, 257869, 257872, 225105, 339795, 397140, 225109, 225113, 257881, 257884, 257887, 225120, 257891, 413539, 225128, 257897, 225138, 339827, 257909, 225142, 372598, 257914, 257917, 225150, 257922, 380803, 225156, 339845, 257927, 225166, 397201, 225171, 380823, 225176, 225183, 184245, 372698, 372704, 372707, 356336, 380919, 393215, 372739, 405534, 266295, 266298, 217158, 421961, 200786, 356440, 217180, 430181, 266351, 356467, 266365, 266375, 381069, 225425, 250003, 225430, 250008, 356507, 250012, 225439, 135328, 192674, 225442, 438434, 225445, 438438, 225448, 438441, 225451, 258223, 225456, 430257, 225459, 225462, 225468, 389309, 225472, 372931, 225476, 430275, 389322, 225485, 225488, 225491, 266454, 225494, 225497, 225500, 225503, 225506, 356580, 225511, 217319, 225515, 225519, 381177, 397572, 389381, 356631, 356638, 356641, 356644, 356647, 266537, 389417, 356650, 356656, 332081, 307507, 340276, 356662, 397623, 332091, 225599, 332098, 201030, 348489, 332107, 151884, 430422, 348503, 332118, 250201, 250203, 332130, 250211, 340328, 250217, 348523, 348528, 332153, 356734, 389503, 332158, 438657, 250239, 332162, 348548, 356741, 332175, 160152, 373146, 373149, 70048, 356783, 266688, 324032, 201158, 340452, 127473, 217590, 340473, 324095, 324100, 324103, 324112, 340501, 324118, 324122, 340512, 332325, 324134, 381483, 356908, 324141, 324143, 356917, 324150, 324156, 168509, 348734, 324161, 324165, 356935, 348745, 381513, 324171, 324174, 324177, 389724, 332381, 373344, 340580, 348777, 381546, 119432, 340628, 184983, 373399, 340639, 258723, 332455, 332460, 389806, 332464, 332473, 381626, 332484, 332487, 332494, 357070, 357074, 332512, 332521, 340724, 332534, 373499, 348926, 389927, 348979, 152371, 398141, 127815, 357202, 389971, 357208, 136024, 389979, 430940, 357212, 357215, 201580, 201583, 349041, 340850, 201589, 381815, 430967, 324473, 398202, 119675, 340859, 324476, 430973, 324479, 340863, 324482, 324485, 324488, 185226, 381834, 324493, 324496, 324499, 430996, 324502, 324511, 422817, 324514, 201638, 373672, 324525, 5040, 111539, 324534, 5047, 324539, 324542, 398280, 349129, 340940, 340942, 209874, 340958, 431073, 398307, 340964, 209896, 201712, 209904, 349173, 381947, 201724, 349181, 431100, 431107, 349203, 209944, 209948, 250915, 250917, 169002, 357419, 209966, 209969, 209973, 209976, 209980, 209988, 209991, 431180, 209996, 349268, 177238, 250968, 210011, 373853, 341094, 210026, 210028, 210032, 349296, 210037, 210042, 210045, 349309, 152704, 349313, 160896, 210053, 210056, 349320, 259217, 373905, 210068, 210072, 210078, 210081, 210085, 210089, 210096, 210100, 324792, 210108, 357571, 210116, 210128, 333010, 210132, 333016, 210139, 210144, 218355, 251123, 218361, 275709, 128254, 275713, 242947, 275717, 275723, 333075, 349460, 333079, 251161, 349486, 349492, 415034, 251211, 210261, 365912, 259423, 374113, 251236, 374118, 234867, 390518, 357756, 374161, 112021, 349591, 357793, 333222, 210357, 259516, 415168, 366035, 415187, 366039, 415192, 415194, 415197, 415200, 333285, 415208, 366057, 366064, 415217, 415225, 423424, 415258, 415264, 366118, 415271, 382503, 349739, 144940, 415279, 415282, 415286, 210488, 415291, 415295, 333387, 333396, 333400, 366173, 333415, 423529, 423533, 333423, 210547, 415354, 333440, 267910, 267929, 333472, 333512, 259789, 358100, 366301, 333535, 366308, 366312, 431852, 399086, 366319, 210673, 366322, 399092, 366326, 333566, 268042, 210700, 366349, 210707, 399129, 333593, 333595, 210720, 366384, 358192, 210740, 366388, 358201, 399166, 325441, 366403, 325447, 341831, 341835, 341839, 341844, 415574, 358235, 341852, 350046, 399200, 399208, 268144, 358256, 358260, 399222, 325494, 186233, 333690, 243584, 325505, 333699, 399244, 333709, 333725, 333737, 382891, 382898, 333767, 358348, 333777, 219094, 358372, 350190, 350194, 333819, 350204, 350207, 325633, 325637, 350214, 268299, 333838, 350225, 350232, 350238, 350241, 374819, 350245, 350249, 350252, 178221, 350257, 350260, 350272, 243782, 350281, 350286, 374865, 252021, 342134, 374904, 268435, 333989, 333998, 334012, 260299, 350411, 350417, 350423, 350426, 334047, 350449, 375027, 358645, 350454, 350459, 350462, 350465, 350469, 325895, 268553, 194829, 350477, 268560, 350481, 432406, 350487, 350491, 350494, 325920, 350500, 350505, 358701, 391469, 350510, 358705, 358714, 358717, 383307, 358738, 334162, 383331, 383334, 391531, 383342, 334204, 268669, 194942, 391564, 366991, 334224, 342431, 375209, 326059, 375220, 342453, 334263, 326087, 358857, 195041, 334306, 334312, 104940, 375279, 162289, 350724, 186898, 342546, 350740, 342551, 334359, 342555, 334364, 416294, 350762, 252463, 358962, 334386, 334397, 252483, 219719, 399957, 244309, 334425, 326240, 375401, 334466, 334469, 162446, 326291, 342680, 342685, 260767, 342711, 244410, 260798, 334530, 260802, 350918, 154318, 342737, 391895, 154329, 416476, 64231, 113389, 342769, 203508, 375541, 342777, 391938, 391949, 375569, 375572, 375575, 375580, 162592, 334633, 326444, 383794, 326452, 326455, 375613, 244542, 260925, 375616, 326468, 244552, 342857, 326474, 326479, 326486, 416599, 342875, 244572, 326494, 326503, 433001, 326508, 400238, 326511, 211826, 211832, 392061, 351102, 252801, 260993, 400260, 211846, 342921, 342931, 252823, 400279, 392092, 400286, 359335, 211885, 400307, 351169, 359362, 351172, 170950, 187335, 326599, 359367, 359383, 359389, 383968, 343018, 359411, 261109, 261112, 244728, 383999, 261130, 261148, 359452, 211999, 261155, 261160, 261166, 359471, 375868, 384099, 384102, 384108, 367724, 326764, 187503, 343155, 384115, 212095, 384136, 384140, 384144, 384152, 384158, 384161, 351399, 384169, 367795, 244917, 384182, 384189, 384192, 351424, 343232, 244934, 367817, 244938, 384202, 253132, 326858, 343246, 384209, 146644, 351450, 384225, 359650, 343272, 351467, 359660, 384247, 351480, 384250, 351483, 351492, 343307, 384270, 359695, 261391, 253202, 261395, 384276, 384284, 245021, 384290, 253218, 245032, 171304, 384299, 351535, 245042, 326970, 384324, 343366, 212296, 212304, 367966, 343394, 343399, 367981, 343410, 155000, 327035, 245121, 245128, 253321, 155021, 384398, 245137, 245143, 245146, 245149, 343453, 245152, 245155, 155045, 245158, 40358, 245163, 114093, 327090, 343478, 359867, 384444, 146878, 327108, 327112, 384457, 327118, 359887, 359891, 343509, 368093, 155103, 343535, 343540, 368120, 343545, 409092, 359948, 359951, 245295, 359984, 400977, 400982, 179803, 155241, 138865, 155255, 155274, 368289, 245410, 425639, 245415, 425652, 425663, 155328, 245463, 155352, 155356, 212700, 155364, 245477, 155372, 245487, 212723, 245495, 409336, 155394, 155404, 245528, 155423, 360224, 155439, 204592, 155444, 155448, 417596, 384829, 360262, 155463, 155477, 376665, 155484, 261982, 425823, 155488, 376672, 155492, 327532, 261997, 376686, 262000, 262003, 425846, 262006, 147319, 262009, 327542, 262012, 155517, 155523, 155526, 360327, 376715, 155532, 262028, 262031, 262034, 262037, 262040, 262043, 155550, 253854, 262046, 262049, 262052, 327590, 155560, 155563, 155566, 327613, 393152, 311244, 212945, 393170, 155604, 155620, 253924, 155622, 253927, 327655, 360432, 393204, 360439, 253944, 393209, 155647 ]
cc5ed55ce8a0cac6d7e3a5f225af90ab294cef21
60a3527e8b6de0b84b7c33365bf57069ec6e5a0d
/Lentach/Models/Core Data/Model Classes/Headline URLs/HeadlineURLs+CoreDataClass.swift
0e585d3c1abe37a7367c20a95b70ef4d5ab4b865
[]
no_license
AndreySlimus/Lentach
39faa47a5196a7f8ab598fc897a60fed09d6dda5
5c07c3dc5417d14f3344eb09603b2ac319b0e998
refs/heads/master
2020-09-17T11:12:38.994966
2019-11-26T01:15:48
2019-11-26T02:18:16
224,084,561
0
2
null
null
null
null
UTF-8
Swift
false
false
237
swift
// // HeadlineURLs+CoreDataClass.swift // Lentach // // Created by Andrey on 00/00/00. // Copyright © 2019 Andrey. All rights reserved. // // import Foundation import CoreData final public class HeadlineURLs: NSManagedObject { }
[ -1 ]
a407e7a1c4275f508c27af47e9bbeb18168d1397
2f3ff615bf2d2b13277343c0624628f0d10ee0ff
/OctoPodium/Controllers/TrendingRepositoryDetailsController.swift
3994ee45173f1e680a5dcee841ab64aec6f8a02b
[]
no_license
teclas07/iOS-OctoPodium
5f1569dc8f5b927b36bed568ffb9b289b0f4ed06
0b0bc4fba0596e2f726572d443eb3a58541617e7
refs/heads/master
2021-01-19T05:06:19.395961
2016-02-19T21:14:04
2016-02-19T21:14:08
null
0
0
null
null
null
null
UTF-8
Swift
false
false
4,151
swift
// // TrendingRepositoryDetailsController.swift // OctoPodium // // Created by Nuno Gonçalves on 02/02/16. // Copyright © 2016 Nuno Gonçalves. All rights reserved. // import UIKit class TrendingRepositoryDetailsController: UIViewController { @IBOutlet weak var webView: UIWebView! @IBOutlet weak var loadingView: GithubLoadingView! var repository: Repository? override func viewDidLoad() { webView.delegate = self navigationItem.title = repository?.name loadWebView() SendToGoogleAnalytics.enteredScreen(String(TrendingRepositoryDetailsController)) navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Action, target: self, action: "showRepoOptions") } @objc private func showRepoOptions() { let repoBuilder = RepositoryOptionsBuilder.build(repository!.url) { [weak self] in guard let s = self else { return } let activityViewController = UIActivityViewController(activityItems: [s.repository!.url as NSString], applicationActivities: nil) s.presentViewController(activityViewController, animated: true, completion: {}) } presentViewController(repoBuilder, animated: true, completion: nil) } private func loadWebView() { getReadMeLocation() } private func getReadMeLocation() { guard let repository = repository else { return } GitHub.RepoContentFetcher(repositoryName: repository.completeName) .get(success: gotGithubApiResponse, failure: gitHubApiFailed) } private func gotGithubApiResponse(readMeLocation: String) { if readMeLocation != "" { gotReadMeLocation(readMeLocation) } else { hideLoadingAndDisplay("Coudn't find a read me.") } } private func gitHubApiFailed(status: NetworkStatus) { hideLoadingAndDisplay(status.message()) } private func gotReadMeLocation(url: String) { let url = NSURL(string: url) webView.loadRequest(NSURLRequest(URL: url!)) } private func hideLoadingAndDisplay(error: String) { loadingView.hide() NotifyError.display(error) } } extension TrendingRepositoryDetailsController : UIWebViewDelegate { func webViewDidStartLoad(webView: UIWebView) { animateLoadingToCorner() } private func animateLoadingToCorner() { let duration: NSTimeInterval = 1.0 UIView.animateWithDuration(duration) { self.loadingView.transform = CGAffineTransformScale(self.loadingView.transform, 0.5, 0.5) } let path = buildCurveToCorner() let anim = buildAnimationIn(path, withDuration: duration) CATransaction.begin() loadingView.layer.addAnimation(anim, forKey: "curve") CATransaction.commit() } private func buildAnimationIn(path: UIBezierPath, withDuration duration: NSTimeInterval) -> CAKeyframeAnimation { let anim = CAKeyframeAnimation(keyPath: "position") anim.rotationMode = kCAAnimationPaced anim.fillMode = kCAFillModeForwards anim.removedOnCompletion = false anim.duration = duration anim.path = path.CGPath return anim } private func buildCurveToCorner() -> UIBezierPath { let path = UIBezierPath() path.moveToPoint(view.center) let destinationPoint = getCornerPoint() path.addQuadCurveToPoint(destinationPoint, controlPoint: CGPoint(x: view.center.x, y: view.center.y + 150)) return path } private func getCornerPoint() -> CGPoint { let p = CGPoint( x: view.frame.width - loadingView.halfWidth, y: view.frame.height - 49 - loadingView.halfHeight) return p } func webViewDidFinishLoad(webView: UIWebView) { loadingView.hide() } func webView(webView: UIWebView, didFailLoadWithError error: NSError?) { hideLoadingAndDisplay("Error loading README contents") loadingView.hide() } }
[ -1 ]
3d2ecce43bff084a399a6e8808e530857dce16f1
beab7bceb2f91db6ac9f7f8bd1a7f0392b29bd4f
/Easy Digital Downloads/Models/Discount.swift
1110a826d8889a21e5035d0c703c5cb5d32ec331
[]
no_license
icey830/edd-ios
6ee5bac0d5c97100dfc58f65c0774ae937e7d9c9
dcf2de869b8bcecdc4697e5c3da08b7bdc3c6e66
refs/heads/master
2021-05-06T12:52:36.041070
2017-10-30T18:15:21
2017-10-30T18:15:21
null
0
0
null
null
null
null
UTF-8
Swift
false
false
4,249
swift
// // Discount.swift // Easy Digital Downloads // // Created by Sunny Ratilal on 17/07/2016. // Copyright © 2016 Easy Digital Downloads. All rights reserved. // import UIKit import CoreData public final class Discount: ManagedObject { // Attributes @NSManaged fileprivate var createdAt: Date @NSManaged public fileprivate(set) var amount: Double @NSManaged public fileprivate(set) var code: String @NSManaged public fileprivate(set) var did: Int64 @NSManaged public fileprivate(set) var expiryDate: Date? @NSManaged public fileprivate(set) var globalDiscount: NSNumber @NSManaged public fileprivate(set) var maxUses: Int64 @NSManaged public fileprivate(set) var minPrice: Double @NSManaged public fileprivate(set) var name: String @NSManaged public fileprivate(set) var productRequirements: Data? @NSManaged public fileprivate(set) var requirementConditions: String @NSManaged public fileprivate(set) var singleUse: NSNumber @NSManaged public fileprivate(set) var startDate: Date? @NSManaged public fileprivate(set) var status: String @NSManaged public fileprivate(set) var type: String @NSManaged public fileprivate(set) var uses: Int64 // Relationships @NSManaged public fileprivate(set) var site: Site @NSManaged fileprivate(set) var sales: Set<Sale> public override func awakeFromInsert() { super.awakeFromInsert() createdAt = Date() } public static func predicateForId(_ discountId: Int64) -> NSPredicate { return NSPredicate(format: "%K == %lld", Discount.Keys.ID.rawValue, discountId) } @discardableResult public static func insertIntoContext(_ moc: NSManagedObjectContext, amount: Double, code: String, did: Int64, expiryDate: Date?, globalDiscount: NSNumber, maxUses: Int64, minPrice: Double, name: String, productRequirements: Data?, requirementConditions: String, singleUse: NSNumber, startDate: Date?, status: String, type: String, uses: Int64) -> Discount { let discount: Discount = moc.insertObject() discount.amount = amount discount.code = code discount.did = did discount.expiryDate = expiryDate discount.globalDiscount = globalDiscount discount.maxUses = maxUses discount.minPrice = minPrice discount.name = name discount.productRequirements = productRequirements discount.requirementConditions = requirementConditions discount.singleUse = singleUse discount.startDate = startDate discount.status = status discount.type = type discount.uses = uses discount.site = Site.fetchRecordForActiveSite(inContext: moc) return discount } } extension Discount: ManagedObjectType { public static var entityName: String { return "Discount" } public static var defaultSortDescriptors: [NSSortDescriptor] { return [NSSortDescriptor(key: CreatedTimestampKey, ascending: false)] } public static var defaultPredicate: NSPredicate { return NSPredicate(format: "site.uid == %@", Site.activeSite().uid!) } public static func defaultFetchRequest() -> NSFetchRequest<NSFetchRequestResult> { let request = NSFetchRequest<NSFetchRequestResult>(entityName: self.entityName) request.fetchLimit = 20 request.predicate = defaultPredicate request.returnsObjectsAsFaults = false request.sortDescriptors = [NSSortDescriptor(key: Discount.Keys.ID.rawValue, ascending: false)] return request } } extension Discount: KeyCodable { public enum Keys: String { case Amount = "amount" case Code = "code" case ID = "did" case ExpiryDate = "expiryDate" case GlobalDiscount = "globalDiscount" case MaxUses = "maxUses" case MinPrice = "minPrice" case Name = "name" case ProductRequirements = "productRequirements" case RequirementConditions = "requirementConditions" case SingleUse = "singleUse" case StartDate = "startDate" case Status = "status" case `Type` = "type" case Uses = "uses" } }
[ -1 ]
e480368547e958c9f777e1c368ffc008ebb530bc
2b09212c0fc9c36472ba7fa08496de71b0345071
/WeatherApp/CoreData/WeatherHistory+CoreDataProperties.swift
ac1bec4172aa550867d0040ac1ff5c92fa632016
[]
no_license
archanger/WeatherApp
0f3d6c53f37b680b37f46fbcb5841259b0e2b763
463cdbd3f39077a04697eab292507302235147eb
refs/heads/master
2021-01-23T00:45:27.933163
2017-06-06T14:23:39
2017-06-06T14:23:39
92,843,865
0
0
null
null
null
null
UTF-8
Swift
false
false
520
swift
// // WeatherHistory+CoreDataProperties.swift // WeatherApp // // Created by Kirill on 06.06.17. // Copyright © 2017 Home LLC. All rights reserved. // import Foundation import CoreData extension WeatherHistory { @nonobjc public class func fetchRequest() -> NSFetchRequest<WeatherHistory> { return NSFetchRequest<WeatherHistory>(entityName: "WeatherHistory") } @NSManaged public var location: String? @NSManaged public var cityId: Int32 @NSManaged public var requestDate: NSDate? }
[ -1 ]
1f56d6bff731a8ffc618a8bc100df6589d6910a6
81fa6df8ef9492a6b265a226f0e349c4a7b26d4f
/CluedoAssistant/Base/Card.swift
ae804ae4d148de8c13e493d709d36dc9272f5523
[]
no_license
zadoromihail/CluedoAssistant
3370b4d0f894613a5253baabbee5040214dfd172
9af0d08cb14f138e55046711513f5f59b52928ab
refs/heads/master
2023-02-05T14:44:42.189563
2020-12-25T10:37:27
2020-12-25T10:37:27
324,340,636
0
0
null
null
null
null
UTF-8
Swift
false
false
435
swift
// // Card.swift // CluedoAssistant // // Created by Михаил Задорожный on 09.11.2020. // import Foundation struct Card: Equatable { static func == (lhs: Card, rhs: Card) -> Bool { lhs.isSelected == rhs.isSelected && lhs.cardType.value == rhs.cardType.value } let cardType: CardType var isSelected = false var markIsShown = false var owner: Person? }
[ -1 ]
6cf713ba05d26739ee4ea007ab603e09e8fb93b3
ed98013e59512e945693c0c8c6576e3f4007a5d9
/Cafe-Manager/UI/Toast.swift
4ca1a97069a7c2cbe8281df402574aed21fd800d
[]
no_license
lahiru0315/cafe-manager
21baaa874c6807339e306df53a4edbbff7a655db
5029584a6e99a200ad58bb3b2d98965850184c41
refs/heads/master
2023-04-25T18:14:27.704202
2021-05-11T17:59:08
2021-05-11T17:59:08
366,470,918
0
0
null
null
null
null
UTF-8
Swift
false
false
668
swift
// // Toast.swift // FoodCafe // // Created by Lahiru on 3/4/21. // Copyright © 2021 Lahiru. All rights reserved. // import UIKit class Toast: UILabel { // Only override draw() if you perform custom drawing. // An empty implementation adversely affects performance during animation. override func drawText(in rect: CGRect) { super.drawText(in: rect.inset(by: UIEdgeInsets(top: 7, left: 7, bottom: 7, right: 7))) } override var intrinsicContentSize: CGSize { let size = super.intrinsicContentSize return CGSize(width: size.width + 2 * 7, height: size.height + 2 * 7) } }
[ -1 ]
48bc9ac8b176a140d3ef67cd95d4fa99de637b51
79c28de900e38f89efba39b4e0c4743db418a079
/test/Macros/macro_expand_throwing.swift
a0d6f90b895e9fc8b4043547440061f41a415442
[ "Apache-2.0", "Swift-exception" ]
permissive
captain-haddock17/swift
1abe162cfb42a3ec26efc54196fe0d3a7d7d4895
43c5824be892967993f4d0111206764eceeffb67
refs/heads/main
2023-02-17T18:20:37.161487
2023-02-09T05:20:27
2023-02-09T05:20:27
311,013,153
0
0
Apache-2.0
2020-11-08T08:00:46
2020-11-08T08:00:45
null
UTF-8
Swift
false
false
1,307
swift
// RUN: %empty-directory(%t) // RUN: %target-build-swift -swift-version 5 -I %swift-host-lib-dir -L %swift-host-lib-dir -emit-library -o %t/%target-library-name(MacroDefinition) -module-name=MacroDefinition %S/Inputs/syntax_macro_definitions.swift -g -no-toolchain-stdlib-rpath -swift-version 5 // Make sure the diagnostic comes through... // RUN: %target-typecheck-verify-swift -swift-version 5 -enable-experimental-feature Macros -load-plugin-library %t/%target-library-name(MacroDefinition) -I %swift-host-lib-dir -module-name MacroUser // Make sure the diagnostic doesn't crash in SILGen // RUN: not %target-swift-frontend -swift-version 5 -emit-sil -enable-experimental-feature Macros -enable-experimental-feature Macros -load-plugin-library %t/%target-library-name(MacroDefinition) -I %swift-host-lib-dir %s -module-name MacroUser -o - -g // FIXME: Swift parser is not enabled on Linux CI yet. // REQUIRES: OS=macosx @freestanding(expression) macro myWarning(_ message: String) = #externalMacro(module: "MacroDefinition", type: "WarningMacro") func testThrownError() { let name = "hello" #myWarning(name) // expected-error{{#myWarning macro requires a string literal (from macro 'myWarning')}} #myWarning("experimental features ahead") // expected-warning{{experimental features ahead}} }
[ -1 ]
4c3a5ce9a91ca35e3ae9ac1e15c91b4476e9c716
334dba657fc765f640bfcb1bd1710c33e2ed6a80
/Card Note/ViewController/CardPickerController.swift
2c8aba02efb4a648295f45573700d517df9d1bc6
[]
no_license
xiaoqiangheye/Card-Note
2e6192b545a63ebed71d79bf7401630543fa530b
f83b2e6c9b45d4611d32c0ab647b5a2d73456df0
refs/heads/master
2022-03-23T09:10:04.243662
2022-03-10T21:49:12
2022-03-10T21:49:12
132,254,190
0
0
null
null
null
null
UTF-8
Swift
false
false
2,143
swift
// // CardPickerController.swift // Card Note // // Created by Wei Wei on 7/15/21. // Copyright © 2021 WeiQiang. All rights reserved. // import Foundation import UIKit class CardPickerController:UIViewController{ private var scrollView: UIScrollView! override func viewDidLoad() { } func loadCard(){ let manager = FileManager.default var cardList:[Card] = [Card]() let url = Constant.Configuration.url.Card do{ let array = try manager.contentsOfDirectory(atPath: url.path) for file in array{ let fileUrl = url.appendingPathComponent(file) let dataRead = try Data.init(contentsOf: fileUrl) let card = NSKeyedUnarchiver.unarchiveObject(with: dataRead) as! Card cardList.append(card) } }catch{ print("Failed to load file") } let sorted = cardList.sorted { (card1, card2) -> Bool in if card1.getTitle().compare(card2.getTitle()) == .orderedAscending{ return true } } var cumulatedY:CGFloat = 70 for card in sorted{ let cardView:CardView = CardView(card:card) cardView.frame.origin.y = CGFloat(cumulatedY) cumulatedY += cardView.bounds.height + 30 let tapGesture = UITapGestureRecognizer() tapGesture.addTarget(self, action: #selector(tapped)) tapGesture.numberOfTapsRequired = 1 tapGesture.numberOfTouchesRequired = 1 cardView.addGestureRecognizer(tapGesture) scrollView.addSubview(cardView) if cumulatedY > scrollView.contentSize.height{ scrollView.contentSize = CGSize(width: self.view.bounds.width, height: cumulatedY) } } scrollView.contentOffset.y = contentOffSetY } @objc func cardTapped() { } }
[ -1 ]
23205e160138fb842b857e987070676297a09c15
849f183ecab0392723ad4d4d8c31979dda6c0db4
/CotEditor/Sources/ReplacementSet.Settings+Object.swift
17722136b74fd16f582ece5f32a32f53cccac196
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
vitu/CotEditor
1f883b59c709052fb26be68f9c9e0a91e0a6fca5
7b7f617d46954841605d216f2ab001d6819577f6
refs/heads/master
2020-03-16T13:51:39.237326
2018-05-01T04:50:48
2018-05-01T04:50:48
132,701,221
0
0
Apache-2.0
2019-06-17T02:53:47
2018-05-09T04:23:10
Swift
UTF-8
Swift
false
false
3,339
swift
// // ReplacementSet.Settings+Object.swift // // CotEditor // https://coteditor.com // // Created by 1024jp on 2017-03-17. // // --------------------------------------------------------------------------- // // © 2017-2018 1024jp // // 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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // import Foundation extension ReplacementSet.Settings { /// KVO-compatible object for ReplacementSet.Settings to use with the Cocoa-binding in a popover with checkboxes final class Object: NSObject { @objc dynamic var textIsLiteralSearch: Bool @objc dynamic var textIgnoresDiacriticMarks: Bool @objc dynamic var textIgnoresWidth: Bool @objc dynamic var regexIsSingleline: Bool @objc dynamic var regexIsMultiline: Bool @objc dynamic var regexUsesUnicodeBoundaries: Bool @objc dynamic var regexUnescapesReplacementString: Bool // MARK: - Lifecycle init(settings: ReplacementSet.Settings) { self.textIsLiteralSearch = settings.textualOptions.contains(.literal) self.textIgnoresDiacriticMarks = settings.textualOptions.contains(.diacriticInsensitive) self.textIgnoresWidth = settings.textualOptions.contains(.widthInsensitive) self.regexIsSingleline = settings.regexOptions.contains(.dotMatchesLineSeparators) self.regexIsMultiline = settings.regexOptions.contains(.anchorsMatchLines) self.regexUsesUnicodeBoundaries = settings.regexOptions.contains(.useUnicodeWordBoundaries) self.regexUnescapesReplacementString = settings.unescapesReplacementString } var settings: ReplacementSet.Settings { var textualOptions = NSString.CompareOptions() if self.textIsLiteralSearch { textualOptions.update(with: .literal) } if self.textIgnoresDiacriticMarks { textualOptions.update(with: .diacriticInsensitive) } if self.textIgnoresWidth { textualOptions.update(with: .widthInsensitive) } var regexOptions = NSRegularExpression.Options() if self.regexIsSingleline { regexOptions.update(with: .dotMatchesLineSeparators) } if self.regexIsMultiline { regexOptions.update(with: .anchorsMatchLines) } if self.regexUsesUnicodeBoundaries { regexOptions.update(with: .useUnicodeWordBoundaries) } return ReplacementSet.Settings(textualOptions: textualOptions, regexOptions: regexOptions, unescapesReplacementString: self.regexUnescapesReplacementString) } } }
[ -1 ]
096d824e294dfe01548236262dcc2b8538c69dab
6cc8110b93c8842ba4db6c1450336d2d1823ad04
/FlowchartReader/ViewController.swift
a737813273ea3431a7d494b56e916637c12e83b7
[]
no_license
Jasonnugraha/ADA-NothingToLose-FlowChartReader
1e8b2e63106656cb0da393c2e7ed90c647b1c4c0
e707a462a10f6ca49c1e1fd21fa2d2506844c45b
refs/heads/main
2023-05-31T07:17:59.016032
2021-06-21T03:27:58
2021-06-21T03:27:58
374,883,949
0
0
null
2021-06-21T03:27:58
2021-06-08T04:46:42
Swift
UTF-8
Swift
false
false
285
swift
// // ViewController.swift // FlowchartReader // // Created by Jason Nugraha on 08/06/21. // import UIKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } }
[ 262528, 385282, 158612, 345751, 155551, 262561, 262453, 266816, 351170, 437582, 377048, 357209, 399201, 350187, 352876, 376687, 432243, 344695, 351481, 361595 ]
ef928b22a8f24aa29f9bcd82c767d98cfb8122e3
60d596e322fe434f39709d7fa79a5ba69055b6b2
/Package.swift
30923e25d70180d04fbb57a47e255bdbf65c7ac5
[ "BSD-2-Clause" ]
permissive
ThePowerOfSwift/PDFjet-Open-Source
d6d885fd1f133df3ee4ae2d4d63c1700c4940adb
61545e0badeefd23683e185b10dbf3401cc7b5f9
refs/heads/master
2022-06-14T06:39:46.063295
2020-05-05T19:58:55
2020-05-05T19:58:55
null
0
0
null
null
null
null
UTF-8
Swift
false
false
3,303
swift
// swift-tools-version:4.0 import PackageDescription let package = Package( name: "PDFjet", targets: [ .target(name: "Example_01", dependencies: ["PDFjet"]), .target(name: "Example_02", dependencies: ["PDFjet"]), .target(name: "Example_03", dependencies: ["PDFjet"]), .target(name: "Example_04", dependencies: ["PDFjet"]), .target(name: "Example_05", dependencies: ["PDFjet"]), .target(name: "Example_06", dependencies: ["PDFjet"]), .target(name: "Example_07", dependencies: ["PDFjet"]), .target(name: "Example_08", dependencies: ["PDFjet"]), .target(name: "Example_09", dependencies: ["PDFjet"]), .target(name: "Example_10", dependencies: ["PDFjet"]), .target(name: "Example_11", dependencies: ["PDFjet"]), .target(name: "Example_12", dependencies: ["PDFjet"]), .target(name: "Example_13", dependencies: ["PDFjet"]), .target(name: "Example_14", dependencies: ["PDFjet"]), .target(name: "Example_15", dependencies: ["PDFjet"]), .target(name: "Example_16", dependencies: ["PDFjet"]), .target(name: "Example_17", dependencies: ["PDFjet"]), .target(name: "Example_18", dependencies: ["PDFjet"]), .target(name: "Example_19", dependencies: ["PDFjet"]), .target(name: "Example_20", dependencies: ["PDFjet"]), .target(name: "Example_21", dependencies: ["PDFjet"]), .target(name: "Example_22", dependencies: ["PDFjet"]), .target(name: "Example_23", dependencies: ["PDFjet"]), .target(name: "Example_24", dependencies: ["PDFjet"]), .target(name: "Example_25", dependencies: ["PDFjet"]), .target(name: "Example_26", dependencies: ["PDFjet"]), .target(name: "Example_27", dependencies: ["PDFjet"]), .target(name: "Example_28", dependencies: ["PDFjet"]), .target(name: "Example_29", dependencies: ["PDFjet"]), .target(name: "Example_30", dependencies: ["PDFjet"]), .target(name: "Example_31", dependencies: ["PDFjet"]), .target(name: "Example_32", dependencies: ["PDFjet"]), .target(name: "Example_33", dependencies: ["PDFjet"]), .target(name: "Example_34", dependencies: ["PDFjet"]), .target(name: "Example_35", dependencies: ["PDFjet"]), .target(name: "Example_36", dependencies: ["PDFjet"]), .target(name: "Example_37", dependencies: ["PDFjet"]), .target(name: "Example_38", dependencies: ["PDFjet"]), .target(name: "Example_39", dependencies: ["PDFjet"]), .target(name: "Example_40", dependencies: ["PDFjet"]), .target(name: "Example_41", dependencies: ["PDFjet"]), .target(name: "Example_42", dependencies: ["PDFjet"]), .target(name: "Example_43", dependencies: ["PDFjet"]), .target(name: "Example_44", dependencies: ["PDFjet"]), .target(name: "Example_45", dependencies: ["PDFjet"]), .target(name: "Example_46", dependencies: ["PDFjet"]), .target(name: "Example_47", dependencies: ["PDFjet"]), .target(name: "Example_48", dependencies: ["PDFjet"]), .target(name: "Example_49", dependencies: ["PDFjet"]), .target(name: "Example_50", dependencies: ["PDFjet"]), .target(name: "PDFjet") ] )
[ -1 ]
5ac07aa1758d0710f1b78312d54ee14889b73833
180e6bce417c4b18293f026af8fdd66d8c89359e
/AC3.2-NYTTopStories/AC3.2-NYTTopStories/AppDelegate.swift
9f43824a17d74943990f314c55a747d712a7c087
[]
no_license
kadellsays/AC3.2-NYTTopStories
f42400242548ee1293e5923f8659804b09c204e6
1f499cdbb7bf50c482330b68cc22704882f31d6c
refs/heads/master
2020-07-03T16:44:35.669745
2016-11-27T19:28:13
2016-11-27T19:28:13
74,243,616
0
0
null
null
null
null
UTF-8
Swift
false
false
2,174
swift
// // AppDelegate.swift // AC3.2-NYTTopStories // // Created by Kadell on 11/19/16. // Copyright © 2016 Kadell. 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, 229391, 327695, 278545, 229394, 278548, 229397, 229399, 229402, 352284, 229405, 278556, 278559, 229408, 278564, 294950, 229415, 229417, 327722, 237613, 229422, 360496, 229426, 237618, 229428, 286774, 229432, 286776, 286778, 319544, 204856, 352318, 286791, 237640, 278605, 286797, 311375, 163920, 237646, 196692, 319573, 311383, 278623, 278626, 319590, 311400, 278635, 303212, 278639, 131192, 278648, 237693, 303230, 327814, 131209, 303241, 417930, 311436, 303244, 319633, 286873, 286876, 311460, 311469, 32944, 327862, 286906, 327866, 180413, 286910, 131264, 286916, 295110, 286922, 286924, 286926, 319694, 286928, 131281, 278743, 278747, 295133, 155872, 319716, 237807, 303345, 286962, 303347, 131314, 229622, 327930, 278781, 278783, 278785, 237826, 319751, 278792, 286987, 319757, 311569, 286999, 319770, 287003, 287006, 287009, 287012, 287014, 287016, 287019, 311598, 287023, 262448, 311601, 287032, 155966, 319809, 319810, 278849, 319814, 311623, 319818, 311628, 229709, 287054, 319822, 278865, 229717, 196963, 196969, 139638, 213367, 106872, 319872, 311683, 319879, 311693, 65943, 319898, 311719, 278952, 139689, 278957, 311728, 278967, 180668, 311741, 278975, 319938, 278980, 98756, 278983, 319945, 278986, 319947, 278990, 278994, 311767, 279003, 279006, 188895, 172512, 279010, 287202, 279015, 172520, 319978, 279020, 172526, 279023, 311791, 172529, 279027, 319989, 164343, 180727, 279035, 311804, 287230, 279040, 303617, 287234, 279045, 172550, 287238, 172552, 303623, 320007, 279051, 172558, 279055, 303632, 279058, 303637, 279063, 279067, 172572, 279072, 172577, 295459, 172581, 295461, 279082, 311850, 279084, 172591, 172598, 279095, 172607, 172609, 172612, 377413, 172614, 213575, 172618, 303690, 33357, 287309, 279124, 172634, 262752, 254563, 172644, 311911, 189034, 295533, 172655, 172656, 189039, 295538, 189040, 172660, 189044, 287349, 352880, 287355, 287360, 295553, 172675, 287365, 311942, 303751, 295557, 352905, 279178, 287371, 311946, 311951, 287377, 172691, 287381, 311957, 221850, 287386, 164509, 303773, 230045, 172702, 287390, 287394, 172705, 303780, 172707, 287398, 205479, 279208, 287400, 172714, 295595, 279212, 189102, 172721, 287409, 66227, 303797, 189114, 287419, 303804, 328381, 287423, 328384, 279231, 287427, 312005, 312006, 172748, 287436, 107212, 172751, 287440, 295633, 172755, 303827, 279255, 172760, 279258, 303835, 213724, 189149, 303838, 287450, 279267, 312035, 295654, 279272, 230128, 312048, 312050, 230131, 189169, 205564, 303871, 230146, 328453, 295685, 230154, 33548, 312077, 295695, 295701, 230169, 369433, 295707, 328476, 295710, 230175, 295720, 303914, 279340, 205613, 279353, 230202, 312124, 328508, 222018, 295755, 377676, 148302, 287569, 303959, 230237, 279390, 230241, 279394, 303976, 336744, 303981, 303985, 328563, 303987, 279413, 303991, 303997, 295806, 295808, 304005, 295813, 213895, 320391, 304007, 304009, 304011, 230284, 304013, 279438, 189325, 295822, 189329, 295825, 304019, 213902, 189331, 58262, 304023, 279452, 410526, 279461, 279462, 304042, 213931, 230327, 304055, 287675, 197564, 230334, 304063, 304065, 213954, 189378, 156612, 295873, 213963, 312272, 304084, 304090, 320481, 304106, 320490, 312302, 328687, 320496, 304114, 295928, 320505, 312321, 295945, 295949, 230413, 197645, 320528, 140312, 295961, 238620, 197663, 304164, 304170, 304175, 238641, 312374, 238652, 238655, 230465, 238658, 336964, 296004, 205895, 320584, 238666, 296021, 402518, 336987, 230497, 296036, 296040, 361576, 205931, 279661, 205934, 164973, 312432, 279669, 337018, 189562, 279679, 66690, 279683, 222340, 205968, 296084, 238745, 304285, 238756, 205991, 222377, 165035, 337067, 238766, 165038, 230576, 238770, 304311, 230592, 279750, 312518, 230600, 230607, 148690, 320727, 279769, 304348, 279777, 304354, 296163, 320740, 279781, 304360, 320748, 279788, 279790, 304370, 296189, 320771, 312585, 296202, 296205, 230674, 320786, 230677, 296213, 296215, 230679, 320792, 230681, 214294, 230689, 173350, 312622, 296243, 312630, 222522, 222525, 296253, 312639, 296255, 230718, 296259, 378181, 296262, 230727, 238919, 320840, 296264, 296267, 296271, 222545, 230739, 312663, 337244, 222556, 230752, 312676, 230760, 173418, 410987, 230763, 148843, 230768, 296305, 312692, 230773, 279929, 304506, 181626, 304505, 181631, 312711, 312712, 296331, 288140, 288144, 230800, 304533, 337306, 288154, 288160, 288162, 288164, 279975, 304555, 370092, 279983, 288176, 173488, 279985, 312755, 296373, 279991, 312759, 288185, 337335, 222652, 312766, 173507, 296389, 222665, 230860, 312783, 288208, 230865, 288210, 370130, 288212, 222676, 288214, 148946, 239064, 288217, 329177, 280027, 288220, 288218, 239070, 288224, 280034, 288226, 280036, 288229, 280038, 288230, 288232, 370146, 288234, 320998, 288236, 288238, 288240, 288242, 296435, 288244, 288250, 402942, 296446, 148990, 321022, 296450, 206336, 230916, 230919, 214535, 304651, 370187, 304653, 230923, 402969, 230940, 222752, 108066, 296486, 296488, 157229, 239152, 230961, 157236, 288320, 288325, 124489, 280140, 280145, 288338, 280149, 288344, 280152, 239194, 280158, 403039, 181854, 370272, 239202, 370279, 312938, 280183, 280185, 280188, 280191, 116354, 280194, 280208, 280211, 288408, 280218, 280222, 419489, 190118, 198310, 321195, 296622, 321200, 337585, 296626, 296634, 296637, 419522, 313027, 280260, 419525, 206536, 280264, 206539, 206541, 206543, 263888, 280276, 313044, 321239, 280283, 313052, 18140, 288478, 313055, 419555, 321252, 313066, 280302, 288494, 280304, 313073, 321266, 288499, 419570, 288502, 280314, 288510, 67330, 280324, 198405, 288519, 280331, 198416, 280337, 296723, 116503, 321304, 329498, 296731, 321311, 313121, 313123, 304932, 321316, 280363, 141101, 165678, 280375, 321336, 296767, 288576, 345921, 280388, 337732, 304968, 280393, 280402, 173907, 313176, 42842, 280419, 321381, 296809, 296812, 313201, 1920, 255873, 305028, 280454, 247688, 280464, 124817, 280468, 239510, 280473, 124827, 214940, 247709, 214944, 280487, 313258, 321458, 296883, 124853, 214966, 10170, 296890, 288700, 296894, 190403, 296900, 280515, 337862, 165831, 280521, 231379, 296921, 354265, 354270, 239586, 313320, 354281, 231404, 124913, 165876, 321528, 239612, 313340, 288764, 239617, 313347, 288773, 313358, 321560, 305176, 313371, 354338, 305191, 223273, 313386, 354348, 124978, 215090, 124980, 288824, 288826, 321595, 313406, 288831, 288836, 67654, 280651, 354382, 288848, 280658, 215123, 354390, 288855, 288859, 280669, 313438, 280671, 149599, 149601, 321634, 149603, 223327, 329830, 280681, 313451, 223341, 280687, 313458, 280691, 215154, 313464, 329850, 321659, 280702, 288895, 321670, 215175, 141446, 141455, 141459, 280725, 313498, 100520, 288936, 280747, 288940, 280755, 288947, 321717, 280759, 280764, 280769, 280771, 280774, 280776, 313548, 321740, 280783, 280786, 280788, 313557, 280793, 280796, 280798, 338147, 280804, 280807, 157930, 280811, 280817, 125171, 157940, 280819, 182517, 280823, 280825, 280827, 280830, 280831, 280833, 125187, 280835, 125191, 125207, 125209, 321817, 125218, 321842, 223539, 125239, 280888, 280891, 289087, 280897, 280900, 239944, 305480, 280906, 239947, 305485, 305489, 379218, 280919, 289111, 248153, 215387, 354653, 313700, 280937, 313705, 190832, 280946, 223606, 313720, 280956, 239997, 280959, 313731, 199051, 240011, 289166, 240017, 297363, 190868, 297365, 240021, 297368, 297372, 141725, 297377, 289186, 297391, 289201, 240052, 289207, 305594, 289210, 281024, 289218, 289221, 289227, 436684, 281045, 281047, 215526, 166378, 305647, 281075, 174580, 240124, 281084, 305662, 305664, 240129, 305666, 305668, 330244, 240132, 281095, 338440, 150025, 223752, 223749, 223757, 281102, 223763, 223765, 281113, 322074, 281116, 281121, 182819, 281127, 281135, 150066, 158262, 158266, 289342, 281154, 322115, 158283, 281163, 281179, 338528, 338532, 281190, 199273, 281196, 158317, 19053, 313973, 281210, 297594, 158347, 264845, 182926, 133776, 182929, 314003, 117398, 314007, 289436, 174754, 330404, 289448, 133801, 174764, 314029, 314033, 240309, 133817, 314045, 314047, 314051, 199364, 297671, 158409, 256716, 289493, 363234, 289513, 289522, 289525, 289532, 322303, 289537, 322310, 264969, 322314, 322318, 281361, 281372, 322341, 215850, 281388, 289593, 281401, 289601, 281410, 281413, 281414, 240458, 281420, 240468, 281430, 322393, 297818, 281435, 281438, 281442, 174955, 224110, 207733, 207737, 183172, 158596, 240519, 322440, 314249, 338823, 183184, 142226, 289687, 224151, 240535, 297883, 289694, 289696, 289700, 289712, 281529, 289724, 52163, 183260, 420829, 281567, 289762, 322534, 297961, 183277, 281581, 322550, 134142, 322563, 314372, 330764, 175134, 322599, 322610, 314421, 281654, 314427, 314433, 207937, 314441, 207949, 322642, 314456, 281691, 314461, 281702, 281704, 314474, 281708, 281711, 289912, 248995, 306341, 306344, 306347, 322734, 306354, 142531, 199877, 289991, 306377, 289997, 249045, 363742, 363745, 298216, 330988, 126190, 216303, 322801, 388350, 257302, 363802, 199976, 199978, 314671, 298292, 298294, 257334, 216376, 298306, 380226, 224584, 224587, 224594, 216404, 306517, 150870, 314714, 224603, 159068, 314718, 265568, 314723, 281960, 150890, 306539, 314732, 314736, 290161, 216436, 306549, 298358, 314743, 306552, 290171, 314747, 298365, 290174, 306555, 224641, 281987, 298372, 314756, 281990, 224647, 265604, 298377, 314763, 142733, 298381, 314768, 224657, 314773, 306581, 314779, 314785, 282025, 314793, 282027, 241068, 241070, 241072, 282034, 241077, 150966, 298424, 306618, 282044, 323015, 306635, 306640, 290263, 290270, 290275, 339431, 282089, 191985, 282098, 290291, 282101, 241142, 191992, 290298, 151036, 290302, 282111, 290305, 175621, 306694, 192008, 323084, 257550, 282127, 290321, 282130, 323090, 282133, 290325, 241175, 290328, 282137, 290332, 241181, 282142, 282144, 290344, 306731, 290349, 290351, 290356, 282186, 224849, 282195, 282199, 282201, 306778, 159324, 159330, 314979, 298598, 323176, 224875, 241260, 323181, 257658, 315016, 282249, 290445, 282255, 282261, 175770, 298651, 282269, 323229, 298655, 323231, 61092, 282277, 306856, 196133, 282295, 282300, 323260, 323266, 282310, 323273, 282319, 306897, 241362, 306904, 282328, 298714, 52959, 216801, 282337, 241380, 216806, 323304, 282345, 12011, 282356, 323318, 282364, 282367, 306945, 241412, 323333, 282376, 216842, 323345, 282388, 323349, 282392, 184090, 315167, 315169, 282402, 315174, 323367, 241448, 315176, 241450, 282410, 306988, 306991, 315184, 323376, 315190, 241464, 159545, 282425, 298811, 307009, 241475, 307012, 298822, 315211, 282446, 307027, 315221, 323414, 315223, 241496, 241498, 307035, 307040, 110433, 282465, 241509, 110438, 298860, 110445, 282478, 315249, 110450, 315251, 282481, 315253, 315255, 339838, 315267, 282499, 315269, 241544, 282505, 241546, 241548, 298896, 298898, 282514, 44948, 298901, 241556, 282520, 241560, 241563, 241565, 241567, 241569, 282531, 241574, 282537, 298922, 36779, 241581, 282542, 241583, 323504, 241586, 282547, 241588, 290739, 241590, 241592, 241598, 290751, 241600, 241605, 151495, 241610, 298975, 241632, 298984, 241640, 241643, 298988, 241646, 241649, 241652, 323574, 290807, 241661, 299006, 282623, 315396, 241669, 315397, 282632, 282639, 290835, 282645, 241693, 282654, 241701, 102438, 217127, 282669, 323630, 282681, 290877, 282687, 159811, 315463, 315466, 192589, 307278, 192596, 176213, 307287, 315482, 217179, 315483, 192605, 233567, 200801, 299105, 217188, 299109, 307303, 315495, 356457, 45163, 307307, 315502, 192624, 307314, 323700, 299126, 233591, 299136, 307329, 315524, 307338, 233613, 241813, 307352, 299164, 241821, 184479, 299167, 184481, 315557, 184486, 307370, 307372, 184492, 307374, 307376, 299185, 323763, 176311, 299191, 307385, 307386, 258235, 176316, 307388, 307390, 184503, 299200, 184512, 307394, 307396, 299204, 184518, 307399, 323784, 233679, 307409, 307411, 176343, 299225, 233701, 307432, 184572, 282881, 184579, 282893, 323854, 291089, 282906, 291104, 233766, 176435, 307508, 315701, 307510, 332086, 307512, 168245, 307515, 282942, 307518, 282947, 323917, 110926, 282957, 233808, 323921, 315733, 323926, 233815, 276052, 315739, 323932, 299357, 242018, 242024, 299373, 315757, 250231, 242043, 315771, 299388, 299391, 291202, 299398, 242057, 291212, 299405, 291222, 283033, 291226, 242075, 315801, 291231, 61855, 283042, 291238, 291241, 127403, 127405, 291247, 127407, 299444, 127413, 283062, 291254, 127417, 291260, 283069, 127421, 127424, 299457, 127429, 176592, 315856, 315860, 176597, 283095, 127447, 299481, 176605, 242143, 291299, 340454, 127463, 242152, 291305, 127466, 176620, 127469, 127474, 291314, 291317, 135672, 233979, 291323, 127485, 291330, 283142, 127497, 233994, 135689, 127500, 291341, 233998, 127506, 234003, 234006, 152087, 127511, 283161, 242202, 234010, 135707, 242206, 135710, 242208, 291361, 242220, 291378, 234038, 152118, 234041, 315961, 70213, 242250, 111193, 242275, 299620, 242279, 168562, 184952, 135805, 291456, 135808, 373383, 299655, 135820, 316051, 225941, 316054, 299672, 135834, 373404, 299677, 225948, 135839, 299680, 225954, 135844, 299684, 242343, 209576, 242345, 373421, 135870, 135873, 135876, 135879, 299720, 299723, 299726, 225998, 226002, 119509, 226005, 226008, 242396, 299740, 201444, 299750, 283368, 234219, 283372, 185074, 226037, 283382, 234231, 316151, 234236, 226045, 234239, 242431, 209665, 234242, 299778, 242436, 226053, 234246, 226056, 234248, 291593, 242443, 234252, 242445, 234254, 291601, 234258, 242450, 242452, 234261, 201496, 234264, 234266, 234269, 283421, 234272, 234274, 152355, 234278, 299814, 283432, 234281, 234284, 234287, 283440, 185138, 242483, 234292, 234296, 234298, 283452, 160572, 234302, 234307, 242499, 234309, 292433, 234313, 316233, 316235, 234316, 283468, 242511, 234319, 234321, 234324, 185173, 201557, 234329, 234333, 308063, 234336, 234338, 242530, 349027, 234341, 234344, 234347, 177004, 234350, 324464, 234353, 152435, 177011, 234356, 234358, 234362, 226171, 234364, 291711, 234368, 234370, 201603, 291714, 234373, 226182, 234375, 291716, 308105, 226185, 234379, 234384, 234388, 234390, 324504, 234393, 209818, 308123, 324508, 234396, 291742, 226200, 234398, 234401, 291747, 291748, 234405, 291750, 234407, 324518, 324520, 234410, 324522, 226220, 291756, 291754, 324527, 291760, 234417, 201650, 324531, 234414, 234422, 226230, 275384, 324536, 234428, 291773, 234431, 242623, 324544, 324546, 234434, 324548, 226245, 234437, 234439, 226239, 234443, 291788, 234446, 275406, 193486, 234449, 316370, 193488, 234452, 234455, 234459, 234461, 234464, 234467, 234470, 168935, 5096, 324585, 234475, 234478, 316400, 234481, 316403, 234484, 234485, 324599, 234487, 234490, 234493, 234496, 316416, 308226, 234501, 275462, 308231, 234504, 234507, 234510, 234515, 300054, 234519, 316439, 234520, 234523, 234526, 234528, 300066, 234532, 300069, 234535, 234537, 234540, 144430, 234543, 234546, 275508, 234549, 300085, 300088, 234553, 234556, 234558, 316479, 234561, 316483, 308291, 234563, 160835, 234568, 234570, 316491, 300108, 234572, 234574, 300115, 234580, 234581, 242777, 234585, 275545, 234590, 234593, 234595, 300133, 234597, 234601, 300139, 234605, 160879, 234607, 275569, 234610, 300148, 234614, 398455, 144506, 234618, 275579, 234620, 234623, 226433, 234627, 275588, 234629, 242822, 234634, 234636, 177293, 234640, 275602, 234643, 226453, 275606, 234647, 275608, 308373, 234650, 324757, 308379, 234653, 324766, 119967, 300189, 234648, 283805, 234657, 242852, 234661, 283813, 300197, 234664, 324768, 275626, 234667, 177318, 316596, 308414, 234687, 300223, 300226, 308418, 226500, 234692, 300229, 308420, 283844, 308422, 283850, 300234, 300238, 300241, 316625, 300243, 300245, 316630, 300248, 300253, 300256, 300258, 300260, 234726, 300263, 300265, 161003, 300267, 300270, 300272, 120053, 300278, 316663, 275703, 300284, 275710, 300287, 300289, 292097, 161027, 300292, 300294, 275719, 234760, 177419, 300299, 283917, 300301, 349451, 177424, 242957, 275725, 349464, 415009, 283939, 259367, 292143, 283951, 300344, 226617, 243003, 283963, 226628, 283973, 300357, 177482, 283983, 316758, 357722, 316766, 292192, 316768, 218464, 292197, 316774, 243046, 218473, 284010, 136562, 324978, 275834, 333178, 275836, 275840, 316803, 316806, 226696, 316811, 226699, 316814, 226703, 300433, 234899, 226709, 357783, 316824, 316826, 144796, 300448, 144807, 144810, 144812, 144814, 144820, 284084, 284087, 292279, 144826, 144828, 144830, 144832, 144835, 144837, 38342, 144839, 144841, 144844, 144847, 144852, 144855, 103899, 300507, 333280, 226787, 218597, 292329, 300523, 259565, 300527, 308720, 259567, 226802, 292338, 316917, 308727, 292343, 300537, 316933, 316947, 308757, 308762, 284191, 316959, 284194, 284196, 235045, 284199, 284204, 284206, 284209, 284211, 284213, 308790, 316983, 284215, 194103, 284218, 194101, 226877, 284223, 284226, 243268, 292421, 226886, 284231, 128584, 284228, 284234, 276043, 317004, 366155, 284238, 226895, 284241, 194130, 284243, 300628, 284245, 276053, 284247, 317015, 284249, 243290, 284251, 235097, 284253, 300638, 284255, 243293, 284258, 292452, 177766, 284263, 292454, 284265, 292458, 284267, 292461, 284272, 284274, 276086, 284278, 292470, 292473, 284283, 276093, 284286, 276095, 284288, 292481, 284290, 325250, 284292, 292485, 292479, 276098, 284297, 317066, 284299, 317068, 276109, 284301, 284303, 276114, 284306, 284308, 284312, 284314, 284316, 276127, 284320, 284322, 284327, 276137, 284329, 284331, 317098, 284333, 284335, 284337, 284339, 300726, 284343, 284346, 284350, 276160, 358080, 284354, 358083, 276166, 284358, 358089, 276170, 284362, 276175, 284368, 276177, 284370, 317138, 284372, 358098, 284377, 276187, 284379, 284381, 284384, 284386, 358114, 358116, 276197, 317158, 358119, 284392, 325353, 284394, 358122, 284397, 358126, 284399, 358128, 276206, 358133, 358135, 276216, 358138, 300795, 358140, 284413, 358142, 358146, 317187, 284418, 317189, 317191, 284428, 300816, 300819, 317207, 284440, 300828, 300830, 276255, 325408, 300832, 300834, 317221, 227109, 358183, 186151, 276268, 300845, 243504, 300850, 284469, 276280, 325436, 358206, 276291, 366406, 276295, 300872, 153417, 292681, 358224, 284499, 276308, 284502, 317271, 178006, 276315, 292700, 284511, 317279, 227175, 292715, 300912, 284529, 292721, 300915, 284533, 292729, 317306, 284540, 292734, 325512, 169868, 276365, 284564, 358292, 399252, 317332, 284566, 350106, 284572, 276386, 284579, 276388, 358312, 284585, 317353, 276395, 292776, 292784, 276402, 358326, 161718, 276410, 276411, 358330, 276418, 276425, 301009, 301011, 301013, 292823, 301015, 301017, 358360, 292828, 276446, 153568, 276452, 276455, 292839, 350186, 292843, 276460, 292845, 276464, 227314, 350200, 276472, 325624, 317435, 276479, 276482, 350210, 276485, 317446, 178181, 276490, 350218, 292876, 350222, 276496, 317456, 317458, 243733, 243740, 317468, 317472, 325666, 243751, 292904, 276528, 178224, 243762, 309298, 325685, 325689, 235579, 276539, 235581, 178238, 325692, 276544, 243779, 284739, 325700, 292934, 243785, 276553, 350293, 350295, 194649, 227418, 309337, 350299, 350302, 227423, 194654, 178273, 194657, 227426, 194660, 276579, 227430, 276583, 309346, 309348, 309350, 309352, 309354, 350308, 276590, 350313, 350316, 350321, 284786, 276595, 301167, 350325, 227440, 350328, 292985, 301178, 350332, 292989, 292993, 301185, 350339, 317570, 317573, 350342, 350345, 350349, 301199, 317584, 325777, 350354, 350357, 350359, 350362, 276638, 350366, 284837, 153765, 350375, 350379, 350381, 350383, 350385, 350387, 350389, 350395, 350397, 350399, 227520, 350402, 227522, 301252, 350406, 227529, 309450, 301258, 276685, 309455, 276689, 309462, 301272, 276699, 309468, 194780, 309471, 301283, 317672, 317674, 325867, 243948, 194801, 309491, 309494, 243960, 276735, 227583, 227587, 276739, 211204, 276742, 227593, 227596, 325910, 309530, 342298, 211232, 317729, 276775, 211241, 325937, 325943, 211260, 260421, 285002, 276811, 235853, 276816, 235858, 276829, 276833, 391523, 276836, 276843, 293227, 276848, 293232, 186744, 211324, 227709, 285061, 366983, 317833, 178572, 285070, 285077, 178583, 227738, 317853, 276896, 317858, 342434, 285093, 317864, 285098, 276907, 235955, 276917, 293304, 293307, 293314, 309707, 293325, 129486, 317910, 293336, 235996, 317917, 293343, 358880, 276961, 227810, 293346, 276964, 293352, 236013, 293364, 293370, 301562, 317951, 309764, 301575, 121352, 236043, 317963, 342541, 55822, 113167, 317971, 309779, 309781, 55837, 227877, 227879, 293417, 227882, 309804, 293421, 105007, 236082, 285236, 23094, 277054, 244288, 219714, 129603, 318020, 301636, 301639, 301643, 277071, 285265, 309844, 277080, 309849, 285277, 285282, 326244, 318055, 277100, 309871, 121458, 277106, 170618, 170619, 309885, 309888, 277122, 227975, 277128, 285320, 301706, 318092, 326285, 318094, 334476, 277136, 277139, 227992, 334488, 285340, 318108, 227998, 318110, 137889, 383658, 285357, 318128, 277170, 342707, 154292, 293555, 318132, 277173, 285368, 277177, 277181, 318144, 277187, 277191, 277194, 277196, 277201, 342745, 137946, 342747, 342749, 113378, 203491, 228069, 277223, 342760, 285417, 56041, 56043, 56045, 277232, 228081, 56059, 310015, 285441, 310020, 285448, 310029, 228113, 285459, 277273, 293659, 326430, 228128, 293666, 228135, 318248, 277291, 293677, 318253, 285489, 293685, 285494, 301880, 285499, 301884, 310080, 293696, 277317, 277322, 293706, 277329, 162643, 310100, 301911, 301913, 277337, 301921, 400236, 236397, 162671, 326514, 310134, 15224, 236408, 277368, 416639, 416640, 113538, 310147, 416648, 39817, 187274, 277385, 301972, 424853, 277405, 277411, 310179, 293798, 293802, 236460, 277426, 293811, 293817, 293820, 203715, 326603, 342994, 276586, 293849, 293861, 228327, 228328, 228330, 318442, 228332, 277486, 326638, 351217, 318450, 293876, 293877, 285686, 302073, 285690, 121850, 293882, 302075, 293887, 277504, 277507, 277511, 293899, 277519, 293908, 293917, 293939, 318516, 277561, 277564, 310336, 7232, 293956, 277573, 228422, 310344, 277577, 293960, 277583, 203857, 310355, 293971, 310359, 236632, 277594, 138332, 277598, 203872, 277601, 285792, 310374, 203879, 310376, 228460, 318573, 203886, 187509, 285815, 285817, 367737, 285821, 302205, 392326, 285831, 294026, 302218, 285835, 162964, 384148, 187542, 302231, 285849, 302233, 285852, 302237, 285854, 285856, 302241, 285862, 277671, 302248, 64682, 277678, 294063, 294065, 302258, 277687, 294072, 318651, 294076, 277695, 318657, 244930, 302275, 130244, 302277, 228550, 302282, 310476, 302285, 302288, 310481, 302290, 203987, 302292, 302294, 302296, 384222, 310498, 285927, 318698, 302315, 195822, 228592, 294132, 138485, 228601, 204026, 228606, 204031, 64768, 310531, 285958, 138505, 228617, 318742, 204067, 277798, 130345, 277801, 113964, 277804, 384302, 285999, 285997, 113969, 277807, 277811, 318773, 318776, 277816, 286010, 277819, 294204, 417086, 277822, 286016, 294211, 302403, 384328, 277832, 277836, 146765, 294221, 326991, 294223, 277839, 277842, 277847, 277850, 179547, 277853, 277857, 302436, 277860, 294246, 327015, 310632, 327017, 351594, 277864, 277869, 277872, 351607, 310648, 277880, 310651, 277884, 277888, 310657, 351619, 294276, 310659, 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, 64966, 245191, 163272, 310727, 302534, 277959, 292968, 302541, 277963, 302543, 277966, 310737, 277971, 228825, 277978, 310749, 277981, 277984, 310755, 277989, 277991, 187880, 277995, 310764, 286188, 278000, 228851, 310772, 278003, 278006, 40440, 212472, 278009, 40443, 286203, 310780, 40448, 228864, 286214, 228871, 302603, 65038, 302614, 286233, 302617, 302621, 187936, 146977, 286240, 187939, 40484, 294435, 286246, 40486, 40488, 278057, 245288, 40491, 294439, 294440, 294443, 310831, 294445, 286248, 40499, 40502, 212538, 40507, 40511, 40513, 228933, 40521, 286283, 40525, 40527, 212560, 228944, 400976, 40533, 147032, 40537, 40539, 40541, 278109, 40544, 40548, 40550, 40552, 286313, 40554, 286312, 310892, 40557, 40560, 188022, 122488, 294521, 343679, 294537, 310925, 286354, 278163, 302740, 122517, 278168, 179870, 327333, 229030, 212648, 278188, 302764, 278192, 319153, 278196, 302781, 319171, 302789, 294599, 278216, 294601, 302793, 343757, 212690, 278227, 286420, 319187, 229076, 286425, 319194, 278235, 301163, 278238, 229086, 286432, 294625, 294634, 302838, 319226, 286460, 278274, 302852, 278277, 302854, 294664, 311048, 319243, 311053, 302862, 319251, 294682, 278306, 188199, 294701, 278320, 319280, 319290, 229192, 302925, 188247, 280021, 188252, 237409, 229233, 294776, 360317, 294785, 327554, 360322, 40840, 40851, 294803, 188312, 294811, 319390, 237470, 294817, 319394, 40865, 294821, 311209, 180142, 188340, 40886, 319419, 294844, 294847, 393177, 294876, 294879, 294883, 393190, 294890, 311279, 278513, 237555, 278516, 311283, 278519, 237562 ]
3de96a11707aafd3199e80f7c40fe7b1884fcad4
78dea4fa639d2cad3c4b73a325e08db767a517bf
/Source/JudoPayViewController.swift
b5b6e0f93795d328b5b2953fa33e32b0193df436
[ "MIT" ]
permissive
ashleymills/JudoKit
4de169d4639a1ee9e1b531174e55fa83d62596e6
c349e5cebfee6fbc17e4d4bcdf397fae229e420b
refs/heads/master
2020-05-02T04:43:42.252436
2019-08-27T15:14:58
2019-08-27T15:19:36
177,756,585
0
0
MIT
2019-03-26T09:33:31
2019-03-26T09:33:31
null
UTF-8
Swift
false
false
17,963
swift
// // JudoPayViewController.swift // JudoKit // // Copyright (c) 2016 Alternative Payments Ltd // // 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 fileprivate func < <T : Comparable>(lhs: T?, rhs: T?) -> Bool { switch (lhs, rhs) { case let (l?, r?): return l < r case (nil, _?): return true default: return false } } fileprivate func > <T : Comparable>(lhs: T?, rhs: T?) -> Bool { switch (lhs, rhs) { case let (l?, r?): return l > r default: return rhs < lhs } } /** the JudoPayViewController is the one solution build to guide a user through the journey of entering their card details. */ open class JudoPayViewController: UIViewController { // MARK: Transaction variables /// the current JudoKit Session open var judoKitSession: JudoKit /// The amount and currency to process, amount to two decimal places and currency in string open fileprivate (set) var amount: Amount? /// The number (e.g. "123-456" or "654321") identifying the Merchant you wish to pay open fileprivate (set) var judoId: String? /// Your reference for this consumer, this payment and an object containing any additional data you wish to tag this payment with. The property name and value are both limited to 50 characters, and the whole object cannot be more than 1024 characters open fileprivate (set) var reference: Reference? /// Card token and Consumer token open fileprivate (set) var paymentToken: PaymentToken? /// Customer address to use when AVS is turned off open private(set) var address: Address? /// The current transaction public let transaction: Transaction // MARK: 3DS variables fileprivate var pending3DSTransaction: Transaction? fileprivate var pending3DSReceiptID: String? // MARK: completion blocks fileprivate var completionBlock: JudoCompletionBlock? /// The overridden view object forwarding to a JudoPayView override open var view: UIView! { get { return self.myView as UIView } set { if newValue is JudoPayView { myView = newValue as? JudoPayView } } } /// The main JudoPayView of this ViewController var myView: JudoPayView! /** Initializer to start a payment journey - parameter judoId: The judoId of the recipient - parameter amount: An amount and currency for the transaction - parameter reference: A Reference for the transaction - parameter transactionType: The type of the transaction - parameter completion: Completion block called when transaction has been finished - parameter currentSession: The current judo apiSession - parameter cardDetails: An object containing all card information - default: nil - parameter paymentToken: A payment token if a payment by token is to be made - default: nil - returns: a JPayViewController object for presentation on a view stack */ public init(judoId: String, amount: Amount, reference: Reference, transactionType: TransactionType = .payment, completion: @escaping JudoCompletionBlock, currentSession: JudoKit, cardDetails: CardDetails? = nil, address: Address? = nil, paymentToken: PaymentToken? = nil) throws { self.judoId = judoId self.amount = amount self.reference = reference self.paymentToken = paymentToken self.address = address self.completionBlock = completion self.judoKitSession = currentSession self.myView = JudoPayView(type: transactionType, currentTheme: currentSession.theme, cardDetails: cardDetails, isTokenPayment: paymentToken != nil) self.transaction = try self.judoKitSession.transaction(self.myView.transactionType, judoId: judoId, amount: amount, reference: reference) super.init(nibName: nil, bundle: nil) } /** Designated initializer that will fail if called - parameter nibNameOrNil: Nib name or nil - parameter nibBundleOrNil: Bundle or nil - returns: will crash if executed */ override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { fatalError("This class should not be initialised with initWithNibName:Bundle:") } /** Designated initializer that will fail if called - parameter aDecoder: A decoder - returns: will crash if executed */ convenience required public init?(coder aDecoder: NSCoder) { fatalError("This class should not be initialised with initWithCoder:") } // MARK: View Lifecycle /** viewDidLoad */ override open func viewDidLoad() { super.viewDidLoad() self.judoKitSession.apiSession.uiClientMode = true switch self.myView.transactionType { case .payment, .preAuth: self.title = self.judoKitSession.theme.paymentTitle case .registerCard: self.title = self.judoKitSession.theme.registerCardTitle case .refund: self.title = self.judoKitSession.theme.refundTitle default: self.title = "Invalid" } self.myView.threeDSecureWebView.delegate = self // Button actions let payButtonTitle = myView.transactionType == .registerCard ? judoKitSession.theme.registerCardNavBarButtonTitle : judoKitSession.theme.paymentButtonTitle self.myView.paymentButton.addTarget(self, action: #selector(JudoPayViewController.payButtonAction(_:)), for: .touchUpInside) self.myView.paymentNavBarButton = UIBarButtonItem(title: payButtonTitle, style: .done, target: self, action: #selector(JudoPayViewController.payButtonAction(_:))) self.myView.paymentNavBarButton!.isEnabled = false self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: self.judoKitSession.theme.backButtonTitle, style: .plain, target: self, action: #selector(JudoPayViewController.doneButtonAction(_:))) self.navigationItem.rightBarButtonItem = self.myView.paymentNavBarButton self.navigationController?.navigationBar.tintColor = self.judoKitSession.theme.getTextColor() self.navigationController?.navigationBar.barTintColor = self.judoKitSession.theme.getNavigationBarBackgroundColor() self.navigationController?.navigationBar.isTranslucent = self.judoKitSession.theme.judoNavigationBarIsTranslucent if !self.judoKitSession.theme.colorMode() { self.navigationController?.navigationBar.barStyle = UIBarStyle.black } navigationController?.navigationBar.setBottomBorderColor(color: judoKitSession.theme.getNavigationBarBottomColor(), height: 1.0) navigationController?.navigationBar.titleTextAttributes = [.foregroundColor: judoKitSession.theme.getNavigationBarTitleColor()] self.view.autoresizingMask = [.flexibleWidth, .flexibleHeight] } /** viewWillAppear - parameter animated: Animated */ open override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) self.myView.paymentEnabled(false) self.myView.layoutIfNeeded() if self.myView.cardDetails == nil && self.myView.cardInputField.textField.text != nil { self.myView.cardInputField.textFieldDidChangeValue(self.myView.cardInputField.textField) self.myView.expiryDateInputField.textFieldDidChangeValue(self.myView.expiryDateInputField.textField) } } /** viewDidAppear - parameter animated: Animated */ open override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) if self.myView.cardInputField.textField.text?.count > 0 { self.myView.secureCodeInputField.textField.becomeFirstResponder() } else { self.myView.cardInputField.textField.becomeFirstResponder() } } // MARK: Button Actions /** When the user hits the pay button, the information is collected from the fields and passed to the backend. The transaction will then be executed. - parameter sender: The payment button */ @objc func payButtonAction(_ sender: AnyObject) { guard let reference = self.reference, let amount = self.amount, let judoId = self.judoId else { self.completionBlock?(nil, JudoError(.parameterError)) return // BAIL } self.myView.secureCodeInputField.textField.resignFirstResponder() self.myView.postCodeInputField.textField.resignFirstResponder() self.myView.loadingView.startAnimating() do { let transaction = try self.judoKitSession.transaction(self.myView.transactionType, judoId: judoId, amount: amount, reference: reference) if var payToken = self.paymentToken { payToken.cv2 = self.myView.secureCodeInputField.textField.text transaction.paymentToken(payToken) } else { // I expect that all the texts are available because the Pay Button would not be active otherwise if self.judoKitSession.theme.avsEnabled { guard let postCode = self.myView.postCodeInputField.textField.text else { return } address = Address(postCode: postCode, country: self.myView.billingCountryInputField.selectedCountry) } var issueNumber: String? = nil var startDate: String? = nil if self.myView.cardInputField.textField.text?.cardNetwork() == .maestro { issueNumber = self.myView.issueNumberInputField.textField.text startDate = self.myView.startDateInputField.textField.text } var cardNumberString = self.myView.cardDetails?._cardNumber if cardNumberString == nil { cardNumberString = self.myView.cardInputField.textField.text!.strippedWhitespaces } transaction.card(Card(number: cardNumberString!, expiryDate: self.myView.expiryDateInputField.textField.text!, securityCode: self.myView.secureCodeInputField.textField.text!, address: address, startDate: startDate, issueNumber: issueNumber)) } try self.judoKitSession.completion(transaction, block: { [weak self] (response, error) -> () in if let error = error { if error.domain == JudoErrorDomain && error.code == .threeDSAuthRequest { guard let payload = error.payload else { self?.completionBlock?(nil, JudoError(.responseParseError)) return // BAIL } do { self?.pending3DSTransaction = transaction self?.pending3DSReceiptID = try self?.myView.threeDSecureWebView.load3DSWithPayload(payload) } catch { self?.myView.loadingView.stopAnimating() self?.completionBlock?(nil, error as? JudoError) } self?.myView.loadingView.actionLabel.text = self?.judoKitSession.theme.redirecting3DSTitle self?.title = self?.judoKitSession.theme.authenticationTitle self?.myView.paymentEnabled(false) } else { self?.completionBlock?(nil, error) self?.myView.loadingView.stopAnimating() } } else if let response = response { self?.completionBlock?(response, nil) self?.myView.loadingView.stopAnimating() } }) } catch let error as JudoError { self.completionBlock?(nil, error) self.myView.loadingView.stopAnimating() } catch { self.completionBlock?(nil, JudoError(.unknown)) self.myView.loadingView.stopAnimating() } } /** executed if the user hits the "Back" button - parameter sender: the button */ @objc func doneButtonAction(_ sender: UIBarButtonItem) { self.completionBlock?(nil, JudoError(.userDidCancel)) } } // MARK: UIWebViewDelegate extension JudoPayViewController: UIWebViewDelegate { /** webView delegate method - parameter webView: The web view - parameter request: The request that was called - parameter navigationType: The navigation Type - returns: return whether webView should start loading the request */ public func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebView.NavigationType) -> Bool { let urlString = request.url?.absoluteString if let urlString = urlString , urlString.range(of: "Parse3DS") != nil { guard let body = request.httpBody, let bodyString = NSString(data: body, encoding: String.Encoding.utf8.rawValue) else { self.completionBlock?(nil, JudoError(.failed3DSError)) return false } var results = JSONDictionary() let pairs = bodyString.components(separatedBy: "&") for pair in pairs { if pair.range(of: "=") != nil { let components = pair.components(separatedBy: "=") let value = components[1] let escapedVal = value.removingPercentEncoding results[components[0]] = escapedVal as AnyObject? } } if let receiptId = self.pending3DSReceiptID { if self.myView.transactionType == .registerCard { self.myView.loadingView.actionLabel.text = self.judoKitSession.theme.verifying3DSRegisterCardTitle } else { self.myView.loadingView.actionLabel.text = self.judoKitSession.theme.verifying3DSPaymentTitle } self.myView.loadingView.startAnimating() self.title = self.judoKitSession.theme.authenticationTitle self.pending3DSTransaction?.threeDSecure(results, receiptId: receiptId, block: { [weak self] (resp, error) -> () in self?.myView.loadingView.stopAnimating() if let error = error { self?.completionBlock?(nil, error) } else if let resp = resp { self?.completionBlock?(resp, nil) } else { self?.completionBlock?(nil, JudoError(.unknown)) } }) } else { self.completionBlock?(nil, JudoError(.unknown)) } UIView.animate(withDuration: 0.3, animations: { () -> Void in self.myView.threeDSecureWebView.alpha = 0.0 }, completion: { (didFinish) -> Void in self.myView.threeDSecureWebView.loadRequest(URLRequest(url: URL(string: "about:blank")!)) }) return false } return true } /** webView delegate method that indicates the webView has finished loading - parameter webView: The web view */ public func webViewDidFinishLoad(_ webView: UIWebView) { var alphaVal: CGFloat = 1.0 if webView.request?.url?.absoluteString == "about:blank" { alphaVal = 0.0 } UIView.animate(withDuration: 0.5, animations: { () -> Void in self.myView.threeDSecureWebView.alpha = alphaVal self.myView.loadingView.stopAnimating() }) } /** webView delegate method that indicates the webView has failed with an error - parameter webView: The web view - parameter error: The error */ public func webView(_ webView: UIWebView, didFailLoadWithError error: Error) { UIView.animate(withDuration: 0.5, animations: { () -> Void in self.myView.threeDSecureWebView.alpha = 0.0 self.myView.loadingView.stopAnimating() }) self.completionBlock?(nil, JudoError(.failed3DSError, bridgedError: error as NSError?)) } }
[ -1 ]
1395b23fec133cf705ee53ebaaada939630e07eb
bd27a6046627c02de2cc43cdbb05ffe8f4feaf50
/Sources/web3swift/Utils/EIP/EIP681.swift
d00e76ba12bc5accbcbbfd85e7a9ddfdfdd0bd06
[ "Apache-2.0" ]
permissive
linen-app/web3swift
e65b9f15c4b0094767b4e46362ddcd10682d48b3
dc7ae435f136bcaa0896368c9b1c1d56d0508052
refs/heads/develop
2023-09-01T19:32:42.563498
2021-10-01T06:39:06
2021-10-01T06:39:06
370,367,137
1
3
Apache-2.0
2021-09-30T15:32:08
2021-05-24T13:45:26
null
UTF-8
Swift
false
false
11,346
swift
// web3swift // // Created by Alex Vlasov. // Copyright © 2018 Alex Vlasov. All rights reserved. // import Foundation import BigInt //import EthereumAddress //import EthereumABI extension Web3 { // request = "ethereum" ":" [ "pay-" ]target_address [ "@" chain_id ] [ "/" function_name ] [ "?" parameters ] // target_address = ethereum_address // chain_id = 1*DIGIT // function_name = STRING // ethereum_address = ( "0x" 40*40HEXDIG ) / ENS_NAME // parameters = parameter *( "&" parameter ) // parameter = key "=" value // key = "value" / "gas" / "gasLimit" / "gasPrice" / TYPE // value = number / ethereum_address / STRING // number = [ "-" / "+" ] *DIGIT [ "." 1*DIGIT ] [ ( "e" / "E" ) [ 1*DIGIT ] [ "+" UNIT ] public struct EIP681Code { public struct EIP681Parameter { public var type: ABI.Element.ParameterType public var value: AnyObject } public var isPayRequest: Bool public var targetAddress: TargetAddress public var chainID: BigUInt? public var functionName: String? public var parameters: [EIP681Parameter] = [EIP681Parameter]() public var gasLimit: BigUInt? public var gasPrice: BigUInt? public var amount: BigUInt? public var function: ABI.Element.Function? public enum TargetAddress { case ethereumAddress(EthereumAddress) case ensAddress(String) public init(_ string: String) { if let ethereumAddress = EthereumAddress(string) { self = TargetAddress.ethereumAddress(ethereumAddress) } else { self = TargetAddress.ensAddress(string) } } } public init(_ targetAddress: TargetAddress, isPayRequest: Bool = false) { self.isPayRequest = isPayRequest self.targetAddress = targetAddress } } public struct EIP681CodeParser { // static var addressRegex = "^(pay-)?([0-9a-zA-Z]+)(@[0-9]+)?" static var addressRegex = "^(pay-)?([0-9a-zA-Z.]+)(@[0-9]+)?\\/?(.*)?$" public static func parse(_ data: Data) -> EIP681Code? { guard let string = String(data: data, encoding: .utf8) else {return nil} return parse(string) } public static func parse(_ string: String) -> EIP681Code? { guard string.hasPrefix("ethereum:") else {return nil} let striped = string.components(separatedBy: "ethereum:") guard striped.count == 2 else {return nil} guard let encoding = striped[1].removingPercentEncoding else {return nil} // guard let url = URL.init(string: encoding) else {return nil} let matcher = try! NSRegularExpression(pattern: addressRegex, options: NSRegularExpression.Options.dotMatchesLineSeparators) let match = matcher.matches(in: encoding, options: NSRegularExpression.MatchingOptions.anchored, range: encoding.fullNSRange) guard match.count == 1 else {return nil} guard match[0].numberOfRanges == 5 else {return nil} var addressString: String? = nil var chainIDString: String? = nil var tail: String? = nil // if let payModifierRange = Range(match[0].range(at: 1), in: encoding) { // let payModifierString = String(encoding[payModifierRange]) // print(payModifierString) // } if let addressRange = Range(match[0].range(at: 2), in: encoding) { addressString = String(encoding[addressRange]) } if let chainIDRange = Range(match[0].range(at: 3), in: encoding) { chainIDString = String(encoding[chainIDRange]) } if let tailRange = Range(match[0].range(at: 4), in: encoding) { tail = String(encoding[tailRange]) } guard let address = addressString else {return nil} let targetAddress = EIP681Code.TargetAddress(address) var code = EIP681Code(targetAddress) if chainIDString != nil { chainIDString!.remove(at: chainIDString!.startIndex) code.chainID = BigUInt(chainIDString!) } if tail == nil { return code } guard let components = URLComponents(string: tail!) else {return code} if components.path == "" { code.isPayRequest = true } else { code.functionName = components.path } guard let queryItems = components.queryItems else {return code} var inputNumber: Int = 0 var inputs = [ABI.Element.InOut]() for comp in queryItems { if let inputType = try? ABITypeParser.parseTypeString(comp.name) { guard let value = comp.value else {continue} var nativeValue: AnyObject? = nil switch inputType { case .address: let val = EIP681Code.TargetAddress(value) switch val { case .ethereumAddress(let ethereumAddress): nativeValue = ethereumAddress as AnyObject // default: // return nil case .ensAddress(let ens): do { let web = web3(provider: InfuraProvider(Networks.fromInt(Int(code.chainID ?? 1)) ?? Networks.Mainnet)!) let ensModel = ENS(web3: web) try ensModel?.setENSResolver(withDomain: ens) let address = try ensModel?.getAddress(forNode: ens) nativeValue = address as AnyObject } catch { return nil } } case .uint(bits: _): if let val = BigUInt(value, radix: 10) { nativeValue = val as AnyObject } else if let val = BigUInt(value.stripHexPrefix(), radix: 16) { nativeValue = val as AnyObject } case .int(bits: _): if let val = BigInt(value, radix: 10) { nativeValue = val as AnyObject } else if let val = BigInt(value.stripHexPrefix(), radix: 16) { nativeValue = val as AnyObject } case .string: nativeValue = value as AnyObject case .dynamicBytes: if let val = Data.fromHex(value) { nativeValue = val as AnyObject } else if let val = value.data(using: .utf8) { nativeValue = val as AnyObject } case .bytes(length: _): if let val = Data.fromHex(value) { nativeValue = val as AnyObject } else if let val = value.data(using: .utf8) { nativeValue = val as AnyObject } case .bool: switch value { case "true","True", "TRUE", "1": nativeValue = true as AnyObject case "false", "False", "FALSE", "0": nativeValue = false as AnyObject default: nativeValue = true as AnyObject } default: continue } if nativeValue != nil { inputs.append(ABI.Element.InOut(name: String(inputNumber), type: inputType)) code.parameters.append(EIP681Code.EIP681Parameter(type: inputType, value: nativeValue!)) inputNumber = inputNumber + 1 } else { return nil } } else { switch comp.name { case "value": guard let value = comp.value else {return nil} let splittedValue = value.split(separator: "e") if splittedValue.count <= 1 { guard let val = BigUInt(value, radix: 10) else {return nil } code.amount = val } else if splittedValue.count == 2 { guard let power = Double(splittedValue[1]) else { return nil } let splittedNumber = String(splittedValue[0]).replacingOccurrences(of: ",", with: ".").split(separator: ".") var a = BigUInt(pow(10, power)) if splittedNumber.count == 1 { guard let number = BigUInt(splittedNumber[0], radix: 10) else { return nil } code.amount = number * a } else if splittedNumber.count == 2 { let stringNumber = String(splittedNumber[0]) + String(splittedNumber[1]) let am = BigUInt(pow(10, Double(splittedNumber[1].count))) a = a / am guard let number = BigUInt(stringNumber, radix: 10) else { return nil } code.amount = number * a } else { return nil } } else { return nil } case "gas": guard let value = comp.value else {return nil} guard let val = BigUInt(value, radix: 10) else {return nil} code.gasLimit = val case "gasLimit": guard let value = comp.value else {return nil} guard let val = BigUInt(value, radix: 10) else {return nil} code.gasLimit = val case "gasPrice": guard let value = comp.value else {return nil} guard let val = BigUInt(value, radix: 10) else {return nil} code.gasPrice = val default: continue } } } if code.functionName != nil { let functionEncoding = ABI.Element.Function(name: code.functionName!, inputs: inputs, outputs: [ABI.Element.InOut](), constant: false, payable: code.amount != nil) code.function = functionEncoding } print(code) return code } } }
[ -1 ]
5907973ef90ea5018a6b364ed6cd1aa907f0d974
358a0b4dbd3185be5ee5a22d5299880d9ea8ad67
/EZPlayerExample/EZPlayerExample/MediaManager.swift
79a6469b520f43cb56463c33faf7ab8f059345ac
[ "MIT" ]
permissive
taixw2/EZPlayer-ojc
142cfb254dbdc98853f189e0134c481476933e4e
54e07d77ddbd457afd72e0960a8dccffcd43f65b
refs/heads/main
2023-03-28T03:55:40.001938
2021-03-30T17:01:56
2021-03-30T17:01:56
353,068,655
0
0
null
null
null
null
UTF-8
Swift
false
false
2,771
swift
// // MediaManager.swift // EZPlayerExample // // Created by yangjun zhu on 2016/12/28. // Copyright © 2016年 yangjun zhu. All rights reserved. // import UIKit import EZPlayer class MediaManager { var player: EZPlayer? var mediaItem: MediaItem? var embeddedContentView: UIView? static let sharedInstance = MediaManager() private init(){ NotificationCenter.default.addObserver(self, selector: #selector(self.playerDidPlayToEnd(_:)), name: NSNotification.Name.EZPlayerPlaybackDidFinish, object: nil) } func playEmbeddedVideo(url: URL, embeddedContentView contentView: UIView? = nil, userinfo: [AnyHashable : Any]? = nil) { var mediaItem = MediaItem() mediaItem.url = url self.playEmbeddedVideo(mediaItem: mediaItem, embeddedContentView: contentView, userinfo: userinfo ) } func playEmbeddedVideo(mediaItem: MediaItem, embeddedContentView contentView: UIView? = nil , userinfo: [AnyHashable : Any]? = nil ) { //stop self.releasePlayer() if let skinView = userinfo?["skin"] as? UIView{ self.player = EZPlayer(controlView: skinView) }else{ self.player = EZPlayer() } // self.player!.slideTrigger = (left:EZPlayerSlideTrigger.none,right:EZPlayerSlideTrigger.none) if let autoPlay = userinfo?["autoPlay"] as? Bool{ self.player!.autoPlay = autoPlay } if let floatMode = userinfo?["floatMode"] as? EZPlayerFloatMode{ self.player!.floatMode = floatMode } if let fullScreenMode = userinfo?["fullScreenMode"] as? EZPlayerFullScreenMode{ self.player!.fullScreenMode = fullScreenMode } self.player!.backButtonBlock = { fromDisplayMode in if fromDisplayMode == .embedded { self.releasePlayer() }else if fromDisplayMode == .fullscreen { if self.embeddedContentView == nil && self.player!.lastDisplayMode != .float{ self.releasePlayer() } }else if fromDisplayMode == .float { if self.player!.lastDisplayMode == .none{ self.releasePlayer() } } } self.embeddedContentView = contentView self.player!.playWithURL(mediaItem.url! , embeddedContentView: self.embeddedContentView) } func releasePlayer(){ self.player?.stop() self.player?.view.removeFromSuperview() self.player = nil self.embeddedContentView = nil self.mediaItem = nil } @objc func playerDidPlayToEnd(_ notifiaction: Notification) { //结束播放关闭播放器 //self.releasePlayer() } }
[ -1 ]
c00d1179e1067c245ff46c08823f18c5f62ead3f
b87af47e1b213fdedac44c78f09d8f4bb6f5574b
/Tests/FormURLEncoderTests.swift
08bf6acf6770a50b1ff8b74595ddb3795f5f8c1d
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
achappell/iOS-Hyperspace
a0a8898e31fcee5de71ae9710e8dae5d7f65b522
ff6e68e6379df24ed50286d0ca6c956ccca75982
refs/heads/master
2023-03-10T17:02:08.156936
2021-02-26T20:07:29
2021-02-26T20:07:29
null
0
0
null
null
null
null
UTF-8
Swift
false
false
1,654
swift
// // FormURLEncoderTests.swift // Hyperspace-iOS // // Created by Will McGinty on 8/18/20. // Copyright © 2020 Bottle Rocket Studios. All rights reserved. // import XCTest @testable import Hyperspace class FormURLEncoderTests: XCTestCase { private let encoder = FormURLEncoder() func test_formURLEncoder_encodesFollowingHTMLSpec() { guard let encoded = encoder.encode([("hello world", "/?+ ")]) else { return XCTFail("Could not properly URL Form encode the value") } let string = String(data: encoded, encoding: .utf8) let decoded = string?.removingPercentEncoding XCTAssertEqual(decoded, "hello+world=/?++") } func test_formURLEncoder_encodesSpacesAsPlus() { let encoded = encoder.formURLEscaped(string: "hello world") XCTAssertEqual(encoded, "hello+world") } func test_formURLEncoder_percentEncodesPlus() { let encoded = encoder.formURLEscaped(string: "hello+world") XCTAssertEqual(encoded, "hello%2Bworld") } func test_formURLEncoder_percentEncodesSlashAndQuestionMark() { let encoded = encoder.formURLEscaped(string: "hello/?") XCTAssertEqual(encoded, "hello%2F%3F") } func test_formURLEncoder_allowedCharacterSetAppropriateCharacters() { XCTAssertFalse(CharacterSet.urlFormAllowed.isSuperset(of: .urlQueryAllowed)) XCTAssertTrue(CharacterSet.urlFormAllowed.contains(" ")) XCTAssertFalse(CharacterSet.urlFormAllowed.contains("/")) XCTAssertFalse(CharacterSet.urlFormAllowed.contains("?")) XCTAssertFalse(CharacterSet.urlFormAllowed.contains("+")) } }
[ -1 ]
7147ec836429137e84f2124d25215ddd04da9ec0
8506affdc78b85c6d78965ac2ea77e025eb20e69
/HFoundation/Directions/DirectionsManager.swift
cfc6f3d3233d44c261204f2a6dddca9688c1d487
[ "MIT" ]
permissive
ignotusverum/PGA-TOUR-BOSE
6bbfbaf89fe7c182ccdf1b452cf89b54d95dc568
2ad916dbad531ef67e751ae26c3e15e2fcb63c9e
refs/heads/master
2023-01-08T02:58:27.832522
2020-11-13T05:34:47
2020-11-13T05:34:47
239,800,647
0
0
null
null
null
null
UTF-8
Swift
false
false
6,033
swift
// // DirectionsManager.swift // HFoundation // // Created by Vlad Z. on 2/20/20. // Copyright © 2020 Vlad Z. All rights reserved. // import UIKit import MapboxCoreNavigation import MapboxDirections import MapboxNavigation public protocol WaypointProtocol { var title: String { get } var coordinate: CLLocationCoordinate2D { get } } public struct HWaypoint: WaypointProtocol { public var title: String public var coordinate: CLLocationCoordinate2D public init(coordinate: CLLocationCoordinate2D, title: String) { self.coordinate = coordinate self.title = title } } public class DirectionsManager: NSObject { public static let shared = DirectionsManager() public func showDirections(origin: HWaypoint, paths: [HWaypoint], in rootController: UIViewController) { let origin = Waypoint(coordinate: origin.coordinate, name: origin.title) let path = paths.map { Waypoint(coordinate: $0.coordinate, name: $0.title) } let options = NavigationRouteOptions(waypoints: [origin] + path, profileIdentifier: .walking) rootController.showLoading() Directions.shared.calculate(options) { (_, routes, _) in guard let route = routes?.first else { return } rootController.dismiss(animated: true, completion: nil) let navigationOptions = NavigationOptions(navigationService: MapboxNavigationService(route: route, locationSource: NavigationLocationManager())) navigationOptions.styles = [NightStyle(), DayStyle()] navigationOptions.styles?.forEach { $0.mapStyleURL = URL(string: "mapbox://styles/ignotusverum/ck7vxrd0412z51inunr9zsnxl")! } let viewController = NavigationViewController(for: route, options: navigationOptions) viewController.delegate = self viewController.modalPresentationStyle = .fullScreen DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { rootController.present(viewController, animated: true, completion: nil) } } } } extension DirectionsManager: NavigationViewControllerDelegate {} class CustomUserLocationAnnotationView: MGLUserLocationAnnotationView { let size: CGFloat = 48 var dot: CALayer! var arrow: CAShapeLayer! override func update() { if frame.isNull { frame = CGRect(x: 0, y: 0, width: size, height: size) return setNeedsLayout() } // Check whether we have the user’s location yet. if CLLocationCoordinate2DIsValid(userLocation!.coordinate) { setupLayers() updateHeading() } } private func updateHeading() { // Show the heading arrow, if the heading of the user is available. if let heading = userLocation!.heading?.trueHeading { arrow.isHidden = false // Get the difference between the map’s current direction and the user’s heading, then convert it from degrees to radians. let directionDegrees = WearableSessionManager.shared.trueHeadingDegrees ?? mapView!.direction let rotation: CGFloat = -MGLRadiansFromDegrees(directionDegrees - heading) // If the difference would be perceptible, rotate the arrow. if abs(rotation) > 0.01 { // Disable implicit animations of this rotation, which reduces lag between changes. CATransaction.begin() CATransaction.setDisableActions(true) arrow.setAffineTransform(CGAffineTransform.identity.rotated(by: rotation)) CATransaction.commit() } } else { arrow.isHidden = true } } private func setupLayers() { // This dot forms the base of the annotation. if dot == nil { dot = CALayer() dot.bounds = CGRect(x: 0, y: 0, width: size, height: size) // Use CALayer’s corner radius to turn this layer into a circle. dot.cornerRadius = size / 2 dot.backgroundColor = super.tintColor.cgColor dot.borderWidth = 4 dot.borderColor = UIColor.white.cgColor layer.addSublayer(dot) } // This arrow overlays the dot and is rotated with the user’s heading. if arrow == nil { arrow = CAShapeLayer() arrow.path = arrowPath() arrow.frame = CGRect(x: 0, y: 0, width: size / 2, height: size / 2) arrow.position = CGPoint(x: dot.frame.midX, y: dot.frame.midY) arrow.fillColor = dot.borderColor layer.addSublayer(arrow) } } // Calculate the vector path for an arrow, for use in a shape layer. private func arrowPath() -> CGPath { let max: CGFloat = size / 2 let pad: CGFloat = 3 let top = CGPoint(x: max * 0.5, y: 0) let left = CGPoint(x: 0 + pad, y: max - pad) let right = CGPoint(x: max - pad, y: max - pad) let center = CGPoint(x: max * 0.5, y: max * 0.6) let bezierPath = UIBezierPath() bezierPath.move(to: top) bezierPath.addLine(to: left) bezierPath.addLine(to: center) bezierPath.addLine(to: right) bezierPath.addLine(to: top) bezierPath.close() return bezierPath.cgPath } }
[ -1 ]
6c7c6b78060ce1b798220275a692c417fed591f3
73c4e02f3364edc07f3817535cbcf9c51efa4298
/start_points/languages/swift-swordfish/start_point/hiker.swift
2ee3318bb66f17b701f197f69cb598b74b63368f
[ "BSD-2-Clause" ]
permissive
cyber-dojo-retired/starter-fat
70d987cb6d4d71ca079a52204b19f6cf9da2b5a5
f23035b58b666cd5e3848bcaaaab2647511a3735
refs/heads/master
2020-03-14T01:52:05.506650
2019-01-08T07:35:17
2019-01-08T07:35:17
null
0
0
null
null
null
null
UTF-8
Swift
false
false
70
swift
class Hiker { func answer() -> Int { return 6 * 9 } }
[ -1 ]
d4182b78f3ee224af12aeca2fc22c7e311696167
1285deeafa0760026d722951f7da2a534e881ea9
/Likey/SignUpViewController.swift
00eb6e9ef993e6e19093b44d72bafa4ca8115600
[]
no_license
huzefazakir/swiftProject
c92512eee10a09b01a3251fa64ea771ec79199bf
44a732e41066ca572f80bce7eb0f8b26b0669006
refs/heads/master
2021-01-10T10:10:57.992149
2017-02-14T06:35:07
2017-02-14T06:35:07
48,772,721
0
0
null
null
null
null
UTF-8
Swift
false
false
3,498
swift
// // SignUpViewController.swift // Likey // // Created by Nafisa Moochhala on 11/28/14. // Copyright (c) 2014 self. All rights reserved. // import UIKit class SignUpViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate{ @IBOutlet weak var firstNameTextField: UITextField! = UITextField() @IBOutlet weak var lastNameTextField: UITextField! = UITextField() @IBOutlet weak var emailTextField: UITextField! = UITextField() @IBOutlet weak var passwordTextField: UITextField! = UITextField() @IBOutlet weak var confrimPasswordTextField: UITextField! = UITextField() override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } @IBAction func signUpAction(sender: AnyObject) { // validation code goes here var user:PFUser = PFUser() // also save the first name and last name of the user user.username = emailTextField.text user.password = passwordTextField.text user.signUpInBackgroundWithBlock{ (success:Bool, error:NSError!)->Void in if (error == nil){ println("Sign Up successful") var imagePicker:UIImagePickerController = UIImagePickerController() imagePicker.sourceType = UIImagePickerControllerSourceType.PhotoLibrary imagePicker.delegate = self self.presentViewController(imagePicker, animated: true, completion: nil) } else { let errorString = error.description println(error.description) } } } func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [NSObject : AnyObject]) { let pickedImage:UIImage = info[UIImagePickerControllerOriginalImage] as! UIImage let scaledImage = self.scaleImageWith(pickedImage, and: CGSizeMake(100, 100)) let imageData = UIImagePNGRepresentation(scaledImage) let imageFile:PFFile = PFFile(data: imageData) PFUser.currentUser().setObject(imageFile, forKey: "profileImage") PFUser.currentUser().saveInBackgroundWithBlock{ (success:Bool, error:NSError!)->Void in if(error == nil) { self.performSegueWithIdentifier("signedUp", sender: self) } } picker.dismissViewControllerAnimated(true, completion: nil) } func scaleImageWith(image:UIImage, and newSize:CGSize )->UIImage{ UIGraphicsBeginImageContextWithOptions(newSize, false, 0.0) image.drawInRect(CGRectMake(0, 0, newSize.width, newSize.height)) var newImage:UIImage = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() return newImage } /* // MARK: - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { // Get the new view controller using segue.destinationViewController. // Pass the selected object to the new view controller. } */ }
[ -1 ]
53187911c175765fa2465e1c87a01b97a96fc785
f447082f413cda803c43c5aed7f1a0f0ce4d7536
/playSoundsViewController+Audio.swift
8920d33453d2ab0a4223d75b3a1e421432dbbb85
[]
no_license
elfsummer/pitchPerfect
132812df25a08aaba37f80f116ee58a75b8e9c98
de0592d2111cdaf1b04938741ef570758d13478f
refs/heads/master
2021-04-09T11:49:49.754055
2018-03-16T03:28:07
2018-03-16T03:28:07
125,457,402
0
0
null
null
null
null
UTF-8
Swift
false
false
6,102
swift
// // playSoundsViewController+Audio.swift // PitchPerfect // // Copyright © 2016 Udacity. All rights reserved. // import UIKit import AVFoundation // MARK: - playSoundsViewController: AVAudioPlayerDelegate extension playSoundsViewController: AVAudioPlayerDelegate { // MARK: Alerts struct Alerts { static let DismissAlert = "Dismiss" static let RecordingDisabledTitle = "Recording Disabled" static let RecordingDisabledMessage = "You've disabled this app from recording your microphone. Check Settings." static let RecordingFailedTitle = "Recording Failed" static let RecordingFailedMessage = "Something went wrong with your recording." static let AudioRecorderError = "Audio Recorder Error" static let AudioSessionError = "Audio Session Error" static let AudioRecordingError = "Audio Recording Error" static let AudioFileError = "Audio File Error" static let AudioEngineError = "Audio Engine Error" } // MARK: PlayingState (raw values correspond to sender tags) enum PlayingState { case playing, notPlaying } // MARK: Audio Functions func setupAudio() { // initialize (recording) audio file do { audioFile = try AVAudioFile(forReading: recordedAudioURL as URL) } catch { showAlert(Alerts.AudioFileError, message: String(describing: error)) } } func playSound(rate: Float? = nil, pitch: Float? = nil, echo: Bool = false, reverb: Bool = false) { // initialize audio engine components audioEngine = AVAudioEngine() // node for playing audio audioPlayerNode = AVAudioPlayerNode() audioEngine.attach(audioPlayerNode) // node for adjusting rate/pitch let changeRatePitchNode = AVAudioUnitTimePitch() if let pitch = pitch { changeRatePitchNode.pitch = pitch } if let rate = rate { changeRatePitchNode.rate = rate } audioEngine.attach(changeRatePitchNode) // node for echo let echoNode = AVAudioUnitDistortion() echoNode.loadFactoryPreset(.multiEcho1) audioEngine.attach(echoNode) // node for reverb let reverbNode = AVAudioUnitReverb() reverbNode.loadFactoryPreset(.cathedral) reverbNode.wetDryMix = 50 audioEngine.attach(reverbNode) // connect nodes if echo == true && reverb == true { connectAudioNodes(audioPlayerNode, changeRatePitchNode, echoNode, reverbNode, audioEngine.outputNode) } else if echo == true { connectAudioNodes(audioPlayerNode, changeRatePitchNode, echoNode, audioEngine.outputNode) } else if reverb == true { connectAudioNodes(audioPlayerNode, changeRatePitchNode, reverbNode, audioEngine.outputNode) } else { connectAudioNodes(audioPlayerNode, changeRatePitchNode, audioEngine.outputNode) } // schedule to play and start the engine! audioPlayerNode.stop() audioPlayerNode.scheduleFile(audioFile, at: nil) { var delayInSeconds: Double = 0 if let lastRenderTime = self.audioPlayerNode.lastRenderTime, let playerTime = self.audioPlayerNode.playerTime(forNodeTime: lastRenderTime) { if let rate = rate { delayInSeconds = Double(self.audioFile.length - playerTime.sampleTime) / Double(self.audioFile.processingFormat.sampleRate) / Double(rate) } else { delayInSeconds = Double(self.audioFile.length - playerTime.sampleTime) / Double(self.audioFile.processingFormat.sampleRate) } } // schedule a stop timer for when audio finishes playing self.stopTimer = Timer(timeInterval: delayInSeconds, target: self, selector: #selector(playSoundsViewController.stopAudio), userInfo: nil, repeats: false) RunLoop.main.add(self.stopTimer!, forMode: RunLoopMode.defaultRunLoopMode) } do { try audioEngine.start() } catch { showAlert(Alerts.AudioEngineError, message: String(describing: error)) return } // play the recording! audioPlayerNode.play() } @objc func stopAudio() { if let audioPlayerNode = audioPlayerNode { audioPlayerNode.stop() } if let stopTimer = stopTimer { stopTimer.invalidate() } configureUI(.notPlaying) if let audioEngine = audioEngine { audioEngine.stop() audioEngine.reset() } } // MARK: Connect List of Audio Nodes func connectAudioNodes(_ nodes: AVAudioNode...) { for x in 0..<nodes.count-1 { audioEngine.connect(nodes[x], to: nodes[x+1], format: audioFile.processingFormat) } } // MARK: UI Functions func configureUI(_ playState: PlayingState) { switch(playState) { case .playing: setPlayButtonsEnabled(false) stopButton.isEnabled = true case .notPlaying: setPlayButtonsEnabled(true) stopButton.isEnabled = false } } func setPlayButtonsEnabled(_ enabled: Bool) { slowButton.isEnabled = enabled highPitchButton.isEnabled = enabled fastButton.isEnabled = enabled lowPitchButton.isEnabled = enabled echoButton.isEnabled = enabled reverbButton.isEnabled = enabled } func showAlert(_ title: String, message: String) { let alert = UIAlertController(title: title, message: message, preferredStyle: .alert) alert.addAction(UIAlertAction(title: Alerts.DismissAlert, style: .default, handler: nil)) self.present(alert, animated: true, completion: nil) } }
[ 289217, 230915, 336707, 283843, 307384, 357417, 321743, 366992, 240534, 293848, 237692, 230174 ]
c0a0230a8230e11604f8be1dce6f76cdf8d8ea8c
8412986cd1d19cb30d718fb4e8000966efd1299a
/Sources/Helpers/QueryBuilder.swift
613ea936a449b349d6ba47d3ff8716d2948dda13
[ "MIT" ]
permissive
rajeshm20/Malibu
2737c78600b0d4b4e6bc5ccd560a367fe4a94d24
6dece2c10af855aa8bcb87d60e2a7c70b9156166
refs/heads/master
2020-12-28T19:33:05.757410
2016-07-29T11:16:32
2016-07-29T11:16:32
null
0
0
null
null
null
null
UTF-8
Swift
false
false
2,032
swift
import Foundation public struct QueryBuilder { public typealias Component = (String, String) let escapingCharacters = ":#[]@!$&'()*+,;=" public init() {} public func buildQuery(parameters: [String: AnyObject]) -> String { return buildComponents(parameters: parameters).map({ "\($0)=\($1)" }).joinWithSeparator("&") } public func buildComponents(parameters parameters: [String: AnyObject]) -> [Component] { var components: [Component] = [] parameters.forEach { key, value in components += buildComponents(key: key, value: value) } return components } public func buildComponents(key key: String, value: AnyObject) -> [Component] { var components: [Component] = [] if let dictionary = value as? [String: AnyObject] { dictionary.forEach { nestedKey, value in components += buildComponents(key: "\(key)[\(nestedKey)]", value: value) } } else if let array = value as? [AnyObject] { array.forEach { value in components += buildComponents(key: "\(key)[]", value: value) } } else { components.append((escape(key), escape("\(value)"))) } return components } public func escape(string: String) -> String { let allowedCharacters = NSCharacterSet.URLQueryAllowedCharacterSet().mutableCopy() as! NSMutableCharacterSet allowedCharacters.removeCharactersInString(escapingCharacters) var escapedString = "" if #available(iOS 8.3, *) { escapedString = string.stringByAddingPercentEncodingWithAllowedCharacters(allowedCharacters) ?? string } else { var index = string.startIndex while index != string.endIndex { let endIndex = index.advancedBy(50, limit: string.endIndex) let range = Range(index..<endIndex) let substring = string.substringWithRange(range) index = endIndex escapedString += substring.stringByAddingPercentEncodingWithAllowedCharacters(allowedCharacters) ?? substring } } return escapedString } }
[ -1 ]
b1a9c52f26f00212e5366e6cbce66b2f84135f4b
43eca86d0510a9fc2abb513d2dc5e2737ad8ae73
/RolodexApp/RolodexApp/Controller/PersonDetails.swift
957d0152a9ef54a1124a5d75953d6b68d810cdfa
[]
no_license
ikjot/Rolodex-App
3fe0aa952ef27897261e72701df101a1349a63a4
764e3270494c0697c4259fedb995f2e1d6221fa6
refs/heads/master
2021-05-04T01:40:29.506945
2018-02-06T00:26:54
2018-02-06T00:26:54
120,361,790
0
0
null
null
null
null
UTF-8
Swift
false
false
1,032
swift
// // PersonDetails.swift // RolodexApp // // Created by Ikjot Kaur on 2/5/18. // Copyright © 2018 Ikjot Kaur. All rights reserved. // import UIKit class PersonDetails: UIViewController { var person:Person? @IBOutlet weak var bioLbl: UITextView! @IBOutlet weak var startLbl: UILabel! @IBOutlet weak var companyLbl: UILabel! @IBOutlet weak var emailLbl: UILabel! @IBOutlet weak var lastNameLbl: UILabel! @IBOutlet weak var firstNameLbl: UILabel! override func viewDidLoad() { super.viewDidLoad() guard let fName = person?.firstName else {return} guard let sName = person?.lastName else {return} title = "\(fName) \(sName)" displayData() } func displayData() { bioLbl.text = person?.bio startLbl.text = person?.startDate companyLbl.text = person?.company emailLbl.text = person?.email lastNameLbl.text = person?.lastName firstNameLbl.text = person?.firstName } }
[ -1 ]
fbef4fcf7622394840a02aa52bd8c713f93ec9d2
1ae05f2664f41961124b6364ef3d484c0610d828
/flickr-image-search-ios-app/Screens/Shared/FlickrPhoto.swift
325700193d6c0d3b00786e9fee319285ba2b275d
[]
no_license
leves/flickr-image-search-ios-app
356149ef18983d635ba007c5ad252c2a0c7de8d9
829a51e41a78eb6f22461ea5f4de1ed6b63fdfd3
refs/heads/main
2023-04-15T00:34:19.464682
2021-04-26T22:24:39
2021-04-26T22:24:39
360,250,467
0
1
null
null
null
null
UTF-8
Swift
false
false
308
swift
// // FlickrPhoto.swift // flickr-image-search-ios-app // // Created by Levente Bernáth on 2021. 04. 26.. // import Foundation // MARK: - FlickrPhoto struct FlickrPhoto: ImageURLProvider { let thumbnailImageURL: URL let largeImageURL: URL let wrappedValue: FlickrService.Photo }
[ -1 ]
1e28aa4aa7fc7126cdf8dc4720ca037017a0d453
260596028615c9f5abc181cea623c5a98b0a5177
/HomeWorkCoreData/ChooseCourseTableViewController.swift
78f89a1f7deaee039093adcc37d42d77cfe400f2
[]
no_license
OberemkovGrigoriy/CoreDataCase
41ce8b9044243b55b3e8f4a86cfcad7eccfc2c53
8f359fdb6521f49313b0a2bef6ce06fde38cda63
refs/heads/master
2021-08-28T16:57:30.612095
2017-12-12T21:01:49
2017-12-12T21:01:49
113,090,776
0
0
null
null
null
null
UTF-8
Swift
false
false
2,825
swift
// // ChooseCourseTableViewController.swift // HomeWorkCoreData // // Created by Gregory Oberemkov on 10.12.17. // Copyright © 2017 Gregory Oberemkov. All rights reserved. // import UIKit import CoreData class ChooseCourseTableViewController: UITableViewController { var managedObjectContext: NSManagedObjectContext? weak var pickerDelegate: CoursePickerDelegate? var selectedCourse: Course? var courses = [Course]() var saveCoreData: SaverWithErrorMessage? var updateCurses: ReloaderCourseData? override func viewDidLoad() { super.viewDidLoad() let appDelegate = UIApplication.shared.delegate as? AppDelegate managedObjectContext = appDelegate?.managedObjectContext title = "Course List" updateCurses = ReloaderCourseData(managedObjectContext: self.managedObjectContext!, tableView: self.tableView) saveCoreData = SaverWithErrorMessage(managedObjectContext: self.managedObjectContext!) } override func viewWillAppear(_ animated: Bool) { courses = (updateCurses?.reloadData())! tableView.reloadData() } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } // MARK: - Table view data source override func numberOfSections(in tableView: UITableView) -> Int { // #warning Incomplete implementation, return the number of sections return 1 } override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { // #warning Incomplete implementation, return the number of rows return courses.count } override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "SelectCell", for: indexPath) let course = courses[indexPath.row] cell.detailTextLabel?.text = course.value(forKey: "teachersName") as? String cell.textLabel?.text = course.value(forKey: "courseName") as? String if selectedCourse == course { cell.accessoryType = .checkmark } else{ cell.accessoryType = .none } return cell } override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { if let pickerDelegate = pickerDelegate { let course = courses[indexPath.row] selectedCourse = course pickerDelegate.didSelectCourse(course: course) tableView.reloadData() } else { print("pickerDelegate not initial") } tableView.deselectRow(at: indexPath as IndexPath, animated: true) } }
[ -1 ]
1a13c088a9b992a008711492e8f24de58ed4b7c9
252031119f96782ddce12597be97baf2b6f60d29
/MMPlayerView/Classes/Item/MMPlayerItem.swift
7ab4084d5ff29375a90848559c850ada5c27da62
[ "MIT" ]
permissive
trantuananh1996/MMPlayerView
3111d31a7f386a467193d7dabcb326bd02c6214d
b3091b40717a58372cdb835285bbb5a3a9bbaebf
refs/heads/master
2022-12-12T09:29:34.295395
2020-05-13T07:15:04
2020-05-13T07:15:04
296,685,105
0
0
MIT
2020-09-18T17:16:36
2020-09-18T17:16:35
null
UTF-8
Swift
false
false
3,003
swift
// // MMPlayerItem.swift // MMPlayerView // // Created by Millman on 2018/11/16. // import UIKit import AVFoundation import Combine protocol MMPlayerItemProtocol: class { func status(change: AVPlayerItem.Status) func isPlaybackKeepUp(isKeepUp: Bool) func isPlaybackEmpty(isEmpty: Bool) } class MMPlayerItem: AVPlayerItem { var statusObservation: NSKeyValueObservation? var keepUpObservation: NSKeyValueObservation? var emptyObservation: NSKeyValueObservation? weak var delegate: MMPlayerItemProtocol? convenience init(asset: AVAsset, delegate: MMPlayerItemProtocol?) { self.init(asset: asset, automaticallyLoadedAssetKeys: nil) self.delegate = delegate self.setup() } func setup() { statusObservation = self.observe(\.status, changeHandler: { [weak self] (item, _) in self?.delegate?.status(change: item.status) }) keepUpObservation = self.observe(\.isPlaybackLikelyToKeepUp, changeHandler: { [weak self] (item, change) in self?.delegate?.isPlaybackKeepUp(isKeepUp: item.isPlaybackLikelyToKeepUp) }) emptyObservation = self.observe(\.isPlaybackBufferEmpty, changeHandler: { [weak self] (item, change) in self?.delegate?.isPlaybackEmpty(isEmpty: item.isPlaybackBufferEmpty) }) } deinit { statusObservation?.invalidate() keepUpObservation?.invalidate() emptyObservation?.invalidate() self.statusObservation = nil self.keepUpObservation = nil self.emptyObservation = nil } } @available(iOS 13.0.0, *) class MMPlayerItemUI: AVPlayerItem, ObservableObject { var statusObservation: NSKeyValueObservation? var keepUpObservation: NSKeyValueObservation? var emptyObservation: NSKeyValueObservation? var statusObserver = PassthroughSubject<AVPlayerItem.Status, Never>() var isKeepUpObserver = PassthroughSubject<Bool, Never>() var isEmptyObserver = PassthroughSubject<Bool, Never>() convenience init(asset: AVAsset) { self.init(asset: asset, automaticallyLoadedAssetKeys: nil) self.setup() } func setup() { statusObservation = self.observe(\.status, changeHandler: { [weak self] (item, _) in self?.statusObserver.send(item.status) }) keepUpObservation = self.observe(\.isPlaybackLikelyToKeepUp, changeHandler: { [weak self] (item, change) in self?.isKeepUpObserver.send(item.isPlaybackLikelyToKeepUp) }) emptyObservation = self.observe(\.isPlaybackBufferEmpty, changeHandler: { [weak self] (item, change) in self?.isEmptyObserver.send(item.isPlaybackBufferEmpty) }) } deinit { statusObservation?.invalidate() keepUpObservation?.invalidate() emptyObservation?.invalidate() self.statusObservation = nil self.keepUpObservation = nil self.emptyObservation = nil } }
[ -1 ]