repo_name
stringlengths 7
91
| path
stringlengths 8
658
| copies
stringclasses 125
values | size
stringlengths 3
6
| content
stringlengths 118
674k
| license
stringclasses 15
values | hash
stringlengths 32
32
| line_mean
float64 6.09
99.2
| line_max
int64 17
995
| alpha_frac
float64 0.3
0.9
| ratio
float64 2
9.18
| autogenerated
bool 1
class | config_or_test
bool 2
classes | has_no_keywords
bool 2
classes | has_few_assignments
bool 1
class |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
xslim/RouteCompare | RouteCompare/RoutesViewController.swift | 1 | 8419 | //
// RoutesViewController.swift
// RouteCompare
//
// Created by Taras Kalapun on 23/07/14.
// Copyright (c) 2014 Kalapun. All rights reserved.
//
import UIKit
import CoreData
class RoutesViewController: UITableViewController, NSFetchedResultsControllerDelegate {
var newRoute:Route?
override func viewDidLoad() {
super.viewDidLoad()
// Uncomment the following line to preserve selection between presentations
// self.clearsSelectionOnViewWillAppear = false
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem()
performFetchAndReload(false)
}
override func viewDidDisappear(animated: Bool) {
super.viewDidDisappear(animated)
self.newRoute = nil
}
lazy var fetchedResultsController: NSFetchedResultsController = {
var fetch: NSFetchRequest = NSFetchRequest(entityName: "Route")
fetch.sortDescriptors = [NSSortDescriptor(key: "dateAdded", ascending: true)]
var frc: NSFetchedResultsController = NSFetchedResultsController(
fetchRequest: fetch,
managedObjectContext: DB.shared.moc,
sectionNameKeyPath: nil,
cacheName: nil)
frc.delegate = self
return frc
}()
func performFetchAndReload(reload: Bool) {
var moc = fetchedResultsController.managedObjectContext
moc.performBlockAndWait {
var error: NSErrorPointer = nil
if !self.fetchedResultsController.performFetch(error) {
println("\(error)")
}
if reload {
self.tableView.reloadData()
}
}
}
func updateCell(cell: UITableViewCell, object: Route) {
cell.textLabel.text = object.name
cell.detailTextLabel.text = object.dateAdded.description
}
func createNewRoute(name:String) {
self.newRoute = Route.createWithName(name)
DB.shared.save()
performSegueWithIdentifier("showRuns", sender: self.newRoute)
}
// MARK: - Actions
@IBAction func addAction(sender: AnyObject) {
var alert = UIAlertController(title: "Create new Route", message: nil, preferredStyle: .Alert)
alert.addTextFieldWithConfigurationHandler({ textField in
textField.placeholder = "Route Name"
})
alert.addAction(UIAlertAction(title: "Cancel", style: .Cancel){_ in})
alert.addAction(UIAlertAction(title: "Create", style: .Default){action in
let textf = alert.textFields[0] as UITextField
self.createNewRoute(textf.text)
})
presentViewController(alert, animated: true, completion: nil)
}
// MARK: - Navigation
override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) {
switch segue.identifier! {
case "showRuns":
var vc = segue.destinationViewController as CompareViewController
if (self.newRoute) {
vc.route = self.newRoute
} else {
let indexPath = self.tableView.indexPathForSelectedRow()
vc.route = self.fetchedResultsController.objectAtIndexPath(indexPath) as? Route
}
case "newRun":
var vc = segue.destinationViewController as CompareViewController
// vc0.route = self.newRoute
// self.navigationController.pushViewController(vc0, animated: false)
//
// var vc = segue.destinationViewController as RunViewController
vc.route = self.newRoute
default:()
}
}
// MARK: - Table view data source
override func numberOfSectionsInTableView(tableView: UITableView!) -> Int {
return fetchedResultsController.sections.count
}
override func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -> Int {
let sectionInfo = fetchedResultsController.sections[section] as NSFetchedResultsSectionInfo
return sectionInfo.numberOfObjects
}
override func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as UITableViewCell
// Configure the cell...
var item: Route = fetchedResultsController.objectAtIndexPath(indexPath) as Route
updateCell(cell, object: item)
return cell
}
// override func tableView(tableView: UITableView!, didSelectRowAtIndexPath indexPath: NSIndexPath!)
// {
// //tableView.deselectRowAtIndexPath(indexPath, animated: true)
//
// // TODO: push VC w/ selected item
//
// self.storyboard
// }
// Override to support conditional editing of the table view.
override func tableView(tableView: UITableView!, canEditRowAtIndexPath indexPath: NSIndexPath!) -> Bool {
// Return NO 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!, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath!) {
if editingStyle == .Delete {
// Delete the row from the data source
//tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
let item = fetchedResultsController.objectAtIndexPath(indexPath) as Route
DB.shared.deleteObject(item)
} 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
//performFetchAndReload(true)
}
}
/*
// Override to support rearranging the table view.
override func tableView(tableView: UITableView!, moveRowAtIndexPath fromIndexPath: NSIndexPath!, toIndexPath: NSIndexPath!) {
}
*/
// Override to support conditional rearranging of the table view.
override func tableView(tableView: UITableView!, canMoveRowAtIndexPath indexPath: NSIndexPath!) -> Bool {
// Return NO if you do not want the item to be re-orderable.
return false
}
// MARK: NSFetchedResultsController
func controllerWillChangeContent(controller: NSFetchedResultsController!) {
tableView.beginUpdates()
}
func controller(controller: NSFetchedResultsController!, didChangeSection sectionInfo: NSFetchedResultsSectionInfo!, atIndex sectionIndex: Int, forChangeType type: NSFetchedResultsChangeType) {
if type == .Insert {
tableView.insertSections(NSIndexSet(index: sectionIndex), withRowAnimation: UITableViewRowAnimation.Fade)
}
else if type == .Delete {
tableView.deleteSections(NSIndexSet(index: sectionIndex), withRowAnimation: UITableViewRowAnimation.Fade)
}
}
func controller(controller: NSFetchedResultsController!, didChangeObject anObject: AnyObject!, atIndexPath indexPath: NSIndexPath!, forChangeType type: NSFetchedResultsChangeType, newIndexPath: NSIndexPath!) {
switch type {
case .Insert:
tableView.insertRowsAtIndexPaths([newIndexPath], withRowAnimation: UITableViewRowAnimation.Fade)
case .Delete:
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.Fade)
case .Update:
updateCell(tableView.cellForRowAtIndexPath(indexPath), object: anObject as Route)
case .Move:
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.Fade)
tableView.insertRowsAtIndexPaths([newIndexPath], withRowAnimation: UITableViewRowAnimation.Fade)
default:
println("unhandled didChangeObject update type \(type)")
}
}
func controllerDidChangeContent(controller: NSFetchedResultsController!) {
tableView.endUpdates()
}
}
| mit | 8d1802682718b138fcfa012574ce3e81 | 36.252212 | 213 | 0.653047 | 5.945621 | false | false | false | false |
ztyjr888/WeChat | WeChat/Plugins/Alert/WeChatBottomAlert.swift | 1 | 4978 | //
// WeChatBottomAlert.swift
// WeChat
//
// Created by Smile on 16/1/12.
// Copyright © 2016年 [email protected]. All rights reserved.
//
import UIKit
class WeChatBottomAlert: WeChatDrawView {
//MARKS: Properties
var isLayedOut:Bool = false//是否初始化view
var fontSize:CGFloat = 12//默认字体大小
var labelHeight:CGFloat = 25//默认标签高度
var titles = [String]()
var colors = [UIColor]()
let paddintLeft:CGFloat = 30//padding-left
let paddintTop:CGFloat = 15//padding-top
let titleFontName:String = "Avenir-Light"//默认标题字体名称
let fontName:String = "Cochin-Bold "//加粗字体
let rectHeight:CGFloat = 5;//矩形高度
var oneBlockHeight:CGFloat = 0//一块区域的高度
var oneBlockWidth:CGFloat = 0//一块区域的宽度
var otherSize:CGFloat = 18
var originX:CGFloat = 0//开始绘制x坐标
var originY:CGFloat = 0//开始绘制y坐标
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
init(frame: CGRect,titles:[String],colors:[UIColor]?,fontSize:CGFloat) {
//MARKS: 初始化数据
if fontSize > 0 {
self.fontSize = fontSize
}
if colors != nil {
self.colors = colors!
}
self.titles = titles
oneBlockHeight = labelHeight + paddintTop * 2
oneBlockWidth = frame.size.width - paddintLeft * 2
//MARKS: 获取Alert总高度
var totalHeight:CGFloat = 0
for(var i = 0;i < titles.count;i++){
if !titles[i].isEmpty {
totalHeight += oneBlockHeight
}
}
totalHeight += 5
var y:CGFloat = 0
if frame.origin.y < 0 {
if frame.size.height <= 0 {
y = UIScreen.mainScreen().bounds.height - totalHeight
}
}else{
y = frame.origin.y
}
originX = frame.origin.x
originY = y
//super.init(frame: CGRectMake(frame.origin.x, y, frame.size.width, totalHeight))
//初始化整个屏幕
super.init(frame: UIScreen.mainScreen().bounds)
//设置背景
self.backgroundColor = UIColor(patternImage: UIImage(named: "bg")!)
//self.alpha = 0.8
}
override func layoutSubviews() {
super.layoutSubviews()
//let shapeLayer = self.setUp()
if !isLayedOut {
//shapeLayer.frame.origin = CGPointZero
//shapeLayer.frame.size = self.layer.frame.size
if titles.count <= 1 {
return
}
var _originY:CGFloat = originY
var size:CGFloat = fontSize
for(var i = 0;i < titles.count;i++){
if titles[i].isEmpty {
continue;
}
if i == 0 {
size = fontSize
} else {
size = otherSize
}
if i != (titles.count - 1) {
var color:UIColor
var fontName:String = titleFontName
if self.colors.count > 0 {
color = self.colors[i]
} else {
color = UIColor.blackColor()
}
if i == 0 {
fontName = titleFontName
}else{
fontName = self.fontName
}
self.addSubview(drawAlertLabel(titles[i],y: _originY,size: size,color:color,isBold: false,fontName: fontName,width:UIScreen.mainScreen().bounds.width,height: oneBlockHeight))
_originY += oneBlockHeight
if titles.count >= 3 {
if i != (titles.count - 2) {
self.layer.addSublayer(drawLine(beginPointX: 0, beginPointY: _originY, endPointX: self.frame.size.width, endPointY: _originY))
}else{
self.layer.addSublayer(drawRect(beginPointX: 0, beginPointY: _originY, width: self.frame.size.width, height: rectHeight))
_originY += rectHeight
}
}
}else{
self.addSubview(drawAlertLabel(titles[i],y: _originY,size: size,color: UIColor.blackColor(),isBold: true,fontName: fontName,width:UIScreen.mainScreen().bounds.width,height: oneBlockHeight))
}
}
isLayedOut = true
}
}
override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) {
super.touchesEnded(touches, withEvent: event)
super.removeFromSuperview()
}
}
| apache-2.0 | 95f8d96453bad3f66084daef3b0a05a3 | 31.755102 | 209 | 0.50405 | 4.643202 | false | false | false | false |
Fenrikur/ef-app_ios | Domain Model/EurofurenceModelTestDoubles/FakeAnnouncementsService.swift | 1 | 1348 | import EurofurenceModel
import Foundation
public class FakeAnnouncementsService: AnnouncementsService {
public var announcements: [Announcement]
public var stubbedReadAnnouncements: [AnnouncementIdentifier]
public init(announcements: [Announcement], stubbedReadAnnouncements: [AnnouncementIdentifier] = []) {
self.announcements = announcements
self.stubbedReadAnnouncements = stubbedReadAnnouncements
}
fileprivate var observers = [AnnouncementsServiceObserver]()
public func add(_ observer: AnnouncementsServiceObserver) {
observers.append(observer)
observer.announcementsServiceDidChangeAnnouncements(announcements)
observer.announcementsServiceDidUpdateReadAnnouncements(stubbedReadAnnouncements)
}
public func fetchAnnouncement(identifier: AnnouncementIdentifier) -> Announcement? {
return announcements.first(where: { $0.identifier == identifier })
}
}
public extension FakeAnnouncementsService {
func updateAnnouncements(_ announcements: [Announcement]) {
observers.forEach({ $0.announcementsServiceDidChangeAnnouncements(announcements) })
}
func updateReadAnnouncements(_ readAnnouncements: [AnnouncementIdentifier]) {
observers.forEach({ $0.announcementsServiceDidUpdateReadAnnouncements(readAnnouncements) })
}
}
| mit | 6cc952e6b77420d57af1e953fd16272d | 35.432432 | 105 | 0.767804 | 5.785408 | false | false | false | false |
YF-Raymond/DouYUzhibo | DYZB/DYZB/Classes/Tools/NetworkTools.swift | 1 | 1163 | //
// NetworkTools.swift
// News
//
// Created by Raymond on 2016/12/22.
// Copyright © 2016年 Raymond. All rights reserved.
//
import UIKit
import Alamofire
// MARK:- 请求方式
enum MethodType {
case get
case post
}
// MARK:- 网络工具类
class NetworkTools {
/// 发送网络请求的函数
///
/// - Parameters:
/// - URLString: 请求url
/// - type: 请求方式
/// - parameters: 请求参数
/// - finishedCallback: 发送请求后的回调闭包
class func requsetData(URLString : String, type : MethodType, parameters : [String : Any]? = nil, finishedCallback : @escaping (_ result : Any) -> ()) {
// 1.获取类型
let method = type == .get ? HTTPMethod.get : HTTPMethod.post
Alamofire.request(URLString, method: method, parameters: parameters).responseJSON { (response) in
// 2.校验是否有结果
guard let result = response.result.value else {
print(response.result.error ?? "请求超时")
return
}
// 3.将结果回调回去
finishedCallback(result)
}
}
}
| mit | 1eceb5664afc8a57c3bcde782e3308ca | 25 | 156 | 0.572115 | 4 | false | false | false | false |
daodaoliang/actor-platform | actor-apps/app-ios/ActorApp/Controllers/Conversation/Cells/AABubbleTextCell.swift | 5 | 10036 | //
// Copyright (c) 2014-2015 Actor LLC. <https://actor.im>
//
import Foundation
import UIKit
class AABubbleTextCell : AABubbleCell, TTTAttributedLabelDelegate {
private static let dateFont = UIFont(name: "HelveticaNeue-Italic", size: 11)!
let messageText = TTTAttributedLabel(frame: CGRectZero)
let statusView = UIImageView();
let senderNameLabel = UILabel();
var needRelayout = true
var isClanchTop:Bool = false
var isClanchBottom:Bool = false
private let dateText = UILabel()
private var messageState: UInt = ACMessageState.UNKNOWN.rawValue
private var cellLayout: TextCellLayout!
init(frame: CGRect) {
super.init(frame: frame, isFullSize: false)
senderNameLabel.font = UIFont(name: "HelveticaNeue-Medium", size: 15)!
messageText.font = TextCellLayout.bubbleFont
messageText.lineBreakMode = .ByWordWrapping
messageText.numberOfLines = 0
messageText.userInteractionEnabled = true
messageText.enabledTextCheckingTypes = NSTextCheckingType.Link.rawValue
messageText.delegate = self
messageText.linkAttributes = [kCTForegroundColorAttributeName: MainAppTheme.chat.autocompleteHighlight,
kCTUnderlineStyleAttributeName: NSNumber(bool: true)]
messageText.activeLinkAttributes = [kCTForegroundColorAttributeName: MainAppTheme.chat.autocompleteHighlight,
kCTUnderlineStyleAttributeName: NSNumber(bool: true)]
messageText.verticalAlignment = TTTAttributedLabelVerticalAlignment.Top
dateText.font = AABubbleTextCell.dateFont
dateText.lineBreakMode = .ByClipping
dateText.numberOfLines = 1
dateText.contentMode = UIViewContentMode.TopLeft
dateText.textAlignment = NSTextAlignment.Right
statusView.contentMode = UIViewContentMode.Center
mainView.addSubview(messageText)
mainView.addSubview(dateText)
mainView.addSubview(statusView)
}
required init(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func canPerformAction(action: Selector, withSender sender: AnyObject?) -> Bool {
if action == "copy:" {
if (bindedMessage!.content is ACTextContent) {
return true
}
}
if action == "delete:" {
return true
}
return false
}
override func copy(sender: AnyObject?) {
UIPasteboard.generalPasteboard().string = (bindedMessage!.content as! ACTextContent).text
}
func attributedLabel(label: TTTAttributedLabel!, didLongPressLinkWithURL url: NSURL!, atPoint point: CGPoint) {
openUrl(url)
}
func attributedLabel(label: TTTAttributedLabel!, didSelectLinkWithURL url: NSURL!) {
openUrl(url)
}
func openUrl(url: NSURL) {
if url.scheme == "source" {
var path = url.path!
var index = path.substringFromIndex(advance(path.startIndex, 1)).toInt()!
var code = self.cellLayout.sources[index]
self.controller.navigateNext(CodePreviewController(code: code), removeCurrent: false)
} else {
UIApplication.sharedApplication().openURL(url)
}
}
override func bind(message: ACMessage, reuse: Bool, cellLayout: CellLayout, setting: CellSetting) {
self.cellLayout = cellLayout as! TextCellLayout
isClanchTop = setting.clenchTop
isClanchBottom = setting.clenchBottom
if (!reuse) {
needRelayout = true
if self.cellLayout.attrText != nil {
messageText.setText(self.cellLayout.attrText)
} else {
messageText.text = self.cellLayout.text
}
if self.cellLayout.isUnsupported {
messageText.font = TextCellLayout.bubbleFontUnsupported
if (isOut) {
messageText.textColor = MainAppTheme.bubbles.textUnsupportedOut
} else {
messageText.textColor = MainAppTheme.bubbles.textUnsupportedIn
}
} else {
messageText.font = TextCellLayout.bubbleFont
if (isOut) {
messageText.textColor = MainAppTheme.bubbles.textOut
} else {
messageText.textColor = MainAppTheme.bubbles.textIn
}
}
if isGroup && !isOut {
if let user = Actor.getUserWithUid(message.senderId) {
senderNameLabel.text = user.getNameModel().get()
var color = Resources.placeHolderColors[Int(abs(user.getId())) % Resources.placeHolderColors.count];
senderNameLabel.textColor = color
}
mainView.addSubview(senderNameLabel)
} else {
senderNameLabel.removeFromSuperview()
}
}
// Always update bubble insets
if (isOut) {
bindBubbleType(.TextOut, isCompact: isClanchBottom)
dateText.textColor = MainAppTheme.bubbles.textDateOut
bubbleInsets = UIEdgeInsets(
top: (isClanchTop ? AABubbleCell.bubbleTopCompact : AABubbleCell.bubbleTop),
left: 0 + (isIPad ? 16 : 0),
bottom: (isClanchBottom ? AABubbleCell.bubbleBottomCompact : AABubbleCell.bubbleBottom),
right: (isClanchBottom ? 10 : 4) + (isIPad ? 16 : 0))
contentInsets = UIEdgeInsets(
top: AABubbleCell.bubbleContentTop,
left: 10,
bottom: AABubbleCell.bubbleContentBottom,
right: (isClanchBottom ? 4 : 10))
} else {
bindBubbleType(.TextIn, isCompact: isClanchBottom)
dateText.textColor = MainAppTheme.bubbles.textDateIn
bubbleInsets = UIEdgeInsets(
top: (isClanchTop ? AABubbleCell.bubbleTopCompact : AABubbleCell.bubbleTop),
left: (isClanchBottom ? 10 : 4) + (isIPad ? 16 : 0),
bottom: (isClanchBottom ? AABubbleCell.bubbleBottomCompact : AABubbleCell.bubbleBottom),
right: 0 + (isIPad ? 16 : 0))
contentInsets = UIEdgeInsets(
top: (isGroup ? 18 : 0) + AABubbleCell.bubbleContentTop,
left: (isClanchBottom ? 11 : 17),
bottom: AABubbleCell.bubbleContentBottom,
right: 10)
}
// Always update date and state
dateText.text = cellLayout.date
messageState = UInt(message.messageState.ordinal());
if (isOut) {
switch(self.messageState) {
case ACMessageState.PENDING.rawValue:
self.statusView.image = Resources.iconClock;
self.statusView.tintColor = MainAppTheme.bubbles.statusSending
break;
case ACMessageState.SENT.rawValue:
self.statusView.image = Resources.iconCheck1;
self.statusView.tintColor = MainAppTheme.bubbles.statusSent
break;
case ACMessageState.RECEIVED.rawValue:
self.statusView.image = Resources.iconCheck2;
self.statusView.tintColor = MainAppTheme.bubbles.statusReceived
break;
case ACMessageState.READ.rawValue:
self.statusView.image = Resources.iconCheck2;
self.statusView.tintColor = MainAppTheme.bubbles.statusRead
break;
case ACMessageState.ERROR.rawValue:
self.statusView.image = Resources.iconError;
self.statusView.tintColor = MainAppTheme.bubbles.statusError
break
default:
self.statusView.image = Resources.iconClock;
self.statusView.tintColor = MainAppTheme.bubbles.statusSending
break;
}
}
}
// MARK: -
// MARK: Layout
override func layoutContent(maxWidth: CGFloat, offsetX: CGFloat) {
// Convenience
var insets = fullContentInsets
var contentWidth = self.contentView.frame.width
var contentHeight = self.contentView.frame.height
// Measure Text
var senderNameBounds = self.senderNameLabel.sizeThatFits(CGSize(width: CGFloat.max, height: CGFloat.max))
self.messageText.frame = CGRectMake(0, 0, self.cellLayout.textSize.width, self.cellLayout.textSize.height)
var textWidth = round(self.cellLayout.textSizeWithPadding.width)
var textHeight = round(self.cellLayout.textSizeWithPadding.height)
if textWidth < senderNameBounds.width {
textWidth = senderNameBounds.width + 5
}
// Layout elements
var topPadding : CGFloat = self.cellLayout.attrText != nil ? -0.5 : 0
if (self.isOut) {
self.messageText.frame.origin = CGPoint(x: contentWidth - textWidth - insets.right, y: insets.top + topPadding)
self.dateText.frame = CGRectMake(contentWidth - insets.right - 70, textHeight + insets.top - 20, 46, 26)
self.statusView.frame = CGRectMake(contentWidth - insets.right - 24, textHeight + insets.top - 20, 20, 26)
self.statusView.hidden = false
} else {
self.messageText.frame.origin = CGPoint(x: insets.left, y: insets.top + topPadding)
self.dateText.frame = CGRectMake(insets.left + textWidth - 47, textHeight + insets.top - 20, 46, 26)
self.statusView.hidden = true
}
if self.isGroup && !self.isOut {
self.senderNameLabel.frame = CGRect(x: insets.left, y: insets.top - 18, width: textWidth, height: 20)
}
layoutBubble(textWidth, contentHeight: textHeight)
}
} | mit | 99cd7780d61dbd0a1ae696a8d17466ce | 40.475207 | 123 | 0.606815 | 5.149307 | false | false | false | false |
mohssenfathi/MTLImage | MTLImage/Sources/Filters/Saturation.swift | 1 | 1440 | //
// Saturation.swift
// Pods
//
// Created by Mohammad Fathi on 3/10/16.
//
//
import UIKit
struct SaturationUniforms: Uniforms {
var saturation: Float = 0.5
}
public
class Saturation: Filter {
var uniforms = SaturationUniforms()
@objc public var saturation: Float = 0.5 {
didSet {
clamp(&saturation, low: 0, high: 1)
needsUpdate = true
}
}
public init() {
super.init(functionName: "saturation")
title = "Saturation"
properties = [Property(key: "saturation", title: "Saturation")]
update()
}
required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override func update() {
if self.input == nil { return }
uniforms.saturation = saturation * 2.0
updateUniforms(uniforms: uniforms)
}
// override func configureArgumentTableWithCommandEncoder(commandEncoder: MTLComputeCommandEncoder?) {
// var uniforms = AdjustSaturationUniforms(saturation: saturation)
//
// if uniformBuffer == nil {
// uniformBuffer = context.device?.newBufferWithLength(sizeofValue(uniforms), options: .cpuCacheModeWriteCombined)
// }
//
// memcpy(uniformBuffer.contents(), withBytes: &uniforms, sizeofValue(uniforms))
// commandEncoder?.setBuffer(uniformBuffer, offset: 0, atIndex: 0)
// }
}
| mit | 39255d6f1ad960d86021154dc3403742 | 24.714286 | 125 | 0.611806 | 4.47205 | false | false | false | false |
GetZero/-Swift-LeetCode | LeetCode/RansomNote.swift | 1 | 1724 | //
// Solution.swift
// LeetCode
//
// Created by 韦曲凌 on 2016/11/7.
// Copyright © 2016年 Wake GetZero. All rights reserved.
//
import Foundation
class RansomNote: NSObject {
// Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the ransom note can be constructed from the magazines ; otherwise, it will return false.
//
// Each letter in the magazine string can only be used once in your ransom note.
// Note:
// You may assume that both strings contain only lowercase letters.
//
// canConstruct("a", "b") -> false
// canConstruct("aa", "ab") -> false
// canConstruct("aa", "aab") -> true
func canConstruct(_ ransomNote: String, _ magazine: String) -> Bool {
if ransomNote.characters.count == 0 {
return true
}
if magazine.characters.count == 0 {
return false
}
var map: [String: Int] = [:]
for i in magazine.characters {
let str: String = String(i)
if let value = map[str] {
map.updateValue(value + 1, forKey: str)
} else {
map.updateValue(1, forKey: str)
}
}
for i in ransomNote.characters {
let str: String = String(i)
if let value = map[str] {
map.updateValue(value - 1, forKey: str)
if map[str]! < 0 {
return false
}
} else {
return false
}
}
return true
}
}
| apache-2.0 | 12760d7334e0cf018129c2f30f026a70 | 27.583333 | 238 | 0.515452 | 4.341772 | false | false | false | false |
gribozavr/swift | test/decl/protocol/protocols.swift | 1 | 21501 | // RUN: %target-typecheck-verify-swift -enable-objc-interop
protocol EmptyProtocol { }
protocol DefinitionsInProtocols {
init() {} // expected-error {{protocol initializers must not have bodies}}
deinit {} // expected-error {{deinitializers may only be declared within a class}}
}
// Protocol decl.
protocol Test {
func setTitle(_: String)
func erase() -> Bool
var creator: String { get }
var major : Int { get }
var minor : Int { get }
var subminor : Int // expected-error {{property in protocol must have explicit { get } or { get set } specifier}} {{21-21= { get <#set#> \}}}
static var staticProperty: Int // expected-error{{property in protocol must have explicit { get } or { get set } specifier}} {{33-33= { get <#set#> \}}}
let bugfix // expected-error {{type annotation missing in pattern}} expected-error {{immutable property requirement must be declared as 'var' with a '{ get }' specifier}}
var comment // expected-error {{type annotation missing in pattern}} expected-error {{property in protocol must have explicit { get } or { get set } specifier}}
}
protocol Test2 {
var property: Int { get }
var title: String = "The Art of War" { get } // expected-error{{initial value is not allowed here}} expected-error {{property in protocol must have explicit { get } or { get set } specifier}} {{20-20= { get <#set#> \}}}
static var title2: String = "The Art of War" // expected-error{{initial value is not allowed here}} expected-error {{property in protocol must have explicit { get } or { get set } specifier}} {{28-28= { get <#set#> \}}}
associatedtype mytype
associatedtype mybadtype = Int
associatedtype V : Test = // expected-error {{expected type in associated type declaration}} {{28-28= <#type#>}}
}
func test1() {
var v1: Test
var s: String
v1.setTitle(s)
v1.creator = "Me" // expected-error {{cannot assign to property: 'creator' is a get-only property}}
}
protocol Bogus : Int {}
// expected-error@-1{{inheritance from non-protocol, non-class type 'Int'}}
// expected-error@-2{{type 'Self' constrained to non-protocol, non-class type 'Int'}}
// Explicit conformance checks (successful).
protocol CustomStringConvertible { func print() } // expected-note{{protocol requires function 'print()' with type '() -> ()'}} expected-note{{protocol requires}} expected-note{{protocol requires}} expected-note{{protocol requires}}
struct TestFormat { }
protocol FormattedPrintable : CustomStringConvertible {
func print(format: TestFormat)
}
struct X0 : Any, CustomStringConvertible {
func print() {}
}
class X1 : Any, CustomStringConvertible {
func print() {}
}
enum X2 : Any { }
extension X2 : CustomStringConvertible {
func print() {}
}
// Explicit conformance checks (unsuccessful)
struct NotPrintableS : Any, CustomStringConvertible {} // expected-error{{type 'NotPrintableS' does not conform to protocol 'CustomStringConvertible'}}
class NotPrintableC : CustomStringConvertible, Any {} // expected-error{{type 'NotPrintableC' does not conform to protocol 'CustomStringConvertible'}}
enum NotPrintableO : Any, CustomStringConvertible {} // expected-error{{type 'NotPrintableO' does not conform to protocol 'CustomStringConvertible'}}
struct NotFormattedPrintable : FormattedPrintable { // expected-error{{type 'NotFormattedPrintable' does not conform to protocol 'CustomStringConvertible'}}
func print(format: TestFormat) {}
}
// Protocol compositions in inheritance clauses
protocol Left {
func l() // expected-note {{protocol requires function 'l()' with type '() -> ()'; do you want to add a stub?}}
}
protocol Right {
func r() // expected-note {{protocol requires function 'r()' with type '() -> ()'; do you want to add a stub?}}
}
typealias Both = Left & Right
protocol Up : Both {
func u()
}
struct DoesNotConform : Up {
// expected-error@-1 {{type 'DoesNotConform' does not conform to protocol 'Left'}}
// expected-error@-2 {{type 'DoesNotConform' does not conform to protocol 'Right'}}
func u() {}
}
// Circular protocols
protocol CircleMiddle : CircleStart { func circle_middle() } // expected-error 3 {{protocol 'CircleMiddle' refines itself}}
protocol CircleStart : CircleEnd { func circle_start() }
// expected-note@-1 3 {{protocol 'CircleStart' declared here}}
protocol CircleEnd : CircleMiddle { func circle_end()} // expected-note 3 {{protocol 'CircleEnd' declared here}}
protocol CircleEntry : CircleTrivial { }
protocol CircleTrivial : CircleTrivial { } // expected-error {{protocol 'CircleTrivial' refines itself}}
struct Circle {
func circle_start() {}
func circle_middle() {}
func circle_end() {}
}
func testCircular(_ circle: Circle) {
// FIXME: It would be nice if this failure were suppressed because the protocols
// have circular definitions.
_ = circle as CircleStart // expected-error{{value of type 'Circle' does not conform to 'CircleStart' in coercion}}
}
// <rdar://problem/14750346>
protocol Q : C, H { }
protocol C : E { }
protocol H : E { }
protocol E { }
//===----------------------------------------------------------------------===//
// Associated types
//===----------------------------------------------------------------------===//
protocol SimpleAssoc {
associatedtype Associated // expected-note{{protocol requires nested type 'Associated'}}
}
struct IsSimpleAssoc : SimpleAssoc {
struct Associated {}
}
struct IsNotSimpleAssoc : SimpleAssoc {} // expected-error{{type 'IsNotSimpleAssoc' does not conform to protocol 'SimpleAssoc'}}
protocol StreamWithAssoc {
associatedtype Element
func get() -> Element // expected-note{{protocol requires function 'get()' with type '() -> NotAStreamType.Element'}}
}
struct AnRange<Int> : StreamWithAssoc {
typealias Element = Int
func get() -> Int {}
}
// Okay: Word is a typealias for Int
struct AWordStreamType : StreamWithAssoc {
typealias Element = Int
func get() -> Int {}
}
struct NotAStreamType : StreamWithAssoc { // expected-error{{type 'NotAStreamType' does not conform to protocol 'StreamWithAssoc'}}
typealias Element = Float
func get() -> Int {} // expected-note{{candidate has non-matching type '() -> Int'}}
}
// Okay: Infers Element == Int
struct StreamTypeWithInferredAssociatedTypes : StreamWithAssoc {
func get() -> Int {}
}
protocol SequenceViaStream {
associatedtype SequenceStreamTypeType : IteratorProtocol // expected-note{{protocol requires nested type 'SequenceStreamTypeType'}}
func makeIterator() -> SequenceStreamTypeType
}
struct IntIterator : IteratorProtocol /*, Sequence, ReplPrintable*/ {
typealias Element = Int
var min : Int
var max : Int
var stride : Int
mutating func next() -> Int? {
if min >= max { return .none }
let prev = min
min += stride
return prev
}
typealias Generator = IntIterator
func makeIterator() -> IntIterator {
return self
}
}
extension IntIterator : SequenceViaStream {
typealias SequenceStreamTypeType = IntIterator
}
struct NotSequence : SequenceViaStream { // expected-error{{type 'NotSequence' does not conform to protocol 'SequenceViaStream'}}
typealias SequenceStreamTypeType = Int // expected-note{{possibly intended match 'NotSequence.SequenceStreamTypeType' (aka 'Int') does not conform to 'IteratorProtocol'}}
func makeIterator() -> Int {}
}
protocol GetATuple {
associatedtype Tuple
func getATuple() -> Tuple
}
struct IntStringGetter : GetATuple {
typealias Tuple = (i: Int, s: String)
func getATuple() -> Tuple {}
}
protocol ClassConstrainedAssocType {
associatedtype T : class
// expected-error@-1 {{'class' constraint can only appear on protocol declarations}}
// expected-note@-2 {{did you mean to write an 'AnyObject' constraint?}}{{22-27=AnyObject}}
}
//===----------------------------------------------------------------------===//
// Default arguments
//===----------------------------------------------------------------------===//
// FIXME: Actually make use of default arguments, check substitutions, etc.
protocol ProtoWithDefaultArg {
func increment(_ value: Int = 1) // expected-error{{default argument not permitted in a protocol method}}
}
struct HasNoDefaultArg : ProtoWithDefaultArg {
func increment(_: Int) {}
}
//===----------------------------------------------------------------------===//
// Variadic function requirements
//===----------------------------------------------------------------------===//
protocol IntMaxable {
func intmax(first: Int, rest: Int...) -> Int // expected-note 2{{protocol requires function 'intmax(first:rest:)' with type '(Int, Int...) -> Int'}}
}
struct HasIntMax : IntMaxable {
func intmax(first: Int, rest: Int...) -> Int {}
}
struct NotIntMax1 : IntMaxable { // expected-error{{type 'NotIntMax1' does not conform to protocol 'IntMaxable'}}
func intmax(first: Int, rest: [Int]) -> Int {} // expected-note{{candidate has non-matching type '(Int, [Int]) -> Int'}}
}
struct NotIntMax2 : IntMaxable { // expected-error{{type 'NotIntMax2' does not conform to protocol 'IntMaxable'}}
func intmax(first: Int, rest: Int) -> Int {} // expected-note{{candidate has non-matching type '(Int, Int) -> Int'}}
}
//===----------------------------------------------------------------------===//
// 'Self' type
//===----------------------------------------------------------------------===//
protocol IsEqualComparable {
func isEqual(other: Self) -> Bool // expected-note{{protocol requires function 'isEqual(other:)' with type '(WrongIsEqual) -> Bool'}}
}
struct HasIsEqual : IsEqualComparable {
func isEqual(other: HasIsEqual) -> Bool {}
}
struct WrongIsEqual : IsEqualComparable { // expected-error{{type 'WrongIsEqual' does not conform to protocol 'IsEqualComparable'}}
func isEqual(other: Int) -> Bool {} // expected-note{{candidate has non-matching type '(Int) -> Bool'}}
}
//===----------------------------------------------------------------------===//
// Using values of existential type.
//===----------------------------------------------------------------------===//
func existentialSequence(_ e: Sequence) { // expected-error{{has Self or associated type requirements}}
var x = e.makeIterator() // expected-error{{member 'makeIterator' cannot be used on value of protocol type 'Sequence'; use a generic constraint instead}}
x.next()
x.nonexistent()
}
protocol HasSequenceAndStream {
associatedtype R : IteratorProtocol, Sequence
func getR() -> R
}
func existentialSequenceAndStreamType(_ h: HasSequenceAndStream) { // expected-error{{has Self or associated type requirements}}
// FIXME: Crummy diagnostics.
var x = h.getR() // expected-error{{member 'getR' cannot be used on value of protocol type 'HasSequenceAndStream'; use a generic constraint instead}}
x.makeIterator()
x.next()
x.nonexistent()
}
//===----------------------------------------------------------------------===//
// Subscripting
//===----------------------------------------------------------------------===//
protocol IntIntSubscriptable {
subscript (i: Int) -> Int { get }
}
protocol IntSubscriptable {
associatedtype Element
subscript (i: Int) -> Element { get }
}
struct DictionaryIntInt {
subscript (i: Int) -> Int {
get {
return i
}
}
}
func testSubscripting(_ iis: IntIntSubscriptable, i_s: IntSubscriptable) { // expected-error{{has Self or associated type requirements}}
var i: Int = iis[17]
var i2 = i_s[17] // expected-error{{member 'subscript' cannot be used on value of protocol type 'IntSubscriptable'; use a generic constraint instead}}
}
//===----------------------------------------------------------------------===//
// Static methods
//===----------------------------------------------------------------------===//
protocol StaticP {
static func f()
}
protocol InstanceP {
func f() // expected-note{{protocol requires function 'f()' with type '() -> ()'}}
}
struct StaticS1 : StaticP {
static func f() {}
}
struct StaticS2 : InstanceP { // expected-error{{type 'StaticS2' does not conform to protocol 'InstanceP'}}
static func f() {} // expected-note{{candidate operates on a type, not an instance as required}}
}
struct StaticAndInstanceS : InstanceP {
static func f() {}
func f() {}
}
func StaticProtocolFunc() {
let a: StaticP = StaticS1()
a.f() // expected-error{{static member 'f' cannot be used on instance of type 'StaticP'}}
}
func StaticProtocolGenericFunc<t : StaticP>(_: t) {
t.f()
}
//===----------------------------------------------------------------------===//
// Operators
//===----------------------------------------------------------------------===//
protocol Eq {
static func ==(lhs: Self, rhs: Self) -> Bool
}
extension Int : Eq { }
// Matching prefix/postfix.
prefix operator <>
postfix operator <>
protocol IndexValue {
static prefix func <> (_ max: Self) -> Int
static postfix func <> (min: Self) -> Int
}
prefix func <> (max: Int) -> Int { return 0 }
postfix func <> (min: Int) -> Int { return 0 }
extension Int : IndexValue {}
//===----------------------------------------------------------------------===//
// Class protocols
//===----------------------------------------------------------------------===//
protocol IntrusiveListNode : class {
var next : Self { get }
}
final class ClassNode : IntrusiveListNode {
var next : ClassNode = ClassNode()
}
struct StructNode : IntrusiveListNode { // expected-error{{non-class type 'StructNode' cannot conform to class protocol 'IntrusiveListNode'}}
var next : StructNode // expected-error {{value type 'StructNode' cannot have a stored property that recursively contains it}}
}
final class ClassNodeByExtension { }
struct StructNodeByExtension { }
extension ClassNodeByExtension : IntrusiveListNode {
var next : ClassNodeByExtension {
get {
return self
}
set {}
}
}
extension StructNodeByExtension : IntrusiveListNode { // expected-error{{non-class type 'StructNodeByExtension' cannot conform to class protocol 'IntrusiveListNode'}}
var next : StructNodeByExtension {
get {
return self
}
set {}
}
}
final class GenericClassNode<T> : IntrusiveListNode {
var next : GenericClassNode<T> = GenericClassNode()
}
struct GenericStructNode<T> : IntrusiveListNode { // expected-error{{non-class type 'GenericStructNode<T>' cannot conform to class protocol 'IntrusiveListNode'}}
var next : GenericStructNode<T> // expected-error {{value type 'GenericStructNode<T>' cannot have a stored property that recursively contains it}}
}
// Refined protocols inherit class-ness
protocol IntrusiveDListNode : IntrusiveListNode {
var prev : Self { get }
}
final class ClassDNode : IntrusiveDListNode {
var prev : ClassDNode = ClassDNode()
var next : ClassDNode = ClassDNode()
}
struct StructDNode : IntrusiveDListNode { // expected-error{{non-class type 'StructDNode' cannot conform to class protocol 'IntrusiveDListNode'}}
// expected-error@-1{{non-class type 'StructDNode' cannot conform to class protocol 'IntrusiveListNode'}}
var prev : StructDNode // expected-error {{value type 'StructDNode' cannot have a stored property that recursively contains it}}
var next : StructDNode
}
@objc protocol ObjCProtocol {
func foo() // expected-note{{protocol requires function 'foo()' with type '() -> ()'}}
}
protocol NonObjCProtocol : class { //expected-note{{protocol 'NonObjCProtocol' declared here}}
func bar()
}
class DoesntConformToObjCProtocol : ObjCProtocol { // expected-error{{type 'DoesntConformToObjCProtocol' does not conform to protocol 'ObjCProtocol'}}
}
@objc protocol ObjCProtocolRefinement : ObjCProtocol { }
@objc protocol ObjCNonObjCProtocolRefinement : NonObjCProtocol { } //expected-error{{@objc protocol 'ObjCNonObjCProtocolRefinement' cannot refine non-@objc protocol 'NonObjCProtocol'}}
// <rdar://problem/16079878>
protocol P1 {
associatedtype Assoc // expected-note 2{{protocol requires nested type 'Assoc'}}
}
protocol P2 {
}
struct X3<T : P1> where T.Assoc : P2 {}
struct X4 : P1 { // expected-error{{type 'X4' does not conform to protocol 'P1'}}
func getX1() -> X3<X4> { return X3() }
}
protocol ShouldntCrash {
// rdar://16109996
let fullName: String { get } // expected-error {{'let' declarations cannot be computed properties}} {{3-6=var}}
// <rdar://problem/17200672> Let in protocol causes unclear errors and crashes
let fullName2: String // expected-error {{immutable property requirement must be declared as 'var' with a '{ get }' specifier}} {{3-6=var}} {{24-24= { get \}}}
// <rdar://problem/16789886> Assert on protocol property requirement without a type
var propertyWithoutType { get } // expected-error {{type annotation missing in pattern}}
// expected-error@-1 {{computed property must have an explicit type}} {{26-26=: <# Type #>}}
}
// rdar://problem/18168866
protocol FirstProtocol {
// expected-warning@+1 {{'weak' should not be applied to a property declaration in a protocol and will be disallowed in future versions}}
weak var delegate : SecondProtocol? { get } // expected-error{{'weak' must not be applied to non-class-bound 'SecondProtocol'; consider adding a protocol conformance that has a class bound}}
}
protocol SecondProtocol {
func aMethod(_ object : FirstProtocol)
}
// <rdar://problem/19495341> Can't upcast to parent types of type constraints without forcing
class C1 : P2 {}
func f<T : C1>(_ x : T) {
_ = x as P2
}
class C2 {}
func g<T : C2>(_ x : T) {
x as P2 // expected-error{{value of type 'T' does not conform to 'P2' in coercion}}
}
class C3 : P1 {} // expected-error{{type 'C3' does not conform to protocol 'P1'}}
func h<T : C3>(_ x : T) {
_ = x as P1 // expected-error{{protocol 'P1' can only be used as a generic constraint because it has Self or associated type requirements}}
}
func i<T : C3>(_ x : T?) -> Bool {
return x is P1 // expected-error{{protocol 'P1' can only be used as a generic constraint because it has Self or associated type requirements}}
// FIXME: Bogus diagnostic. See SR-11920.
// expected-warning@-2 {{checking a value with optional type 'T?' against dynamic type 'P1' succeeds whenever the value is non-nil; did you mean to use '!= nil'?}}
}
func j(_ x : C1) -> Bool {
return x is P1 // expected-error{{protocol 'P1' can only be used as a generic constraint because it has Self or associated type requirements}}
}
func k(_ x : C1?) -> Bool {
return x is P1 // expected-error{{protocol 'P1' can only be used as a generic constraint because it has Self or associated type requirements}}
}
protocol P4 {
associatedtype T // expected-note {{protocol requires nested type 'T'}}
}
class C4 : P4 { // expected-error {{type 'C4' does not conform to protocol 'P4'}}
associatedtype T = Int // expected-error {{associated types can only be defined in a protocol; define a type or introduce a 'typealias' to satisfy an associated type requirement}} {{3-17=typealias}}
}
// <rdar://problem/25185722> Crash with invalid 'let' property in protocol
protocol LetThereBeCrash {
let x: Int
// expected-error@-1 {{immutable property requirement must be declared as 'var' with a '{ get }' specifier}} {{13-13= { get \}}}
// expected-note@-2 {{declared here}}
}
extension LetThereBeCrash {
init() { x = 1 }
// expected-error@-1 {{'let' property 'x' may not be initialized directly; use "self.init(...)" or "self = ..." instead}}
}
// SR-11412
// Offer fix-it to conform type of context to the missing protocols
protocol SR_11412_P1 {}
protocol SR_11412_P2 {}
protocol SR_11412_P3 {}
protocol SR_11412_P4: AnyObject {}
class SR_11412_C0 {
var foo1: SR_11412_P1?
var foo2: (SR_11412_P1 & SR_11412_P2)?
weak var foo3: SR_11412_P4?
}
// Context has no inherited types and does not conform to protocol //
class SR_11412_C1 {
let c0 = SR_11412_C0()
func conform() {
c0.foo1 = self // expected-error {{cannot assign value of type 'SR_11412_C1' to type 'SR_11412_P1?'}}
// expected-note@-1 {{add missing conformance to 'SR_11412_P1' to class 'SR_11412_C1'}}{{18-18=: SR_11412_P1}}
}
}
// Context has no inherited types and does not conform to protocol composition //
class SR_11412_C2 {
let c0 = SR_11412_C0()
func conform() {
c0.foo2 = self // expected-error {{cannot assign value of type 'SR_11412_C2' to type '(SR_11412_P1 & SR_11412_P2)?'}}
// expected-note@-1 {{add missing conformance to 'SR_11412_P1 & SR_11412_P2' to class 'SR_11412_C2'}}{{18-18=: SR_11412_P1 & SR_11412_P2}}
}
}
// Context already has an inherited type, but does not conform to protocol //
class SR_11412_C3: SR_11412_P3 {
let c0 = SR_11412_C0()
func conform() {
c0.foo1 = self // expected-error {{cannot assign value of type 'SR_11412_C3' to type 'SR_11412_P1?'}}
// expected-note@-1 {{add missing conformance to 'SR_11412_P1' to class 'SR_11412_C3'}}{{31-31=, SR_11412_P1}}
}
}
// Context conforms to only one protocol in the protocol composition //
class SR_11412_C4: SR_11412_P1 {
let c0 = SR_11412_C0()
func conform() {
c0.foo2 = self // expected-error {{cannot assign value of type 'SR_11412_C4' to type '(SR_11412_P1 & SR_11412_P2)?'}}
// expected-note@-1 {{add missing conformance to 'SR_11412_P1 & SR_11412_P2' to class 'SR_11412_C4'}}{{31-31=, SR_11412_P2}}
}
}
// Context is a value type, but protocol requires class //
struct SR_11412_S0 {
let c0 = SR_11412_C0()
func conform() {
c0.foo3 = self // expected-error {{cannot assign value of type 'SR_11412_S0' to type 'SR_11412_P4?'}}
}
}
| apache-2.0 | 171b50a45de8975a8bda75496f5d5643 | 35.380711 | 232 | 0.654435 | 4.144372 | false | false | false | false |
dekatotoro/FluxWithRxSwiftSample | FluxWithRxSwiftSample/API/GitHub/GitHubAPI.swift | 1 | 2243 | //
// API.swift
// FluxWithRxSwitSample
//
// Created by Yuji Hato on 2016/10/13.
// Copyright © 2016年 DEKATOTORO. All rights reserved.
//
import APIKit
import Himotoki
import RxSwift
protocol GitHubRequest: Request {}
extension GitHubRequest {
var baseURL: URL {
return URL(string: Config.gitHub.apiBaseURL)!
}
var headerFields: [String: String] {
return ["Authorization": "token \(Config.gitHub.apiToken)",
"Content-Type" : "application/json; charset=utf-8",
"Accept" : "application/vnd.github.v3+json"]
}
}
extension GitHubRequest where Response: Decodable {
func response(from object: Any, urlResponse: HTTPURLResponse) throws -> Response {
return try Response.decodeValue(object)
}
}
struct GitHubResponse<T> {
var resource: T
var totalCount: Int?
var incomplete_results: Bool
var linkHeader: GitHubLinkHeader?
}
struct GitHubAPI {
static func searchUser(with params: [String : Any]?) -> Observable<GitHubResponse<[GitHubUser]>> {
let request = SearchUserRequest(customParams: params)
let observable = Observable<GitHubResponse<[GitHubUser]>>.create { observer -> Disposable in
Session.send(request, callbackQueue: .main, handler: { result in
switch result {
case .success(let users):
observer.on(.next(users))
observer.onCompleted()
case .failure(let error):
switch error {
case .connectionError(let error):
if (error as NSError).code == URLError.cancelled.rawValue {
// onCompleted when cancelled
observer.onCompleted()
break
}
observer.onError(error)
default:
observer.onError(error)
}
}
})
return Disposables.create()
}
return observable.take(1)
}
static func cancelSearchUser() {
Session.cancelRequests(with: SearchUserRequest.self)
}
}
| mit | 5d3e582a844e5f4937db5f85c905a731 | 28.866667 | 103 | 0.561607 | 4.923077 | false | false | false | false |
nifti/CinchKit | CinchKitTests/CinchClient+AuthTests.swift | 1 | 14186 | //
// CinchClient+AuthTests.swift
// CinchKit
//
// Created by Ryan Fitzgerald on 2/12/15.
// Copyright (c) 2015 cinch. All rights reserved.
//
import Foundation
import Quick
import Nimble
import CinchKit
import Nocilla
class CinchClientAuthSpec: QuickSpec {
override func spec() {
describe("Cinch Client Auth") {
var client: CinchClient?
var accountsResource : ApiResource?
var tokensResource : ApiResource?
beforeEach {
LSNocilla.sharedInstance().start()
LSNocilla.sharedInstance().clearStubs()
client = CinchClient()
let authServerURL = NSURL(string: "http://auth-service-jgjfpv9gvy.elasticbeanstalk.com")!
accountsResource = ApiResource(id: "accounts", href: NSURL(string: "\(authServerURL)/accounts")!, title: "get and create accounts")
tokensResource = ApiResource(id: "tokens", href: NSURL(string: "\(authServerURL)/tokens")!, title: "Create and refresh authentication tokens")
client!.rootResources = ["accounts" : accountsResource!, "tokens" : tokensResource!]
}
afterEach {
LSNocilla.sharedInstance().clearStubs()
LSNocilla.sharedInstance().stop()
}
describe("fetch Accounts matching ids") {
it("should return single account") {
let path : NSString = "\(accountsResource!.href.absoluteString)/.+"
let data = CinchKitTestsHelper.loadJsonData("fetchAccount")
stubRequest("GET", path.regex())
.andReturn(200).withHeader("Content-Type", "application/json").withBody(data)
waitUntil(timeout: 1) { done in
client!.fetchAccountsMatchingIds(["c49ef0c0-8610-491d-9bb2-c494d4a52c5c"]) { (accounts, error) in
expect(accounts).toNot(beEmpty())
expect(error).to(beNil())
if let acc = accounts {
expect(acc.count).to(equal(1))
}
done()
}
}
}
it("should return 404 not found error") {
waitUntil(timeout: 1) { done in
let path : NSString = "\(accountsResource!.href.absoluteString)/.+"
let data = CinchKitTestsHelper.loadJsonData("accountNotFound")
stubRequest("GET", path.regex())
.andReturn(404).withHeader("Content-Type", "application/json").withBody(data)
client!.fetchAccountsMatchingIds(["c49ef0c0-8610-491d-9bb2-c494d4a52c5d"]) { (accounts, error) in
expect(accounts).to(beNil())
expect(error).toNot(beNil())
if let err = error {
expect(err.domain).to(equal(CinchKitErrorDomain))
expect(err.code).to(equal(404))
}
done()
}
}
}
}
describe("fetch Accounts matching email") {
it("should return single account") {
let path : NSString = "\(accountsResource!.href.absoluteString)\\?email\\=.*"
let data = CinchKitTestsHelper.loadJsonData("fetchAccount")
stubRequest("GET", path.regex())
.andReturn(200).withHeader("Content-Type", "application/json").withBody(data)
waitUntil(timeout: 1) { done in
client!.fetchAccountsMatchingEmail("[email protected]") { (accounts, error) in
expect(error).to(beNil())
expect(accounts).toNot(beEmpty())
expect(accounts!.count).to(equal(1))
expect(accounts!.first!.links!.count).to(equal(3))
done()
}
}
}
it("should return 404 not found error") {
let path : NSString = "\(accountsResource!.href.absoluteString)\\?email\\=.*"
let data = CinchKitTestsHelper.loadJsonData("accountNotFound")
stubRequest("GET", path.regex())
.andReturn(404).withHeader("Content-Type", "application/json").withBody(data)
waitUntil(timeout: 1) { done in
client!.fetchAccountsMatchingEmail("asdfasdfasdf") { (accounts, error) in
expect(error).toNot(beNil())
expect(accounts).to(beNil())
expect(error!.code).to(equal(404))
done()
}
}
}
it("should return error when accounts resource doesnt exist") {
let c = CinchClient()
waitUntil(timeout: 1) { done in
c.fetchAccountsMatchingEmail("[email protected]") { (accounts, error) in
expect(error).toNot(beNil())
expect(error!.domain).to(equal(CinchKitErrorDomain))
expect(accounts).to(beNil())
done()
}
}
}
}
describe("fetch Accounts matching username") {
it("should return single account") {
let path : NSString = "\(accountsResource!.href.absoluteString)\\?username\\=.*"
let data = CinchKitTestsHelper.loadJsonData("fetchAccount")
stubRequest("GET", path.regex())
.andReturn(200).withHeader("Content-Type", "application/json").withBody(data)
waitUntil(timeout: 1) { done in
client!.fetchAccountsMatchingUsername("foobar") { (accounts, error) in
expect(error).to(beNil())
expect(accounts).toNot(beEmpty())
expect(accounts!.count).to(equal(1))
done()
}
}
}
it("should return 404 not found") {
let path : NSString = "\(accountsResource!.href.absoluteString)\\?username\\=.*"
let data = CinchKitTestsHelper.loadJsonData("accountNotFound")
stubRequest("GET", path.regex())
.andReturn(404).withHeader("Content-Type", "application/json").withBody(data)
waitUntil(timeout: 1) { done in
client!.fetchAccountsMatchingUsername("asdfasdfasdf") { (accounts, error) in
expect(error).toNot(beNil())
expect(accounts).to(beNil())
expect(error!.code).to(equal(404))
done()
}
}
}
it("should return error when accounts resource doesnt exist") {
let c = CinchClient()
waitUntil(timeout: 5) { done in
c.fetchAccountsMatchingUsername("foobar") { (accounts, error) in
expect(error).toNot(beNil())
expect(error!.domain).to(equal(CinchKitErrorDomain))
expect(accounts).to(beNil())
done()
}
}
}
}
describe("create account") {
it("should return created account") {
let str : NSString = accountsResource!.href.absoluteString
let data = CinchKitTestsHelper.loadJsonData("createAccount")
stubRequest("POST", str).andReturn(201).withHeader("Content-Type", "application/json").withBody(data)
waitUntil(timeout: 2) { done in
client!.createAccount(["email" : "[email protected]", "username" : "foobar23", "name" : "foobar"]) { (account, error) in
expect(error).to(beNil())
expect(account).toNot(beNil())
expect(client!.session.accessTokenData).toNot(beNil())
expect(account!.roles).toNot(beEmpty())
done()
}
}
}
}
describe("refreshSession") {
it("should return new session") {
let data = CinchKitTestsHelper.loadJsonData("createToken")
let token = CinchKitTestsHelper.validAuthToken()
client!.session.accessTokenData = token
stubRequest("POST", token.href.absoluteString).withHeader("Authorization", "Bearer \(token.refresh)")
.andReturn(201).withHeader("Content-Type", "application/json").withBody(data)
waitUntil(timeout: 2) { done in
client!.refreshSession { (account, error) in
expect(error).to(beNil())
expect(account).to(beNil())
expect(client!.session.accessTokenData).toNot(beNil())
expect(client!.session.accessTokenData!.expires.timeIntervalSince1970).to(equal(1425950710.000))
done()
}
}
}
it("should return new session with account") {
let data = CinchKitTestsHelper.loadJsonData("createTokenIncludeAccount")
let token = CinchKitTestsHelper.validAuthToken()
client!.session.accessTokenData = token
let path : NSString = "\(token.href.absoluteString)?include=account"
stubRequest("POST", path).withHeader("Authorization", "Bearer \(token.refresh)")
.andReturn(201).withHeader("Content-Type", "application/json").withBody(data)
waitUntil(timeout: 2) { done in
client!.refreshSession(true) { (account, error) in
expect(error).to(beNil())
expect(account).toNot(beNil())
expect(client!.session.accessTokenData).toNot(beNil())
expect(client!.session.accessTokenData!.expires.timeIntervalSince1970).to(equal(1425950710.000))
done()
}
}
}
it("should create a session") {
let data = CinchKitTestsHelper.loadJsonData("createTokenIncludeAccount")
let path : NSString = tokensResource!.href.absoluteString
stubRequest("POST", path.regex())
.andReturn(201).withHeader("Content-Type", "application/json").withBody(data)
waitUntil(timeout: 2) { done in
client!.createSession(["facebookAccessToken" : "123"], headers: nil) { (account, error) in
expect(error).to(beNil())
expect(account).toNot(beNil())
expect(client!.session.accessTokenData).toNot(beNil())
expect(client!.session.accessTokenData!.expires.timeIntervalSince1970).to(equal(1425950710.000))
done()
}
}
}
}
}
}
}
class CinchBlockedAccountsSpec: QuickSpec {
override func spec() {
describe("check blocked user") {
let c = CinchClient()
CinchKitTestsHelper.setTestUserSession(c)
it("should return blocked user") {
waitUntil(timeout: 105) { done in
c.refreshSession { (account, error) in
let url = NSURL(string: "http://auth-service-jgjfpv9gvy.elasticbeanstalk.com/accounts/72d25ff9-1d37-4814-b2bd-bc149c222220/blockedAccounts/0fc27cf5-0965-427a-a617-101cf987fe42")!
c.checkBlockedAccount(atURL: url, queue: nil, completionHandler: { (blocked, error) -> () in
expect(error).to(beNil())
done()
})
}
}
}
}
}
}
| mit | 7fb0fa35155ca1f55dfe48eab7e718ea | 45.359477 | 202 | 0.437121 | 6.026338 | false | true | false | false |
LipliStyle/Liplis-iOS | Liplis/ObjLiplisLog.swift | 1 | 803 | //
// ObjLiplisLog.swift
// Liplis
//
// ログ1件データ
//
//アップデート履歴
// 2015/04/17 ver0.1.0 作成
// 2015/05/09 ver1.0.0 リリース
//
// Created by sachin on 2015/04/17.
// Copyright (c) 2015年 sachin. All rights reserved.
//
import Foundation
class ObjLiplisLog {
///=============================
/// プロパティ
internal var log : String! = ""
internal var url : String! = ""
internal var type : Int! = 0
//============================================================
//
//初期化処理
//
//============================================================
internal init(log : String!, url : String!,type : Int! )
{
self.log = log
self.url = url
self.type = type
}
} | mit | 2efb997c354a1a8e42e8ab7afe36c26f | 19.054054 | 66 | 0.412955 | 3.761421 | false | false | false | false |
renzifeng/ZFZhiHuDaily | ZFZhiHuDaily/Other/Config/ZFThemeConfig.swift | 1 | 792 | //
// ZFThemeConfig.swift
// ZFZhiHuDaily
//
// Created by 任子丰 on 16/2/19.
// Copyright © 2016年 任子丰. All rights reserved.
//
import UIKit
/// view的背景颜色
let BG_COLOR = DKColorWithColors(UIColor.whiteColor(), RGB(52, 52, 52))
/// Cell的背景颜色
let CELL_COLOR = DKColorWithColors(UIColor.whiteColor(), RGB(39, 39, 39))
/// cell上文字的颜色
let CELL_TITLE = DKColorWithRGB(0x343434,0xffffff)
/// TableHeader的颜色
let TAB_HEADER = DKColorWithColors(ThemeColor, RGB(52, 52, 52))
/// 根据alpha值,设置主题的颜色
func ThemeColorWithAlpha(alpha : CGFloat) -> DKColorPicker {
return DKColorWithColors(RGBA(0, 130, 210, alpha),RGBA(52, 52, 52, alpha))
}
/// Table分割线的颜色
let TAB_SEPAROTOR = DKColorWithRGB(0xaaaaaa, 0x313131) | apache-2.0 | 2a7818462dad9cf878047c37e933c69c | 23.344828 | 78 | 0.719149 | 2.865854 | false | false | false | false |
tdquang/CarlWrite | CarlWrite/FormViewController.swift | 1 | 8867 | //
// FormViewController.swift
// This view contains the form for the user to fill in the information.
// WrittingApp
//
// Quang Tran & Anmol Raina
// Copyright (c) 2015 Quang Tran. All rights reserved.
//
import UIKit
class FormViewController: UIViewController {
@IBOutlet weak var course: UITextField!
@IBOutlet weak var instructor: UITextField!
@IBOutlet weak var topic: UITextField!
@IBOutlet weak var paperType: UITextField!
@IBOutlet weak var currentState: UITextField!
@IBOutlet weak var dueDate: UITextField!
@IBOutlet weak var classYear: UITextField!
@IBOutlet weak var major: UITextField!
@IBOutlet weak var copyForProf: UITextField!
@IBOutlet weak var firstVisit: UITextField!
@IBOutlet weak var goalsTable: UITableView!
@IBOutlet weak var visitSourceTable: UITableView!
let paperTypeArray = dataFile().returnPaperType()
let classYearArray = dataFile().returnClassYear()
let dueDateArray = dataFile().returnDueDate()
let majorArray = dataFile().returnMajor()
let yesNoArray = dataFile().returnYesNo()
let lengthArray = dataFile().returnPaperLengths()
let currentStateArray = dataFile().returnListOfStates()
let goalsTableArray = dataFile().returnGoalsForVisit()
let visitSourceTableArray = dataFile().returnVisitSource()
let textCellIdentifier1 = "TextCell1"
let textCellIdentifier2 = "TextCell2"
let sharedData = dataFile.sharedInstance
var dateToDisplay = ""
var selectedRow = [Int]()
var selectedSource = Int()
var holdDataArray = [String]()
var visitSource = ""
@IBOutlet weak var scrollView: UIScrollView!
override func viewDidLoad() {
super.viewDidLoad()
// Setting the background
self.view.backgroundColor = UIColor(patternImage: UIImage(named: "background.jpg")!)
scrollView.contentSize = CGSize(width: 1000, height: 10000)
self.goalsTable.registerClass(UITableViewCell.self, forCellReuseIdentifier: "cell")
self.goalsTable.scrollEnabled = false
self.visitSourceTable.registerClass(UITableViewCell.self, forCellReuseIdentifier: "cell")
// Initializing necessary textfields
classYear.text = classYearArray[0]
major.text = majorArray[0]
copyForProf.text = yesNoArray[1]
firstVisit.text = yesNoArray[1]
dueDate.text = dueDateArray[0]
currentState.text = currentStateArray[0]
paperType.text = paperTypeArray[0]
}
// prepareForSegue function to submit the form and add it to the list of appointments
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "submitForm" {
sharedData.addAppointment([dateToDisplay, course.text!, instructor.text!, topic.text!, paperType.text!, currentState.text!, classYear.text!, major.text!, firstVisit.text!, copyForProf.text!])
}
print(dataFile().listOfAppointments.count, terminator: "")
}
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
// Table view functions below
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if(tableView == goalsTable){
return goalsTableArray.count
}
else {
return visitSourceTableArray.count
}
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
// goalsTable is a table view that allows the user to check several items
if(tableView == goalsTable){
let cell = self.goalsTable.dequeueReusableCellWithIdentifier(textCellIdentifier1, forIndexPath: indexPath)
let row = indexPath.row
cell.textLabel?.text = goalsTableArray[row]
if (self.selectedRow.contains(row)){
cell.accessoryType = UITableViewCellAccessoryType.Checkmark
}
else{
cell.accessoryType = UITableViewCellAccessoryType.None
}
return cell
}
// visitSource Table allows the user to select only 1 item
else {
let cell = self.visitSourceTable.dequeueReusableCellWithIdentifier(textCellIdentifier2, forIndexPath: indexPath)
let row = indexPath.row
cell.textLabel?.text = visitSourceTableArray[row]
if (self.selectedSource == row){
cell.accessoryType = UITableViewCellAccessoryType.Checkmark
}
else{
cell.accessoryType = UITableViewCellAccessoryType.None
}
return cell
}
}
// When the user clicks on a cell
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
if(tableView == goalsTable){
goalsTable.deselectRowAtIndexPath(indexPath, animated: true)
let row = indexPath.row
holdDataArray.append(goalsTableArray[row])
if (self.selectedRow.contains(row)){
for var index = 0; index < self.selectedRow.count; ++index{
if (self.selectedRow[index] == row){
self.selectedRow.removeAtIndex(index)
}
}
}
else{
self.selectedRow.append(row)
}
tableView.reloadData()
}
else if(tableView == visitSourceTable){
visitSourceTable.deselectRowAtIndexPath(indexPath, animated: true)
let row = indexPath.row
visitSource = visitSourceTableArray[row]
selectedSource = row
tableView.reloadData()
}
}
func textFieldShouldBeginEditing(textField: UITextField) -> Bool {
return false
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// Below are the functions that are called when the user touches down on the text field
@IBAction func paperStatePicker(sender: UITextField) {
ActionSheetStringPicker.showPickerWithTitle("Choose Paper State", rows: currentStateArray, initialSelection: 1, doneBlock: {
picker, value, index in
sender.text = dataFile().returnListOfStates()[value]
return
}, cancelBlock: { ActionStringCancelBlock in return }, origin: sender)
}
@IBAction func paperTypePicker(sender: UITextField) {
ActionSheetStringPicker.showPickerWithTitle("Choose Paper Type", rows: paperTypeArray, initialSelection: 1, doneBlock: {
picker, value, index in
sender.text = dataFile().returnPaperType()[value]
return
}, cancelBlock: { ActionStringCancelBlock in return }, origin: sender)
}
@IBAction func paperDueDatePicker(sender: UITextField) {
ActionSheetStringPicker.showPickerWithTitle("Due Date", rows: dueDateArray, initialSelection: 1, doneBlock: {
picker, value, index in
sender.text = self.dueDateArray[value]
return
}, cancelBlock: { ActionStringCancelBlock in return }, origin: sender)
}
@IBAction func classYearPicker(sender: UITextField) {
ActionSheetStringPicker.showPickerWithTitle("Choose Class Year", rows: classYearArray, initialSelection: 1, doneBlock: {
picker, value, index in
sender.text = self.classYearArray[value]
return
}, cancelBlock: { ActionStringCancelBlock in return }, origin: sender)
}
@IBAction func majorPicker(sender: UITextField) {
ActionSheetStringPicker.showPickerWithTitle("Choose Your Major", rows: majorArray, initialSelection: 1, doneBlock: {
picker, value, index in
sender.text = self.majorArray[value]
return
}, cancelBlock: { ActionStringCancelBlock in return }, origin: sender)
}
@IBAction func firstVisitPicker(sender: UITextField) {
ActionSheetStringPicker.showPickerWithTitle("First Visit?", rows: ["Yes", "No"], initialSelection: 1, doneBlock: {
picker, value, index in
sender.text = ["Yes", "No"][value]
return
}, cancelBlock: { ActionStringCancelBlock in return }, origin: sender)
}
@IBAction func copyForProfPicker(sender: UITextField) {
ActionSheetStringPicker.showPickerWithTitle("Send a Copy?", rows: ["Yes", "No"], initialSelection: 1, doneBlock: {
picker, value, index in
sender.text = ["Yes", "No"][value]
return
}, cancelBlock: { ActionStringCancelBlock in return }, origin: sender)
}
}
| mit | 66a37b65c472ae9a4241a2ab156950da | 39.304545 | 203 | 0.646216 | 5.170262 | false | false | false | false |
DAloG/BlueCap | BlueCapKit/External/FutureLocation/Logger.swift | 1 | 525 | //
// Logger.swift
// FutureLocation
//
// Created by Troy Stribling on 2/22/15.
// Copyright (c) 2015 Troy Stribling. The MIT License (MIT).
//
import Foundation
public class Logger {
public class func debug(message:String? = nil, function: String = __FUNCTION__, file: String = __FILE__, line: Int = __LINE__) {
#if DEBUG
if let message = message {
print("\(file):\(function):\(line): \(message)")
} else {
print("\(file):\(function):\(line)")
}
#endif
}
}
| mit | 6bb318a646f8aac1efbdea65a4e23f06 | 24 | 132 | 0.565714 | 3.804348 | false | false | false | false |
blokadaorg/blokada | ios/App/UI/Settings/LeaseListViewModel.swift | 1 | 1728 | //
// This file is part of Blokada.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright © 2020 Blocka AB. All rights reserved.
//
// @author Karol Gusak
//
import Foundation
import Combine
class LeaseListViewModel: ObservableObject {
private lazy var leaseRepo = Repos.leaseRepo
private lazy var accountRepo = Repos.accountRepo
private var cancellables = Set<AnyCancellable>()
@Published var leases = [LeaseViewModel]()
init() {
onLeasesChanged()
}
private func onLeasesChanged() {
// Get latest leases and account info
Publishers.CombineLatest(
leaseRepo.leasesHot, accountRepo.accountHot
)
// Map each lease to isMe flag (if lease is for current device)
.map { it -> Array<(Lease, Bool)> in
let (leases, account) = it
return leases.map { (
$0, // Lease
$0.public_key == account.keypair.publicKey // isMe
) }
}
.receive(on: RunLoop.main)
// Put all this to views
.sink(onValue: { it in
self.leases = it.map { leaseAndMeFlag in
let (lease, isMe) = leaseAndMeFlag
return LeaseViewModel(lease, isMe: isMe)
}
})
.store(in: &cancellables)
}
func deleteLease(_ index: IndexSet) {
let lease = leases[index.first!]
if !lease.isMe {
leaseRepo.deleteLease(lease.lease)
}
}
func refreshLeases() {
leaseRepo.refreshLeases()
}
}
| mpl-2.0 | 02e21ffcaffe91c05d0a053a1d06c7bb | 25.984375 | 71 | 0.586566 | 4.006961 | false | false | false | false |
ben-ng/swift | test/decl/protocol/req/associated_type_inference.swift | 1 | 7685 | // RUN: %target-typecheck-verify-swift
protocol P0 {
associatedtype Assoc1 : PSimple // expected-note{{ambiguous inference of associated type 'Assoc1': 'Double' vs. 'Int'}}
// expected-note@-1{{ambiguous inference of associated type 'Assoc1': 'Double' vs. 'Int'}}
// expected-note@-2{{unable to infer associated type 'Assoc1' for protocol 'P0'}}
// expected-note@-3{{unable to infer associated type 'Assoc1' for protocol 'P0'}}
func f0(_: Assoc1)
func g0(_: Assoc1)
}
protocol PSimple { }
extension Int : PSimple { }
extension Double : PSimple { }
struct X0a : P0 { // okay: Assoc1 == Int
func f0(_: Int) { }
func g0(_: Int) { }
}
struct X0b : P0 { // expected-error{{type 'X0b' does not conform to protocol 'P0'}}
func f0(_: Int) { } // expected-note{{matching requirement 'f0' to this declaration inferred associated type to 'Int'}}
func g0(_: Double) { } // expected-note{{matching requirement 'g0' to this declaration inferred associated type to 'Double'}}
}
struct X0c : P0 { // okay: Assoc1 == Int
func f0(_: Int) { }
func g0(_: Float) { }
func g0(_: Int) { }
}
struct X0d : P0 { // okay: Assoc1 == Int
func f0(_: Int) { }
func g0(_: Double) { } // viable, but no corresponding f0
func g0(_: Int) { }
}
struct X0e : P0 { // expected-error{{type 'X0e' does not conform to protocol 'P0'}}
func f0(_: Double) { } // expected-note{{matching requirement 'f0' to this declaration inferred associated type to 'Double}}
func f0(_: Int) { } // expected-note{{matching requirement 'f0' to this declaration inferred associated type to 'Int'}}
func g0(_: Double) { }
func g0(_: Int) { }
}
struct X0f : P0 { // okay: Assoc1 = Int because Float doesn't conform to PSimple
func f0(_: Float) { }
func f0(_: Int) { }
func g0(_: Float) { }
func g0(_: Int) { }
}
struct X0g : P0 { // expected-error{{type 'X0g' does not conform to protocol 'P0'}}
func f0(_: Float) { } // expected-note{{inferred type 'Float' (by matching requirement 'f0') is invalid: does not conform to 'PSimple'}}
func g0(_: Float) { } // expected-note{{inferred type 'Float' (by matching requirement 'g0') is invalid: does not conform to 'PSimple'}}
}
struct X0h<T : PSimple> : P0 {
func f0(_: T) { }
}
extension X0h {
func g0(_: T) { }
}
struct X0i<T : PSimple> {
}
extension X0i {
func g0(_: T) { }
}
extension X0i : P0 { }
extension X0i {
func f0(_: T) { }
}
// Protocol extension used to infer requirements
protocol P1 {
}
extension P1 {
final func f0(_ x: Int) { }
final func g0(_ x: Int) { }
}
struct X0j : P0, P1 { }
protocol P2 {
associatedtype P2Assoc
func h0(_ x: P2Assoc)
}
extension P2 where Self.P2Assoc : PSimple {
final func f0(_ x: P2Assoc) { } // expected-note{{inferred type 'Float' (by matching requirement 'f0') is invalid: does not conform to 'PSimple'}}
final func g0(_ x: P2Assoc) { } // expected-note{{inferred type 'Float' (by matching requirement 'g0') is invalid: does not conform to 'PSimple'}}
}
struct X0k : P0, P2 {
func h0(_ x: Int) { }
}
struct X0l : P0, P2 { // expected-error{{type 'X0l' does not conform to protocol 'P0'}}
func h0(_ x: Float) { }
}
// Prefer declarations in the type to those in protocol extensions
struct X0m : P0, P2 {
func f0(_ x: Double) { }
func g0(_ x: Double) { }
func h0(_ x: Double) { }
}
// Inference from properties.
protocol PropertyP0 {
associatedtype Prop : PSimple // expected-note{{unable to infer associated type 'Prop' for protocol 'PropertyP0'}}
var property: Prop { get }
}
struct XProp0a : PropertyP0 { // okay PropType = Int
var property: Int
}
struct XProp0b : PropertyP0 { // expected-error{{type 'XProp0b' does not conform to protocol 'PropertyP0'}}
var property: Float // expected-note{{inferred type 'Float' (by matching requirement 'property') is invalid: does not conform to 'PSimple'}}
}
// Inference from subscripts
protocol SubscriptP0 {
associatedtype Index
associatedtype Element : PSimple // expected-note{{unable to infer associated type 'Element' for protocol 'SubscriptP0'}}
subscript (i: Index) -> Element { get }
}
struct XSubP0a : SubscriptP0 {
subscript (i: Int) -> Int { get { return i } }
}
struct XSubP0b : SubscriptP0 { // expected-error{{type 'XSubP0b' does not conform to protocol 'SubscriptP0'}}
subscript (i: Int) -> Float { get { return Float(i) } } // expected-note{{inferred type 'Float' (by matching requirement 'subscript') is invalid: does not conform to 'PSimple'}}
}
// Inference from properties and subscripts
protocol CollectionLikeP0 {
associatedtype Index
associatedtype Element
var startIndex: Index { get }
var endIndex: Index { get }
subscript (i: Index) -> Element { get }
}
struct SomeSlice<T> { }
struct XCollectionLikeP0a<T> : CollectionLikeP0 {
var startIndex: Int
var endIndex: Int
subscript (i: Int) -> T { get { fatalError("blah") } }
subscript (r: Range<Int>) -> SomeSlice<T> { get { return SomeSlice() } }
}
// rdar://problem/21304164
public protocol Thenable {
associatedtype T // expected-note{{protocol requires nested type 'T'}}
func then(_ success: (_: T) -> T) -> Self
}
public class CorePromise<T> : Thenable { // expected-error{{type 'CorePromise<T>' does not conform to protocol 'Thenable'}}
public func then(_ success: @escaping (_ t: T, _: CorePromise<T>) -> T) -> Self {
return self.then() { (t: T) -> T in
return success(t: t, self)
}
}
}
// rdar://problem/21559670
protocol P3 {
associatedtype Assoc = Int
associatedtype Assoc2
func foo(_ x: Assoc2) -> Assoc?
}
protocol P4 : P3 { }
extension P4 {
func foo(_ x: Int) -> Float? { return 0 }
}
extension P3 where Assoc == Int {
func foo(_ x: Int) -> Assoc? { return nil }
}
struct X4 : P4 { }
// rdar://problem/21738889
protocol P5 {
associatedtype A = Int
}
struct X5<T : P5> : P5 {
typealias A = T.A
}
protocol P6 : P5 {
associatedtype A : P5 = X5<Self>
}
extension P6 where A == X5<Self> { }
// rdar://problem/21774092
protocol P7 {
associatedtype A
associatedtype B
func f() -> A
func g() -> B
}
struct X7<T> { }
extension P7 {
func g() -> X7<A> { return X7() }
}
struct Y7<T> : P7 {
func f() -> Int { return 0 }
}
struct MyAnySequence<Element> : MySequence {
typealias SubSequence = MyAnySequence<Element>
func makeIterator() -> MyAnyIterator<Element> {
return MyAnyIterator<Element>()
}
}
struct MyAnyIterator<T> : MyIteratorType {
typealias Element = T
}
protocol MyIteratorType {
associatedtype Element
}
protocol MySequence {
associatedtype Iterator : MyIteratorType
associatedtype SubSequence
func foo() -> SubSequence
func makeIterator() -> Iterator
}
extension MySequence {
func foo() -> MyAnySequence<Iterator.Element> {
return MyAnySequence()
}
}
struct SomeStruct<Element> : MySequence {
let element: Element
init(_ element: Element) {
self.element = element
}
func makeIterator() -> MyAnyIterator<Element> {
return MyAnyIterator<Element>()
}
}
// rdar://problem/21883828 - ranking of solutions
protocol P8 {
}
protocol P9 : P8 {
}
protocol P10 {
associatedtype A
func foo() -> A
}
struct P8A { }
struct P9A { }
extension P8 {
func foo() -> P8A { return P8A() }
}
extension P9 {
func foo() -> P9A { return P9A() }
}
struct Z10 : P9, P10 {
}
func testZ10() -> Z10.A {
var zA: Z10.A
zA = P9A()
return zA
}
// rdar://problem/21926788
protocol P11 {
associatedtype A
associatedtype B
func foo() -> B
}
extension P11 where A == Int {
func foo() -> Int { return 0 }
}
protocol P12 : P11 {
}
extension P12 {
func foo() -> String { return "" }
}
struct X12 : P12 {
typealias A = String
}
| apache-2.0 | c13a4e7d3bb5bff5b5209fce151bc1fa | 22.429878 | 179 | 0.648926 | 3.238517 | false | false | false | false |
adrfer/swift | stdlib/private/SwiftPrivatePthreadExtras/PthreadBarriers.swift | 2 | 3531 | //===--- PthreadBarriers.swift --------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS)
import Darwin
#elseif os(Linux) || os(FreeBSD)
import Glibc
#endif
//
// Implement pthread barriers.
//
// (OS X does not implement them.)
//
public struct _stdlib_pthread_barrierattr_t {
public init() {}
}
public func _stdlib_pthread_barrierattr_init(
attr: UnsafeMutablePointer<_stdlib_pthread_barrierattr_t>
) -> CInt {
return 0
}
public func _stdlib_pthread_barrierattr_destroy(
attr: UnsafeMutablePointer<_stdlib_pthread_barrierattr_t>
) -> CInt {
return 0
}
public var _stdlib_PTHREAD_BARRIER_SERIAL_THREAD: CInt {
return 1
}
public struct _stdlib_pthread_barrier_t {
var mutex: UnsafeMutablePointer<pthread_mutex_t> = nil
var cond: UnsafeMutablePointer<pthread_cond_t> = nil
/// The number of threads to synchronize.
var count: CUnsignedInt = 0
/// The number of threads already waiting on the barrier.
///
/// This shared variable is protected by `mutex`.
var numThreadsWaiting: CUnsignedInt = 0
public init() {}
}
public func _stdlib_pthread_barrier_init(
barrier: UnsafeMutablePointer<_stdlib_pthread_barrier_t>,
_ attr: UnsafeMutablePointer<_stdlib_pthread_barrierattr_t>,
_ count: CUnsignedInt
) -> CInt {
barrier.memory = _stdlib_pthread_barrier_t()
if count == 0 {
errno = EINVAL
return -1
}
barrier.memory.mutex = UnsafeMutablePointer.alloc(1)
if pthread_mutex_init(barrier.memory.mutex, nil) != 0 {
// FIXME: leaking memory.
return -1
}
barrier.memory.cond = UnsafeMutablePointer.alloc(1)
if pthread_cond_init(barrier.memory.cond, nil) != 0 {
// FIXME: leaking memory, leaking a mutex.
return -1
}
barrier.memory.count = count
return 0
}
public func _stdlib_pthread_barrier_destroy(
barrier: UnsafeMutablePointer<_stdlib_pthread_barrier_t>
) -> CInt {
if pthread_cond_destroy(barrier.memory.cond) != 0 {
// FIXME: leaking memory, leaking a mutex.
return -1
}
if pthread_mutex_destroy(barrier.memory.mutex) != 0 {
// FIXME: leaking memory.
return -1
}
barrier.memory.cond.destroy()
barrier.memory.cond.dealloc(1)
barrier.memory.mutex.destroy()
barrier.memory.mutex.dealloc(1)
return 0
}
public func _stdlib_pthread_barrier_wait(
barrier: UnsafeMutablePointer<_stdlib_pthread_barrier_t>
) -> CInt {
if pthread_mutex_lock(barrier.memory.mutex) != 0 {
return -1
}
barrier.memory.numThreadsWaiting += 1
if barrier.memory.numThreadsWaiting < barrier.memory.count {
// Put the thread to sleep.
if pthread_cond_wait(barrier.memory.cond, barrier.memory.mutex) != 0 {
return -1
}
if pthread_mutex_unlock(barrier.memory.mutex) != 0 {
return -1
}
return 0
} else {
// Reset thread count.
barrier.memory.numThreadsWaiting = 0
// Wake up all threads.
if pthread_cond_broadcast(barrier.memory.cond) != 0 {
return -1
}
if pthread_mutex_unlock(barrier.memory.mutex) != 0 {
return -1
}
return _stdlib_PTHREAD_BARRIER_SERIAL_THREAD
}
}
| apache-2.0 | 16410ebd2f3d8e755e0ffcf61a5e72f2 | 25.75 | 80 | 0.664967 | 3.796774 | false | false | false | false |
maximkhatskevich/MKHUniFlow | Sources/MutationDecriptors/2-TransitionFrom.swift | 1 | 1838 | /*
MIT License
Copyright (c) 2016 Maxim Khatskevich ([email protected])
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
import Foundation /// for access to `Date` type
//---
public
struct TransitionFrom<Old: SomeState>: SomeMutationDecriptor
{
public
let timestamp: Date
public
let oldValue: Old
public
let newValue: SomeStateBase
public
init?(
from mutationReport: ByTypeStorage.HistoryElement
) {
guard
let oldValue = mutationReport.asTransition?.oldValue as? Old,
let newValue = mutationReport.asTransition?.newValue
else
{
return nil
}
//---
self.timestamp = mutationReport.timestamp
self.oldValue = oldValue
self.newValue = newValue
}
}
| mit | c8a9cc6310ec4a1642becd687afabf90 | 28.645161 | 79 | 0.702938 | 5.021858 | false | false | false | false |
michael-yuji/spartanX | Sources/SXOutgoingSocket.swift | 2 | 17336 |
// Copyright (c) 2016, Yuji
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// The views and conclusions contained in the software and documentation are those
// of the authors and should not be interpreted as representing official policies,
// either expressed or implied, of the FreeBSD Project.
//
// Created by Yuji on 9/11/16.
// Copyright © 2016 yuuji. All rights reserved.
//
#if __tls
import struct swiftTLS.TLSClient
#endif
import CKit
import struct Foundation.Data
private func connect(_ fd: Int32, _ sockaddr: UnsafePointer<sockaddr>, _ socklen_t: socklen_t) -> Int32 {
return xlibc.connect(fd, sockaddr, socklen_t)
}
public typealias SXConnectionSocket = SXOutgoingSocket // backward support
public struct SXOutgoingSocket: OutgoingSocket
{
static let defaultBufsize = 1048576 * 4
public var sockfd: Int32
public var domain: SocketDomains
public var type: SocketTypes
public var `protocol`: Int32
public var port: in_port_t?
#if __tls
let tlsContext = TLSClient.securedClient()
#endif
public var address: SXSocketAddress?
public var readBufsize: size_t
var handler: ((Data?) -> Bool)?
public var hashValue: Int
public var errhandler: ((Error) -> Bool)?
internal var readHandler: (Readable & Socket, Int) throws -> Data?
internal var writeHandler: (Writable & Socket, Data) throws -> ()
}
//MARK: - runtime
extension SXOutgoingSocket {
@inline(__always)
public func write(data: Data) throws {
if send(sockfd, data.bytes, data.length, 0) == -1 {
throw SocketError.send("send: \(String.errno)")
}
}
public static func oneshot(tls: Bool, hostname: String, service: String, request: Data, expectedResponseSize size: Int = SXOutgoingSocket.defaultBufsize, timeout: timeval?, callback: (Data?) -> () ) throws {
let socket = try SXOutgoingSocket(tls: tls, hostname: hostname, service: service, bufsize: size)
try socket.write(data: request)
if let timeout = timeout {
socket.setTimeoutInterval(timeout)
}
socket.setBlockingMode(block: false)
let data = try socket.read(size: size)
callback(data)
socket.done()
}
public static func oneshot(unixDomain: String, type: SocketTypes, request: Data, expectedResponseSize size: Int = SXOutgoingSocket.defaultBufsize, timeout: timeval?, callback: (Data?) -> () ) throws {
let socket = try SXOutgoingSocket(unixDomainName: unixDomain, type: type)
try socket.write(data: request)
if let timeout = timeout {
socket.setTimeoutInterval(timeout)
}
socket.setBlockingMode(block: true)
let data = try socket.read(size: size)
callback(data)
socket.done()
}
public func read() throws -> Data? {
var size: Int = 0
#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS)
let FIONREAD = 1074030207 /* Trust me, it is FIONREAD found in <sys/filio.h>, somehow it cannot import to swift */
#endif
_ = ioctl(sockfd, UInt(FIONREAD), UnsafeMutableRawPointer(mutablePointer(of: &size)))
return try read(size: size)
}
@inline(__always)
public func read(size: Int) throws -> Data? {
return self.isBlocking ?
try self.read_block(size: size) :
try self.read_nonblock(size: size)
}
public func done() {
close(self.sockfd)
}
}
extension SXOutgoingSocket: KqueueManagable {
public func runloop(manager: SXKernel, _ ev: event) {
func kdone() {
manager.remove(ident: self.ident, for: .read)
self.done()
}
do {
#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS) || os(FreeBSD) || os(PS4)
let payload = try self.read(size: ev.data)
#else
var size: Int = 0
_ = ioctl(ev.data.fd, UInt(FIONREAD), UnsafeMutableRawPointer(mutablePointer(of: &size)))
let payload = try self.read()
#endif
if handler?(payload) == false {
kdone()
}
} catch {
if let errh = errhandler {
if !errh(error) {
kdone()
}
} else {
kdone()
}
}
}
}
//MARK: - initializers
public extension SXOutgoingSocket {
public init(unixDomainName: String, type: SocketTypes, `protocol`: Int32 = 0, bufsize: Int = SXOutgoingSocket.defaultBufsize) throws {
if type != .stream && type != .seqpacket {
throw SocketError.unconnectable
}
self.readHandler = { client, size throws -> Data? in
client.setBlockingMode(block: true)
return client.isBlocking ?
try client.recv_block(size: size) :
try client.recv_nonblock(size: size)
}
self.writeHandler = { (client: Socket & Writable, data: Data) throws -> () in
if send(client.sockfd, data.bytes, data.length, 0) == -1 {
throw SocketError.send("send: \(String.errno)")
}
}
self.type = type
self.domain = .unix
self.`protocol` = `protocol`
self.readBufsize = bufsize
self.sockfd = socket(AF_UNIX, self.type.rawValue, `protocol`)
self.hashValue = Int(sockfd) * time(nil)
self.address = SXSocketAddress(address: unixDomainName, withDomain: .unix, port: 0)
switch self.address! {
case var .unix(addr):
if type == .stream {
if connect(sockfd, pointer(of: &addr).cast(to: sockaddr.self), address!.socklen) == -1 {
throw SocketError.connect(String.errno)
}
}
default:
break
}
}
public init(tls: Bool = false, hostname: String, service: String, type: SocketTypes = .stream, `protocol`: Int32 = 0, bufsize: Int = SXOutgoingSocket.defaultBufsize) throws {
let addresses: [SXSocketAddress] = try! DNS.lookup(hostname: hostname, service: service)
var fd: Int32 = -1
self.type = type
self.domain = .unspec
self.`protocol` = `protocol`
self.readBufsize = bufsize
self.readHandler = { client, size throws -> Data? in
return client.isBlocking ?
try client.recv_block(size: size) :
try client.recv_nonblock(size: size)
}
self.writeHandler = { (client: Socket & Writable, data: Data) throws -> () in
if send(client.sockfd, data.bytes, data.length, 0) == -1 {
throw SocketError.send("send: \(String.errno)")
}
}
#if __tls
if tls {
self.readHandler = { client_socket, _ throws -> Data? in
return try (client_socket as! SXOutgoingSocket).tlsContext.read(size: 16 * 1024)
}
self.writeHandler = { client_socket, data throws in
_ = try client_socket.write(data: data)
}
}
#endif
searchAddress: for address in addresses {
switch address {
case var .inet(addr):
fd = socket(AF_INET, type.rawValue, 0)
if connect(fd, pointer(of: &addr).cast(to: sockaddr.self), address.socklen) == -1 {
continue
}
self.domain = .inet
break searchAddress
case var .inet6(addr):
fd = socket(AF_INET6, type.rawValue, 0)
if connect(fd, pointer(of: &addr).cast(to: sockaddr.self), address.socklen) == -1 {
continue
}
self.domain = .inet6
break searchAddress
default:
throw SocketError.unconnectable
}
}
if fd == -1 {
throw SocketError.connect(String.errno)
}
self.sockfd = fd
self.hashValue = Int(sockfd) * time(nil)
}
public init(tls: Bool = false, hostname: String, port: in_port_t, type: SocketTypes = .stream, `protocol`: Int32 = 0, bufsize: Int = SXOutgoingSocket.defaultBufsize) throws {
let addresses: [SXSocketAddress] = try! DNS.lookup(hostname: hostname, port: port)
var fd: Int32 = -1
self.type = type
self.domain = .unspec
self.`protocol` = `protocol`
self.readBufsize = bufsize
self.readHandler = { client, size throws -> Data? in
return client.isBlocking ?
try client.recv_block(size: size) :
try client.recv_nonblock(size: size)
}
self.writeHandler = { (client: Socket & Writable, data: Data) throws -> () in
if send(client.sockfd, data.bytes, data.length, 0) == -1 {
throw SocketError.send("send: \(String.errno)")
}
}
#if __tls
if tls {
self.readHandler = { client_socket, _ throws -> Data? in
return try (client_socket as! SXOutgoingSocket).tlsContext.read(size: 16 * 1024)
}
self.writeHandler = { client_socket, data throws in
_ = try client_socket.write(data: data)
}
}
#endif
searchAddress: for address in addresses {
switch address {
case var .inet(addr):
fd = socket(AF_INET, type.rawValue, 0)
if connect(fd, pointer(of: &addr).cast(to: sockaddr.self), address.socklen) == -1 {
continue
}
self.domain = .inet
break searchAddress
case var .inet6(addr):
fd = socket(AF_INET6, type.rawValue, 0)
if connect(fd, pointer(of: &addr).cast(to: sockaddr.self), address.socklen) == -1 {
continue
}
self.domain = .inet6
break searchAddress
default:
throw SocketError.nonInetDomain
}
}
if fd == -1 {
throw SocketError.unconnectable
}
self.sockfd = fd
self.hashValue = Int(sockfd) * time(nil)
}
public init(ipv4: String, port: in_port_t, type: SocketTypes = .stream, `protocol`: Int32 = 0, bufsize: Int = SXOutgoingSocket.defaultBufsize) throws {
self.sockfd = socket(AF_INET, type.rawValue, `protocol`)
self.domain = .inet
self.type = type
self.protocol = `protocol`
self.address = SXSocketAddress(address: ipv4, withDomain: .inet, port: port)
self.readBufsize = bufsize
self.hashValue = Int(sockfd) * time(nil)
self.readHandler = { client, size throws -> Data? in
return client.isBlocking ?
try client.recv_block(size: size) :
try client.recv_nonblock(size: size)
}
self.writeHandler = { (client: Socket & Writable, data: Data) throws -> () in
if send(client.sockfd, data.bytes, data.length, 0) == -1 {
throw SocketError.send("send: \(String.errno)")
}
}
switch self.address! {
case var .inet(addr):
if connect(self.sockfd, pointer(of: &addr).cast(to: sockaddr.self), self.address!.socklen) == -1 {
throw SocketError.connect(String.errno)
}
default: throw DNS.Error.unknownDomain
}
}
public init(ipv6: String, port: in_port_t, type: SocketTypes = .stream, `protocol`: Int32 = 0, bufsize: Int = SXOutgoingSocket.defaultBufsize) throws {
self.sockfd = socket(AF_INET6, type.rawValue, `protocol`)
self.domain = .inet6
self.type = type
self.protocol = `protocol`
self.address = SXSocketAddress(address: ipv6, withDomain: .inet6, port: port)
self.readBufsize = bufsize
self.hashValue = Int(sockfd) * time(nil)
self.readHandler = { client, size throws -> Data? in
return client.isBlocking ?
try client.recv_block(size: size) :
try client.recv_nonblock(size: size)
}
self.writeHandler = { (client: Socket & Writable, data: Data) throws -> () in
if send(client.sockfd, data.bytes, data.length, 0) == -1 {
throw SocketError.send("send: \(String.errno)")
}
}
switch self.address! {
case var .inet6(addr):
if connect(self.sockfd, pointer(of: &addr).cast(to: sockaddr.self), self.address!.socklen) == -1 {
throw SocketError.connect(String.errno)
}
default: throw DNS.Error.unknownDomain
}
}
public init?(ipv4: String, service: String, type: SocketTypes = .stream, `protocol`: Int32 = 0, bufsize: Int = SXOutgoingSocket.defaultBufsize) throws {
let port = (UInt16(getservbyname(service.cString(using: String.Encoding.ascii)!, nil).pointee.s_port)).byteSwapped
self.sockfd = socket(AF_INET, type.rawValue, `protocol`)
self.domain = .inet
self.type = type
self.protocol = `protocol`
self.address = SXSocketAddress(address: ipv4, withDomain: .inet, port: port)
self.readBufsize = bufsize
self.hashValue = Int(sockfd) * time(nil)
self.readHandler = { client, size throws -> Data? in
return client.isBlocking ?
try client.recv_block(size: size) :
try client.recv_nonblock(size: size)
}
self.writeHandler = { (client: Socket & Writable, data: Data) throws -> () in
if send(client.sockfd, data.bytes, data.length, 0) == -1 {
throw SocketError.send("send: \(String.errno)")
}
}
switch self.address! {
case var .inet(addr):
if connect(self.sockfd, pointer(of: &addr).cast(to: sockaddr.self), self.address!.socklen) == -1 {
throw SocketError.connect(String.errno)
}
default: throw DNS.Error.unknownDomain
}
}
public init(ipv6: String, service: String, type: SocketTypes = .stream, `protocol`: Int32 = 0, bufsize: Int = SXOutgoingSocket.defaultBufsize) throws {
let port = (UInt16(getservbyname(service.cString(using: String.Encoding.ascii)!, nil).pointee.s_port)).byteSwapped
self.sockfd = socket(AF_INET6, type.rawValue, `protocol`)
self.domain = .inet6
self.type = type
self.protocol = `protocol`
self.address = SXSocketAddress(address: ipv6, withDomain: .inet6, port: port)
self.readBufsize = bufsize
self.hashValue = Int(sockfd) * time(nil)
self.readHandler = { client, size throws -> Data? in
return client.isBlocking ?
try client.recv_block(size: size) :
try client.recv_nonblock(size: size)
}
self.writeHandler = { (client: Socket & Writable, data: Data) throws -> () in
if send(client.sockfd, data.bytes, data.length, 0) == -1 {
throw SocketError.send("send: \(String.errno)")
}
}
switch self.address! {
case var .inet6(addr):
if connect(self.sockfd, pointer(of: &addr).cast(to: sockaddr.self), self.address!.socklen) == -1 {
throw SocketError.connect(String.errno)
}
default: throw DNS.Error.unknownDomain
}
}
}
| bsd-2-clause | 2a822c841c8236965f82c09f991d06f4 | 37.436807 | 211 | 0.567407 | 4.204463 | false | false | false | false |
LYM-mg/MGOFO | MGOFO/MGOFO/Class/Home/Controller/TravelCostViewController.swift | 1 | 1652 | //
// TravelCostViewController.swift
// MGOFO
//
// Created by i-Techsys.com on 2017/5/21.
// Copyright © 2017年 i-Techsys. All rights reserved.
//
import UIKit
import SwiftySound
class TravelCostViewController: UIViewController {
@IBOutlet weak var costFeeLabel: UILabel!
@IBOutlet weak var totalFeeLabel: UILabel!
@IBOutlet weak var confirmPaymentBtn: UIButton!
var costTip: Int = 0
override func viewDidLoad() {
super.viewDidLoad()
self.title = "行程消费"
self.navigationItem.leftBarButtonItem = UIBarButtonItem(customView: UIView())
self.navigationItem.backBarButtonItem = nil
(self.navigationController as! BaseNavigationController).removeGlobalPanGes()
Sound.play(file: "骑行结束_LH.m4a")
costFeeLabel.text = String(format: "%.2f", Float(costTip))
totalFeeLabel.text = "总费用\(self.costTip)元"
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
(self.navigationController as! BaseNavigationController).setUpGlobalPanGes()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
// MARK: - Action
@IBAction func confirmPaymentBtn(_ sender: Any) {
self.showHint(hint: "支付费用")
self.navigationController?.popToRootViewController(animated: true)
}
@IBAction func voiceBtnClick(_ sender: UIButton) {
sender.isSelected = !sender.isSelected
self.showInfo(info: "声音")
SaveTools.mg_SaveToLocal(value: !sender.isSelected, key: "isVoiceOn")
}
}
| mit | 0804ec70c2c2aed87284136f567c75dd | 30.019231 | 85 | 0.6708 | 4.289894 | false | false | false | false |
pkvenu/viewsaurus | test/fixtures/basic/ViewController.swift | 1 | 6985 | //
// ViewController.swift
// IPMQuickstart
//
// Created by Kevin Whinnery on 12/9/15.
// Copyright © 2015 Twilio. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
// MARK: IP messaging memebers
var client: TwilioIPMessagingClient? = nil
var generalChannel: TWMChannel? = nil
var identity = ""
var messages: [TWMMessage] = []
// MARK: UI controls
@IBOutlet weak var bottomConstraint: NSLayoutConstraint!
@IBOutlet weak var textField: UITextField!
@IBOutlet weak var tableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
// Fetch Access Token form the server and initialize IPM Client - this assumes you are running
// the PHP starter app on your local machine, as instructed in the quick start guide
let deviceId = UIDevice.currentDevice().identifierForVendor!.UUIDString
let urlString = "http://localhost:8000/token.php?device=\(deviceId)"
let defaultChannel = "general"
// Get JSON from server
let config = NSURLSessionConfiguration.defaultSessionConfiguration()
let session = NSURLSession(configuration: config, delegate: nil, delegateQueue: nil)
let url = NSURL(string: urlString)
let request = NSMutableURLRequest(URL: url!)
request.HTTPMethod = "GET"
// Make HTTP request
session.dataTaskWithRequest(request, completionHandler: { data, response, error in
if (data != nil) {
// Parse result JSON
let json = JSON(data: data!)
let token = json["token"].stringValue
self.identity = json["identity"].stringValue
// Set up Twilio IPM client and join the general channel
self.client = TwilioIPMessagingClient.ipMessagingClientWithToken(token, delegate: self)
// Auto-join the general channel
self.client?.channelsListWithCompletion { result, channels in
if (result == .Success) {
if let channel = channels.channelWithUniqueName(defaultChannel) {
// Join the general channel if it already exists
self.generalChannel = channel
self.generalChannel?.joinWithCompletion({ result in
print("Channel joined with result \(result)")
})
} else {
// Create the general channel (for public use) if it hasn't been created yet
channels.createChannelWithFriendlyName("General Chat Channel", type: .Public) {
(channelResult, channel) -> Void in
if result == .Success {
self.generalChannel = channel
self.generalChannel?.joinWithCompletion({ result in
self.generalChannel?.setUniqueName(defaultChannel, completion: { result in
print("channel unqiue name set")
})
})
}
}
}
}
}
// Update UI on main thread
dispatch_async(dispatch_get_main_queue()) {
self.navigationItem.prompt = "Logged in as \"\(self.identity)\""
}
} else {
print("Error fetching token :\(error)")
}
}).resume()
// Listen for keyboard events and animate text field as necessary
NSNotificationCenter.defaultCenter().addObserver(self,
selector: Selector("keyboardWillShow:"),
name:UIKeyboardWillShowNotification,
object: nil);
NSNotificationCenter.defaultCenter().addObserver(self,
selector: Selector("keyboardDidShow:"),
name:UIKeyboardDidShowNotification,
object: nil);
NSNotificationCenter.defaultCenter().addObserver(self,
selector: Selector("keyboardWillHide:"),
name:UIKeyboardWillHideNotification,
object: nil);
// Set up UI controls
self.tableView.rowHeight = UITableViewAutomaticDimension
self.tableView.estimatedRowHeight = 66.0
self.tableView.separatorStyle = .None
}
// MARK: Keyboard Dodging Logic
func keyboardWillShow(notification: NSNotification) {
let keyboardHeight = notification.userInfo?[UIKeyboardFrameBeginUserInfoKey]?.CGRectValue.height
UIView.animateWithDuration(0.1, animations: { () -> Void in
self.bottomConstraint.constant = keyboardHeight! + 10
self.view.layoutIfNeeded()
})
}
func keyboardDidShow(notification: NSNotification) {
self.scrollToBottomMessage()
}
func keyboardWillHide(notification: NSNotification) {
UIView.animateWithDuration(0.1, animations: { () -> Void in
self.bottomConstraint.constant = 20
self.view.layoutIfNeeded()
})
}
// MARK: UI Logic
// Dismiss keyboard if container view is tapped
@IBAction func viewTapped(sender: AnyObject) {
self.textField.resignFirstResponder()
}
// Scroll to bottom of table view for messages
func scrollToBottomMessage() {
if self.messages.count == 0 {
return
}
let bottomMessageIndex = NSIndexPath(forRow: self.tableView.numberOfRowsInSection(0) - 1,
inSection: 0)
self.tableView.scrollToRowAtIndexPath(bottomMessageIndex, atScrollPosition: .Bottom,
animated: true)
}
}
// MARK: Twilio IP Messaging Delegate
extension ViewController: TwilioIPMessagingClientDelegate {
// Called whenever a channel we've joined receives a new message
func ipMessagingClient(client: TwilioIPMessagingClient!, channel: TWMChannel!,
messageAdded message: TWMMessage!) {
self.messages.append(message)
self.tableView.reloadData()
dispatch_async(dispatch_get_main_queue()) {
if self.messages.count > 0 {
self.scrollToBottomMessage()
}
}
}
}
// MARK: UITextField Delegate
extension ViewController: UITextFieldDelegate {
func textFieldShouldReturn(textField: UITextField) -> Bool {
let msg = self.generalChannel?.messages.createMessageWithBody(textField.text!)
self.generalChannel?.messages.sendMessage(msg) { result in
textField.text = ""
textField.resignFirstResponder()
}
return true
}
}
// MARK: UITableView Delegate
extension ViewController: UITableViewDelegate {
// Return number of rows in the table
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.messages.count
}
// Create table view rows
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath)
-> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("MessageCell", forIndexPath: indexPath)
let message = self.messages[indexPath.row]
// Set table cell values
cell.detailTextLabel?.text = message.author
cell.textLabel?.text = message.body
cell.selectionStyle = .None
return cell
}
}
// MARK: UITableViewDataSource Delegate
extension ViewController: UITableViewDataSource {
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
}
| mit | ea5d05f95a198003d0a069e84ab662ac | 33.574257 | 100 | 0.672394 | 5.075581 | false | false | false | false |
donald-pinckney/SwiftNum | Sources/Linear/MatrixComponentWiseFunction.swift | 1 | 1419 | //
// MatrixComponentWiseFunction.swift
// SwiftNum
//
// Created by Donald Pinckney on 1/1/17.
//
//
import Foundation
import Accelerate
public func extendToMatrix(_ f: @escaping (Double) -> Double) -> ((Matrix) -> Matrix) {
return { mat in
var res = mat
res.data = res.data.map(f)
return res
}
}
public func exp(_ X: Matrix) -> Matrix {
var res = X
res.data = X.data.map(Foundation.exp)
return res
}
public func log(_ X: Matrix) -> Matrix {
var res = X
res.data = X.data.map(Foundation.log)
return res
}
public func sin(_ X: Matrix) -> Matrix {
var res = X
res.data = X.data.map(Foundation.sin)
return res
}
public func cos(_ X: Matrix) -> Matrix {
var res = X
res.data = X.data.map(Foundation.cos)
return res
}
public func tan(_ X: Matrix) -> Matrix {
var res = X
res.data = X.data.map(Foundation.tan)
return res
}
public func sinh(_ X: Matrix) -> Matrix {
var res = X
res.data = X.data.map(Foundation.sinh)
return res
}
public func cosh(_ X: Matrix) -> Matrix {
var res = X
res.data = X.data.map(Foundation.cosh)
return res
}
public func tanh(_ X: Matrix) -> Matrix {
var res = X
res.data = X.data.map(Foundation.tanh)
return res
}
public func abs(_ X: Matrix) -> Matrix {
var res = X
vDSP_vabsD(X.data, 1, &res.data, 1, vDSP_Length(X.data.count))
return res
}
| mit | 334c393e3af7344bd43e70d8f232df3a | 18.708333 | 87 | 0.603242 | 3.098253 | false | false | false | false |
XLabKC/Badger | Badger/Badger/TeamHeaderCell.swift | 1 | 807 | import UIKit
class TeamHeaderCell: UITableViewCell {
private var hasAwakened = false
private var team: Team?
@IBOutlet weak var backgroundImage: UIImageView!
@IBOutlet weak var teamCircle: TeamCircle!
@IBOutlet weak var nameLabel: UILabel!
@IBOutlet weak var metaLabel: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
self.hasAwakened = true
self.updateView()
}
func setTeam(team: Team) {
self.team = team
self.updateView()
}
private func updateView() {
if self.hasAwakened {
if let team = self.team {
self.nameLabel.text = team.name
self.metaLabel.text = team.description()
self.teamCircle.setTeam(team)
}
}
}
}
| gpl-2.0 | 18df59a35175c08c87772703573c7ef2 | 24.21875 | 56 | 0.598513 | 4.458564 | false | false | false | false |
jacobwhite/firefox-ios | SyncTelemetry/SyncTelemetryEvents.swift | 6 | 3392 | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import Shared
import SwiftyJSON
private let log = Logger.browserLogger
public typealias IdentifierString = String
public extension IdentifierString {
func validate() -> Bool {
// Regex located here: http://gecko.readthedocs.io/en/latest/toolkit/components/telemetry/telemetry/collection/events.html#limits
let regex = try! NSRegularExpression(pattern: "^[a-zA-Z][a-zA-Z0-9_.]*[a-zA-Z0-9]$", options: [])
return regex.matches(in: self, options: [], range: NSRange(location: 0, length: self.count)).count > 0
}
}
// Telemetry Events
// Documentation: http://gecko.readthedocs.io/en/latest/toolkit/components/telemetry/telemetry/collection/events.html#events
public struct Event {
let timestamp: Timestamp
let category: IdentifierString
let method: IdentifierString
let object: IdentifierString
let value: String?
let extra: [String: String]?
public init(category: IdentifierString,
method: IdentifierString,
object: IdentifierString,
value: String? = nil,
extra: [String: String]? = nil) {
self.init(timestamp: .uptimeInMilliseconds(),
category: category,
method: method,
object: object,
value: value,
extra: extra)
}
init(timestamp: Timestamp,
category: IdentifierString,
method: IdentifierString,
object: IdentifierString,
value: String? = nil,
extra: [String: String]? = nil) {
self.timestamp = timestamp
self.category = category
self.method = method
self.object = object
self.value = value
self.extra = extra
}
public func validate() -> Bool {
let results = [category, method, object].map { $0.validate() }
// Fold down the results into false if any of the results is false.
return results.reduce(true) { $0 ? $1 :$0 }
}
public func pickle() -> Data? {
do {
return try JSONSerialization.data(withJSONObject: toArray(), options: [])
} catch let error {
log.error("Error pickling telemetry event. Error: \(error), Event: \(self)")
return nil
}
}
public static func unpickle(_ data: Data) -> Event? {
do {
let array = try JSONSerialization.jsonObject(with: data, options: []) as! [Any]
return Event(
timestamp: Timestamp(array[0] as! UInt64),
category: array[1] as! String,
method: array[2] as! String,
object: array[3] as! String,
value: array[4] as? String,
extra: array[5] as? [String: String]
)
} catch let error {
log.error("Error unpickling telemetry event: \(error)")
return nil
}
}
public func toArray() -> [Any] {
return [timestamp, category, method, object, value ?? NSNull(), extra ?? NSNull()]
}
}
extension Event: CustomDebugStringConvertible {
public var debugDescription: String {
return toArray().description
}
}
| mpl-2.0 | 52b14fa1bab666d33198531cb48eebf1 | 33.612245 | 137 | 0.593455 | 4.371134 | false | false | false | false |
mattwelborn/HSTracker | HSTracker/UIs/Preferences/Splashscreen.swift | 1 | 939 | /*
* This file is part of the HSTracker package.
* (c) Benjamin Michotte <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* Created on 13/02/16.
*/
import Cocoa
class Splashscreen: NSWindowController {
@IBOutlet weak var information: NSTextField!
@IBOutlet weak var progressBar: NSProgressIndicator!
func display(str: String, indeterminate: Bool) {
information.stringValue = str
progressBar.indeterminate = indeterminate
}
func display(str: String, total: Double) {
progressBar.indeterminate = false
information.stringValue = str
progressBar.maxValue = total
progressBar.doubleValue = 0
}
func increment(str: String? = nil) {
progressBar.incrementBy(1)
if let str = str {
information.stringValue = str
}
}
}
| mit | 253f79c80a00d92d4df6042e9666c371 | 25.828571 | 74 | 0.667732 | 4.602941 | false | false | false | false |
criticalmaps/criticalmaps-ios | CriticalMapsKit/Sources/SettingsFeature/RideEventSettingsView.swift | 1 | 4263 | import ComposableArchitecture
import L10n
import SharedModels
import Styleguide
import SwiftUI
import SwiftUIHelpers
/// A view to render next ride event settings
public struct RideEventSettingsView: View {
public typealias State = RideEventSettings
public typealias Action = RideEventsSettingsFeature.Action
let store: Store<State, Action>
@ObservedObject var viewStore: ViewStore<State, Action>
public init(store: Store<State, Action>) {
self.store = store
viewStore = ViewStore(store)
}
public var body: some View {
SettingsForm {
Spacer(minLength: 28)
SettingsRow {
HStack {
Toggle(
isOn: viewStore.binding(
get: \.isEnabled,
send: Action.setRideEventsEnabled
),
label: { Text(L10n.Settings.eventSettingsEnable) }
)
.accessibilityRepresentation(representation: {
viewStore.isEnabled
? Text(L10n.A11y.General.on)
: Text(L10n.A11y.General.off)
})
}
.accessibilityElement(children: .combine)
}
ZStack(alignment: .top) {
VStack {
SettingsSection(title: L10n.Settings.eventTypes) {
ForEach(viewStore.typeSettings, id: \.type.title) { rideType in
SettingsRow {
Button(
action: { viewStore.send(
.setRideEventTypeEnabled(
.init(
type: rideType.type,
isEnabled: !rideType.isEnabled
)
)
)
},
label: {
RideEventSettingsRow(
title: rideType.type.title,
isEnabled: rideType.isEnabled
)
}
)
}
.accessibilityValue(rideType.isEnabled ? Text(L10n.A11y.General.selected) : Text(""))
}
}
SettingsSection(title: L10n.Settings.eventSearchRadius) {
ForEach(EventDistance.allCases, id: \.self) { radius in
SettingsRow {
Button(
action: { viewStore.send(.setRideEventRadius(radius)) },
label: {
HStack(spacing: .grid(3)) {
Text(String(radius.displayValue))
.accessibility(label: Text(radius.accessibilityLabel))
.padding(.vertical, .grid(2))
Spacer()
if viewStore.eventDistance == radius {
Image(systemName: "checkmark.circle.fill")
.accessibilityRepresentation {
Text(L10n.A11y.General.selected)
}
}
}
.accessibilityElement(children: .combine)
}
)
}
}
}
}
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: viewStore.isEnabled ? .none : 0)
.clipped()
.accessibleAnimation(.interactiveSpring(), value: viewStore.isEnabled)
}
.foregroundColor(Color(.textPrimary))
.disabled(!viewStore.isEnabled)
}
.navigationBarTitle(L10n.Settings.eventSettings, displayMode: .inline)
}
}
// MARK: Preview
struct RideEventSettings_Previews: PreviewProvider {
static var previews: some View {
Preview {
NavigationView {
RideEventSettingsView(
store: .init(
initialState: .init(
isEnabled: true,
typeSettings: .all,
eventDistance: .near
),
reducer: RideEventsSettingsFeature()._printChanges()
)
)
}
}
}
}
// MARK: Helper
struct RideEventSettingsRow: View {
let title: String
let isEnabled: Bool
var body: some View {
HStack(spacing: .grid(3)) {
Text(title)
.padding(.vertical, .grid(2))
Spacer()
if isEnabled {
Image(systemName: "checkmark.circle.fill")
} else {
Image(systemName: "circle")
}
}
}
}
| mit | c4d867432ae433938136f224aba0c785 | 28.604167 | 106 | 0.516538 | 5.09319 | false | false | false | false |
lorentey/Attabench | Attabench/AttabenchDocument.swift | 2 | 41176 | // Copyright © 2017 Károly Lőrentey.
// This file is part of Attabench: https://github.com/attaswift/Attabench
// For licensing information, see the file LICENSE.md in the Git repository above.
import Cocoa
import GlueKit
import BenchmarkModel
import BenchmarkRunner
import BenchmarkCharts
import BenchmarkIPC
enum UTI {
static let png = "public.png"
static let pdf = "com.adobe.pdf"
static let attabench = "org.attaswift.attabench-benchmark"
static let attaresult = "org.attaswift.attabench-results"
}
let attaresultExtension = NSWorkspace.shared.preferredFilenameExtension(forType: UTI.attaresult)!
enum ConsoleAttributes {
private static let indentedParagraphStyle: NSParagraphStyle = {
let style = NSParagraphStyle.default.mutableCopy() as! NSMutableParagraphStyle
style.headIndent = 12
style.firstLineHeadIndent = 12
return style
}()
static let standardOutput: [NSAttributedStringKey: Any] = [
.font: NSFont(name: "Menlo-Regular", size: 12) ?? NSFont.systemFont(ofSize: 12, weight: .regular),
.foregroundColor: NSColor(white: 0.3, alpha: 1),
.paragraphStyle: indentedParagraphStyle
]
static let standardError: [NSAttributedStringKey: Any] = [
.font: NSFont(name: "Menlo-Bold", size: 12) ?? NSFont.systemFont(ofSize: 12, weight: .bold),
.foregroundColor: NSColor(white: 0.3, alpha: 1),
.paragraphStyle: indentedParagraphStyle
]
static let statusMessage: [NSAttributedStringKey: Any] = [
.font: NSFont.systemFont(ofSize: 12, weight: .medium),
.foregroundColor: NSColor.black,
.paragraphStyle: NSParagraphStyle.default
]
static let errorMessage: [NSAttributedStringKey: Any] = [
.font: NSFont.systemFont(ofSize: 12, weight: .bold),
.foregroundColor: NSColor.black,
.paragraphStyle: NSParagraphStyle.default
]
}
class AttabenchDocument: NSDocument, BenchmarkDelegate {
enum State {
case noBenchmark
case idle
case loading(BenchmarkProcess)
case waiting // We should be running, but parameters aren't ready yet
case running(BenchmarkProcess)
case stopping(BenchmarkProcess, then: Followup)
case failedBenchmark
enum Followup {
case idle
case reload
case restart
}
var process: BenchmarkProcess? {
switch self {
case .loading(let process): return process
case .running(let process): return process
case .stopping(let process, _): return process
default: return nil
}
}
}
var state: State = .noBenchmark {
didSet { stateDidChange(from: oldValue, to: state) }
}
var activity: NSObjectProtocol? // Preventing system sleep
let model = Variable<Attaresult>(Attaresult())
var m: Attaresult {
get { return model.value }
set { model.value = newValue }
}
let taskFilterString: OptionalVariable<String> = nil
lazy var taskFilter: AnyObservableValue<TaskFilter>
= self.taskFilterString.map { TaskFilter($0) }
lazy var visibleTasks: AnyObservableArray<Task>
= self.model.map{$0.tasks}.filter { [taskFilter] task in taskFilter.map { $0.test(task) } }
struct TaskFilter {
typealias Pattern = (string: String, isNegative: Bool)
let patterns: [[Pattern]]
init(_ pattern: String?) {
self.patterns = (pattern ?? "")
.lowercased()
.components(separatedBy: ",")
.map { (pattern: String) -> [Pattern] in
pattern
.components(separatedBy: .whitespacesAndNewlines)
.map { (word: String) -> Pattern in
word.hasPrefix("!")
? (string: String(word.dropFirst()), isNegative: true)
: (string: word, isNegative: false) }
.filter { (pattern: Pattern) -> Bool in !pattern.string.isEmpty }
}
.filter { !$0.isEmpty }
}
func test(_ task: Task) -> Bool {
guard !patterns.isEmpty else { return true }
let name = task.name.lowercased()
return patterns.contains { (conjunctive: [Pattern]) -> Bool in
!conjunctive.contains { (pattern: Pattern) -> Bool in
name.contains(pattern.string) == pattern.isNegative
}
}
}
}
lazy var checkedTasks = self.visibleTasks.filter { $0.checked }
lazy var tasksToRun = self.visibleTasks.filter { $0.checked && $0.isRunnable }
lazy var batchCheckboxState: AnyObservableValue<NSControl.StateValue>
= visibleTasks.observableCount.combined(checkedTasks.observableCount) { c1, c2 in
if c1 == c2 { return .on }
if c2 == 0 { return .off }
return .mixed
}
let theme = Variable<BenchmarkTheme>(BenchmarkTheme.Predefined.screen)
var _log: NSMutableAttributedString? = nil
var _status: String = "Ready"
lazy var refreshChart = RateLimiter(maxDelay: 5, async: true) { [unowned self] in self._refreshChart() }
var tasksTableViewController: GlueKitTableViewController<Task, TaskCellView>?
var pendingResults: [(task: String, size: Int, time: Time)] = []
lazy var processPendingResults = RateLimiter(maxDelay: 0.2) { [unowned self] in
for (task, size, time) in self.pendingResults {
self.m.addMeasurement(time, forTask: task, size: size)
}
self.pendingResults = []
self.updateChangeCount(.changeDone)
self.refreshChart.later()
}
@IBOutlet weak var runButton: NSButton?
@IBOutlet weak var minimumSizeButton: NSPopUpButton?
@IBOutlet weak var maximumSizeButton: NSPopUpButton?
@IBOutlet weak var rootSplitView: NSSplitView?
@IBOutlet weak var leftPane: NSVisualEffectView?
@IBOutlet weak var leftVerticalSplitView: NSSplitView?
@IBOutlet weak var tasksTableView: NSTableView?
@IBOutlet weak var leftBar: ColoredView?
@IBOutlet weak var batchCheckbox: NSButtonCell!
@IBOutlet weak var taskFilterTextField: NSSearchField!
@IBOutlet weak var showRunOptionsButton: NSButton?
@IBOutlet weak var runOptionsPane: ColoredView?
@IBOutlet weak var iterationsField: NSTextField?
@IBOutlet weak var iterationsStepper: NSStepper?
@IBOutlet weak var minimumDurationField: NSTextField?
@IBOutlet weak var maximumDurationField: NSTextField?
@IBOutlet weak var middleSplitView: NSSplitView?
@IBOutlet weak var chartView: ChartView?
@IBOutlet weak var middleBar: ColoredView?
@IBOutlet weak var showLeftPaneButton: NSButton?
@IBOutlet weak var showConsoleButton: NSButton?
@IBOutlet weak var statusLabel: StatusLabel?
@IBOutlet weak var showRightPaneButton: NSButton?
@IBOutlet weak var consolePane: NSView?
@IBOutlet weak var consoleTextView: NSTextView?
@IBOutlet weak var rightPane: ColoredView?
@IBOutlet weak var themePopUpButton: NSPopUpButton?
@IBOutlet weak var amortizedCheckbox: NSButton?
@IBOutlet weak var logarithmicSizeCheckbox: NSButton?
@IBOutlet weak var logarithmicTimeCheckbox: NSButton?
@IBOutlet weak var centerBandPopUpButton: NSPopUpButton?
@IBOutlet weak var errorBandPopUpButton: NSPopUpButton?
@IBOutlet weak var highlightSelectedSizeRangeCheckbox: NSButton?
@IBOutlet weak var displayIncludeAllMeasuredSizesCheckbox: NSButton?
@IBOutlet weak var displayIncludeSizeScaleRangeCheckbox: NSButton?
@IBOutlet weak var displaySizeScaleRangeMinPopUpButton: NSPopUpButton?
@IBOutlet weak var displaySizeScaleRangeMaxPopUpButton: NSPopUpButton?
@IBOutlet weak var displayIncludeAllMeasuredTimesCheckbox: NSButton?
@IBOutlet weak var displayIncludeTimeRangeCheckbox: NSButton?
@IBOutlet weak var displayTimeRangeMinPopUpButton: NSPopUpButton?
@IBOutlet weak var displayTimeRangeMaxPopUpButton: NSPopUpButton?
@IBOutlet weak var progressRefreshIntervalField: NSTextField?
@IBOutlet weak var chartRefreshIntervalField: NSTextField?
override init() {
super.init()
self.glue.connector.connect(self.theme.values) { [unowned self] theme in
self.m.themeName.value = theme.name
}
self.glue.connector.connect([tasksToRun.tick, model.map{$0.runOptionsTick}].gather()) { [unowned self] in
self.updateChangeCount(.changeDone)
self.runOptionsDidChange()
}
self.glue.connector.connect([checkedTasks.tick,
model.map{$0.runOptionsTick},
model.map{$0.chartOptionsTick}].gather()) { [unowned self] in
self.updateChangeCount(.changeDone)
self.refreshChart.now()
}
self.glue.connector.connect(batchCheckboxState.futureValues) { [unowned self] state in
self.batchCheckbox?.state = state
}
self.glue.connector.connect(taskFilterString.futureValues) { [unowned self] filter in
guard let field = self.taskFilterTextField else { return }
if field.stringValue != filter {
self.taskFilterTextField.stringValue = filter ?? ""
}
}
self.glue.connector.connect(model.map{$0.progressRefreshInterval}.values) { [unowned self] interval in
self.statusLabel?.refreshRate = interval.seconds
self.processPendingResults.maxDelay = interval.seconds
}
self.glue.connector.connect(model.map{$0.chartRefreshInterval}.values) { [unowned self] interval in
self.refreshChart.maxDelay = interval.seconds
}
}
deinit {
self.state = .idle
}
override var windowNibName: NSNib.Name? {
// Returns the nib file name of the document
// If you need to use a subclass of NSWindowController or if your document supports multiple NSWindowControllers, you should remove this property and override -makeWindowControllers instead.
return NSNib.Name("AttabenchDocument")
}
override func windowControllerDidLoadNib(_ windowController: NSWindowController) {
super.windowControllerDidLoadNib(windowController)
consoleTextView!.textStorage!.setAttributedString(_log ?? NSAttributedString())
let tasksTVC = GlueKitTableViewController<Task, TaskCellView>(tableView: tasksTableView!, contents: visibleTasks) { [unowned self] cell, item in
cell.task = item
cell.context = self
}
self.tasksTableViewController = tasksTVC
self.tasksTableView!.delegate = tasksTVC
self.tasksTableView!.dataSource = tasksTVC
self.statusLabel!.immediateStatus = _status
self.chartView!.documentBasename = self.displayName
self.chartView!.theme = self.theme.anyObservableValue
self.batchCheckbox.state = self.batchCheckboxState.value
self.iterationsField!.glue.value <-- model.map{$0.iterations}
self.iterationsStepper!.glue.intValue <-- model.map{$0.iterations}
self.minimumDurationField!.glue.value <-- model.map{$0.durationRange.lowerBound}
self.maximumDurationField!.glue.value <-- model.map{$0.durationRange.upperBound}
self.amortizedCheckbox!.glue.state <-- model.map{$0.amortizedTime}
self.logarithmicSizeCheckbox!.glue.state <-- model.map{$0.logarithmicSizeScale}
self.logarithmicTimeCheckbox!.glue.state <-- model.map{$0.logarithmicTimeScale}
self.progressRefreshIntervalField!.glue.value <-- model.map{$0.progressRefreshInterval}
self.chartRefreshIntervalField!.glue.value <-- model.map{$0.chartRefreshInterval}
self.centerBandPopUpButton!.glue <-- NSPopUpButton.Choices<CurveBandValues>(
model: model.map{$0.centerBand}
.map({ CurveBandValues($0) },
inverse: { $0.band }),
values: [
"None": .none,
"Minimum": .minimum,
"Average": .average,
"Maximum": .maximum,
"Sample Size": .count,
])
self.errorBandPopUpButton!.glue <-- NSPopUpButton.Choices<ErrorBandValues>(
model: model.map{$0.topBand}.combined(model.map{$0.bottomBand})
.map({ ErrorBandValues(top: $0.0, bottom: $0.1) },
inverse: { ($0.top, $0.bottom) }),
values: [
"None": .none,
"Maximum": .maximum,
"μ + σ": .sigma1,
"μ + 2σ": .sigma2,
"μ + 3σ": .sigma3,
])
self.themePopUpButton!.glue <-- NSPopUpButton.Choices<BenchmarkTheme>(
model: self.theme,
values: BenchmarkTheme.Predefined.themes.map { (label: $0.name, value: $0) })
let sizeChoices: [(label: String, value: Int)]
= (0 ... Attaresult.largestPossibleSizeScale).map { ((1 << $0).sizeLabel, $0) }
let lowerBoundSizeChoices = sizeChoices.map { (label: "\($0.0) ≤", value: $0.1) }
let upperBoundSizeChoices = sizeChoices.map { (label: "≤ \($0.0)", value: $0.1) }
self.minimumSizeButton!.glue <-- NSPopUpButton.Choices<Int>(
model: model.map{$0.sizeScaleRange.lowerBound},
values: lowerBoundSizeChoices)
self.maximumSizeButton!.glue <-- NSPopUpButton.Choices<Int>(
model: model.map{$0.sizeScaleRange.upperBound},
values: upperBoundSizeChoices)
self.highlightSelectedSizeRangeCheckbox!.glue.state <-- model.map{$0.highlightSelectedSizeRange}
self.displayIncludeAllMeasuredSizesCheckbox!.glue.state <-- model.map{$0.displayIncludeAllMeasuredSizes}
self.displayIncludeSizeScaleRangeCheckbox!.glue.state <-- model.map{$0.displayIncludeSizeScaleRange}
self.displaySizeScaleRangeMinPopUpButton!.glue <-- NSPopUpButton.Choices<Int>(
model: model.map{$0.displaySizeScaleRange.lowerBound},
values: lowerBoundSizeChoices)
self.displaySizeScaleRangeMinPopUpButton!.glue.isEnabled <-- model.map{$0.displayIncludeSizeScaleRange}
self.displaySizeScaleRangeMaxPopUpButton!.glue <-- NSPopUpButton.Choices<Int>(
model: model.map{$0.displaySizeScaleRange.upperBound},
values: upperBoundSizeChoices)
self.displaySizeScaleRangeMaxPopUpButton!.glue.isEnabled <-- model.map{$0.displayIncludeSizeScaleRange}
var timeChoices: [(label: String, value: Time)] = []
var time = Time(picoseconds: 1)
for _ in 0 ..< 20 {
timeChoices.append(("\(time)", time))
time = 10 * time
}
self.displayIncludeAllMeasuredTimesCheckbox!.glue.state <-- model.map{$0.displayIncludeAllMeasuredTimes}
self.displayIncludeTimeRangeCheckbox!.glue.state <-- model.map{$0.displayIncludeTimeRange}
self.displayTimeRangeMinPopUpButton!.glue <-- NSPopUpButton.Choices<Time>(
model: model.map{$0.displayTimeRange.lowerBound},
values: timeChoices)
self.displayTimeRangeMinPopUpButton!.glue.isEnabled <-- model.map{$0.displayIncludeTimeRange}
self.displayTimeRangeMaxPopUpButton!.glue <-- NSPopUpButton.Choices<Time>(
model: model.map{$0.displayTimeRange.upperBound},
values: timeChoices)
self.displayTimeRangeMaxPopUpButton!.glue.isEnabled <-- model.map{$0.displayIncludeTimeRange}
refreshRunButton()
refreshChart.now()
}
enum CurveBandValues: Equatable {
case none
case average
case minimum
case maximum
case count
case other(TimeSample.Band?)
init(_ band: TimeSample.Band?) {
switch band {
case nil: self = .none
case .average?: self = .average
case .minimum?: self = .minimum
case .maximum?: self = .maximum
case .count?: self = .count
default: self = .other(band)
}
}
var band: TimeSample.Band? {
switch self {
case .none: return nil
case .average: return .average
case .minimum: return .minimum
case .maximum: return .maximum
case .count: return .count
case .other(let band): return band
}
}
static func ==(left: CurveBandValues, right: CurveBandValues) -> Bool {
return left.band == right.band
}
}
enum ErrorBandValues: Equatable {
case none
case maximum
case sigma1
case sigma2
case sigma3
case other(top: TimeSample.Band?, bottom: TimeSample.Band?)
var top: TimeSample.Band? {
switch self {
case .none: return nil
case .maximum: return .maximum
case .sigma1: return .sigma(1)
case .sigma2: return .sigma(2)
case .sigma3: return .sigma(3)
case .other(top: let top, bottom: _): return top
}
}
var bottom: TimeSample.Band? {
switch self {
case .none: return nil
case .maximum: return .minimum
case .sigma1: return .minimum
case .sigma2: return .minimum
case .sigma3: return .minimum
case .other(top: _, bottom: let bottom): return bottom
}
}
init(top: TimeSample.Band?, bottom: TimeSample.Band?) {
switch (top, bottom) {
case (nil, nil): self = .none
case (.maximum?, .minimum?): self = .maximum
case (.sigma(1)?, .minimum?): self = .sigma1
case (.sigma(2)?, .minimum?): self = .sigma2
case (.sigma(3)?, .minimum?): self = .sigma3
case let (t, b): self = .other(top: t, bottom: b)
}
}
static func ==(left: ErrorBandValues, right: ErrorBandValues) -> Bool {
return left.top == right.top && left.bottom == right.bottom
}
}
func stateDidChange(from old: State, to new: State) {
switch old {
case .loading(let process):
process.stop()
case .running(let process):
process.stop()
default:
break
}
let name = m.benchmarkDisplayName.value
switch new {
case .noBenchmark:
self.setStatus(.immediate, "Attabench document cannot be found; can't take new measurements")
case .idle:
self.setStatus(.immediate, "Ready")
case .loading(_):
self.setStatus(.immediate, "Loading \(name)...")
case .waiting:
self.setStatus(.immediate, "No executable tasks selected, pausing")
case .running(_):
self.setStatus(.immediate, "Starting \(name)...")
case .stopping(_, then: .restart):
self.setStatus(.immediate, "Restarting \(name)...")
case .stopping(_, then: _):
self.setStatus(.immediate, "Stopping \(name)...")
case .failedBenchmark:
self.setStatus(.immediate, "Failed")
}
self.refreshRunButton()
}
func refreshRunButton() {
switch state {
case .noBenchmark:
self.runButton?.isEnabled = false
self.runButton?.image = #imageLiteral(resourceName: "RunTemplate")
case .idle:
self.runButton?.isEnabled = true
self.runButton?.image = #imageLiteral(resourceName: "RunTemplate")
case .loading(_):
self.runButton?.isEnabled = true
self.runButton?.image = #imageLiteral(resourceName: "StopTemplate")
case .waiting:
self.runButton?.isEnabled = true
self.runButton?.image = #imageLiteral(resourceName: "StopTemplate")
case .running(_):
self.runButton?.isEnabled = true
self.runButton?.image = #imageLiteral(resourceName: "StopTemplate")
case .stopping(_, then: .restart):
self.runButton?.isEnabled = true
self.runButton?.image = #imageLiteral(resourceName: "StopTemplate")
case .stopping(_, then: _):
self.runButton?.isEnabled = false
self.runButton?.image = #imageLiteral(resourceName: "StopTemplate")
case .failedBenchmark:
self.runButton?.image = #imageLiteral(resourceName: "RunTemplate")
self.runButton?.isEnabled = true
}
}
}
extension AttabenchDocument {
override class var readableTypes: [String] { return [UTI.attabench, UTI.attaresult] }
override class var writableTypes: [String] { return [UTI.attaresult] }
override class var autosavesInPlace: Bool { return true }
override func data(ofType typeName: String) throws -> Data {
switch typeName {
case UTI.attaresult:
return try JSONEncoder().encode(m)
default:
throw NSError(domain: NSOSStatusErrorDomain, code: unimpErr, userInfo: nil)
}
}
func readAttaresult(_ data: Data) throws {
self.m = try JSONDecoder().decode(Attaresult.self, from: data)
self.theme.value = BenchmarkTheme.Predefined.theme(named: self.m.themeName.value) ?? BenchmarkTheme.Predefined.screen
}
override func read(from url: URL, ofType typeName: String) throws {
switch typeName {
case UTI.attaresult:
try self.readAttaresult(try Data(contentsOf: url))
if let url = m.benchmarkURL.value {
do {
log(.status, "Loading \(FileManager().displayName(atPath: url.path))")
self.state = .loading(try BenchmarkProcess(url: url, command: .list, delegate: self, on: .main))
}
catch {
log(.status, "Failed to load benchmark: \(error.localizedDescription)")
self.state = .failedBenchmark
}
}
else {
self.state = .noBenchmark
}
case UTI.attabench:
log(.status, "Loading \(FileManager().displayName(atPath: url.path))")
do {
self.isDraft = true
self.fileType = UTI.attaresult
self.fileURL = nil
self.fileModificationDate = nil
self.displayName = url.deletingPathExtension().lastPathComponent
self.m = Attaresult()
self.m.benchmarkURL.value = url
self.state = .loading(try BenchmarkProcess(url: url, command: .list, delegate: self, on: .main))
}
catch {
log(.status, "Failed to load benchmark: \(error.localizedDescription)")
self.state = .failedBenchmark
throw error
}
default:
throw NSError(domain: NSOSStatusErrorDomain, code: unimpErr, userInfo: nil)
}
}
}
extension AttabenchDocument {
//MARK: Logging & Status Messages
enum LogKind {
case standardOutput
case standardError
case status
}
func log(_ kind: LogKind, _ text: String) {
let attributes: [NSAttributedStringKey: Any]
switch kind {
case .standardOutput: attributes = ConsoleAttributes.standardOutput
case .standardError: attributes = ConsoleAttributes.standardError
case .status: attributes = ConsoleAttributes.statusMessage
}
let atext = NSAttributedString(string: text, attributes: attributes)
if let textView = self.consoleTextView {
if !textView.textStorage!.string.hasSuffix("\n") {
textView.textStorage!.mutableString.append("\n")
}
textView.textStorage!.append(atext)
textView.scrollToEndOfDocument(nil)
}
else if let pendingLog = self._log {
if !pendingLog.string.hasSuffix("\n") {
pendingLog.mutableString.append("\n")
}
pendingLog.append(atext)
}
else {
_log = (atext.mutableCopy() as! NSMutableAttributedString)
}
}
@IBAction func clearConsole(_ sender: Any) {
_log = nil
self.consoleTextView?.textStorage?.setAttributedString(NSAttributedString())
}
enum StatusUpdate {
case immediate
case lazy
}
func setStatus(_ kind: StatusUpdate, _ text: String) {
self._status = text
switch kind {
case .immediate: self.statusLabel?.immediateStatus = text
case .lazy: self.statusLabel?.lazyStatus = text
}
}
}
extension AttabenchDocument {
//MARK: BenchmarkDelegate
func benchmark(_ benchmark: BenchmarkProcess, didReceiveListOfTasks taskNames: [String]) {
guard case .loading(let process) = state, process === benchmark else { benchmark.stop(); return }
let fresh = Set(taskNames)
let stale = Set(m.tasks.value.map { $0.name })
let newTasks = fresh.subtracting(stale)
let missingTasks = stale.subtracting(fresh)
m.tasks.append(contentsOf:
taskNames
.filter { newTasks.contains($0) }
.map { Task(name: $0) })
for task in m.tasks.value {
task.isRunnable.value = fresh.contains(task.name)
}
log(.status, "Received \(m.tasks.count) task names (\(newTasks.count) new, \(missingTasks.count) missing).")
}
func benchmark(_ benchmark: BenchmarkProcess, willMeasureTask task: String, atSize size: Int) {
guard case .running(let process) = state, process === benchmark else { benchmark.stop(); return }
setStatus(.lazy, "Measuring size \(size.sizeLabel) for task \(task)")
}
func benchmark(_ benchmark: BenchmarkProcess, didMeasureTask task: String, atSize size: Int, withResult time: Time) {
guard case .running(let process) = state, process === benchmark else { benchmark.stop(); return }
pendingResults.append((task, size, time))
processPendingResults.later()
if pendingResults.count > 10000 {
// Don't let reports swamp the run loop.
log(.status, "Receiving reports too quickly; terminating benchmark.")
log(.status, "Try selected larger sizes, or increasing the iteration count or minimum duration in Run Options.")
stopMeasuring()
}
}
func benchmark(_ benchmark: BenchmarkProcess, didPrintToStandardOutput line: String) {
guard self.state.process === benchmark else { benchmark.stop(); return }
log(.standardOutput, line)
}
func benchmark(_ benchmark: BenchmarkProcess, didPrintToStandardError line: String) {
guard self.state.process === benchmark else { benchmark.stop(); return }
log(.standardError, line)
}
func benchmark(_ benchmark: BenchmarkProcess, didFailWithError error: String) {
guard self.state.process === benchmark else { return }
log(.status, error)
processDidStop(success: false)
}
func benchmarkDidStop(_ benchmark: BenchmarkProcess) {
guard self.state.process === benchmark else { return }
log(.status, "Process finished.")
processDidStop(success: true)
}
}
extension AttabenchDocument {
//MARK: Start/stop
func processDidStop(success: Bool) {
if let activity = self.activity {
ProcessInfo.processInfo.endActivity(activity)
self.activity = nil
}
refreshChart.nowIfNeeded()
switch self.state {
case .loading(_):
self.state = success ? .idle : .failedBenchmark
case .stopping(_, then: .idle):
self.state = .idle
case .stopping(_, then: .restart):
self.state = .idle
startMeasuring()
case .stopping(_, then: .reload):
_reload()
default:
self.state = .idle
}
}
override func validateMenuItem(_ menuItem: NSMenuItem) -> Bool {
guard let action = menuItem.action else { return super.validateMenuItem(menuItem) }
switch action {
case #selector(AttabenchDocument.startStopAction(_:)):
let startLabel = "Start Running"
let stopLabel = "Stop Running"
guard m.benchmarkURL.value != nil else { return false }
switch self.state {
case .noBenchmark:
menuItem.title = startLabel
return false
case .idle:
menuItem.title = startLabel
return true
case .failedBenchmark:
menuItem.title = startLabel
return false
case .loading(_):
menuItem.title = stopLabel
return true
case .waiting:
menuItem.title = stopLabel
return true
case .running(_):
menuItem.title = stopLabel
return true
case .stopping(_, then: .restart):
menuItem.title = stopLabel
return true
case .stopping(_, then: _):
menuItem.title = stopLabel
return false
}
case #selector(AttabenchDocument.delete(_:)):
return self.tasksTableView?.selectedRowIndexes.isEmpty == false
default:
return super.validateMenuItem(menuItem)
}
}
@IBAction func delete(_ sender: AnyObject) {
// FIXME this is horrible. Implement Undo etc.
let tasks = (self.tasksTableView?.selectedRowIndexes ?? []).map { self.visibleTasks[$0] }
m.tasks.withTransaction {
for task in tasks {
task.deleteResults(in: NSEvent.modifierFlags.contains(.shift)
? nil
: self.m.selectedSizeRange.value)
if !task.isRunnable.value && task.sampleCount.value == 0 {
self.m.remove(task)
}
}
}
self.refreshChart.now()
self.updateChangeCount(.changeDone)
}
@IBAction func chooseBenchmark(_ sender: AnyObject) {
guard let window = self.windowControllers.first?.window else { return }
let openPanel = NSOpenPanel()
openPanel.message = "This result file has no associated Attabench document. To add measurements, you need to select a benchmark file."
openPanel.prompt = "Choose"
openPanel.canChooseFiles = true
openPanel.allowedFileTypes = [UTI.attabench]
openPanel.treatsFilePackagesAsDirectories = false
openPanel.beginSheetModal(for: window) { response in
guard response == .OK else { return }
guard let url = openPanel.urls.first else { return }
self.m.benchmarkURL.value = url
self._reload()
}
}
func _reload() {
do {
guard let url = m.benchmarkURL.value else { chooseBenchmark(self); return }
log(.status, "Loading \(FileManager().displayName(atPath: url.path))")
self.state = .loading(try BenchmarkProcess(url: url, command: .list, delegate: self, on: .main))
}
catch {
log(.status, "Failed to load benchmark: \(error.localizedDescription)")
self.state = .failedBenchmark
}
}
@IBAction func reloadAction(_ sender: AnyObject) {
switch state {
case .noBenchmark:
chooseBenchmark(sender)
case .idle, .failedBenchmark, .waiting:
_reload()
case .running(let process):
self.state = .stopping(process, then: .reload)
process.stop()
case .loading(let process):
self.state = .stopping(process, then: .reload)
process.stop()
case .stopping(let process, then: _):
self.state = .stopping(process, then: .reload)
}
}
@IBAction func startStopAction(_ sender: AnyObject) {
switch state {
case .noBenchmark, .failedBenchmark:
NSSound.beep()
case .idle:
guard !m.tasks.isEmpty else { return }
self.startMeasuring()
case .waiting:
self.state = .idle
case .running(_):
stopMeasuring()
case .loading(let process):
self.state = .failedBenchmark
process.stop()
case .stopping(let process, then: .restart):
self.state = .stopping(process, then: .idle)
case .stopping(let process, then: .reload):
self.state = .stopping(process, then: .idle)
case .stopping(let process, then: .idle):
self.state = .stopping(process, then: .restart)
}
}
func stopMeasuring() {
guard case .running(let process) = state else { return }
self.state = .stopping(process, then: .idle)
process.stop()
}
func startMeasuring() {
guard let source = self.m.benchmarkURL.value else { log(.status, "Can't start measuring"); return }
switch self.state {
case .waiting, .idle: break
default: return
}
let tasks = tasksToRun.value.map { $0.name }
let sizes = self.m.selectedSizes.value.sorted()
guard !tasks.isEmpty, !sizes.isEmpty else {
self.state = .waiting
return
}
log(.status, "\nRunning \(m.benchmarkDisplayName.value) with \(tasks.count) tasks at sizes from \(sizes.first!.sizeLabel) to \(sizes.last!.sizeLabel).")
let options = RunOptions(tasks: tasks,
sizes: sizes,
iterations: m.iterations.value,
minimumDuration: m.durationRange.value.lowerBound.seconds,
maximumDuration: m.durationRange.value.upperBound.seconds)
do {
self.state = .running(try BenchmarkProcess(url: source, command: .run(options), delegate: self, on: .main))
self.activity = ProcessInfo.processInfo.beginActivity(
options: [.idleSystemSleepDisabled, .automaticTerminationDisabled, .suddenTerminationDisabled],
reason: "Benchmarking")
}
catch {
self.log(.status, error.localizedDescription)
self.state = .idle
}
}
func runOptionsDidChange() {
switch self.state {
case .waiting:
startMeasuring()
case .running(let process):
self.state = .stopping(process, then: .restart)
default:
break
}
}
}
extension AttabenchDocument {
//MARK: Size selection
@IBAction func increaseMinScale(_ sender: AnyObject) {
m.sizeScaleRange.lowerBound.value += 1
}
@IBAction func decreaseMinScale(_ sender: AnyObject) {
m.sizeScaleRange.lowerBound.value -= 1
}
@IBAction func increaseMaxScale(_ sender: AnyObject) {
m.sizeScaleRange.upperBound.value += 1
}
@IBAction func decreaseMaxScale(_ sender: AnyObject) {
m.sizeScaleRange.upperBound.value -= 1
}
}
extension AttabenchDocument {
//MARK: Chart rendering
private func _refreshChart() {
guard let chartView = self.chartView else { return }
let tasks = checkedTasks.value
var options = BenchmarkChart.Options()
options.amortizedTime = m.amortizedTime.value
options.logarithmicSize = m.logarithmicSizeScale.value
options.logarithmicTime = m.logarithmicTimeScale.value
var sizeBounds = Bounds<Int>()
if m.highlightSelectedSizeRange.value {
let r = m.sizeScaleRange.value
sizeBounds.formUnion(with: Bounds((1 << r.lowerBound) ... (1 << r.upperBound)))
}
if m.displayIncludeSizeScaleRange.value {
let r = m.displaySizeScaleRange.value
sizeBounds.formUnion(with: Bounds((1 << r.lowerBound) ... (1 << r.upperBound)))
}
options.displaySizeRange = sizeBounds.range
options.displayAllMeasuredSizes = m.displayIncludeAllMeasuredSizes.value
var timeBounds = Bounds<Time>()
if m.displayIncludeTimeRange.value {
let r = m.displayTimeRange.value
timeBounds.formUnion(with: Bounds(r))
}
if let r = timeBounds.range {
options.displayTimeRange = r.lowerBound ... r.upperBound
}
options.displayAllMeasuredTimes = m.displayIncludeAllMeasuredTimes.value
options.topBand = m.topBand.value
options.centerBand = m.centerBand.value
options.bottomBand = m.bottomBand.value
chartView.chart = BenchmarkChart(title: "", tasks: tasks, options: options)
}
}
extension AttabenchDocument: NSSplitViewDelegate {
@IBAction func showHideLeftPane(_ sender: Any) {
guard let pane = self.leftPane else { return }
pane.isHidden = !pane.isHidden
}
@IBAction func showHideRightPane(_ sender: Any) {
guard let pane = self.rightPane else { return }
pane.isHidden = !pane.isHidden
}
@IBAction func showHideRunOptions(_ sender: NSButton) {
guard let pane = self.runOptionsPane else { return }
pane.isHidden = !pane.isHidden
}
@IBAction func showHideConsole(_ sender: NSButton) {
guard let pane = self.consolePane else { return }
pane.isHidden = !pane.isHidden
}
func splitView(_ splitView: NSSplitView, canCollapseSubview subview: NSView) -> Bool {
if subview === self.leftPane { return true }
if subview === self.rightPane { return true }
if subview === self.runOptionsPane { return true }
if subview === self.consolePane { return true }
return false
}
func splitViewDidResizeSubviews(_ notification: Notification) {
guard let splitView = notification.object as? NSSplitView else { return }
if splitView === rootSplitView {
let state: NSControl.StateValue = splitView.isSubviewCollapsed(self.leftPane!) ? .off : .on
if showLeftPaneButton!.state != state {
showLeftPaneButton!.state = state
}
}
if splitView === rootSplitView {
let state: NSControl.StateValue = splitView.isSubviewCollapsed(self.rightPane!) ? .off : .on
if showRightPaneButton!.state != state {
showRightPaneButton!.state = state
}
}
else if splitView === leftVerticalSplitView {
let state: NSControl.StateValue = splitView.isSubviewCollapsed(self.runOptionsPane!) ? .off : .on
if showRunOptionsButton!.state != state {
showRunOptionsButton!.state = state
}
}
else if splitView === middleSplitView {
let state: NSControl.StateValue = splitView.isSubviewCollapsed(self.consolePane!) ? .off : .on
if showConsoleButton!.state != state {
showConsoleButton!.state = state
}
}
}
func splitView(_ splitView: NSSplitView, additionalEffectiveRectOfDividerAt dividerIndex: Int) -> NSRect {
if splitView === middleSplitView, dividerIndex == 1 {
let status = splitView.convert(self.statusLabel!.bounds, from: self.statusLabel!)
let bar = splitView.convert(self.middleBar!.bounds, from: self.middleBar!)
return CGRect(x: status.minX, y: bar.minY, width: status.width, height: bar.height)
}
return .zero
}
}
extension AttabenchDocument {
@IBAction func batchCheckboxAction(_ sender: NSButton) {
let v = (sender.state != .off)
self.visibleTasks.value.forEach { $0.checked.apply(.beginTransaction) }
self.visibleTasks.value.forEach { $0.checked.value = v }
self.visibleTasks.value.forEach { $0.checked.apply(.endTransaction) }
}
}
extension AttabenchDocument: NSTextFieldDelegate {
override func controlTextDidChange(_ obj: Notification) {
guard obj.object as AnyObject === self.taskFilterTextField else {
super.controlTextDidChange(obj)
return
}
let v = self.taskFilterTextField!.stringValue
self.taskFilterString.value = v.isEmpty ? nil : v
}
}
extension AttabenchDocument {
//MARK: State restoration
enum RestorationKey: String {
case taskFilterString
}
override func encodeRestorableState(with coder: NSCoder) {
super.encodeRestorableState(with: coder)
coder.encode(self.taskFilterString.value, forKey: RestorationKey.taskFilterString.rawValue)
}
override func restoreState(with coder: NSCoder) {
super.restoreState(with: coder)
self.taskFilterString.value = coder.decodeObject(forKey: RestorationKey.taskFilterString.rawValue) as? String
}
}
| mit | cf5833bd7be2740863f3db211932b48d | 38.311366 | 198 | 0.613232 | 4.667082 | false | false | false | false |
txstate-etc/mobile-tracs-ios | mobile-tracs-ios/UIWidgets/FontAwesome/Enum.swift | 4 | 50916 | // Enum.swift
//
// Copyright (c) 2014-present FontAwesome.swift contributors
//
// 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.
/// An enumaration of FontAwesome icon names.
public enum FontAwesome: String {
case fiveHundredPixels = "\u{f26e}"
case addressBook = "\u{f2b9}"
case addressBookO = "\u{f2ba}"
case addressCard = "\u{f2bb}"
case addressCardO = "\u{f2bc}"
case adjust = "\u{f042}"
case adn = "\u{f170}"
case alignCenter = "\u{f037}"
case alignJustify = "\u{f039}"
case alignLeft = "\u{f036}"
case alignRight = "\u{f038}"
case amazon = "\u{f270}"
case ambulance = "\u{f0f9}"
case americanSignLanguageInterpreting = "\u{f2a3}"
case anchor = "\u{f13d}"
case android = "\u{f17b}"
case angellist = "\u{f209}"
case angleDoubleDown = "\u{f103}"
case angleDoubleLeft = "\u{f100}"
case angleDoubleRight = "\u{f101}"
case angleDoubleUp = "\u{f102}"
case angleDown = "\u{f107}"
case angleLeft = "\u{f104}"
case angleRight = "\u{f105}"
case angleUp = "\u{f106}"
case apple = "\u{f179}"
case archive = "\u{f187}"
case areaChart = "\u{f1fe}"
case arrowCircleDown = "\u{f0ab}"
case arrowCircleLeft = "\u{f0a8}"
case arrowCircleODown = "\u{f01a}"
case arrowCircleOLeft = "\u{f190}"
case arrowCircleORight = "\u{f18e}"
case arrowCircleOUp = "\u{f01b}"
case arrowCircleRight = "\u{f0a9}"
case arrowCircleUp = "\u{f0aa}"
case arrowDown = "\u{f063}"
case arrowLeft = "\u{f060}"
case arrowRight = "\u{f061}"
case arrowUp = "\u{f062}"
case arrows = "\u{f047}"
case arrowsAlt = "\u{f0b2}"
case arrowsH = "\u{f07e}"
case arrowsV = "\u{f07d}"
case aslInterpreting = "\u{f2a3}A"
case assistiveListeningSystems = "\u{f2a2}"
case asterisk = "\u{f069}"
case at = "\u{f1fa}"
case audioDescription = "\u{f29e}"
case automobile = "\u{f1b9}A"
case backward = "\u{f04a}"
case balanceScale = "\u{f24e}"
case ban = "\u{f05e}"
case bandCamp = "\u{f2d5}"
case bank = "\u{f19c}A"
case barChart = "\u{f080}"
case barChartO = "\u{f080}A"
case barcode = "\u{f02a}"
case bars = "\u{f0c9}"
case bath = "\u{f2cd}"
case battery0 = "\u{f244}A"
case battery1 = "\u{f243}A"
case battery2 = "\u{f242}A"
case battery3 = "\u{f241}A"
case battery4 = "\u{f240}A"
case batteryEmpty = "\u{f244}"
case batteryFull = "\u{f240}"
case batteryHalf = "\u{f242}"
case batteryQuarter = "\u{f243}"
case batteryThreeQuarters = "\u{f241}"
case bed = "\u{f236}"
case beer = "\u{f0fc}"
case behance = "\u{f1b4}"
case behanceSquare = "\u{f1b5}"
case bell = "\u{f0f3}"
case bellO = "\u{f0a2}"
case bellSlash = "\u{f1f6}"
case bellSlashO = "\u{f1f7}"
case bicycle = "\u{f206}"
case binoculars = "\u{f1e5}"
case birthdayCake = "\u{f1fd}"
case bitbucket = "\u{f171}"
case bitbucketSquare = "\u{f172}"
case bitcoin = "\u{f15a}A"
case blackTie = "\u{f27e}"
case blind = "\u{f29d}"
case bluetooth = "\u{f293}"
case bluetoothB = "\u{f294}"
case bold = "\u{f032}"
case bolt = "\u{f0e7}"
case bomb = "\u{f1e2}"
case book = "\u{f02d}"
case bookmark = "\u{f02e}"
case bookmarkO = "\u{f097}"
case braille = "\u{f2a1}"
case briefcase = "\u{f0b1}"
case btc = "\u{f15a}"
case bug = "\u{f188}"
case building = "\u{f1ad}"
case buildingO = "\u{f0f7}"
case bullhorn = "\u{f0a1}"
case bullseye = "\u{f140}"
case bus = "\u{f207}"
case buysellads = "\u{f20d}"
case cab = "\u{f1ba}A"
case calculator = "\u{f1ec}"
case calendar = "\u{f073}"
case calendarCheckO = "\u{f274}"
case calendarMinusO = "\u{f272}"
case calendarO = "\u{f133}"
case calendarPlusO = "\u{f271}"
case calendarTimesO = "\u{f273}"
case camera = "\u{f030}"
case cameraRetro = "\u{f083}"
case car = "\u{f1b9}"
case caretDown = "\u{f0d7}"
case caretLeft = "\u{f0d9}"
case caretRight = "\u{f0da}"
case caretSquareODown = "\u{f150}"
case caretSquareOLeft = "\u{f191}"
case caretSquareORight = "\u{f152}"
case caretSquareOUp = "\u{f151}"
case caretUp = "\u{f0d8}"
case cartArrowDown = "\u{f218}"
case cartPlus = "\u{f217}"
case cc = "\u{f20a}"
case ccAmex = "\u{f1f3}"
case ccDinersClub = "\u{f24c}"
case ccDiscover = "\u{f1f2}"
case ccJCB = "\u{f24b}"
case ccMasterCard = "\u{f1f1}"
case ccPaypal = "\u{f1f4}"
case ccStripe = "\u{f1f5}"
case ccVisa = "\u{f1f0}"
case certificate = "\u{f0a3}"
case chain = "\u{f0c1}A"
case chainBroken = "\u{f127}"
case check = "\u{f00c}"
case checkCircle = "\u{f058}"
case checkCircleO = "\u{f05d}"
case checkSquare = "\u{f14a}"
case checkSquareO = "\u{f046}"
case chevronCircleDown = "\u{f13a}"
case chevronCircleLeft = "\u{f137}"
case chevronCircleRight = "\u{f138}"
case chevronCircleUp = "\u{f139}"
case chevronDown = "\u{f078}"
case chevronLeft = "\u{f053}"
case chevronRight = "\u{f054}"
case chevronUp = "\u{f077}"
case child = "\u{f1ae}"
case chrome = "\u{f268}"
case circle = "\u{f111}"
case circleO = "\u{f10c}"
case circleONotch = "\u{f1ce}"
case circleThin = "\u{f1db}"
case clipboard = "\u{f0ea}"
case clockO = "\u{f017}"
case clone = "\u{f24d}"
case close = "\u{f00d}A"
case cloud = "\u{f0c2}"
case cloudDownload = "\u{f0ed}"
case cloudUpload = "\u{f0ee}"
case cny = "\u{f157}A"
case code = "\u{f121}"
case codeFork = "\u{f126}"
case codepen = "\u{f1cb}"
case codiepie = "\u{f284}"
case coffee = "\u{f0f4}"
case cog = "\u{f013}"
case cogs = "\u{f085}"
case columns = "\u{f0db}"
case comment = "\u{f075}"
case commentO = "\u{f0e5}"
case commenting = "\u{f27a}"
case commentingO = "\u{f27b}"
case comments = "\u{f086}"
case commentsO = "\u{f0e6}"
case compass = "\u{f14e}"
case compress = "\u{f066}"
case connectdevelop = "\u{f20e}"
case contao = "\u{f26d}"
case copy = "\u{f0c5}A"
case copyright = "\u{f1f9}"
case creativeCommons = "\u{f25e}"
case creditCard = "\u{f09d}"
case creditCardAlt = "\u{f283}"
case crop = "\u{f125}"
case crosshairs = "\u{f05b}"
case css3 = "\u{f13c}"
case cube = "\u{f1b2}"
case cubes = "\u{f1b3}"
case cut = "\u{f0c4}A"
case cutlery = "\u{f0f5}"
case dashboard = "\u{f0e4}A"
case dashcube = "\u{f210}"
case database = "\u{f1c0}"
case deaf = "\u{f2a4}"
case deafness = "\u{f2a4}A"
case dedent = "\u{f03b}A"
case delicious = "\u{f1a5}"
case desktop = "\u{f108}"
case deviantart = "\u{f1bd}"
case diamond = "\u{f219}"
case digg = "\u{f1a6}"
case dollar = "\u{f155}A"
case dotCircleO = "\u{f192}"
case download = "\u{f019}"
case dribbble = "\u{f17d}"
case dropbox = "\u{f16b}"
case drupal = "\u{f1a9}"
case edge = "\u{f282}"
case edit = "\u{f044}A"
case eercast = "\u{f2da}"
case eject = "\u{f052}"
case ellipsisH = "\u{f141}"
case ellipsisV = "\u{f142}"
case empire = "\u{f1d1}"
case envelope = "\u{f0e0}"
case envelopeO = "\u{f003}"
case envelopeOpen = "\u{f2b6}"
case envelopeOpenO = "\u{f2b7}"
case envelopeSquare = "\u{f199}"
case envira = "\u{f299}"
case eraser = "\u{f12d}"
case etsy = "\u{f2d7}"
case eur = "\u{f153}"
case euro = "\u{f153}A"
case exchange = "\u{f0ec}"
case exclamation = "\u{f12a}"
case exclamationCircle = "\u{f06a}"
case exclamationTriangle = "\u{f071}"
case expand = "\u{f065}"
case expeditedSSL = "\u{f23e}"
case externalLink = "\u{f08e}"
case externalLinkSquare = "\u{f14c}"
case eye = "\u{f06e}"
case eyeSlash = "\u{f070}"
case eyedropper = "\u{f1fb}"
case fa = "\u{f2b4}A"
case facebook = "\u{f09a}"
case facebookF = "\u{f09a}A"
case facebookOfficial = "\u{f230}"
case facebookSquare = "\u{f082}"
case fastBackward = "\u{f049}"
case fastForward = "\u{f050}"
case fax = "\u{f1ac}"
case feed = "\u{f09e}A"
case female = "\u{f182}"
case fighterJet = "\u{f0fb}"
case file = "\u{f15b}"
case fileArchiveO = "\u{f1c6}"
case fileAudioO = "\u{f1c7}"
case fileCodeO = "\u{f1c9}"
case fileExcelO = "\u{f1c3}"
case fileImageO = "\u{f1c5}"
case fileMovieO = "\u{f1c8}A"
case fileO = "\u{f016}"
case filePdfO = "\u{f1c1}"
case filePhotoO = "\u{f1c5}A"
case filePictureO = "\u{f1c5}B"
case filePowerpointO = "\u{f1c4}"
case fileSoundO = "\u{f1c7}A"
case fileText = "\u{f15c}"
case fileTextO = "\u{f0f6}"
case fileVideoO = "\u{f1c8}"
case fileWordO = "\u{f1c2}"
case fileZipO = "\u{f1c6}A"
case filesO = "\u{f0c5}"
case film = "\u{f008}"
case filter = "\u{f0b0}"
case fire = "\u{f06d}"
case fireExtinguisher = "\u{f134}"
case firefox = "\u{f269}"
case firstOrder = "\u{f2b0}"
case flag = "\u{f024}"
case flagCheckered = "\u{f11e}"
case flagO = "\u{f11d}"
case flash = "\u{f0e7}A"
case flask = "\u{f0c3}"
case flickr = "\u{f16e}"
case floppyO = "\u{f0c7}"
case folder = "\u{f07b}"
case folderO = "\u{f114}"
case folderOpen = "\u{f07c}"
case folderOpenO = "\u{f115}"
case font = "\u{f031}"
case fontAwesome = "\u{f2b4}"
case fonticons = "\u{f280}"
case fortAwesome = "\u{f286}"
case forumbee = "\u{f211}"
case forward = "\u{f04e}"
case foursquare = "\u{f180}"
case freeCodeCamp = "\u{f2c5}"
case frownO = "\u{f119}"
case futbolO = "\u{f1e3}"
case gamepad = "\u{f11b}"
case gavel = "\u{f0e3}"
case gbp = "\u{f154}"
case ge = "\u{f1d1}A"
case gear = "\u{f013}A"
case gears = "\u{f085}A"
case genderless = "\u{f22d}"
case getPocket = "\u{f265}"
case gg = "\u{f260}"
case ggCircle = "\u{f261}"
case gift = "\u{f06b}"
case git = "\u{f1d3}"
case gitSquare = "\u{f1d2}"
case github = "\u{f09b}"
case githubAlt = "\u{f113}"
case githubSquare = "\u{f092}"
case gitlab = "\u{f296}"
case gittip = "\u{f184}A"
case glass = "\u{f000}"
case glide = "\u{f2a5}"
case glideG = "\u{f2a6}"
case globe = "\u{f0ac}"
case google = "\u{f1a0}"
case googlePlus = "\u{f0d5}"
case googlePlusCircle = "\u{f2b3}A"
case googlePlusOfficial = "\u{f2b3}"
case googlePlusSquare = "\u{f0d4}"
case googleWallet = "\u{f1ee}"
case graduationCap = "\u{f19d}"
case gratipay = "\u{f184}"
case grav = "\u{f2d6}"
case group = "\u{f0c0}A"
case hSquare = "\u{f0fd}"
case hackerNews = "\u{f1d4}"
case handGrabO = "\u{f255}A"
case handLizardO = "\u{f258}"
case handODown = "\u{f0a7}"
case handOLeft = "\u{f0a5}"
case handORight = "\u{f0a4}"
case handOUp = "\u{f0a6}"
case handPaperO = "\u{f256}"
case handPeaceO = "\u{f25b}"
case handPointerO = "\u{f25a}"
case handRockO = "\u{f255}"
case handScissorsO = "\u{f257}"
case handShakeO = "\u{f2b5}"
case handSpockO = "\u{f259}"
case handStopO = "\u{f256}A"
case hardOfHearing = "\u{f2a4}B"
case hashtag = "\u{f292}"
case hddO = "\u{f0a0}"
case header = "\u{f1dc}"
case headphones = "\u{f025}"
case heart = "\u{f004}"
case heartO = "\u{f08a}"
case heartbeat = "\u{f21e}"
case history = "\u{f1da}"
case home = "\u{f015}"
case hospitalO = "\u{f0f8}"
case hotel = "\u{f236}A"
case hourglass = "\u{f254}"
case hourglass1 = "\u{f251}A"
case hourglass2 = "\u{f252}A"
case hourglass3 = "\u{f253}A"
case hourglassEnd = "\u{f253}"
case hourglassHalf = "\u{f252}"
case hourglassO = "\u{f250}"
case hourglassStart = "\u{f251}"
case houzz = "\u{f27c}"
case html5 = "\u{f13b}"
case iCursor = "\u{f246}"
case idBadge = "\u{f2c1}"
case idCard = "\u{f2c2}"
case idCardO = "\u{f2c3}"
case ils = "\u{f20b}"
case image = "\u{f03e}A"
case imdb = "\u{f2d8}"
case inbox = "\u{f01c}"
case indent = "\u{f03c}"
case industry = "\u{f275}"
case info = "\u{f129}"
case infoCircle = "\u{f05a}"
case inr = "\u{f156}"
case instagram = "\u{f16d}"
case institution = "\u{f19c}B"
case internetExplorer = "\u{f26b}"
case intersex = "\u{f224}A"
case ioxhost = "\u{f208}"
case italic = "\u{f033}"
case joomla = "\u{f1aa}"
case jpy = "\u{f157}"
case jsfiddle = "\u{f1cc}"
case key = "\u{f084}"
case keyboardO = "\u{f11c}"
case krw = "\u{f159}"
case language = "\u{f1ab}"
case laptop = "\u{f109}"
case lastFM = "\u{f202}"
case lastFMSquare = "\u{f203}"
case leaf = "\u{f06c}"
case leanpub = "\u{f212}"
case legal = "\u{f0e3}A"
case lemonO = "\u{f094}"
case levelDown = "\u{f149}"
case levelUp = "\u{f148}"
case lifeBouy = "\u{f1cd}A"
case lifeBuoy = "\u{f1cd}B"
case lifeRing = "\u{f1cd}"
case lifeSaver = "\u{f1cd}C"
case lightbulbO = "\u{f0eb}"
case lineChart = "\u{f201}"
case link = "\u{f0c1}"
case linkedIn = "\u{f0e1}"
case linkedInSquare = "\u{f08c}"
case linode = "\u{f2b8}"
case linux = "\u{f17c}"
case list = "\u{f03a}"
case listAlt = "\u{f022}"
case listOL = "\u{f0cb}"
case listUL = "\u{f0ca}"
case locationArrow = "\u{f124}"
case lock = "\u{f023}"
case longArrowDown = "\u{f175}"
case longArrowLeft = "\u{f177}"
case longArrowRight = "\u{f178}"
case longArrowUp = "\u{f176}"
case lowVision = "\u{f2a8}"
case magic = "\u{f0d0}"
case magnet = "\u{f076}"
case mailForward = "\u{f064}A"
case mailReply = "\u{f112}A"
case mailReplyAll = "\u{f122}A"
case male = "\u{f183}"
case map = "\u{f279}"
case mapMarker = "\u{f041}"
case mapO = "\u{f278}"
case mapPin = "\u{f276}"
case mapSigns = "\u{f277}"
case mars = "\u{f222}"
case marsDouble = "\u{f227}"
case marsStroke = "\u{f229}"
case marsStrokeH = "\u{f22b}"
case marsStrokeV = "\u{f22a}"
case maxcdn = "\u{f136}"
case meanpath = "\u{f20c}"
case medium = "\u{f23a}"
case medkit = "\u{f0fa}"
case meetup = "\u{f2e0}"
case mehO = "\u{f11a}"
case mercury = "\u{f223}"
case microchip = "\u{f2db}"
case microphone = "\u{f130}"
case microphoneSlash = "\u{f131}"
case minus = "\u{f068}"
case minusCircle = "\u{f056}"
case minusSquare = "\u{f146}"
case minusSquareO = "\u{f147}"
case mixcloud = "\u{f289}"
case mobile = "\u{f10b}"
case mobilePhone = "\u{f10b}A"
case modx = "\u{f285}"
case money = "\u{f0d6}"
case moonO = "\u{f186}"
case mortarBoard = "\u{f19d}A"
case motorcycle = "\u{f21c}"
case mousePointer = "\u{f245}"
case music = "\u{f001}"
case navicon = "\u{f0c9}A"
case neuter = "\u{f22c}"
case newspaperO = "\u{f1ea}"
case objectGroup = "\u{f247}"
case objectUngroup = "\u{f248}"
case odnoklassniki = "\u{f263}"
case odnoklassnikiSquare = "\u{f264}"
case openCart = "\u{f23d}"
case openID = "\u{f19b}"
case opera = "\u{f26a}"
case optinMonster = "\u{f23c}"
case outdent = "\u{f03b}"
case pagelines = "\u{f18c}"
case paintBrush = "\u{f1fc}"
case paperPlane = "\u{f1d8}"
case paperPlaneO = "\u{f1d9}"
case paperclip = "\u{f0c6}"
case paragraph = "\u{f1dd}"
case paste = "\u{f0ea}A"
case pause = "\u{f04c}"
case pauseCircle = "\u{f28b}"
case pauseCircleO = "\u{f28c}"
case paw = "\u{f1b0}"
case paypal = "\u{f1ed}"
case pencil = "\u{f040}"
case pencilSquare = "\u{f14b}"
case pencilSquareO = "\u{f044}"
case percent = "\u{f295}"
case phone = "\u{f095}"
case phoneSquare = "\u{f098}"
case photo = "\u{f03e}B"
case pictureO = "\u{f03e}"
case pieChart = "\u{f200}"
case piedPiper = "\u{f2ae}"
case piedPiperAlt = "\u{f1a8}"
case piedPiperPp = "\u{f1a7}"
case pinterest = "\u{f0d2}"
case pinterestP = "\u{f231}"
case pinterestSquare = "\u{f0d3}"
case plane = "\u{f072}"
case play = "\u{f04b}"
case playCircle = "\u{f144}"
case playCircleO = "\u{f01d}"
case plug = "\u{f1e6}"
case plus = "\u{f067}"
case plusCircle = "\u{f055}"
case plusSquare = "\u{f0fe}"
case plusSquareO = "\u{f196}"
case podcast = "\u{f2ce}"
case powerOff = "\u{f011}"
case print = "\u{f02f}"
case productHunt = "\u{f288}"
case puzzlePiece = "\u{f12e}"
case qq = "\u{f1d6}"
case qrcode = "\u{f029}"
case quora = "\u{f2c4}"
case question = "\u{f128}"
case questionCircle = "\u{f059}"
case questionCircleO = "\u{f29c}"
case quoteLeft = "\u{f10d}"
case quoteRight = "\u{f10e}"
case ra = "\u{f1d0}A"
case random = "\u{f074}"
case ravelry = "\u{f2d9}"
case rebel = "\u{f1d0}"
case recycle = "\u{f1b8}"
case reddit = "\u{f1a1}"
case redditAlien = "\u{f281}"
case redditSquare = "\u{f1a2}"
case refresh = "\u{f021}"
case registered = "\u{f25d}"
case remove = "\u{f00d}B"
case renren = "\u{f18b}"
case reorder = "\u{f0c9}B"
case `repeat` = "\u{f01e}"
case reply = "\u{f112}"
case replyAll = "\u{f122}"
case resistance = "\u{f1d0}B"
case retweet = "\u{f079}"
case rmb = "\u{f157}B"
case road = "\u{f018}"
case rocket = "\u{f135}"
case rotateLeft = "\u{f0e2}A"
case rotateRight = "\u{f01e}A"
case rouble = "\u{f158}A"
case rss = "\u{f09e}"
case rssSquare = "\u{f143}"
case rub = "\u{f158}"
case ruble = "\u{f158}B"
case rupee = "\u{f156}A"
case safari = "\u{f267}"
case save = "\u{f0c7}A"
case scissors = "\u{f0c4}"
case scribd = "\u{f28a}"
case search = "\u{f002}"
case searchMinus = "\u{f010}"
case searchPlus = "\u{f00e}"
case sellsy = "\u{f213}"
case send = "\u{f1d8}A"
case sendO = "\u{f1d9}A"
case server = "\u{f233}"
case share = "\u{f064}"
case shareAlt = "\u{f1e0}"
case shareAltSquare = "\u{f1e1}"
case shareSquare = "\u{f14d}"
case shareSquareO = "\u{f045}"
case shekel = "\u{f20b}A"
case sheqel = "\u{f20b}B"
case shield = "\u{f132}"
case ship = "\u{f21a}"
case shirtsinbulk = "\u{f214}"
case shoppingBag = "\u{f290}"
case shoppingBasket = "\u{f291}"
case shoppingCart = "\u{f07a}"
case shower = "\u{f2cc}"
case signIn = "\u{f090}"
case signLanguage = "\u{f2a7}"
case signOut = "\u{f08b}"
case signal = "\u{f012}"
case signing = "\u{f2a7}A"
case simplybuilt = "\u{f215}"
case sitemap = "\u{f0e8}"
case skyatlas = "\u{f216}"
case skype = "\u{f17e}"
case slack = "\u{f198}"
case sliders = "\u{f1de}"
case slideshare = "\u{f1e7}"
case smileO = "\u{f118}"
case snapchat = "\u{f2ab}"
case snapchatGhost = "\u{f2ac}"
case snapchatSquare = "\u{f2ad}"
case snowflakeO = "\u{f2dc}"
case soccerBallO = "\u{f1e3}A"
case sort = "\u{f0dc}"
case sortAlphaAsc = "\u{f15d}"
case sortAlphaDesc = "\u{f15e}"
case sortAmountAsc = "\u{f160}"
case sortAmountDesc = "\u{f161}"
case sortAsc = "\u{f0de}"
case sortDesc = "\u{f0dd}"
case sortDown = "\u{f0dd}A"
case sortNumericAsc = "\u{f162}"
case sortNumericDesc = "\u{f163}"
case sortUp = "\u{f0de}A"
case soundCloud = "\u{f1be}"
case spaceShuttle = "\u{f197}"
case spinner = "\u{f110}"
case spoon = "\u{f1b1}"
case spotify = "\u{f1bc}"
case square = "\u{f0c8}"
case squareO = "\u{f096}"
case stackExchange = "\u{f18d}"
case stackOverflow = "\u{f16c}"
case star = "\u{f005}"
case starHalf = "\u{f089}"
case starHalfEmpty = "\u{f123}A"
case starHalfFull = "\u{f123}B"
case starHalfO = "\u{f123}"
case starO = "\u{f006}"
case steam = "\u{f1b6}"
case steamSquare = "\u{f1b7}"
case stepBackward = "\u{f048}"
case stepForward = "\u{f051}"
case stethoscope = "\u{f0f1}"
case stickyNote = "\u{f249}"
case stickyNoteO = "\u{f24a}"
case stop = "\u{f04d}"
case stopCircle = "\u{f28d}"
case stopCircleO = "\u{f28e}"
case streetView = "\u{f21d}"
case strikethrough = "\u{f0cc}"
case stumbleUpon = "\u{f1a4}"
case stumbleUponCircle = "\u{f1a3}"
case `subscript` = "\u{f12c}"
case subway = "\u{f239}"
case suitcase = "\u{f0f2}"
case sunO = "\u{f185}"
case superscript = "\u{f12b}"
case superpowers = "\u{f2dd}"
case support = "\u{f1cd}D"
case table = "\u{f0ce}"
case tablet = "\u{f10a}"
case tachometer = "\u{f0e4}"
case tag = "\u{f02b}"
case tags = "\u{f02c}"
case tasks = "\u{f0ae}"
case taxi = "\u{f1ba}"
case telegram = "\u{f2c6}"
case television = "\u{f26c}"
case tencentWeibo = "\u{f1d5}"
case terminal = "\u{f120}"
case textHeight = "\u{f034}"
case textWidth = "\u{f035}"
case th = "\u{f00a}"
case thLarge = "\u{f009}"
case thList = "\u{f00b}"
case themeisle = "\u{f2b2}"
case thermometerEmpty = "\u{f2cb}"
case thermometerFull = "\u{f2c7}"
case thermometerHalf = "\u{f2c9}"
case thermometerQuarter = "\u{f2ca}"
case thermometerThreeQuarters = "\u{f2c8}"
case thumbTack = "\u{f08d}"
case thumbsDown = "\u{f165}"
case thumbsODown = "\u{f088}"
case thumbsOUp = "\u{f087}"
case thumbsUp = "\u{f164}"
case ticket = "\u{f145}"
case times = "\u{f00d}"
case timesCircle = "\u{f057}"
case timesCircleO = "\u{f05c}"
case tint = "\u{f043}"
case toggleDown = "\u{f150}A"
case toggleLeft = "\u{f191}A"
case toggleOff = "\u{f204}"
case toggleOn = "\u{f205}"
case toggleRight = "\u{f152}A"
case toggleUp = "\u{f151}A"
case trademark = "\u{f25c}"
case train = "\u{f238}"
case transgender = "\u{f224}"
case transgenderAlt = "\u{f225}"
case trash = "\u{f1f8}"
case trashO = "\u{f014}"
case tree = "\u{f1bb}"
case trello = "\u{f181}"
case tripAdvisor = "\u{f262}"
case trophy = "\u{f091}"
case truck = "\u{f0d1}"
case `try` = "\u{f195}"
case tty = "\u{f1e4}"
case tumblr = "\u{f173}"
case tumblrSquare = "\u{f174}"
case turkishLira = "\u{f195}A"
case tv = "\u{f26c}A"
case twitch = "\u{f1e8}"
case twitter = "\u{f099}"
case twitterSquare = "\u{f081}"
case umbrella = "\u{f0e9}"
case underline = "\u{f0cd}"
case undo = "\u{f0e2}"
case universalAccess = "\u{f29a}"
case university = "\u{f19c}"
case unlink = "\u{f127}A"
case unlock = "\u{f09c}"
case unlockAlt = "\u{f13e}"
case unsorted = "\u{f0dc}A"
case upload = "\u{f093}"
case usb = "\u{f287}"
case usd = "\u{f155}"
case user = "\u{f007}"
case userO = "\u{f2c0}"
case userCircle = "\u{f2bd}"
case userCircleO = "\u{f2be}"
case userMd = "\u{f0f0}"
case userPlus = "\u{f234}"
case userSecret = "\u{f21b}"
case userTimes = "\u{f235}"
case users = "\u{f0c0}"
case venus = "\u{f221}"
case venusDouble = "\u{f226}"
case venusMars = "\u{f228}"
case viacoin = "\u{f237}"
case viadeo = "\u{f2a9}"
case viadeoSquare = "\u{f2aa}"
case videoCamera = "\u{f03d}"
case vimeo = "\u{f27d}"
case vimeoSquare = "\u{f194}"
case vine = "\u{f1ca}"
case vk = "\u{f189}"
case volumeControlPhone = "\u{f2a0}"
case volumeDown = "\u{f027}"
case volumeOff = "\u{f026}"
case volumeUp = "\u{f028}"
case warning = "\u{f071}A"
case wechat = "\u{f1d7}A"
case weibo = "\u{f18a}"
case weixin = "\u{f1d7}"
case whatsapp = "\u{f232}"
case wheelchair = "\u{f193}"
case wheelchairAlt = "\u{f29b}"
case wifi = "\u{f1eb}"
case wikipediaW = "\u{f266}"
case windowClose = "\u{f2d3}"
case windowCloseO = "\u{f2d4}"
case windowMaximize = "\u{f2d0}"
case windowMinimize = "\u{f2d1}"
case windowRestore = "\u{f2d2}"
case windows = "\u{f17a}"
case won = "\u{f159}A"
case wordpress = "\u{f19a}"
case wpbeginner = "\u{f297}"
case wpexplorer = "\u{f2de}"
case wpforms = "\u{f298}"
case wrench = "\u{f0ad}"
case xing = "\u{f168}"
case xingSquare = "\u{f169}"
case yCombinator = "\u{f23b}"
case yCombinatorSquare = "\u{f1d4}A"
case yahoo = "\u{f19e}"
case yc = "\u{f23b}A"
case ycSquare = "\u{f1d4}B"
case yelp = "\u{f1e9}"
case yen = "\u{f157}C"
case yoast = "\u{f2b1}"
case youTube = "\u{f167}"
case youTubePlay = "\u{f16a}"
case youTubeSquare = "\u{f166}"
/// Get a FontAwesome string from the given CSS icon code. Icon code can be found here: http://fontawesome.io/icons/
///
/// - parameter code: The preferred icon name.
/// - returns: FontAwesome icon.
public static func fromCode(_ code: String) -> FontAwesome? {
guard let raw = FontAwesomeIcons[code], let icon = FontAwesome(rawValue: raw) else {
return nil
}
return icon
}
}
/// An array of FontAwesome icon codes.
public let FontAwesomeIcons = [
"fa-500px": "\u{f26e}",
"fa-adjust": "\u{f042}",
"fa-adn": "\u{f170}",
"fa-address-book":"\u{f2b9}",
"fa-address-book-o":"\u{f2ba}",
"fa-address-card":"\u{f2bb}",
"fa-address-card-o":"\u{f2bc}",
"fa-align-center": "\u{f037}",
"fa-align-justify": "\u{f039}",
"fa-align-left": "\u{f036}",
"fa-align-right": "\u{f038}",
"fa-amazon": "\u{f270}",
"fa-ambulance": "\u{f0f9}",
"fa-american-sign-language-interpreting": "\u{f2a3}",
"fa-anchor": "\u{f13d}",
"fa-android": "\u{f17b}",
"fa-angellist": "\u{f209}",
"fa-angle-double-down": "\u{f103}",
"fa-angle-double-left": "\u{f100}",
"fa-angle-double-right": "\u{f101}",
"fa-angle-double-up": "\u{f102}",
"fa-angle-down": "\u{f107}",
"fa-angle-left": "\u{f104}",
"fa-angle-right": "\u{f105}",
"fa-angle-up": "\u{f106}",
"fa-apple": "\u{f179}",
"fa-archive": "\u{f187}",
"fa-area-chart": "\u{f1fe}",
"fa-arrow-circle-down": "\u{f0ab}",
"fa-arrow-circle-left": "\u{f0a8}",
"fa-arrow-circle-o-down": "\u{f01a}",
"fa-arrow-circle-o-left": "\u{f190}",
"fa-arrow-circle-o-right": "\u{f18e}",
"fa-arrow-circle-o-up": "\u{f01b}",
"fa-arrow-circle-right": "\u{f0a9}",
"fa-arrow-circle-up": "\u{f0aa}",
"fa-arrow-down": "\u{f063}",
"fa-arrow-left": "\u{f060}",
"fa-arrow-right": "\u{f061}",
"fa-arrow-up": "\u{f062}",
"fa-arrows": "\u{f047}",
"fa-arrows-alt": "\u{f0b2}",
"fa-arrows-h": "\u{f07e}",
"fa-arrows-v": "\u{f07d}",
"fa-asl-interpreting": "\u{f2a3}",
"fa-assistive-listening-systems": "\u{f2a2}",
"fa-asterisk": "\u{f069}",
"fa-at": "\u{f1fa}",
"fa-audio-description": "\u{f29e}",
"fa-automobile": "\u{f1b9}",
"fa-backward": "\u{f04a}",
"fa-balance-scale": "\u{f24e}",
"fa-ban": "\u{f05e}",
"fa-bandcamp": "\u{f2d5}",
"fa-bank": "\u{f19c}",
"fa-bar-chart": "\u{f080}",
"fa-bar-chart-o": "\u{f080}",
"fa-barcode": "\u{f02a}",
"fa-bars": "\u{f0c9}",
"fa-bath": "\u{f2cd}",
"fa-battery-0": "\u{f244}",
"fa-battery-1": "\u{f243}",
"fa-battery-2": "\u{f242}",
"fa-battery-3": "\u{f241}",
"fa-battery-4": "\u{f240}",
"fa-battery-empty": "\u{f244}",
"fa-battery-full": "\u{f240}",
"fa-battery-half": "\u{f242}",
"fa-battery-quarter": "\u{f243}",
"fa-battery-three-quarters": "\u{f241}",
"fa-bed": "\u{f236}",
"fa-beer": "\u{f0fc}",
"fa-behance": "\u{f1b4}",
"fa-behance-square": "\u{f1b5}",
"fa-bell": "\u{f0f3}",
"fa-bell-o": "\u{f0a2}",
"fa-bell-slash": "\u{f1f6}",
"fa-bell-slash-o": "\u{f1f7}",
"fa-bicycle": "\u{f206}",
"fa-binoculars": "\u{f1e5}",
"fa-birthday-cake": "\u{f1fd}",
"fa-bitbucket": "\u{f171}",
"fa-bitbucket-square": "\u{f172}",
"fa-bitcoin": "\u{f15a}",
"fa-black-tie": "\u{f27e}",
"fa-blind": "\u{f29d}",
"fa-bluetooth": "\u{f293}",
"fa-bluetooth-b": "\u{f294}",
"fa-bold": "\u{f032}",
"fa-bolt": "\u{f0e7}",
"fa-bomb": "\u{f1e2}",
"fa-book": "\u{f02d}",
"fa-bookmark": "\u{f02e}",
"fa-bookmark-o": "\u{f097}",
"fa-braille": "\u{f2a1}",
"fa-briefcase": "\u{f0b1}",
"fa-btc": "\u{f15a}",
"fa-bug": "\u{f188}",
"fa-building": "\u{f1ad}",
"fa-building-o": "\u{f0f7}",
"fa-bullhorn": "\u{f0a1}",
"fa-bullseye": "\u{f140}",
"fa-bus": "\u{f207}",
"fa-buysellads": "\u{f20d}",
"fa-cab": "\u{f1ba}",
"fa-calculator": "\u{f1ec}",
"fa-calendar": "\u{f073}",
"fa-calendar-check-o": "\u{f274}",
"fa-calendar-minus-o": "\u{f272}",
"fa-calendar-o": "\u{f133}",
"fa-calendar-plus-o": "\u{f271}",
"fa-calendar-times-o": "\u{f273}",
"fa-camera": "\u{f030}",
"fa-camera-retro": "\u{f083}",
"fa-car": "\u{f1b9}",
"fa-caret-down": "\u{f0d7}",
"fa-caret-left": "\u{f0d9}",
"fa-caret-right": "\u{f0da}",
"fa-caret-square-o-down": "\u{f150}",
"fa-caret-square-o-left": "\u{f191}",
"fa-caret-square-o-right": "\u{f152}",
"fa-caret-square-o-up": "\u{f151}",
"fa-caret-up": "\u{f0d8}",
"fa-cart-arrow-down": "\u{f218}",
"fa-cart-plus": "\u{f217}",
"fa-cc": "\u{f20a}",
"fa-cc-amex": "\u{f1f3}",
"fa-cc-diners-club": "\u{f24c}",
"fa-cc-discover": "\u{f1f2}",
"fa-cc-jcb": "\u{f24b}",
"fa-cc-mastercard": "\u{f1f1}",
"fa-cc-paypal": "\u{f1f4}",
"fa-cc-stripe": "\u{f1f5}",
"fa-cc-visa": "\u{f1f0}",
"fa-certificate": "\u{f0a3}",
"fa-chain": "\u{f0c1}",
"fa-chain-broken": "\u{f127}",
"fa-check": "\u{f00c}",
"fa-check-circle": "\u{f058}",
"fa-check-circle-o": "\u{f05d}",
"fa-check-square": "\u{f14a}",
"fa-check-square-o": "\u{f046}",
"fa-chevron-circle-down": "\u{f13a}",
"fa-chevron-circle-left": "\u{f137}",
"fa-chevron-circle-right": "\u{f138}",
"fa-chevron-circle-up": "\u{f139}",
"fa-chevron-down": "\u{f078}",
"fa-chevron-left": "\u{f053}",
"fa-chevron-right": "\u{f054}",
"fa-chevron-up": "\u{f077}",
"fa-child": "\u{f1ae}",
"fa-chrome": "\u{f268}",
"fa-circle": "\u{f111}",
"fa-circle-o": "\u{f10c}",
"fa-circle-o-notch": "\u{f1ce}",
"fa-circle-thin": "\u{f1db}",
"fa-clipboard": "\u{f0ea}",
"fa-clock-o": "\u{f017}",
"fa-clone": "\u{f24d}",
"fa-close": "\u{f00d}",
"fa-cloud": "\u{f0c2}",
"fa-cloud-download": "\u{f0ed}",
"fa-cloud-upload": "\u{f0ee}",
"fa-cny": "\u{f157}",
"fa-code": "\u{f121}",
"fa-code-fork": "\u{f126}",
"fa-codepen": "\u{f1cb}",
"fa-codiepie": "\u{f284}",
"fa-coffee": "\u{f0f4}",
"fa-cog": "\u{f013}",
"fa-cogs": "\u{f085}",
"fa-columns": "\u{f0db}",
"fa-comment": "\u{f075}",
"fa-comment-o": "\u{f0e5}",
"fa-commenting": "\u{f27a}",
"fa-commenting-o": "\u{f27b}",
"fa-comments": "\u{f086}",
"fa-comments-o": "\u{f0e6}",
"fa-compass": "\u{f14e}",
"fa-compress": "\u{f066}",
"fa-connectdevelop": "\u{f20e}",
"fa-contao": "\u{f26d}",
"fa-copy": "\u{f0c5}",
"fa-copyright": "\u{f1f9}",
"fa-creative-commons": "\u{f25e}",
"fa-credit-card": "\u{f09d}",
"fa-credit-card-alt": "\u{f283}",
"fa-crop": "\u{f125}",
"fa-crosshairs": "\u{f05b}",
"fa-css3": "\u{f13c}",
"fa-cube": "\u{f1b2}",
"fa-cubes": "\u{f1b3}",
"fa-cut": "\u{f0c4}",
"fa-cutlery": "\u{f0f5}",
"fa-dashboard": "\u{f0e4}",
"fa-dashcube": "\u{f210}",
"fa-database": "\u{f1c0}",
"fa-deaf": "\u{f2a4}",
"fa-deafness": "\u{f2a4}",
"fa-dedent": "\u{f03b}",
"fa-delicious": "\u{f1a5}",
"fa-desktop": "\u{f108}",
"fa-deviantart": "\u{f1bd}",
"fa-diamond": "\u{f219}",
"fa-digg": "\u{f1a6}",
"fa-dollar": "\u{f155}",
"fa-dot-circle-o": "\u{f192}",
"fa-download": "\u{f019}",
"fa-dribbble": "\u{f17d}",
"fa-dropbox": "\u{f16b}",
"fa-drupal": "\u{f1a9}",
"fa-edge": "\u{f282}",
"fa-edit": "\u{f044}",
"fa-eercast": "\u{f2da}",
"fa-eject": "\u{f052}",
"fa-ellipsis-h": "\u{f141}",
"fa-ellipsis-v": "\u{f142}",
"fa-empire": "\u{f1d1}",
"fa-envelope": "\u{f0e0}",
"fa-envelope-o": "\u{f003}",
"fa-envelope-square": "\u{f199}",
"fa-envelope-open": "\u{f2b6}",
"fa-envelope-open-o": "\u{f2b7}",
"fa-envira": "\u{f299}",
"fa-eraser": "\u{f12d}",
"fa-etsy": "\u{f2d7}",
"fa-eur": "\u{f153}",
"fa-euro": "\u{f153}",
"fa-exchange": "\u{f0ec}",
"fa-exclamation": "\u{f12a}",
"fa-exclamation-circle": "\u{f06a}",
"fa-exclamation-triangle": "\u{f071}",
"fa-expand": "\u{f065}",
"fa-expeditedssl": "\u{f23e}",
"fa-external-link": "\u{f08e}",
"fa-external-link-square": "\u{f14c}",
"fa-eye": "\u{f06e}",
"fa-eye-slash": "\u{f070}",
"fa-eyedropper": "\u{f1fb}",
"fa-fa": "\u{f2b4}",
"fa-facebook": "\u{f09a}",
"fa-facebook-f": "\u{f09a}",
"fa-facebook-official": "\u{f230}",
"fa-facebook-square": "\u{f082}",
"fa-fast-backward": "\u{f049}",
"fa-fast-forward": "\u{f050}",
"fa-fax": "\u{f1ac}",
"fa-feed": "\u{f09e}",
"fa-female": "\u{f182}",
"fa-fighter-jet": "\u{f0fb}",
"fa-file": "\u{f15b}",
"fa-file-archive-o": "\u{f1c6}",
"fa-file-audio-o": "\u{f1c7}",
"fa-file-code-o": "\u{f1c9}",
"fa-file-excel-o": "\u{f1c3}",
"fa-file-image-o": "\u{f1c5}",
"fa-file-movie-o": "\u{f1c8}",
"fa-file-o": "\u{f016}",
"fa-file-pdf-o": "\u{f1c1}",
"fa-file-photo-o": "\u{f1c5}",
"fa-file-picture-o": "\u{f1c5}",
"fa-file-powerpoint-o": "\u{f1c4}",
"fa-file-sound-o": "\u{f1c7}",
"fa-file-text": "\u{f15c}",
"fa-file-text-o": "\u{f0f6}",
"fa-file-video-o": "\u{f1c8}",
"fa-file-word-o": "\u{f1c2}",
"fa-file-zip-o": "\u{f1c6}",
"fa-files-o": "\u{f0c5}",
"fa-film": "\u{f008}",
"fa-filter": "\u{f0b0}",
"fa-fire": "\u{f06d}",
"fa-fire-extinguisher": "\u{f134}",
"fa-firefox": "\u{f269}",
"fa-first-order": "\u{f2b0}",
"fa-flag": "\u{f024}",
"fa-flag-checkered": "\u{f11e}",
"fa-flag-o": "\u{f11d}",
"fa-flash": "\u{f0e7}",
"fa-flask": "\u{f0c3}",
"fa-flickr": "\u{f16e}",
"fa-floppy-o": "\u{f0c7}",
"fa-folder": "\u{f07b}",
"fa-folder-o": "\u{f114}",
"fa-folder-open": "\u{f07c}",
"fa-folder-open-o": "\u{f115}",
"fa-font": "\u{f031}",
"fa-font-awesome": "\u{f2b4}",
"fa-fonticons": "\u{f280}",
"fa-fort-awesome": "\u{f286}",
"fa-forumbee": "\u{f211}",
"fa-forward": "\u{f04e}",
"fa-foursquare": "\u{f180}",
"fa-free-code-camp": "\u{f2c5}",
"fa-frown-o": "\u{f119}",
"fa-futbol-o": "\u{f1e3}",
"fa-gamepad": "\u{f11b}",
"fa-gavel": "\u{f0e3}",
"fa-gbp": "\u{f154}",
"fa-ge": "\u{f1d1}",
"fa-gear": "\u{f013}",
"fa-gears": "\u{f085}",
"fa-genderless": "\u{f22d}",
"fa-get-pocket": "\u{f265}",
"fa-gg": "\u{f260}",
"fa-gg-circle": "\u{f261}",
"fa-gift": "\u{f06b}",
"fa-git": "\u{f1d3}",
"fa-git-square": "\u{f1d2}",
"fa-github": "\u{f09b}",
"fa-github-alt": "\u{f113}",
"fa-github-square": "\u{f092}",
"fa-gitlab": "\u{f296}",
"fa-gittip": "\u{f184}",
"fa-glass": "\u{f000}",
"fa-glide": "\u{f2a5}",
"fa-glide-g": "\u{f2a6}",
"fa-globe": "\u{f0ac}",
"fa-google": "\u{f1a0}",
"fa-google-plus": "\u{f0d5}",
"fa-google-plus-circle": "\u{f2b3}",
"fa-google-plus-official": "\u{f2b3}",
"fa-google-plus-square": "\u{f0d4}",
"fa-google-wallet": "\u{f1ee}",
"fa-graduation-cap": "\u{f19d}",
"fa-gratipay": "\u{f184}",
"fa-grav": "\u{f2d6}",
"fa-group": "\u{f0c0}",
"fa-h-square": "\u{f0fd}",
"fa-hacker-news": "\u{f1d4}",
"fa-handshake-o": "\u{f2b5}",
"fa-hand-grab-o": "\u{f255}",
"fa-hand-lizard-o": "\u{f258}",
"fa-hand-o-down": "\u{f0a7}",
"fa-hand-o-left": "\u{f0a5}",
"fa-hand-o-right": "\u{f0a4}",
"fa-hand-o-up": "\u{f0a6}",
"fa-hand-paper-o": "\u{f256}",
"fa-hand-peace-o": "\u{f25b}",
"fa-hand-pointer-o": "\u{f25a}",
"fa-hand-rock-o": "\u{f255}",
"fa-hand-scissors-o": "\u{f257}",
"fa-hand-spock-o": "\u{f259}",
"fa-hand-stop-o": "\u{f256}",
"fa-hard-of-hearing": "\u{f2a4}",
"fa-hashtag": "\u{f292}",
"fa-hdd-o": "\u{f0a0}",
"fa-header": "\u{f1dc}",
"fa-headphones": "\u{f025}",
"fa-heart": "\u{f004}",
"fa-heart-o": "\u{f08a}",
"fa-heartbeat": "\u{f21e}",
"fa-history": "\u{f1da}",
"fa-home": "\u{f015}",
"fa-hospital-o": "\u{f0f8}",
"fa-hotel": "\u{f236}",
"fa-hourglass": "\u{f254}",
"fa-hourglass-1": "\u{f251}",
"fa-hourglass-2": "\u{f252}",
"fa-hourglass-3": "\u{f253}",
"fa-hourglass-end": "\u{f253}",
"fa-hourglass-half": "\u{f252}",
"fa-hourglass-o": "\u{f250}",
"fa-hourglass-start": "\u{f251}",
"fa-houzz": "\u{f27c}",
"fa-html5": "\u{f13b}",
"fa-i-cursor": "\u{f246}",
"fa-id-badge": "\u{f2c1}",
"fa-id-card": "\u{f2c2}",
"fa-id-card-o": "\u{f2c3}",
"fa-ils": "\u{f20b}",
"fa-image": "\u{f03e}",
"fa-imdb": "\u{f2d8}",
"fa-inbox": "\u{f01c}",
"fa-indent": "\u{f03c}",
"fa-industry": "\u{f275}",
"fa-info": "\u{f129}",
"fa-info-circle": "\u{f05a}",
"fa-inr": "\u{f156}",
"fa-instagram": "\u{f16d}",
"fa-institution": "\u{f19c}",
"fa-internet-explorer": "\u{f26b}",
"fa-intersex": "\u{f224}",
"fa-ioxhost": "\u{f208}",
"fa-italic": "\u{f033}",
"fa-joomla": "\u{f1aa}",
"fa-jpy": "\u{f157}",
"fa-jsfiddle": "\u{f1cc}",
"fa-key": "\u{f084}",
"fa-keyboard-o": "\u{f11c}",
"fa-krw": "\u{f159}",
"fa-language": "\u{f1ab}",
"fa-laptop": "\u{f109}",
"fa-lastfm": "\u{f202}",
"fa-lastfm-square": "\u{f203}",
"fa-leaf": "\u{f06c}",
"fa-leanpub": "\u{f212}",
"fa-legal": "\u{f0e3}",
"fa-lemon-o": "\u{f094}",
"fa-level-down": "\u{f149}",
"fa-level-up": "\u{f148}",
"fa-life-bouy": "\u{f1cd}",
"fa-life-buoy": "\u{f1cd}",
"fa-life-ring": "\u{f1cd}",
"fa-life-saver": "\u{f1cd}",
"fa-lightbulb-o": "\u{f0eb}",
"fa-line-chart": "\u{f201}",
"fa-link": "\u{f0c1}",
"fa-linkedin": "\u{f0e1}",
"fa-linkedin-square": "\u{f08c}",
"fa-linode": "\u{f2b8}",
"fa-linux": "\u{f17c}",
"fa-list": "\u{f03a}",
"fa-list-alt": "\u{f022}",
"fa-list-ol": "\u{f0cb}",
"fa-list-ul": "\u{f0ca}",
"fa-location-arrow": "\u{f124}",
"fa-lock": "\u{f023}",
"fa-long-arrow-down": "\u{f175}",
"fa-long-arrow-left": "\u{f177}",
"fa-long-arrow-right": "\u{f178}",
"fa-long-arrow-up": "\u{f176}",
"fa-low-vision": "\u{f2a8}",
"fa-magic": "\u{f0d0}",
"fa-magnet": "\u{f076}",
"fa-mail-forward": "\u{f064}",
"fa-mail-reply": "\u{f112}",
"fa-mail-reply-all": "\u{f122}",
"fa-male": "\u{f183}",
"fa-map": "\u{f279}",
"fa-map-marker": "\u{f041}",
"fa-map-o": "\u{f278}",
"fa-map-pin": "\u{f276}",
"fa-map-signs": "\u{f277}",
"fa-mars": "\u{f222}",
"fa-mars-double": "\u{f227}",
"fa-mars-stroke": "\u{f229}",
"fa-mars-stroke-h": "\u{f22b}",
"fa-mars-stroke-v": "\u{f22a}",
"fa-maxcdn": "\u{f136}",
"fa-meanpath": "\u{f20c}",
"fa-medium": "\u{f23a}",
"fa-medkit": "\u{f0fa}",
"fa-meetup": "\u{f2e0}",
"fa-meh-o": "\u{f11a}",
"fa-mercury": "\u{f223}",
"fa-microchip": "\u{f2db}",
"fa-microphone": "\u{f130}",
"fa-microphone-slash": "\u{f131}",
"fa-minus": "\u{f068}",
"fa-minus-circle": "\u{f056}",
"fa-minus-square": "\u{f146}",
"fa-minus-square-o": "\u{f147}",
"fa-mixcloud": "\u{f289}",
"fa-mobile": "\u{f10b}",
"fa-mobile-phone": "\u{f10b}",
"fa-modx": "\u{f285}",
"fa-money": "\u{f0d6}",
"fa-moon-o": "\u{f186}",
"fa-mortar-board": "\u{f19d}",
"fa-motorcycle": "\u{f21c}",
"fa-mouse-pointer": "\u{f245}",
"fa-music": "\u{f001}",
"fa-navicon": "\u{f0c9}",
"fa-neuter": "\u{f22c}",
"fa-newspaper-o": "\u{f1ea}",
"fa-object-group": "\u{f247}",
"fa-object-ungroup": "\u{f248}",
"fa-odnoklassniki": "\u{f263}",
"fa-odnoklassniki-square": "\u{f264}",
"fa-opencart": "\u{f23d}",
"fa-openid": "\u{f19b}",
"fa-opera": "\u{f26a}",
"fa-optin-monster": "\u{f23c}",
"fa-outdent": "\u{f03b}",
"fa-pagelines": "\u{f18c}",
"fa-paint-brush": "\u{f1fc}",
"fa-paper-plane": "\u{f1d8}",
"fa-paper-plane-o": "\u{f1d9}",
"fa-paperclip": "\u{f0c6}",
"fa-paragraph": "\u{f1dd}",
"fa-paste": "\u{f0ea}",
"fa-pause": "\u{f04c}",
"fa-pause-circle": "\u{f28b}",
"fa-pause-circle-o": "\u{f28c}",
"fa-paw": "\u{f1b0}",
"fa-paypal": "\u{f1ed}",
"fa-pencil": "\u{f040}",
"fa-pencil-square": "\u{f14b}",
"fa-pencil-square-o": "\u{f044}",
"fa-percent": "\u{f295}",
"fa-phone": "\u{f095}",
"fa-phone-square": "\u{f098}",
"fa-photo": "\u{f03e}",
"fa-picture-o": "\u{f03e}",
"fa-pie-chart": "\u{f200}",
"fa-pied-piper": "\u{f2ae}",
"fa-pied-piper-alt": "\u{f1a8}",
"fa-pied-piper-pp": "\u{f1a7}",
"fa-pinterest": "\u{f0d2}",
"fa-pinterest-p": "\u{f231}",
"fa-pinterest-square": "\u{f0d3}",
"fa-plane": "\u{f072}",
"fa-play": "\u{f04b}",
"fa-play-circle": "\u{f144}",
"fa-play-circle-o": "\u{f01d}",
"fa-plug": "\u{f1e6}",
"fa-plus": "\u{f067}",
"fa-plus-circle": "\u{f055}",
"fa-plus-square": "\u{f0fe}",
"fa-plus-square-o": "\u{f196}",
"fa-podcast": "\u{f2ce}",
"fa-power-off": "\u{f011}",
"fa-print": "\u{f02f}",
"fa-product-hunt": "\u{f288}",
"fa-puzzle-piece": "\u{f12e}",
"fa-qq": "\u{f1d6}",
"fa-qrcode": "\u{f029}",
"fa-question": "\u{f128}",
"fa-question-circle": "\u{f059}",
"fa-question-circle-o": "\u{f29c}",
"fa-quora": "\u{f2c4}",
"fa-quote-left": "\u{f10d}",
"fa-quote-right": "\u{f10e}",
"fa-ra": "\u{f1d0}",
"fa-random": "\u{f074}",
"fa-ravelry": "\u{f2d9}",
"fa-rebel": "\u{f1d0}",
"fa-recycle": "\u{f1b8}",
"fa-reddit": "\u{f1a1}",
"fa-reddit-alien": "\u{f281}",
"fa-reddit-square": "\u{f1a2}",
"fa-refresh": "\u{f021}",
"fa-registered": "\u{f25d}",
"fa-remove": "\u{f00d}",
"fa-renren": "\u{f18b}",
"fa-reorder": "\u{f0c9}",
"fa-repeat": "\u{f01e}",
"fa-reply": "\u{f112}",
"fa-reply-all": "\u{f122}",
"fa-resistance": "\u{f1d0}",
"fa-retweet": "\u{f079}",
"fa-rmb": "\u{f157}",
"fa-road": "\u{f018}",
"fa-rocket": "\u{f135}",
"fa-rotate-left": "\u{f0e2}",
"fa-rotate-right": "\u{f01e}",
"fa-rouble": "\u{f158}",
"fa-rss": "\u{f09e}",
"fa-rss-square": "\u{f143}",
"fa-rub": "\u{f158}",
"fa-ruble": "\u{f158}",
"fa-rupee": "\u{f156}",
"fa-safari": "\u{f267}",
"fa-save": "\u{f0c7}",
"fa-scissors": "\u{f0c4}",
"fa-scribd": "\u{f28a}",
"fa-search": "\u{f002}",
"fa-search-minus": "\u{f010}",
"fa-search-plus": "\u{f00e}",
"fa-sellsy": "\u{f213}",
"fa-send": "\u{f1d8}",
"fa-send-o": "\u{f1d9}",
"fa-server": "\u{f233}",
"fa-share": "\u{f064}",
"fa-share-alt": "\u{f1e0}",
"fa-share-alt-square": "\u{f1e1}",
"fa-share-square": "\u{f14d}",
"fa-share-square-o": "\u{f045}",
"fa-shekel": "\u{f20b}",
"fa-sheqel": "\u{f20b}",
"fa-shield": "\u{f132}",
"fa-ship": "\u{f21a}",
"fa-shirtsinbulk": "\u{f214}",
"fa-shopping-bag": "\u{f290}",
"fa-shopping-basket": "\u{f291}",
"fa-shopping-cart": "\u{f07a}",
"fa-shower": "\u{f2cc}",
"fa-sign-in": "\u{f090}",
"fa-sign-language": "\u{f2a7}",
"fa-sign-out": "\u{f08b}",
"fa-signal": "\u{f012}",
"fa-signing": "\u{f2a7}",
"fa-simplybuilt": "\u{f215}",
"fa-sitemap": "\u{f0e8}",
"fa-skyatlas": "\u{f216}",
"fa-skype": "\u{f17e}",
"fa-slack": "\u{f198}",
"fa-sliders": "\u{f1de}",
"fa-slideshare": "\u{f1e7}",
"fa-smile-o": "\u{f118}",
"fa-snapchat": "\u{f2ab}",
"fa-snapchat-ghost": "\u{f2ac}",
"fa-snapchat-square": "\u{f2ad}",
"fa-snowflake": "\u{f2dc}",
"fa-soccer-ball-o": "\u{f1e3}",
"fa-sort": "\u{f0dc}",
"fa-sort-alpha-asc": "\u{f15d}",
"fa-sort-alpha-desc": "\u{f15e}",
"fa-sort-amount-asc": "\u{f160}",
"fa-sort-amount-desc": "\u{f161}",
"fa-sort-asc": "\u{f0de}",
"fa-sort-desc": "\u{f0dd}",
"fa-sort-down": "\u{f0dd}",
"fa-sort-numeric-asc": "\u{f162}",
"fa-sort-numeric-desc": "\u{f163}",
"fa-sort-up": "\u{f0de}",
"fa-soundcloud": "\u{f1be}",
"fa-space-shuttle": "\u{f197}",
"fa-spinner": "\u{f110}",
"fa-spoon": "\u{f1b1}",
"fa-spotify": "\u{f1bc}",
"fa-square": "\u{f0c8}",
"fa-square-o": "\u{f096}",
"fa-stack-exchange": "\u{f18d}",
"fa-stack-overflow": "\u{f16c}",
"fa-star": "\u{f005}",
"fa-star-half": "\u{f089}",
"fa-star-half-empty": "\u{f123}",
"fa-star-half-full": "\u{f123}",
"fa-star-half-o": "\u{f123}",
"fa-star-o": "\u{f006}",
"fa-steam": "\u{f1b6}",
"fa-steam-square": "\u{f1b7}",
"fa-step-backward": "\u{f048}",
"fa-step-forward": "\u{f051}",
"fa-stethoscope": "\u{f0f1}",
"fa-sticky-note": "\u{f249}",
"fa-sticky-note-o": "\u{f24a}",
"fa-stop": "\u{f04d}",
"fa-stop-circle": "\u{f28d}",
"fa-stop-circle-o": "\u{f28e}",
"fa-street-view": "\u{f21d}",
"fa-strikethrough": "\u{f0cc}",
"fa-stumbleupon": "\u{f1a4}",
"fa-stumbleupon-circle": "\u{f1a3}",
"fa-subscript": "\u{f12c}",
"fa-subway": "\u{f239}",
"fa-suitcase": "\u{f0f2}",
"fa-sun-o": "\u{f185}",
"fa-superpowers": "\u{f2dd}",
"fa-superscript": "\u{f12b}",
"fa-support": "\u{f1cd}",
"fa-table": "\u{f0ce}",
"fa-tablet": "\u{f10a}",
"fa-tachometer": "\u{f0e4}",
"fa-tag": "\u{f02b}",
"fa-tags": "\u{f02c}",
"fa-tasks": "\u{f0ae}",
"fa-taxi": "\u{f1ba}",
"fa-telegram": "\u{f2c6}",
"fa-television": "\u{f26c}",
"fa-tencent-weibo": "\u{f1d5}",
"fa-terminal": "\u{f120}",
"fa-text-height": "\u{f034}",
"fa-text-width": "\u{f035}",
"fa-th": "\u{f00a}",
"fa-th-large": "\u{f009}",
"fa-th-list": "\u{f00b}",
"fa-themeisle": "\u{f2b2}",
"fa-thermometer-empty": "\u{f2cb}",
"fa-fa-thermometer-full": "\u{f2c7}",
"fa-fa-thermometer-half": "\u{f2c9}",
"fa-fa-thermometer-quarter": "\u{f2ca}",
"fa-thermometer-three-quarters": "\u{f2c8}",
"fa-thumb-tack": "\u{f08d}",
"fa-thumbs-down": "\u{f165}",
"fa-thumbs-o-down": "\u{f088}",
"fa-thumbs-o-up": "\u{f087}",
"fa-thumbs-up": "\u{f164}",
"fa-ticket": "\u{f145}",
"fa-times": "\u{f00d}",
"fa-times-circle": "\u{f057}",
"fa-times-circle-o": "\u{f05c}",
"fa-tint": "\u{f043}",
"fa-toggle-down": "\u{f150}",
"fa-toggle-left": "\u{f191}",
"fa-toggle-off": "\u{f204}",
"fa-toggle-on": "\u{f205}",
"fa-toggle-right": "\u{f152}",
"fa-toggle-up": "\u{f151}",
"fa-trademark": "\u{f25c}",
"fa-train": "\u{f238}",
"fa-transgender": "\u{f224}",
"fa-transgender-alt": "\u{f225}",
"fa-trash": "\u{f1f8}",
"fa-trash-o": "\u{f014}",
"fa-tree": "\u{f1bb}",
"fa-trello": "\u{f181}",
"fa-tripadvisor": "\u{f262}",
"fa-trophy": "\u{f091}",
"fa-truck": "\u{f0d1}",
"fa-try": "\u{f195}",
"fa-tty": "\u{f1e4}",
"fa-tumblr": "\u{f173}",
"fa-tumblr-square": "\u{f174}",
"fa-turkish-lira": "\u{f195}",
"fa-tv": "\u{f26c}",
"fa-twitch": "\u{f1e8}",
"fa-twitter": "\u{f099}",
"fa-twitter-square": "\u{f081}",
"fa-umbrella": "\u{f0e9}",
"fa-underline": "\u{f0cd}",
"fa-undo": "\u{f0e2}",
"fa-universal-access": "\u{f29a}",
"fa-university": "\u{f19c}",
"fa-unlink": "\u{f127}",
"fa-unlock": "\u{f09c}",
"fa-unlock-alt": "\u{f13e}",
"fa-unsorted": "\u{f0dc}",
"fa-upload": "\u{f093}",
"fa-usb": "\u{f287}",
"fa-usd": "\u{f155}",
"fa-user": "\u{f007}",
"fa-user-o": "\u{f2c0}",
"fa-user-md": "\u{f0f0}",
"fa-user-plus": "\u{f234}",
"fa-user-secret": "\u{f21b}",
"fa-user-times": "\u{f235}",
"fa-user-circle": "\u{f2bd}",
"fa-user-circle-o": "\u{f2be}",
"fa-users": "\u{f0c0}",
"fa-venus": "\u{f221}",
"fa-venus-double": "\u{f226}",
"fa-venus-mars": "\u{f228}",
"fa-viacoin": "\u{f237}",
"fa-viadeo": "\u{f2a9}",
"fa-viadeo-square": "\u{f2aa}",
"fa-video-camera": "\u{f03d}",
"fa-vimeo": "\u{f27d}",
"fa-vimeo-square": "\u{f194}",
"fa-vine": "\u{f1ca}",
"fa-vk": "\u{f189}",
"fa-volume-control-phone": "\u{f2a0}",
"fa-volume-down": "\u{f027}",
"fa-volume-off": "\u{f026}",
"fa-volume-up": "\u{f028}",
"fa-warning": "\u{f071}",
"fa-wechat": "\u{f1d7}",
"fa-weibo": "\u{f18a}",
"fa-weixin": "\u{f1d7}",
"fa-whatsapp": "\u{f232}",
"fa-wheelchair": "\u{f193}",
"fa-wheelchair-alt": "\u{f29b}",
"fa-wifi": "\u{f1eb}",
"fa-wikipedia-w": "\u{f266}",
"fa-window-close": "\u{f2d3}",
"fa-window-close-o": "\u{f2d4}",
"fa-window-maximize": "\u{f2d0}",
"fa-window-minimize": "\u{f2d1}",
"fa-window-restore": "\u{f2d2}",
"fa-windows": "\u{f17a}",
"fa-won": "\u{f159}",
"fa-wordpress": "\u{f19a}",
"fa-wpbeginner": "\u{f297}",
"fa-wpexplorer": "\u{f2de}",
"fa-wpforms": "\u{f298}",
"fa-wrench": "\u{f0ad}",
"fa-xing": "\u{f168}",
"fa-xing-square": "\u{f169}",
"fa-y-combinator": "\u{f23b}",
"fa-y-combinator-square": "\u{f1d4}",
"fa-yahoo": "\u{f19e}",
"fa-yc": "\u{f23b}",
"fa-yc-square": "\u{f1d4}",
"fa-yelp": "\u{f1e9}",
"fa-yen": "\u{f157}",
"fa-yoast": "\u{f2b1}",
"fa-youtube": "\u{f167}",
"fa-youtube-play": "\u{f16a}",
"fa-youtube-square": "\u{f166}"
]
| mit | 3fad9cea9f91e8e3ea85908c8ff293ab | 31.164245 | 120 | 0.526279 | 2.449651 | false | false | false | false |
drinkapoint/DrinkPoint-iOS | DrinkPoint/DrinkPoint/Games/Trivia/TriviaViewController.swift | 1 | 9155 | //
// TriviaViewController.swift
// DrinkPoint
//
// Created by Paul Kirk Adams on 7/13/16.
// Copyright © 2016 Paul Kirk Adams. All rights reserved.
//
import UIKit
import AVFoundation
class TriviaViewController: UIViewController {
var singleGameSound: AVAudioPlayer!
var questionNumber = 5
var sum = 0
var correctAnswer = 0
var random = 0
var quizArray = [NSMutableArray]()
var count = 0
var timer: NSTimer!
var ansTrueAnimeArray: Array<UIImage> = []
var ansFalseAnimeArray: Array<UIImage> = []
let answerQuestion: UIImage! = UIImage(named: "TriviaQuestion.png")
let answerTrue: UIImage! = UIImage(named: "TriviaTrue.png")
let answerFalse: UIImage! = UIImage(named: "TriviaFalse.png")
@IBOutlet var quizTextView: UITextView!
@IBOutlet var choiceButtons: Array<UIButton>!
@IBOutlet var answerMark: UIImageView!
override func prefersStatusBarHidden() -> Bool {
return true
}
override func viewDidLoad() {
super.viewDidLoad()
self.navigationController?.navigationBarHidden = false
ansTrueAnimeArray.append(answerTrue)
ansFalseAnimeArray.append(answerFalse)
quizArray.append([
"How do crickets hear?",
"Through their wings",
"Through their belly",
"Through their knees",
"Through their tongue",
3, 1])
quizArray.append([
"Which American city invented plastic vomit?",
"Chicago",
"Detroit",
"Columbus",
"Baltimore",
1, 2])
quizArray.append([
"In ‘Ben Hur,’ which modern object can be seen during the chariot scene?",
"A waitress",
"A car",
"A mailbox",
"A street lamp",
2, 3])
quizArray.append([
"What was Karl Marx’s favorite color?",
"Brown",
"Blue",
"Red",
"Purple",
3, 4])
quizArray.append([
"What’s the best way to stop crying while peeling onions?",
"Lick almonds",
"Suck lemons",
"Eat cheese",
"Chew gum",
4, 5])
quizArray.append([
"How old was the youngest Pope?",
"11",
"17",
"22",
"29",
1, 6])
quizArray.append([
"Which animal sleeps for only five minutes a day?",
"A chameleon",
"A koala",
"A giraffe",
"A beaver",
3, 7])
quizArray.append([
"How many words in the English language end in “dous”?",
"Two",
"Four",
"Six",
"Eight",
2, 8])
quizArray.append([
"One human hair can support how many kilograms?",
"Three",
"Five",
"Seven",
"Nine",
1, 9])
quizArray.append([
"The bikini was originally called the what?",
"Poke",
"Range",
"Half",
"Atom",
4, 10])
quizArray.append([
"Which European city is home to the Fairy Investigation Society?",
"Poznan",
"Dublin",
"Bratislava",
"Tallinn",
2, 11])
quizArray.append([
"What’s a frog’s favorite color?",
"Blue",
"Orange",
"Yellow",
"Brown",
1, 12])
quizArray.append([
"Which one of these planets rotates clockwise?",
"Uranus",
"Mercury",
"Pluto",
"Venus",
4, 13])
quizArray.append([
"What perspires half a pint of fluid a day?",
"Your scalp",
"Your armpits",
"Your feet",
"Your buttocks",
3, 14])
quizArray.append([
"Saint Stephen is the patron saint of who?",
"Plumbers",
"Bricklayers",
"Roofers",
"Carpenters",
2, 15])
quizArray.append([
"Which country leads the world in cork production?",
"Greece",
"Australia",
"Spain",
"Mexico",
3, 16])
quizArray.append([
"On average, what do you do 15 times a day?",
"Laugh",
"Burp",
"Fart",
"Lick your lips",
1, 17])
quizArray.append([
"What color was Coca-Cola originally?",
"Red",
"Purple",
"Beige",
"Green",
4, 18])
quizArray.append([
"Bubble gum contains what?",
"Plastic",
"Calcium",
"Rubber",
"Pepper",
3, 19])
quizArray.append([
"The inventor of the paint roller was of which nationality?",
"Hungarian",
"Canadian",
"Norwegian",
"Argentinian",
2, 20])
choiceQuiz()
timer = NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: #selector(TriviaViewController.OnUpdate(_:)), userInfo: nil, repeats: true)
timer.fire()
}
func playSingleGameSound(filename: String) {
let url = NSBundle.mainBundle().URLForResource(filename, withExtension: nil)
guard let singleGameSoundURL = url else {
print("Could not find file: \(filename)")
return
}
do {
singleGameSound = try AVAudioPlayer(contentsOfURL: singleGameSoundURL)
singleGameSound.prepareToPlay()
singleGameSound.play()
singleGameSound.volume = 1
} catch let error as NSError {
print(error.description)
}
}
func vibrate() {
AudioServicesPlaySystemSound(SystemSoundID(kSystemSoundID_Vibrate))
}
func delay(delay: Double, closure: ()->()) {
dispatch_after(
dispatch_time(
DISPATCH_TIME_NOW,
Int64(delay * Double(NSEC_PER_SEC))
),
dispatch_get_main_queue(), closure)
}
func choiceQuiz() {
if quizArray.count == 0 {
random = 0
} else {
random = Int(arc4random_uniform(UInt32(quizArray.count)))
}
quizTextView.text = quizArray[random][0] as! NSString as String
for i in 0 ..< choiceButtons.count {
choiceButtons[i].setTitle(quizArray[random][i+1] as! NSString as String, forState: .Normal)
choiceButtons[i].tag = i + 1;
}
}
@IBAction func choiceAnswer(sender: UIButton) {
sum += 1
print("\(sum) of \(questionNumber - sum + 1) questions remaining", terminator: "")
print("Question #\(random)")
print("The correct choice to \(quizArray[random][5] as! Int) is \(sender.tag)")
answerMark.alpha = 1
if quizArray[random][5] as! Int == sender.tag {
correctAnswer += 1
print("Player's choice is correct")
let image = UIImage(named: "TriviaTrue.png")!
answerMark.image = image
self.playSingleGameSound("TriviaTrue.wav")
} else {
print("Player's choice is incorrect")
let image = UIImage(named: "TriviaFalse.png")!
answerMark.image = image
self.playSingleGameSound("TriviaFalse.wav")
vibrate()
}
delay((2/3), closure: { () -> () in
if self.sum == self.questionNumber {
self.delay((1/2), closure: {
self.answerMark.alpha = 0
self.answerMark.image = nil
self.playSingleGameSound("TriviaResults.wav")
self.performSegueToResult()
})
} else {
self.quizArray.removeAtIndex(self.random)
self.choiceQuiz()
let image = UIImage(named: "TriviaQuestion.png")!
self.answerMark.alpha = 1
self.answerMark.image = image
}
})
count = 5
print("The answer is \(correctAnswer).")
}
func OnUpdate(timer: NSTimer){
self.count -= 1
print(self.count)
}
func performSegueToResult() {
performSegueWithIdentifier("toResultsView", sender: nil)
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
if (segue.identifier == "toResultsView") {
let ResultView: TriviaResultsViewController = segue.destinationViewController as! TriviaResultsViewController
ResultView.questionNumber = self.questionNumber
ResultView.correctAnswer = self.correctAnswer
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
} | mit | c0c554fab90ba512fccfce32e43f5def | 28.672078 | 157 | 0.508645 | 4.626835 | false | false | false | false |
saagarjha/iina | iina/Switch.swift | 1 | 4743 | //
// Switch.swift
// iina
//
// Created by Collider LI on 12/6/2020.
// Copyright © 2020 lhc. All rights reserved.
//
import Cocoa
@IBDesignable
class Switch: NSView {
private var _title = ""
private var _checkboxMargin = true
private var _checked = false
private var _switchOnLeft = false
@IBInspectable var title: String {
get {
return _title
}
set {
_title = NSLocalizedString(newValue, comment: newValue)
if #available(macOS 10.15, *) {
label?.stringValue = _title
} else {
checkbox?.title = (checkboxMargin ? " " : "") + _title
}
}
}
@IBInspectable var checkboxMargin: Bool {
get {
return _checkboxMargin
}
set {
_checkboxMargin = newValue
guard let checkbox = checkbox else { return }
if newValue {
checkbox.title = " " + checkbox.title
} else {
checkbox.title = String(checkbox.title.dropFirst())
}
}
}
var checked: Bool {
get {
return _checked
}
set {
_checked = newValue
if #available(macOS 10.15, *) {
(nsSwitch as! NSSwitch).state = _checked ? .on : .off
} else {
checkbox?.state = _checked ? .on : .off
}
}
}
private lazy var viewMap: [String: Any] = {
["l": label!, "s": nsSwitch!]
}()
private lazy var switchOnLeftConstraint = {
NSLayoutConstraint.constraints(withVisualFormat: "H:|-0-[s]-8-[l]-(>=0)-|", options: [], metrics: nil, views: viewMap)
}()
private lazy var switchOnRightConstraint = {
NSLayoutConstraint.constraints(withVisualFormat: "H:|-0-[l]-(>=8)-[s]-0-|", options: [], metrics: nil, views: viewMap)
}()
@IBInspectable var switchOnLeft: Bool {
get {
return _switchOnLeft
}
set {
if #available(macOS 10.15, *) {
if newValue {
NSLayoutConstraint.deactivate(switchOnRightConstraint)
NSLayoutConstraint.activate(switchOnLeftConstraint)
} else {
NSLayoutConstraint.deactivate(switchOnLeftConstraint)
NSLayoutConstraint.activate(switchOnRightConstraint)
}
}
_switchOnLeft = newValue
}
}
@IBInspectable var isEnabled: Bool {
get {
if #available(macOS 10.15, *) {
return (nsSwitch as? NSSwitch)?.isEnabled ?? false
} else {
return checkbox?.isEnabled ?? false
}
}
set {
if #available(macOS 10.15, *) {
(nsSwitch as? NSSwitch)?.isEnabled = newValue
} else {
checkbox?.isEnabled = newValue
}
}
}
override var intrinsicContentSize: NSSize {
if #available(macOS 10.15, *) {
return NSSize(width: 0, height: 22)
} else {
return NSSize(width: 0, height: 14)
}
}
var action: (Bool) -> Void = { _ in }
private var nsSwitch: Any?
private var label: NSTextField?
private var checkbox: NSButton?
private func setupSubViews() {
if #available(macOS 10.15, *) {
let label = NSTextField(labelWithString: title)
let nsSwitch = NSSwitch()
nsSwitch.target = self
nsSwitch.action = #selector(statusChanged)
label.translatesAutoresizingMaskIntoConstraints = false
nsSwitch.translatesAutoresizingMaskIntoConstraints = false
addSubview(label)
addSubview(nsSwitch)
self.nsSwitch = nsSwitch
self.label = label
if switchOnLeft {
NSLayoutConstraint.activate(switchOnLeftConstraint)
} else {
NSLayoutConstraint.activate(switchOnRightConstraint)
}
label.centerYAnchor.constraint(equalTo: self.centerYAnchor).isActive = true
nsSwitch.centerYAnchor.constraint(equalTo: self.centerYAnchor).isActive = true
} else {
let checkbox: NSButton
if #available(macOS 10.12, *) {
checkbox = NSButton(checkboxWithTitle: title, target: self, action: #selector(statusChanged))
} else {
checkbox = NSButton()
checkbox.setButtonType(.switch)
checkbox.target = self
checkbox.action = #selector(statusChanged)
}
checkbox.translatesAutoresizingMaskIntoConstraints = false
self.checkbox = checkbox
addSubview(checkbox)
Utility.quickConstraints(["H:|-0-[b]-(>=0)-|"], ["b": checkbox])
checkbox.centerYAnchor.constraint(equalTo: self.centerYAnchor).isActive = true
}
}
override init(frame frameRect: NSRect) {
super.init(frame: frameRect)
setupSubViews()
}
required init?(coder: NSCoder) {
super.init(coder: coder)
setupSubViews()
}
@objc func statusChanged() {
if #available(macOS 10.15, *) {
_checked = (nsSwitch as! NSSwitch).state == .on
} else {
_checked = checkbox!.state == .on
}
self.action(_checked)
}
}
| gpl-3.0 | 2fd5f143e0b698c8a4b0de356ba1caf7 | 26.097143 | 122 | 0.617672 | 4.303085 | false | false | false | false |
milseman/swift | test/Reflection/typeref_lowering_objc.swift | 13 | 1630 | // RUN: %empty-directory(%t)
// RUN: %target-build-swift %S/Inputs/TypeLoweringObjectiveC.swift -parse-as-library -emit-module -emit-library -module-name TypeLowering -o %t/libTypesToReflect
// RUN: %target-swift-reflection-dump -binary-filename %t/libTypesToReflect -binary-filename %platform-module-dir/libswiftCore.dylib -dump-type-lowering < %s | %FileCheck %s
// REQUIRES: objc_interop
// REQUIRES: CPU=x86_64
12TypeLowering14FunctionStructV
// CHECK: (struct TypeLowering.FunctionStruct)
// CHECK-NEXT: (struct size=8 alignment=8 stride=8 num_extra_inhabitants=2147483647
// CHECK-NEXT: (field name=blockFunction offset=0
// CHECK-NEXT: (reference kind=strong refcounting=unknown)))
12TypeLowering14HasObjCClassesC
// CHECK: (class TypeLowering.HasObjCClasses)
// CHECK-NEXT: (reference kind=strong refcounting=native)
12TypeLowering16NSObjectSubclassC
// CHECK: (class TypeLowering.NSObjectSubclass)
// CHECK-NEXT: (reference kind=strong refcounting=unknown)
12TypeLowering11HasObjCEnumV
// CHECK: (struct size=24 alignment=8 stride=24 num_extra_inhabitants=0
// CHECK-NEXT: (field name=optionalEnum offset=0
// CHECK-NEXT: (single_payload_enum size=9 alignment=8 stride=16 num_extra_inhabitants=0
// CHECK-NEXT: (field name=some offset=0
// CHECK-NEXT: (builtin size=8 alignment=8 stride=8 num_extra_inhabitants=0))))
// CHECK-NEXT: (field name=reference offset=16
// CHECK-NEXT: (class_existential size=8 alignment=8 stride=8 num_extra_inhabitants=2147483647
// CHECK-NEXT: (field name=object offset=0
// CHECK-NEXT: (reference kind=strong refcounting=unknown)))))
| apache-2.0 | d8523c3a4cac7bb03d2ef41ce3a84ae5 | 51.580645 | 173 | 0.753374 | 3.614191 | false | false | false | false |
kbelter/SnazzyList | Example/Pods/Quick/Sources/Quick/Example.swift | 3 | 3846 | import Foundation
#if canImport(Darwin)
// swiftlint:disable type_name
@objcMembers
public class _ExampleBase: NSObject {}
#else
public class _ExampleBase: NSObject {}
// swiftlint:enable type_name
#endif
/**
Examples, defined with the `it` function, use assertions to
demonstrate how code should behave. These are like "tests" in XCTest.
*/
final public class Example: _ExampleBase {
/**
A boolean indicating whether the example is a shared example;
i.e.: whether it is an example defined with `itBehavesLike`.
*/
public var isSharedExample = false
/**
The site at which the example is defined.
This must be set correctly in order for Xcode to highlight
the correct line in red when reporting a failure.
*/
public var callsite: Callsite
weak internal var group: ExampleGroup?
private let internalDescription: String
private let closure: () -> Void
private let flags: FilterFlags
internal init(description: String, callsite: Callsite, flags: FilterFlags, closure: @escaping () -> Void) {
self.internalDescription = description
self.closure = closure
self.callsite = callsite
self.flags = flags
}
public override var description: String {
return internalDescription
}
/**
The example name. A name is a concatenation of the name of
the example group the example belongs to, followed by the
description of the example itself.
The example name is used to generate a test method selector
to be displayed in Xcode's test navigator.
*/
public var name: String {
guard let groupName = group?.name else { return description }
return "\(groupName), \(description)"
}
/**
Executes the example closure, as well as all before and after
closures defined in the its surrounding example groups.
*/
public func run() {
let world = World.sharedWorld
if world.numberOfExamplesRun == 0 {
world.suiteHooks.executeBefores()
}
let exampleMetadata = ExampleMetadata(example: self, exampleIndex: world.numberOfExamplesRun)
world.currentExampleMetadata = exampleMetadata
defer {
world.currentExampleMetadata = nil
}
world.exampleHooks.executeBefores(exampleMetadata)
group!.phase = .beforesExecuting
for before in group!.befores {
before(exampleMetadata)
}
group!.phase = .beforesFinished
closure()
group!.phase = .aftersExecuting
for after in group!.afters {
after(exampleMetadata)
}
group!.phase = .aftersFinished
world.exampleHooks.executeAfters(exampleMetadata)
world.numberOfExamplesRun += 1
if !world.isRunningAdditionalSuites && world.numberOfExamplesRun >= world.cachedIncludedExampleCount {
world.suiteHooks.executeAfters()
}
}
/**
Evaluates the filter flags set on this example and on the example groups
this example belongs to. Flags set on the example are trumped by flags on
the example group it belongs to. Flags on inner example groups are trumped
by flags on outer example groups.
*/
internal var filterFlags: FilterFlags {
var aggregateFlags = flags
for (key, value) in group!.filterFlags {
aggregateFlags[key] = value
}
return aggregateFlags
}
}
extension Example {
/**
Returns a boolean indicating whether two Example objects are equal.
If two examples are defined at the exact same callsite, they must be equal.
*/
@nonobjc public static func == (lhs: Example, rhs: Example) -> Bool {
return lhs.callsite == rhs.callsite
}
}
| apache-2.0 | fb946b9b3b535400be7d285ea6fef176 | 30.268293 | 111 | 0.653926 | 4.956186 | false | false | false | false |
AcerFeng/SwiftProject | PlayLocalVideo/PlayLocalVideo/MasterViewController.swift | 1 | 2333 | //
// MasterViewController.swift
// PlayLocalVideo
//
// Created by lanfeng on 16/11/14.
// Copyright © 2016年 lanfeng. All rights reserved.
//
import UIKit
import AVKit
import AVFoundation
class MasterViewController: UITableViewController {
@IBOutlet var videoTableView: UITableView!
var data = [
video(image: "videoScreenshot01", title: "Introduce 3DS Mario", source: "Youtube - 06:32"),
video(image: "videoScreenshot02", title: "Emoji Among Us", source: "Vimeo - 3:34"),
video(image: "videoScreenshot03", title: "Seals Documentary", source: "Vine - 00:06"),
video(image: "videoScreenshot04", title: "Adventure Time", source: "Youtube - 02:39"),
video(image: "videoScreenshot05", title: "Facebook HQ", source: "Facebook - 10:20"),
video(image: "videoScreenshot06", title: "Lijiang Lugu Lake", source: "Allen - 20:30")
]
var playViewController = AVPlayerViewController()
var playerView = AVPlayer()
@IBAction func playVideoButtonTouch(_ sender: AnyObject) {
let path = Bundle.main.path(forResource: "emoji zone", ofType: "mp4")
playerView = AVPlayer(url: URL(fileURLWithPath: path!))
playViewController.player = playerView
self.present(playViewController, animated: true) {
self.playViewController.player?.play()
}
}
override func viewDidLoad() {
super.viewDidLoad()
}
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 220
}
override func numberOfSections(in tableView: UITableView) -> Int {
return 2
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return data.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "VideoCell", for: indexPath) as! VideoCell
let video = data[(indexPath as NSIndexPath).row]
cell.videoScreenshot.image = UIImage(named: video.image)
cell.videoTitleLabel.text = video.title
cell.videoSourceLabel.text = video.source
return cell
}
}
| apache-2.0 | c428e86bd1493784f2f8bcef8a788816 | 31.816901 | 109 | 0.651073 | 4.669339 | false | false | false | false |
HabitRPG/habitrpg-ios | Habitica API Client/Habitica API Client/Models/User/APIUser.swift | 1 | 4275 | //
// APIUser.swift
// Habitica API Client
//
// Created by Phillip Thelen on 07.03.18.
// Copyright © 2018 HabitRPG Inc. All rights reserved.
//
import Foundation
import Habitica_Models
public class APIUser: UserProtocol, Decodable {
public var party: UserPartyProtocol?
public var id: String?
public var stats: StatsProtocol?
public var flags: FlagsProtocol?
public var preferences: PreferencesProtocol?
public var profile: ProfileProtocol?
public var contributor: ContributorProtocol?
public var backer: BackerProtocol?
public var items: UserItemsProtocol?
public var balance: Float = 0
public var tasksOrder: [String: [String]]
public var tags: [TagProtocol]
public var needsCron: Bool = false
public var lastCron: Date?
public var inbox: InboxProtocol?
public var authentication: AuthenticationProtocol?
public var purchased: PurchasedProtocol?
public var challenges: [ChallengeMembershipProtocol]
public var hasNewMessages: [UserNewMessagesProtocol]
public var invitations: [GroupInvitationProtocol]
public var pushDevices: [PushDeviceProtocol]
public var isValid: Bool { return true }
public var achievements: UserAchievementsProtocol?
enum CodingKeys: String, CodingKey {
case id
case stats
case flags
case preferences
case profile
case contributor
case backer
case items
case balance
case tasksOrder
case tags
case needsCron
case lastCron
case inbox
case authentication = "auth"
case purchased
case party
case challenges
case hasNewMessages = "newMessages"
case invitations
case pushDevices
case achievements
}
public required init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: CodingKeys.self)
id = try? values.decode(String.self, forKey: .id)
stats = (try? values.decode(APIStats.self, forKey: .stats))
flags = (try? values.decode(APIFlags.self, forKey: .flags))
preferences = (try? values.decode(APIPreferences.self, forKey: .preferences))
profile = (try? values.decode(APIProfile.self, forKey: .profile))
contributor = (try? values.decode(APIContributor.self, forKey: .contributor))
backer = (try? values.decode(APIBacker.self, forKey: .backer))
items = (try? values.decode(APIUserItems.self, forKey: .items))
balance = (try? values.decode(Float.self, forKey: .balance)) ?? -1
tasksOrder = (try? values.decode([String: [String]].self, forKey: .tasksOrder)) ?? [:]
tags = (try? values.decode([APITag].self, forKey: .tags)) ?? []
tags.enumerated().forEach { (arg) in
arg.element.order = arg.offset
}
needsCron = (try? values.decode(Bool.self, forKey: .needsCron)) ?? false
lastCron = try? values.decode(Date.self, forKey: .lastCron)
inbox = try? values.decode(APIInbox.self, forKey: .inbox)
authentication = try? values.decode(APIAuthentication.self, forKey: .authentication)
purchased = try? values.decode(APIPurchased.self, forKey: .purchased)
party = try? values.decode(APIUserParty.self, forKey: .party)
let challengeList = (try? values.decode([String].self, forKey: .challenges)) ?? []
challenges = challengeList.map { challengeID in
return APIChallengeMembership(challengeID: challengeID)
}
hasNewMessages = (try? values.decode([String: APIUserNewMessages].self, forKey: .hasNewMessages).map({ (key, value) in
value.id = key
return value
})) ?? []
let invitationsHelper = try? values.decode(APIGroupInvitationHelper.self, forKey: .invitations)
invitationsHelper?.parties?.forEach({ (invitation) in
invitation.isPartyInvitation = true
})
invitations = (invitationsHelper?.guilds ?? []) + (invitationsHelper?.parties ?? [])
pushDevices = (try? values.decode([APIPushDevice].self, forKey: .pushDevices)) ?? []
achievements = try? values.decode(APIUserAchievements.self, forKey: .achievements)
}
}
| gpl-3.0 | 1801af2a71e8419dbc5c8c1ec4b37cb6 | 39.704762 | 126 | 0.658634 | 4.330294 | false | false | false | false |
nProdanov/FuelCalculator | Fuel economy smart calc./Fuel economy smart calc./DbModelCharge.swift | 1 | 3123 | //
// DbModelCharge.swift
// Fuel economy smart calc.
//
// Created by Nikolay Prodanow on 3/28/17.
// Copyright © 2017 Nikolay Prodanow. All rights reserved.
//
import CoreData
class DbModelCharge: NSManagedObject
{
class func createCharge(with chargeInfo: Charge, in context: NSManagedObjectContext) throws -> DbModelCharge
{
let charge = DbModelCharge(context: context)
charge.gasStation = try? DbModelGasStation.findOrCreateGasStation(with: chargeInfo.gasStation, in: context)
charge.chargedFuel = chargeInfo.chargedFuel
charge.chargingDate = chargeInfo.chargingDate as NSDate?
charge.distancePast = chargeInfo.distancePast!
charge.distanceUnit = chargeInfo.distanceUnit
charge.fuelConsumption = chargeInfo.fuelConsumption!
charge.priceConsumption = chargeInfo.priceConsumption!
charge.fuelUnit = chargeInfo.fuelUnit
charge.priceUnit = chargeInfo.priceUnit
charge.price = chargeInfo.price
charge.id = chargeInfo.id
try? context.save()
return charge
}
class func findOrCreateCharge(with chargeInfo: Charge, in context: NSManagedObjectContext) throws -> DbModelCharge
{
let request: NSFetchRequest<DbModelCharge> = DbModelCharge.fetchRequest()
request.predicate = NSPredicate(format: "id = %@", chargeInfo.id)
do {
let matches = try context.fetch(request)
if matches.count > 0 {
assert(matches.count == 1, "db model gas station -- inconsistency")
return matches[0]
}
} catch {
throw error
}
let charge = DbModelCharge(context: context)
charge.id = chargeInfo.id
charge.chargedFuel = chargeInfo.chargedFuel
charge.chargingDate = chargeInfo.chargingDate as NSDate?
charge.distancePast = chargeInfo.distancePast!
charge.distanceUnit = chargeInfo.distanceUnit
charge.fuelConsumption = chargeInfo.fuelConsumption!
charge.fuelUnit = chargeInfo.fuelUnit
charge.gasStation = try? DbModelGasStation.findOrCreateGasStation(with: chargeInfo.gasStation, in: context)
charge.price = chargeInfo.price
charge.priceConsumption = chargeInfo.priceConsumption!
charge.priceUnit = chargeInfo.priceUnit
return charge
}
class func delete(byId id: String, in context: NSManagedObjectContext) throws
{
let request: NSFetchRequest<DbModelCharge> = DbModelCharge.fetchRequest()
request.predicate = NSPredicate(format: "id = %@", id)
do {
var matches = try context.fetch(request)
if matches.count > 0 {
assert(matches.count == 1, "Cannot have more than 1 current charge per time")
context.delete(matches[0])
try? context.save()
} else {
// Throw eror - no current charge
}
} catch {
throw error
}
}
}
| mit | f44968eca44c9dd37633d37451b92be6 | 35.302326 | 118 | 0.630685 | 4.652757 | false | false | false | false |
rb-de0/tech.reb-dev.com | Sources/App/Models/DTO/Siteinfo.swift | 2 | 1840 | import FluentProvider
import Validation
final class Siteinfo: Model, JSONRepresentable {
static let `default` = Siteinfo(sitename: "vapor-cms", overview: "A simple cms server written by swift.")
static let entity = "siteinfo"
let storage = Storage()
var sitename: String
var overview: String
init(request: Request) throws {
sitename = request.data["sitename"]?.string ?? ""
overview = request.data["overview"]?.string ?? ""
try validate()
}
func validate() throws {
try sitename.validated(by: Count.containedIn(low: 1, high: 30))
try overview.validated(by: Count.containedIn(low: 1, high: 200))
}
init(sitename: String, overview: String) {
self.sitename = sitename
self.overview = overview
}
required init(row: Row) throws {
sitename = try row.get("sitename")
overview = try row.get("overview")
}
func makeRow() throws -> Row {
var row = Row()
try row.set("sitename", sitename)
try row.set("overview", overview)
return row
}
func makeJSON() throws -> JSON {
var json = JSON()
try json.set("sitename", sitename)
try json.set("overview", overview)
return json
}
}
// MARK: - Preparation
extension Siteinfo: Preparation {
static func prepare(_ database: Fluent.Database) throws {}
static func revert(_ database: Fluent.Database) throws {}
}
extension Siteinfo: Updateable {
func update(for req: Request) throws {
sitename = req.data["sitename"]?.string ?? ""
overview = req.data["overview"]?.string ?? ""
try validate()
}
static var updateableKeys: [UpdateableKey<Siteinfo>] {
return []
}
}
| mit | 64fdeecfd6c8a4c2387ca7e8e039ea96 | 24.205479 | 109 | 0.586957 | 4.319249 | false | false | false | false |
roecrew/AudioKit | AudioKit/Common/Nodes/Effects/Filters/Low Shelf Parametric Equalizer Filter/AKLowShelfParametricEqualizerFilter.swift | 1 | 5643 | //
// AKLowShelfParametricEqualizerFilter.swift
// AudioKit
//
// Created by Aurelius Prochazka, revision history on Github.
// Copyright (c) 2016 Aurelius Prochazka. All rights reserved.
//
import AVFoundation
/// This is an implementation of Zoelzer's parametric equalizer filter.
///
/// - Parameters:
/// - input: Input node to process
/// - cornerFrequency: Corner frequency.
/// - gain: Amount at which the corner frequency value shall be increased or decreased. A value of 1 is a flat response.
/// - q: Q of the filter. sqrt(0.5) is no resonance.
///
public class AKLowShelfParametricEqualizerFilter: AKNode, AKToggleable {
// MARK: - Properties
internal var internalAU: AKLowShelfParametricEqualizerFilterAudioUnit?
internal var token: AUParameterObserverToken?
private var cornerFrequencyParameter: AUParameter?
private var gainParameter: AUParameter?
private var qParameter: AUParameter?
/// Ramp Time represents the speed at which parameters are allowed to change
public var rampTime: Double = AKSettings.rampTime {
willSet {
if rampTime != newValue {
internalAU?.rampTime = newValue
internalAU?.setUpParameterRamp()
}
}
}
/// Corner frequency.
public var cornerFrequency: Double = 1000 {
willSet {
if cornerFrequency != newValue {
if internalAU!.isSetUp() {
cornerFrequencyParameter?.setValue(Float(newValue), originator: token!)
} else {
internalAU?.cornerFrequency = Float(newValue)
}
}
}
}
/// Amount at which the corner frequency value shall be increased or decreased. A value of 1 is a flat response.
public var gain: Double = 1.0 {
willSet {
if gain != newValue {
if internalAU!.isSetUp() {
gainParameter?.setValue(Float(newValue), originator: token!)
} else {
internalAU?.gain = Float(newValue)
}
}
}
}
/// Q of the filter. sqrt(0.5) is no resonance.
public var q: Double = 0.707 {
willSet {
if q != newValue {
if internalAU!.isSetUp() {
qParameter?.setValue(Float(newValue), originator: token!)
} else {
internalAU?.q = Float(newValue)
}
}
}
}
/// Tells whether the node is processing (ie. started, playing, or active)
public var isStarted: Bool {
return internalAU!.isPlaying()
}
// MARK: - Initialization
/// Initialize this equalizer node
///
/// - Parameters:
/// - input: Input node to process
/// - cornerFrequency: Corner frequency.
/// - gain: Amount at which the corner frequency value shall be increased or decreased. A value of 1 is a flat response.
/// - q: Q of the filter. sqrt(0.5) is no resonance.
///
public init(
_ input: AKNode,
cornerFrequency: Double = 1000,
gain: Double = 1.0,
q: Double = 0.707) {
self.cornerFrequency = cornerFrequency
self.gain = gain
self.q = q
var description = AudioComponentDescription()
description.componentType = kAudioUnitType_Effect
description.componentSubType = fourCC("peq1")
description.componentManufacturer = fourCC("AuKt")
description.componentFlags = 0
description.componentFlagsMask = 0
AUAudioUnit.registerSubclass(
AKLowShelfParametricEqualizerFilterAudioUnit.self,
asComponentDescription: description,
name: "Local AKLowShelfParametricEqualizerFilter",
version: UInt32.max)
super.init()
AVAudioUnit.instantiateWithComponentDescription(description, options: []) {
avAudioUnit, error in
guard let avAudioUnitEffect = avAudioUnit else { return }
self.avAudioNode = avAudioUnitEffect
self.internalAU = avAudioUnitEffect.AUAudioUnit as? AKLowShelfParametricEqualizerFilterAudioUnit
AudioKit.engine.attachNode(self.avAudioNode)
input.addConnectionPoint(self)
}
guard let tree = internalAU?.parameterTree else { return }
cornerFrequencyParameter = tree.valueForKey("cornerFrequency") as? AUParameter
gainParameter = tree.valueForKey("gain") as? AUParameter
qParameter = tree.valueForKey("q") as? AUParameter
token = tree.tokenByAddingParameterObserver {
address, value in
dispatch_async(dispatch_get_main_queue()) {
if address == self.cornerFrequencyParameter!.address {
self.cornerFrequency = Double(value)
} else if address == self.gainParameter!.address {
self.gain = Double(value)
} else if address == self.qParameter!.address {
self.q = Double(value)
}
}
}
internalAU?.cornerFrequency = Float(cornerFrequency)
internalAU?.gain = Float(gain)
internalAU?.q = Float(q)
}
// MARK: - Control
/// Function to start, play, or activate the node, all do the same thing
public func start() {
self.internalAU!.start()
}
/// Function to stop or bypass the node, both are equivalent
public func stop() {
self.internalAU!.stop()
}
}
| mit | 2d790a638d4960b623c3d0cecd09feef | 33.408537 | 126 | 0.595074 | 5.09296 | false | false | false | false |
iziz/libPhoneNumber-iOS | libPhoneNumber-Demo/libPhoneNumber-Demo/GeocodingTableView.swift | 1 | 3969 | //
// GeocodingTableView.swift
// libPhoneNumber-Demo
//
// Created by Rastaar Haghi on 7/17/20.
// Copyright © 2020 Google LLC. All rights reserved.
//
import SwiftUI
import libPhoneNumberGeocoding
import libPhoneNumber_iOS
struct GeocodingTableView: View {
// Keep track of runtime statistics
var maxRuntime: CGFloat = 0.00
var minRuntime: CGFloat = 0.00
var totalRuntime: CGFloat = 0.00
var averageRuntime: CGFloat = 0.00
init() {
for _ in 1...50 {
makeGeocodingAPICalls()
}
self.maxRuntime = runtimeArray.max() ?? 0.0
self.minRuntime = runtimeArray.min() ?? 0.0
self.totalRuntime = 0.00
for i in 0..<500 {
totalRuntime += runtimeArray[i]
runtimeArray[i] = runtimeArray[i] / maxRuntime
}
self.averageRuntime = totalRuntime / CGFloat(runtimeArray.count)
}
var body: some View {
VStack {
Form {
Section(header: Text("This table makes 500 Geocoding API calls")) {
List {
ForEach(regionDescriptions, id: \.self) { pair in
HStack {
Text(pair[0]!)
Spacer()
Text(pair[1]!)
}
}
}
}
}
Form {
Section(header: Text("Runtime Performance for Geocoding API Calls")) {
LineGraph(dataPoints: runtimeArray)
.stroke(Color.green, lineWidth: 2)
.aspectRatio(16 / 9, contentMode: .fit)
.border(Color.gray, width: 1)
.padding()
}
Section(header: Text("Statistics for Runtime Performance (in milliseconds)")) {
List {
Text("Average API Call Runtime: \(round(averageRuntime).description)")
Text("Longest API Call Runtime: \(round(maxRuntime).description)")
Text("Shortest API Call Runtime: \(round(minRuntime).description)")
Text("Total Runtime: \(round(totalRuntime).description)")
}
}
}
}
.navigationBarTitle("Large Set of Geocoding Calls")
}
}
struct GeocodingTableView_Previews: PreviewProvider {
static var previews: some View {
GeocodingTableView()
}
}
extension GeocodingTableView {
// Fetch Geocoding info for each number in phoneNumbers
func makeGeocodingAPICalls() {
for phoneNumber in phoneNumbers {
do {
let startTimer = DispatchTime.now()
let parsedPhoneNumber = try phoneUtil.parse(phoneNumber, defaultRegion: "US")
regionDescriptions.append([
phoneNumber,
geocoder.description(for: parsedPhoneNumber),
])
let endTimer = DispatchTime.now()
let runtimeData = CGFloat(endTimer.uptimeNanoseconds - startTimer.uptimeNanoseconds)
runtimeArray.append(runtimeData / 1000000.0)
} catch {
print(error)
}
}
}
// Graph Design based from: https://www.objc.io/blog/2020/03/16/swiftui-line-graph-animation/
struct LineGraph: Shape {
var dataPoints: [CGFloat]
func path(in rect: CGRect) -> Path {
func point(at ix: Int) -> CGPoint {
let point = dataPoints[ix]
let x = rect.width * CGFloat(ix) / CGFloat(dataPoints.count - 1)
let y = (1 - point) * rect.height
return CGPoint(x: x, y: y)
}
return Path { p in
guard dataPoints.count > 1 else { return }
let start = dataPoints[0]
p.move(to: CGPoint(x: 0, y: (1 - start) * rect.height))
for idx in dataPoints.indices {
p.addLine(to: point(at: idx))
}
}
}
}
}
let phoneNumbers: [String] = [
"19098611234",
"14159601234",
"12014321234",
"12034811234",
"12067061234",
"12077711234",
"12144681234",
"12158231234",
"12394351234",
"12534591234",
]
private var geocoder: NBPhoneNumberOfflineGeocoder = NBPhoneNumberOfflineGeocoder()
private var phoneUtil: NBPhoneNumberUtil = NBPhoneNumberUtil()
var regionDescriptions: [[String?]] = []
var runtimeArray: [CGFloat] = []
| apache-2.0 | 5100e00832bf86dc07eaa304f88a17c0 | 27.753623 | 95 | 0.613911 | 4.065574 | false | false | false | false |
liuchuo/Swift-practice | 20150608-8.playground/Contents.swift | 1 | 304 | //: Playground - noun: a place where people can play
import UIKit
var 🐒 = true
var 🐼 : Bool = false
var 小欣欣 :Bool = false
var 陈恺垣 = true
if(陈恺垣 == 🐒){
println("咩哈哈哈~~~")
}
else{
println("啦啦啦啦~~")
}
if(小欣欣 == 🐼){
println("喵喵喵~~~")
}
| gpl-2.0 | eda486144fb312cd648c7a9453b523a7 | 13.470588 | 52 | 0.565041 | 2.216216 | false | false | false | false |
ChaselAn/ACBadge | ACBadgeDemo/ACBadge/UIBarButtonItem+ACBadge.swift | 1 | 2713 | ////
//// UIBarButtonItem+ACBadge.swift
//// ACBadgeDemo
////
//// Created by ancheng on 2017/8/3.
//// Copyright © 2017年 ac. All rights reserved.
////
//
//import UIKit
//
//extension UIBarButtonItem {
//
// static let ac_imgViewTag = 1003
//
// public var ac_badgeBackgroundColor: UIColor {
// set {
// ac_getBadgeSuperView?.ac_badgeBackgroundColor = newValue
// }
// get {
// return ac_getBadgeSuperView!.ac_badgeBackgroundColor
// }
// }
//
// public var ac_badgeTextColor: UIColor {
// set {
// ac_getBadgeSuperView?.ac_badgeTextColor = newValue
// }
// get {
// return ac_getBadgeSuperView!.ac_badgeTextColor
//
// }
// }
//
// public var ac_badgeRedDotWidth: CGFloat {
// set {
// ac_getBadgeSuperView?.ac_badgeRedDotWidth = newValue
// }
// get {
// return ac_getBadgeSuperView!.ac_badgeRedDotWidth
// }
// }
//
// public var ac_badge: UILabel? {
// set {
// ac_getBadgeSuperView?.ac_badge = newValue
// }
// get {
// return ac_getBadgeSuperView!.ac_badge
// }
// }
//
// public var ac_badgeCenterOffset: CGPoint {
// set {
// ac_getBadgeSuperView?.ac_badgeCenterOffset = newValue
// }
// get {
// return ac_getBadgeSuperView!.ac_badgeCenterOffset
// }
// }
//
// public var ac_badgeFont: UIFont {
// set {
// ac_getBadgeSuperView?.ac_badgeFont = newValue
// }
// get {
// return ac_getBadgeSuperView!.ac_badgeFont
// }
// }
//
// // badge的最大值,如果超过最大值,显示“最大值+”,比如最大值为99,超过99,显示“99+”,默认为0(没有最大值)
// public var ac_badgeMaximumNumber: Int {
// set {
// ac_getBadgeSuperView?.ac_badgeMaximumNumber = newValue
// }
// get {
// return ac_getBadgeSuperView!.ac_badgeMaximumNumber
// }
// }
//
// // 仅适用于type为number的bagde
// public var ac_badgeText: Int {
// set {
// ac_getBadgeSuperView?.ac_badgeText = newValue
// }
// get {
// return ac_getBadgeSuperView!.ac_badgeText
// }
// }
//
// public func ac_showBadge(with type: ACBadge.ACBadgeType) {
// ac_getBadgeSuperView?.ac_showBadge(with: type)
// }
//
// public func ac_clearBadge() {
// ac_getBadgeSuperView?.ac_clearBadge()
// }
//
// public func ac_resumeBadge() {
// ac_getBadgeSuperView?.ac_resumeBadge()
// }
//
// public func ac_showRedDot(_ isShow: Bool) {
// ac_getBadgeSuperView?.ac_showRedDot(isShow)
// }
//
// private var ac_getBadgeSuperView: UIView? {
// let actualSuperView = value(forKeyPath: "view") as? UIView
// actualSuperView?.tag = UITabBarItem.ac_imgViewTag
// return actualSuperView
// }
//}
//
| mit | 07c57c5194996a43492128ca6a551a73 | 22.267857 | 67 | 0.607061 | 3.016204 | false | false | false | false |
davidlivadaru/DLAngle | Sources/DLAngle/Angle/Angle.swift | 1 | 5703 | //
// Angle.swift
// DLAngle
//
// Created by David Livadaru on 18/02/2017.
//
import Foundation
#if !os(Linux)
import CoreGraphics
#endif
/// A class which provides an abstraction of the angle.
public class Angle {
/// The internal representation of angle.
public private (set) var rawValue: Double
/// RawValue represented as Float.
public var float: Float {
return Float(rawValue)
}
#if !os(Linux)
/// RawValue represented as CGFloat.
public var cgFloat: CGFloat {
return CGFloat(rawValue)
}
#endif
/// The precision to use for equality.
public static var equalityPrecision: Int {
get {
return _equalityPrecision
}
set {
_equalityPrecision = min(newValue, 15)
}
}
private static var _equalityPrecision: Int = 15
private static var marginOfError: Double {
let precision = Double(equalityPrecision)
return Double(pow(10.0, -precision))
}
// MARK: Initializers
/// Create an angle by providing raw value.
///
/// - Parameter rawValue: The representation of angle.
public required init(rawValue: Double) {
self.rawValue = rawValue
}
/// Create an angle with 0.0 as raw value.
public convenience init() {
self.init(rawValue: 0.0)
}
/// Create an angle by providing raw value as Float.
/// Note that the raw value will be converted to Double.
///
/// - Parameter float: The representation of angle.
public convenience init(float: Float) {
self.init(rawValue: Double(float))
}
#if !os(Linux)
/// Create an angle by providing raw value as CGFloat.
/// Note that the raw value will be converted to Double.
///
/// - Parameter cgFloat: The representation of angle.
public convenience init(cgFloat: CGFloat) {
self.init(rawValue: Double(cgFloat))
}
#endif
// MARK: Normalization
func normalize(by value: Double) {
guard rawValue.isFinite else { return }
rawValue = rawValue.truncatingRemainder(dividingBy: value)
if rawValue < 0.0 {
rawValue += value
}
}
func normalized<A: Angle>(by value: Double) -> A {
guard rawValue.isFinite else { return A(rawValue: rawValue) }
let angle = A(rawValue: rawValue)
angle.normalize(by: value)
return angle
}
// MARK: Operations
static func add<A: Angle>(lhs: A, rhs: A) -> A {
return A(rawValue: lhs.rawValue + rhs.rawValue)
}
static func addEqual<A: Angle>(lhs: inout A, rhs: A) {
lhs.rawValue += rhs.rawValue
}
static func minus<A: Angle>(lhs: A, rhs: A) -> A {
return A(rawValue: lhs.rawValue - rhs.rawValue)
}
static func minusEqual<A: Angle>(lhs: inout A, rhs: A) {
lhs.rawValue -= rhs.rawValue
}
static func multiply<A: Angle>(angle: A, with value: Double) -> A {
return A(rawValue: angle.rawValue * value)
}
static func multiply<A: Angle>(angle: A, with value: Float) -> A {
return A(rawValue: angle.rawValue * Double(value))
}
#if !os(Linux)
static func multiply<A: Angle>(angle: A, with value: CGFloat) -> A {
return A(rawValue: angle.rawValue * Double(Double(value)))
}
#endif
static func multiply<A: Angle>(value: Double, with angle: A) -> A {
return A(rawValue: value * angle.rawValue)
}
static func multiply<A: Angle>(value: Float, with angle: A) -> A {
return A(rawValue: Double(value) * angle.rawValue)
}
#if !os(Linux)
static func multiply<A: Angle>(value: CGFloat, with angle: A) -> A {
return A(rawValue: Double(value) * angle.rawValue)
}
#endif
static func multiplyEqual<A: Angle>(angle: inout A, with value: Double) {
angle.rawValue *= value
}
static func multiplyEqual<A: Angle>(angle: inout A, with value: Float) {
angle.rawValue *= Double(value)
}
#if !os(Linux)
static func multiplyEqual<A: Angle>(angle: inout A, with value: CGFloat) {
angle.rawValue *= Double(value)
}
#endif
static func divide<A: Angle>(angle: A, with value: Double) -> A {
return A(rawValue: angle.rawValue / value)
}
static func divide<A: Angle>(angle: A, with value: Float) -> A {
return A(rawValue: angle.rawValue / Double(value))
}
#if !os(Linux)
static func divide<A: Angle>(angle: A, with value: CGFloat) -> A {
return A(rawValue: angle.rawValue / Double(value))
}
#endif
static func divide<A: Angle>(value: Double, with angle: A) -> A {
return A(rawValue: value / angle.rawValue)
}
static func divide<A: Angle>(value: Float, with angle: A) -> A {
return A(rawValue: Double(value) / angle.rawValue)
}
#if !os(Linux)
static func divide<A: Angle>(value: CGFloat, with angle: A) -> A {
return A(rawValue: Double(value) / angle.rawValue)
}
#endif
static func divideEqual<A: Angle>(lhs: inout A, rhs: Double) {
lhs.rawValue /= rhs
}
static func divideEqual<A: Angle>(lhs: inout A, rhs: Float) {
lhs.rawValue /= Double(rhs)
}
#if !os(Linux)
static func divideEqual<A: Angle>(lhs: inout A, rhs: CGFloat) {
lhs.rawValue /= Double(rhs)
}
#endif
// MARK: Equality and Comparison
static func equal<A: Angle>(lhs: A, rhs: A) -> Bool {
let difference = abs(lhs.rawValue - rhs.rawValue)
return difference < marginOfError
}
static func lessThan<A: Angle>(lhs: A, rhs: A) -> Bool {
return lhs.rawValue < rhs.rawValue
}
}
| mit | abeb509b425a9321b74a70fe2a1ee783 | 26.287081 | 78 | 0.60512 | 3.900821 | false | false | false | false |
yanif/circator | MetabolicCompass/DataSources/AdditionalInfoDataSource.swift | 1 | 7265 | //
// AdditionalInfoDataSource.swift
// MetabolicCompass
//
// Created by Anna Tkach on 4/28/16.
// Copyright © 2016 Yanif Ahmad, Tom Woolf. All rights reserved.
//
import UIKit
import MetabolicCompassKit
let AdditionalInfoFont = UIFont(name: "GothamBook", size: 16.0)!
let AdditionalInfoUnitsFont = UIFont(name: "GothamBook", size: 12.0)!
class HeaderView: UICollectionReusableView {
@IBOutlet weak var titleLbl: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
titleLbl.font = ScreenManager.appFontOfSize(15)
}
}
public class AdditionalInfoDataSource: BaseDataSource {
let model = AdditionalInfoModel()
var editMode = true
private let titledInputCellIdentifier = "titledInputCell"
private let scrollSelectionCellIdentifier = "scrollSelectionCell"
override func registerCells() {
let loadImageCellNib = UINib(nibName: "TitledInputCollectionViewCell", bundle: nil)
collectionView?.registerNib(loadImageCellNib, forCellWithReuseIdentifier: titledInputCellIdentifier)
let scrollSelectionCellNib = UINib(nibName: "ScrollSelectionViewCell", bundle: nil)
collectionView?.registerNib(scrollSelectionCellNib, forCellWithReuseIdentifier: scrollSelectionCellIdentifier)
let physiologicalHeaderViewNib = UINib(nibName: "PhysiologicalHeaderView", bundle: nil)
collectionView?.registerNib(physiologicalHeaderViewNib, forSupplementaryViewOfKind: UICollectionElementKindSectionHeader, withReuseIdentifier: "sectionHeaderView")
}
internal func isSleepCellAtIndexPath(indexPath: NSIndexPath) -> Bool {
return indexPath.section == 0 && indexPath.row == 0
}
// MARK: - UICollectionView DataSource & Delegate
func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
return model.sections.count
}
override public func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return model.numberOfItemsInSection(section)
}
override public func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let item = model.itemAtIndexPath(indexPath)
if isSleepCellAtIndexPath(indexPath) {
// it is sleep cell
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(scrollSelectionCellIdentifier, forIndexPath: indexPath) as! ScrollSelectionViewCell
cell.minValue = 3
cell.maxValue = 12
cell.titleLbl.text = item.name
cell.smallDescriptionLbl.text = item.unitsTitle
cell.pickerShown = editMode
cell.titleLbl.font = AdditionalInfoFont
cell.smallDescriptionLbl.font = AdditionalInfoUnitsFont
cell.valueLbl.font = AdditionalInfoFont
if let value = item.intValue() where value > 0 {
cell.setSelectedValue(value)
} else {
let defaultValue = 8
self.model.setNewValueForItem(atIndexPath: indexPath, newValue: defaultValue)
cell.setSelectedValue(defaultValue)
}
cell.changesHandler = { (cell: UICollectionViewCell, newValue: AnyObject?) -> () in
if let indexPath = self.collectionView!.indexPathForCell(cell) {
self.model.setNewValueForItem(atIndexPath: indexPath, newValue: newValue)
}
}
return cell
}
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(titledInputCellIdentifier, forIndexPath: indexPath) as! TitledInputCollectionViewCell
cell.titleLbl.text = item.name
if let strValue = item.stringValue() {
cell.inputTxtField.text = strValue
//cell.inputTxtField.font = ScreenManager.appFontOfSize(15.0)
}
else {
cell.inputTxtField.text = nil
//cell.inputTxtField.font = ScreenManager.appFontOfSize(13.0)
}
cell.smallDescriptionLbl.text = item.unitsTitle
let attr = [NSForegroundColorAttributeName : unselectedTextColor, NSFontAttributeName: AdditionalInfoFont]
cell.inputTxtField.attributedPlaceholder = NSAttributedString(string: item.title, attributes: attr)
var keypadType = UIKeyboardType.Default
if item.dataType == .Int {
keypadType = UIKeyboardType.NumberPad
}
else if item.dataType == .Decimal {
keypadType = UIKeyboardType.DecimalPad
}
cell.inputTxtField.keyboardType = keypadType
cell.titleLbl.textColor = selectedTextColor
cell.inputTxtField.textColor = selectedTextColor
cell.smallDescriptionLbl.textColor = unselectedTextColor
cell.titleLbl.font = AdditionalInfoFont
cell.inputTxtField.font = AdditionalInfoFont
cell.smallDescriptionLbl.font = AdditionalInfoUnitsFont
cell.titleLbl.adjustsFontSizeToFitWidth = true
cell.titleLbl.numberOfLines = 0
cell.inputTxtField.adjustsFontSizeToFitWidth = true
cell.inputTxtField.minimumFontSize = 10.0
cell.smallDescriptionLbl.adjustsFontSizeToFitWidth = true
cell.smallDescriptionLbl.numberOfLines = 1
cell.changesHandler = { (cell: UICollectionViewCell, newValue: AnyObject?) -> () in
if let indexPath = self.collectionView!.indexPathForCell(cell) {
self.model.setNewValueForItem(atIndexPath: indexPath, newValue: newValue)
}
}
cell.userInteractionEnabled = editMode
return cell
}
func collectionView(collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, atIndexPath indexPath: NSIndexPath) -> UICollectionReusableView {
if kind == UICollectionElementKindSectionHeader {
let headerView = collectionView.dequeueReusableSupplementaryViewOfKind(kind, withReuseIdentifier: "sectionHeaderView", forIndexPath: indexPath) as! HeaderView
headerView.titleLbl.text = model.sectionTitleAtIndexPath(indexPath)
return headerView
}
return UICollectionReusableView()
}
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
return CGSizeMake(CGRectGetWidth(collectionView.frame), 50)
}
// MARK: - Cells sizes
private let cellHeight: CGFloat = 60
private let cellHeightHight: CGFloat = 110
private func defaultCellSize() -> CGSize {
let size = CGSizeMake(self.collectionView!.bounds.width, cellHeight)
return size
}
private func intPickerCellSize() -> CGSize {
let size = CGSizeMake(self.collectionView!.bounds.width, editMode ? cellHeightHight : cellHeight)
return size
}
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
return isSleepCellAtIndexPath(indexPath) ? intPickerCellSize() : defaultCellSize()
}
func reset() {
self.model.updateValues()
}
}
| apache-2.0 | b660c1d665380c35cbdfe33347302105 | 39.808989 | 171 | 0.702919 | 5.583397 | false | false | false | false |
Yvent/YVImagePickerController | YVImagePickerController/YVSplitVideoManager.swift | 2 | 1736 | //
// YVSplitVideoManager.swift
// Pods-YVImagePickerController-Demo
//
// Created by Devil on 2017/10/20.
//
import UIKit
import AVFoundation
class YVSplitVideoManager: NSObject {
static let shared = YVSplitVideoManager()
private override init() {}
func yvSplitVideo(_ asset: AVAsset, videoTimeRange: CMTimeRange? = nil, outUrl: URL, finished: @escaping (()->()) ) {
// let videoAsset = AVURLAsset(url: musicUrl, options: nil)
let exportSession = AVAssetExportSession(asset: asset, presetName: AVAssetExportPresetHighestQuality)
exportSession?.outputURL = outUrl
exportSession?.timeRange = videoTimeRange == nil ? CMTimeRange(start: kCMTimeZero, duration: kCMTimePositiveInfinity) : videoTimeRange!
exportSession?.outputFileType = AVFileTypeQuickTimeMovie
//删除本地重复视频
if FileManager.default.fileExists(atPath: outUrl.path) {
do {
try FileManager.default.removeItem(atPath: outUrl.path)
print("Downloaded dir creat success")
}catch{
print("failed to create downloaded dir")
}
}
exportSession?.exportAsynchronously(completionHandler: { () -> Void in
switch exportSession!.status {
case .unknown:
print("unknow")
case .cancelled:
print("cancelled")
case .failed:
print("failed")
case .waiting:
print("waiting")
case .exporting:
print("exporting")
case .completed:
print("completed")
finished()
}
})
}
}
| mit | 46d4e3bda5c9793f4e5ea0c23ce933f0 | 33.4 | 143 | 0.58314 | 5.227964 | false | false | false | false |
iOSWizards/AwesomeMedia | Example/Pods/AwesomeCore/AwesomeCore/Classes/DataAccess/QuestProductVariantDA.swift | 1 | 3412 | //
// QuestProductVariantDA.swift
// AwesomeCore
//
// Created by Antonio on 1/16/18.
//
//import Foundation
//
//class QuestProductVariantDA {
//
// // MARK: - Parser
//
// func parseToCoreData(_ questProductVariant: QuestProductVariant, result: @escaping (CDProductVariant) -> Void) {
// AwesomeCoreDataAccess.shared.performInBackground {
// let cdProductVariant = self.parseToCoreData(questProductVariant)
// result(cdProductVariant)
// }
// }
//
// func parseToCoreData(_ questProductVariant: QuestProductVariant) -> CDProductVariant {
//
// guard let identifier = questProductVariant.identifier else {
// fatalError("CDProductVariant object can't be created without identifier.")
// }
// let p = predicate(identifier, questProductVariant.productId ?? "")
// let cdProductVariant = CDProductVariant.getObjectAC(predicate: p, createIfNil: true) as! CDProductVariant
//
// cdProductVariant.identifier = questProductVariant.identifier
// cdProductVariant.type = questProductVariant.type
// cdProductVariant.currency = questProductVariant.price.currency
// cdProductVariant.price = questProductVariant.price.amount ?? 0
// return cdProductVariant
// }
//
// func parseFromCoreData(_ cdProductVariant: CDProductVariant) -> QuestProductVariant {
// let price = QuestProductPrice(
// currency: cdProductVariant.currency,
// amount: cdProductVariant.price
// )
// return QuestProductVariant(
// identifier: cdProductVariant.identifier,
// price: price,
// type: cdProductVariant.type,
// productId: cdProductVariant.product?.id
// )
// }
//
// // MARK: - Fetch
//
// func loadBy(productVariantId: String, productId: String, result: @escaping (CDProductVariant?) -> Void) {
// func perform() {
// let p = predicate(productVariantId, productId)
// guard let cdProductVariant = CDProductVariant.listAC(predicate: p).first as? CDProductVariant else {
// result(nil); return
// }
// result(cdProductVariant)
// }
// AwesomeCoreDataAccess.shared.performBackgroundBatchOperation({ (workerContext) in
// perform()
// })
// }
//
// // MARK: - Helpers
//
// func extractCDProductVariants(_ questProductVariants: [QuestProductVariant]?) -> NSSet {
// var variants = NSSet()
// guard let questProductVariants = questProductVariants else { return variants }
// for qpv in questProductVariants {
// variants = variants.adding(parseToCoreData(qpv)) as NSSet
// }
// return variants
// }
//
// func extractQuestVariants(_ cdQuestVariants: NSSet?) -> [QuestProductVariant] {
// var variants = [QuestProductVariant]()
// guard let cdProductVariants = cdQuestVariants else { return variants }
// for qp in cdProductVariants {
// variants.append(parseFromCoreData(qp as! CDProductVariant))
// }
// return variants
// }
//
// private func predicate(_ productVariantId: String, _ productId: String) -> NSPredicate {
// return NSPredicate(format: "identifier == %@ AND product.id == %@", productVariantId, productId)
// }
//}
| mit | 26fddd31b5b13d933e43335c0e60bb14 | 37.772727 | 118 | 0.626612 | 4.335451 | false | false | false | false |
hpux735/PMJSON | Sources/Encoder.swift | 1 | 8693 | //
// Encoder.swift
// PMJSON
//
// Created by Kevin Ballard on 2/1/16.
// Copyright © 2016 Postmates.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//
#if os(iOS) || os(OSX) || os(watchOS) || os(tvOS)
import struct Foundation.Decimal
#endif
extension JSON {
/// Encodes a `JSON` to a `String`.
/// - Parameter json: The `JSON` to encode.
/// - Parameters options: Options that controls JSON encoding. Defaults to no options. See `JSONEncoderOptions` for details.
/// - Returns: A `String` with the JSON representation of *json*.
public static func encodeAsString(_ json: JSON, options: JSONEncoderOptions = []) -> String {
var s = ""
encode(json, to: &s, options: options)
return s
}
@available(*, deprecated, message: "Use JSON.encodeAsString(_:options:) instead")
public static func encodeAsString(_ json: JSON, pretty: Bool) -> String {
return encodeAsString(json, options: JSONEncoderOptions(pretty: pretty))
}
/// Encodes a `JSON` to an output stream.
/// - Parameter json: The `JSON` to encode.
/// - Parameter stream: The output stream to write the encoded JSON to.
/// - Parameters options: Options that controls JSON encoding. Defaults to no options. See `JSONEncoderOptions` for details.
public static func encode<Target: TextOutputStream>(_ json: JSON, to stream: inout Target, options: JSONEncoderOptions = []) {
encode(json, to: &stream, indent: options.pretty ? 0 : nil)
}
@available(*, deprecated, message: "Use JSON.encode(_:to:options:) instead")
public static func encode<Target: TextOutputStream>(_ json: JSON, to stream: inout Target, pretty: Bool) {
encode(json, to: &stream, options: JSONEncoderOptions(pretty: pretty))
}
@available(*, deprecated, renamed: "encode(_:to:pretty:)")
public static func encode<Target: TextOutputStream>(_ json: JSON, toStream stream: inout Target, pretty: Bool) {
encode(json, to: &stream, options: JSONEncoderOptions(pretty: pretty))
}
private static func encode<Target: TextOutputStream>(_ json: JSON, to stream: inout Target, indent: Int?) {
switch json {
case .null: encodeNull(&stream)
case .bool(let b): encodeBool(b, toStream: &stream)
case .int64(let i): encodeInt64(i, toStream: &stream)
case .double(let d): encodeDouble(d, toStream: &stream)
case .decimal(let d): encodeDecimal(d, toStream: &stream)
case .string(let s): encodeString(s, toStream: &stream)
case .object(let obj): encodeObject(obj, toStream: &stream, indent: indent)
case .array(let ary): encodeArray(ary, toStream: &stream, indent: indent)
}
}
private static func encodeNull<Target: TextOutputStream>(_ stream: inout Target) {
stream.write("null")
}
private static func encodeBool<Target: TextOutputStream>(_ value: Bool, toStream stream: inout Target) {
stream.write(value ? "true" : "false")
}
private static func encodeInt64<Target: TextOutputStream>(_ value: Int64, toStream stream: inout Target) {
stream.write(String(value))
}
private static func encodeDouble<Target: TextOutputStream>(_ value: Double, toStream stream: inout Target) {
stream.write(String(value))
}
#if os(iOS) || os(OSX) || os(watchOS) || os(tvOS)
private static func encodeDecimal<Target: TextOutputStream>(_ value: Decimal, toStream stream: inout Target) {
stream.write(String(describing: value))
}
#else
private static func encodeDecimal<Target: TextOutputStream>(_ value: DecimalPlaceholder, toStream stream: inout Target) {
// This is a dummy value. Lets just encode it as null for the time being.
stream.write("null")
}
#endif
private static func encodeString<Target: TextOutputStream>(_ value: String, toStream stream: inout Target) {
stream.write("\"")
let scalars = value.unicodeScalars
var start = scalars.startIndex
let end = scalars.endIndex
var idx = start
while idx < scalars.endIndex {
let s: String
let c = scalars[idx]
switch c {
case "\\": s = "\\\\"
case "\"": s = "\\\""
case "\n": s = "\\n"
case "\r": s = "\\r"
case "\t": s = "\\t"
case "\u{8}": s = "\\b"
case "\u{C}": s = "\\f"
case "\0"..<"\u{10}":
s = "\\u000\(String(c.value, radix: 16, uppercase: true))"
case "\u{10}"..<" ":
s = "\\u00\(String(c.value, radix: 16, uppercase: true))"
default:
idx = scalars.index(after: idx)
continue
}
if idx != start {
stream.write(String(scalars[start..<idx]))
}
stream.write(s)
idx = scalars.index(after: idx)
start = idx
}
if start != end {
String(scalars[start..<end]).write(to: &stream)
}
stream.write("\"")
}
private static func encodeObject<Target: TextOutputStream>(_ object: JSONObject, toStream stream: inout Target, indent: Int?) {
let indented = indent.map({$0+1})
if let indent = indented {
stream.write("{\n")
writeIndent(indent, toStream: &stream)
} else {
stream.write("{")
}
var first = true
for (key, value) in object {
if first {
first = false
} else if let indent = indented {
stream.write(",\n")
writeIndent(indent, toStream: &stream)
} else {
stream.write(",")
}
encodeString(key, toStream: &stream)
stream.write(indented != nil ? ": " : ":")
encode(value, to: &stream, indent: indented)
}
if let indent = indent {
stream.write("\n")
writeIndent(indent, toStream: &stream)
}
stream.write("}")
}
private static func encodeArray<Target: TextOutputStream>(_ array: JSONArray, toStream stream: inout Target, indent: Int?) {
let indented = indent.map({$0+1})
if let indent = indented {
stream.write("[\n")
writeIndent(indent, toStream: &stream)
} else {
stream.write("[")
}
var first = true
for elt in array {
if first {
first = false
} else if let indent = indented {
stream.write(",\n")
writeIndent(indent, toStream: &stream)
} else {
stream.write(",")
}
encode(elt, to: &stream, indent: indented)
}
if let indent = indent {
stream.write("\n")
writeIndent(indent, toStream: &stream)
}
stream.write("]")
}
private static func writeIndent<Target: TextOutputStream>(_ indent: Int, toStream stream: inout Target) {
for _ in stride(from: 4, through: indent, by: 4) {
stream.write(" ")
}
switch indent % 4 {
case 1: stream.write(" ")
case 2: stream.write(" ")
case 3: stream.write(" ")
default: break
}
}
}
public struct JSONEncoderOptions {
/// If `true`, the output is formatted with whitespace to be easier to read.
/// If `false`, the output omits any unnecessary whitespace.
///
/// The default value is `false`.
public var pretty: Bool = false
/// Returns a new `JSONEncoderOptions` with default values.
public init() {}
/// Returns a new `JSONEncoderOptions`.
/// - Parameter pretty: Whether the output should be formatted nicely. Defaults to `false`.
public init(pretty: Bool = false) {
self.pretty = pretty
}
}
extension JSONEncoderOptions: ExpressibleByArrayLiteral {
public enum Element {
/// Formats the output with whitespace to be easier to read.
/// - SeeAlso: `JSONEncoderOptions.pretty`.
case pretty
}
public init(arrayLiteral elements: Element...) {
for elt in elements {
switch elt {
case .pretty: pretty = true
}
}
}
}
| apache-2.0 | 32d2c1d1618aa932e0533c24b00f7f96 | 36.627706 | 131 | 0.573171 | 4.365645 | false | false | false | false |
dasdom/Jupp | PostToADN/PostService.swift | 1 | 2701 | //
// PostService.swift
// Jupp
//
// Created by dasdom on 05.12.14.
// Copyright (c) 2014 Dominik Hauser. All rights reserved.
//
import Foundation
import UIKit
import KeychainAccess
public class PostService: NSObject, NSURLSessionDataDelegate, NSURLSessionTaskDelegate {
var session = NSURLSession()
public class var sharedService: PostService {
struct Singleton {
static let instance = PostService()
}
return Singleton.instance
}
public func uploadImage(image: UIImage, session: NSURLSession, completion: ([String:AnyObject]) -> (), progress: (Float) -> ()) {
self.session = session
if let accessToken = KeychainAccess.passwordForAccount("AccessToken") {
let imageUploadRequest = RequestFactory.imageUploadRequest(image, accessToken: accessToken)
// let imageURL = ImageService().saveImageToUpload(image, name: "imageName")
let sessionTask = session.dataTaskWithRequest(imageUploadRequest)
sessionTask.resume()
}
}
public func URLSession(session: NSURLSession, didBecomeInvalidWithError error: NSError?) {
print("didBecomeInvalidWithError \(error)")
}
public func URLSession(session: NSURLSession, dataTask: NSURLSessionDataTask, didReceiveResponse response: NSURLResponse, completionHandler: (NSURLSessionResponseDisposition) -> Void) {
print("didReceiveResponse: \(response)")
}
public func URLSession(session: NSURLSession, task: NSURLSessionTask, didSendBodyData bytesSent: Int64, totalBytesSent: Int64, totalBytesExpectedToSend: Int64) {
print("didSendBodyData")
}
public func URLSession(session: NSURLSession, dataTask: NSURLSessionDataTask, didReceiveData data: NSData) {
print("didReceiveData")
dispatch_async(dispatch_get_main_queue()) {
let dataString = NSString(data: data, encoding: NSUTF8StringEncoding)
print("uploadImage dataString \(dataString)")
}
}
public func URLSessionDidFinishEventsForBackgroundURLSession(session: NSURLSession) {
print("URLSessionDidFinishEventsForBackgroundURLSession")
}
public func URLSession(session: NSURLSession, task: NSURLSessionTask, didCompleteWithError error: NSError?) {
print("didCompleteWithError: session \(session) task \(task) error \(error)")
}
public func URLSession(session: NSURLSession, dataTask: NSURLSessionDataTask, willCacheResponse proposedResponse: NSCachedURLResponse, completionHandler: (NSCachedURLResponse?) -> Void) {
print("willCacheResponse")
}
}
| mit | 2fb2cfdae671f4a455dfb59a0b2138b2 | 37.042254 | 191 | 0.691966 | 5.833693 | false | false | false | false |
alaphao/gitstatus | GitStatus/GitStatus/Data.swift | 1 | 8312 | //
// Data.swift
// TesteGitStatus
//
// Created by Gustavo Tiago on 27/04/15.
// Copyright (c) 2015 Gustavo Tiago. All rights reserved.
//
import Foundation
class Data {
var dictionary: [AnyObject] = []
var labelsUrl: [AnyObject] = []
var labelDictionary: [AnyObject] = []
var reposName: [AnyObject] = []
let requestAuth = RequestAuthorization()
var avatarUrl = ""
var dic: [String:String] = [:]
var repoShared: [AnyObject] = []
var qntComments: [AnyObject] = []
func lookForUserPullUrl(username:String, password:String){
var x = 0
for dics in self.dictionary{
var string = self.dictionary[x] as! String
var request = self.requestAuth.getRequest(string, username: username,pw:password)
var error = NSError?()
var response: NSURLResponse?
let data = NSURLConnection.sendSynchronousRequest(request, returningResponse: &response, error: &error)
var try = NSError?()
let httpResp = response as! NSHTTPURLResponse
var i=0
if httpResp.statusCode == 200 {
let dataArr = NSJSONSerialization.JSONObjectWithData(data!, options: NSJSONReadingOptions.MutableContainers, error: &try) as! Array<NSDictionary>
for repo in dataArr {
var string = dataArr[i]["user"]! as! NSDictionary
//USUARIO VAI AQUI!
if(string["login"]!.isEqualToString(username)){
var stringLabelUrl = dataArr[i]["issue_url"]! as! String
var nomeRepoShared = stringLabelUrl as NSString
for reposNome in self.reposName {
var repoAux = reposNome as! String
if(nomeRepoShared.containsString(repoAux)){
nomeRepoShared = repoAux as String
var dic = ["nomeRepo": nomeRepoShared, "issueURL": stringLabelUrl]
self.repoShared.append(dic)
}
}
var request = self.requestAuth.getRequest(stringLabelUrl, username: username,pw: password)
var error = NSError?()
var response: NSURLResponse?
let urlData = NSURLConnection.sendSynchronousRequest(request, returningResponse: &response, error: &error)
let httpResp = response as! NSHTTPURLResponse
if httpResp.statusCode == 200 {
let dataArr = NSJSONSerialization.JSONObjectWithData(urlData!, options: NSJSONReadingOptions.MutableContainers, error: &try) as! NSDictionary
var personLabels = dataArr["labels"] as! Array<NSDictionary>
var repositorio = dataArr["url"] as! NSString
for repo in personLabels{
for reposNome in self.reposName {
var repoAux = reposNome as! String
if(repositorio.containsString(repoAux)){
repositorio = repoAux as String
}
}
var dictionary = ["name": repo["name"] as! String, "color": repo["color"] as! String, "repo":repositorio, "issue": stringLabelUrl]
labelDictionary.append(dictionary)
}
var teste = dataArr["comments"] as! NSNumber
self.dic["quantidade"] = teste.stringValue
self.dic["repo"] = repositorio as String
self.qntComments.append(self.dic)
// println(self.qntComments)
}
} ///////
i++
}
}
let connection = NSURLConnection(request: request, delegate: nil, startImmediately: true)
x++
}
NSNotificationCenter.defaultCenter().postNotificationName("loadedDataFromWeb", object: self)
}
func getRepo(username:String, password:String){
let usuario = username as String
var request = self.requestAuth.getRequest("https://api.github.com/users/\(usuario)", username: username, pw: password)
NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.mainQueue()) {(response, data, error) in
var try = NSError?()
if(response != nil){
let httpResponse = response as! NSHTTPURLResponse
println("Response: \(httpResponse.statusCode)")
//PEGA O AVATAR
if httpResponse.statusCode == 200 {
let dataArr = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers, error: &try) as! NSDictionary
let avatar = dataArr["avatar_url"] as! String
self.avatarUrl = avatar
}
// println(self.avatarUrl)
var request = self.requestAuth.getRequest("https://api.github.com/users/mackmobile/repos", username: username,pw: password)
NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.mainQueue()) {(response, data, error) in
var try = NSError?()
if(response != nil){
let httpResponse = response as! NSHTTPURLResponse
if httpResponse.statusCode == 200 {
let dataArr = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers, error: &try) as! Array<NSDictionary>
var i=0
for repo in dataArr {
var string = dataArr[i]["pulls_url"]! as! String
var repos = dataArr[i]["name"]! as! String
let range = advance(string.endIndex, -9)..<string.endIndex
string.removeRange(range)
string += "?per_page=100"
self.dictionary.append(string)
self.reposName.append(repos)
i++
}
}
self.lookForUserPullUrl(username, password: password)
let connection = NSURLConnection(request: request, delegate: nil, startImmediately: true)
}
}//Request Async
} else {
NSNotificationCenter.defaultCenter().postNotificationName("failToLoadDataFromWeb", object: self)
println("FATAL ERROR")
}
}
} //Funcao termina aqui
func clearAll(){
self.labelDictionary.removeAll(keepCapacity: false)
self.dictionary.removeAll(keepCapacity: false)
self.labelsUrl.removeAll(keepCapacity: false)
self.qntComments.removeAll(keepCapacity: false)
self.reposName.removeAll(keepCapacity: false)
self.dic.removeAll(keepCapacity: false)
self.repoShared.removeAll(keepCapacity: false)
}
} | mit | 30424b74f73613e1e73f62bc8907bf9d | 44.675824 | 172 | 0.477262 | 6.292203 | false | false | false | false |
breadwallet/breadwallet-core | Swift/BRCrypto/BRCryptoKey.swift | 1 | 6356 | //
// BRCryptoKey.swift
// BRCrypto
//
// Created by Ed Gamble on 7/22/19.
// Copyright © 2019 Breadwinner AG. All rights reserved.
//
// See the LICENSE file at the project root for license information.
// See the CONTRIBUTORS file at the project root for a list of contributors.
//
import Foundation // Data
import BRCryptoC
public final class Key {
static public var wordList: [String]?
///
/// Check if a private key `string` is a valid passphrase-protected private key. The string
/// must be BIP38 format.
///
static public func isProtected(asPrivate string: String) -> Bool {
return CRYPTO_TRUE == cryptoKeyIsProtectedPrivate (string)
}
///
/// Create `Key` from a BIP-39 phrase
///
/// - Parameters:
/// - phrase: A 12 word phrase (aka paper key)
/// - words: Official BIP-39 list of words, with 2048 entries, in the language for `phrase`
///
/// - Returns: A Key, if the phrase if valid
///
static public func createFrom (phrase: String, words: [String]? = wordList) -> Key? {
guard var words = words?.map ({ UnsafePointer<Int8> (strdup($0)) }) else { return nil }
defer { words.forEach { cryptoMemoryFree (UnsafeMutablePointer (mutating: $0)) } }
return cryptoKeyCreateFromPhraseWithWords (phrase, &words)
.map { Key (core: $0)}
}
///
/// Create `Key` from `string` using the passphrase to decrypt it. The string must be BIP38
/// format. Different crypto currencies have different implementations; this function will
/// look for a valid string using BITCOIN mainnet and BITCOIN testnet.
///
/// - Parameter string
/// - Parameter passphrase
///
/// - Returns: A Key if one exists
///
static public func createFromString (asPrivate string: String, withPassphrase: String) -> Key? {
return cryptoKeyCreateFromStringProtectedPrivate (string, withPassphrase)
.map { Key (core: $0) }
}
///
/// Create `Key` from `string`. The string must be wallet import format (WIF), mini private
/// key format, or hex string for example: 5HxWvvfubhXpYYpS3tJkw6fq9jE9j18THftkZjHHfmFiWtmAbrj
/// Different crypto currencies have different formats; this function will look for a valid
/// string using BITCOIN mainnet and BITCOIN testnet.
///
/// - Parameter string
///
/// - Returns: A Key if one exists
///
static public func createFromString (asPrivate string: String) -> Key? {
return cryptoKeyCreateFromStringPrivate (string)
.map { Key (core: $0) }
}
///
/// Create `Key`, as a public key, from `string`. The string must be the hex-encoded
/// DER-encoded public key that is produced by `encodeAsPublic`
///
/// - Parameter string:
///
/// - Returns: A Key, if one exists
///
static public func createFromString (asPublic string: String) -> Key? {
return cryptoKeyCreateFromStringPublic (string)
.map { Key (core: $0) }
}
static public func createForPigeonFrom (key: Key, nonce: Data) -> Key {
let nonceCount = nonce.count
var nonce = nonce
return nonce.withUnsafeMutableBytes { (nonceBytes: UnsafeMutableRawBufferPointer) -> Key in
let nonceAddr = nonceBytes.baseAddress?.assumingMemoryBound(to: UInt8.self)
return cryptoKeyCreateForPigeon (key.core, nonceAddr, nonceCount)
.map { Key (core: $0) }!
}
}
static public func createForBIP32ApiAuth (phrase: String, words: [String]? = wordList) -> Key? {
guard var words = words?.map ({ UnsafePointer<Int8> (strdup($0)) }) else { return nil }
defer { words.forEach { cryptoMemoryFree (UnsafeMutablePointer (mutating: $0)) } }
return cryptoKeyCreateForBIP32ApiAuth (phrase, &words)
.map { Key (core: $0) }
}
static public func createForBIP32BitID (phrase: String, index: Int, uri:String, words: [String]? = wordList) -> Key? {
guard var words = words?.map ({ UnsafePointer<Int8> (strdup($0)) }) else { return nil }
defer { words.forEach { cryptoMemoryFree (UnsafeMutablePointer (mutating: $0)) } }
return cryptoKeyCreateForBIP32BitID (phrase, Int32(index), uri, &words)
.map { Key (core: $0) }
}
// The Core representation
internal let core: BRCryptoKey
deinit { cryptoKeyGive (core) }
public var hasSecret: Bool {
return 1 == cryptoKeyHasSecret (self.core)
}
/// Return the WIF-encoded private key
public var encodeAsPrivate: String {
return asUTF8String(cryptoKeyEncodePrivate(self.core), true)
}
/// Return the hex-encoded, DER-encoded public key
public var encodeAsPublic: String {
return asUTF8String (cryptoKeyEncodePublic (self.core), true)
}
public typealias Secret = ( // 32 bytes
UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8,
UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8,
UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8,
UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8)
public var secret: Secret {
return cryptoKeyGetSecret (self.core).data
}
///
/// Check if `self` and `that` have an identical public key
///
/// - Parameter that: the other CryptoKey
///
/// - Returns: If identical `true`; otherwise `false`
///
public func publicKeyMatch (_ that: Key) -> Bool {
return 1 == cryptoKeyPublicMatch (core, that.core)
}
internal func privateKeyMatch (_ that: Key) -> Bool {
return 1 == cryptoKeySecretMatch (core, that.core)
}
///
/// Initialize based on a Core BRKey - the provided BRKey might be private+public or just
/// a public key (such as one that is recovered from the signature.
///
/// - Parameter core: The Core representaion
///
internal init (core: BRCryptoKey) {
self.core = core
cryptoKeyProvidePublicKey (core, 0, 0)
}
///
/// Initialize based on `secret` to produce a private+public key pair
///
/// - Parameter secret: the secret
///
internal convenience init (secret: Secret) {
self.init (core: cryptoKeyCreateFromSecret (BRCryptoSecret.init(data: secret)))
}
}
| mit | 1a4fd978895d1136a98ba3fd6272670f | 35.107955 | 122 | 0.633832 | 3.996855 | false | false | false | false |
binarylevel/Tinylog-iOS | Pods/SGBackgroundView/Pod/Classes/SGBackgroundView.swift | 1 | 3384 | //
// SGBackgroundView.swift
// SGBackgroundView
//
// Created by Spiros Gerokostas on 15/10/15.
// Copyright © 2015 Spiros Gerokostas. All rights reserved.
//
import UIKit
public class SGBackgroundView: UIView {
var _width:CGFloat?
var _height:CGFloat?
var _color:NSString?
var _bgColor:UIColor?
var _topLine:Bool?
var _xPosLine:CGFloat?
var _lineColor:UIColor?
public var xPosLine:CGFloat {
set {
_xPosLine = newValue
self.setNeedsDisplay()
}
get {
return _xPosLine!
}
}
public var topLine:Bool {
set {
_topLine = newValue
self.setNeedsDisplay()
}
get {
return _topLine!
}
}
public var width:CGFloat {
set {
_width = newValue
self.setNeedsDisplay()
}
get {
return _width!
}
}
public var height:CGFloat {
set {
_height = newValue
self.setNeedsDisplay()
}
get {
return _height!
}
}
public var color:NSString {
set {
_color = newValue
self.setNeedsDisplay()
}
get {
return _color!
}
}
public var lineColor:UIColor {
set {
_lineColor = newValue
self.setNeedsDisplay()
}
get {
return _lineColor!
}
}
public var bgColor:UIColor {
set {
_bgColor = newValue
self.setNeedsDisplay()
}
get {
return _bgColor!
}
}
override public init(frame: CGRect) {
super.init(frame: frame)
bgColor = UIColor.whiteColor()
topLine = false
xPosLine = 0.0
width = frame.width
height = frame.height
self.contentMode = UIViewContentMode.Redraw
}
required public init(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override public func drawRect(rect: CGRect) {
let context:CGContextRef = UIGraphicsGetCurrentContext()!
let backgroundColor:UIColor = UIColor.whiteColor()
backgroundColor.set()
CGContextFillRect(context, rect);
CGContextSaveGState(context);
let rectangle:CGRect = CGRectMake(0.0 , 0.0, _width!, _height!);
CGContextAddRect(context, rectangle);
CGContextSetFillColorWithColor(context, _bgColor!.CGColor);
CGContextFillRect(context, rectangle);
CGContextRestoreGState(context);
if _topLine! {
CGContextSetLineWidth(context, 1.0);
CGContextSetStrokeColorWithColor(context, _lineColor!.CGColor);
CGContextMoveToPoint(context, 0.0, 0.0);
CGContextAddLineToPoint(context, _width!, 0.0);
CGContextStrokePath(context);
}
CGContextSetLineWidth(context, 1.0);
CGContextSetStrokeColorWithColor(context, _lineColor!.CGColor);
CGContextMoveToPoint(context, _xPosLine!, floor(rectangle.origin.y + rectangle.size.height));
CGContextAddLineToPoint(context, _width!, floor(rectangle.origin.y + rectangle.size.height));
CGContextStrokePath(context);
}
}
| mit | 13bb7be360b4881706ad516dc4b8854f | 24.824427 | 101 | 0.554833 | 5.102564 | false | false | false | false |
LearningSwift2/LearningApps | SimpleContacts/SimpleContacts/ViewController.swift | 1 | 1245 | //
// ViewController.swift
// SimpleContacts
//
// Created by Phil Wright on 4/6/16.
// Copyright © 2016 Touchopia, LLC. All rights reserved.
//
import UIKit
import Contacts
import ContactsUI
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func presentContactMatchingName(name: String) throws {
let predicate = CNContact.predicateForContactsMatchingName(name)
let keysToFetch = [CNContactGivenNameKey, CNContactFamilyNameKey]
let store = CNContactStore()
let contacts = try store.unifiedContactsMatchingPredicate(
predicate,
keysToFetch: keysToFetch
)
if let firstContact = contacts.first {
let viewController = CNContactViewController(forContact: firstContact)
viewController.contactStore = self.store
presentViewController(viewController, animated: true, completion: nil)
}
}
}
| apache-2.0 | 45a545644b1b41ede3394932e2e7aa51 | 26.644444 | 82 | 0.662379 | 5.339056 | false | false | false | false |
silence0201/Swift-Study | Learn/13.类继承/使用Any和AnyObject类型.playground/section-1.swift | 1 | 1726 |
class Person {
var name: String
var age: Int
func description() -> String {
return "\(name) 年龄是: \(age)"
}
convenience init () {
self.init(name: "Tony")
self.age = 18
}
convenience init (name: String) {
self.init(name: name, age: 18)
}
init (name: String, age: Int) {
self.name = name
self.age = age
}
}
class Student: Person {
var school: String
init (name: String, age: Int, school: String) {
self.school = school
super.init(name: name, age: age)
}
}
class Worker: Person {
var factory: String
init (name: String, age: Int, factory: String) {
self.factory = factory
super.init(name: name, age: age)
}
}
let p1: Person = Student(name: "Tom", age: 20, school: "清华大学")
let p2: Person = Worker(name: "Tom", age: 18, factory: "钢厂")
let p3: Person = Person(name: "Tom", age: 28)
let student1 = Student(name: "Tom", age: 18, school: "清华大学")
let student2 = Student(name: "Ben", age: 28, school: "北京大学")
let student3 = Student(name: "Tony", age: 38, school: "香港大学")
let worker1 = Worker(name: "Tom", age: 18, factory: "钢厂")
let worker2 = Worker(name: "Ben", age: 20, factory: "电厂")
let people1: [Person] = [student1, student2, student3, worker1, worker2]
let people2: [AnyObject] = [student1, student2, student3, worker1, worker2]
let people3: [Any] = [student1, student2, student3, worker1, worker2]
for item in people3 {
if let student = item as? Student {
print("Student school: \(student.school)")
} else if let worker = item as? Worker {
print("Worker factory: \(worker.factory)")
}
}
| mit | 15cbbb075dea4927de9df9b0b2623061 | 26.032258 | 75 | 0.598449 | 3.150376 | false | false | false | false |
PureSwift/Bluetooth | Sources/Bluetooth/Generated/GeneratedCompanyIdentifierNames.swift | 1 | 179542 | //
// CompanyIdentifierNames.swift
// Bluetooth
//
#if (swift(<5.6) || !SWIFTPM_ENABLE_PLUGINS) && !os(WASI)
internal extension CompanyIdentifier {
static let companyIdentifiers: [UInt16: String] = {
var companyIdentifiers = [UInt16: String]()
companyIdentifiers.reserveCapacity(3031)
companyIdentifiers[0] = #"Ericsson Technology Licensing"#
companyIdentifiers[1] = #"Nokia Mobile Phones"#
companyIdentifiers[2] = #"Intel Corp."#
companyIdentifiers[3] = #"IBM Corp."#
companyIdentifiers[4] = #"Toshiba Corp."#
companyIdentifiers[5] = #"3Com"#
companyIdentifiers[6] = #"Microsoft"#
companyIdentifiers[7] = #"Lucent"#
companyIdentifiers[8] = #"Motorola"#
companyIdentifiers[9] = #"Infineon Technologies AG"#
companyIdentifiers[10] = #"Qualcomm Technologies International, Ltd. (QTIL)"#
companyIdentifiers[11] = #"Silicon Wave"#
companyIdentifiers[12] = #"Digianswer A/S"#
companyIdentifiers[13] = #"Texas Instruments Inc."#
companyIdentifiers[14] = #"Parthus Technologies Inc."#
companyIdentifiers[15] = #"Broadcom Corporation"#
companyIdentifiers[16] = #"Mitel Semiconductor"#
companyIdentifiers[17] = #"Widcomm, Inc."#
companyIdentifiers[18] = #"Zeevo, Inc."#
companyIdentifiers[19] = #"Atmel Corporation"#
companyIdentifiers[20] = #"Mitsubishi Electric Corporation"#
companyIdentifiers[21] = #"RTX Telecom A/S"#
companyIdentifiers[22] = #"KC Technology Inc."#
companyIdentifiers[23] = #"Newlogic"#
companyIdentifiers[24] = #"Transilica, Inc."#
companyIdentifiers[25] = #"Rohde & Schwarz GmbH & Co. KG"#
companyIdentifiers[26] = #"TTPCom Limited"#
companyIdentifiers[27] = #"Signia Technologies, Inc."#
companyIdentifiers[28] = #"Conexant Systems Inc."#
companyIdentifiers[29] = #"Qualcomm"#
companyIdentifiers[30] = #"Inventel"#
companyIdentifiers[31] = #"AVM Berlin"#
companyIdentifiers[32] = #"BandSpeed, Inc."#
companyIdentifiers[33] = #"Mansella Ltd"#
companyIdentifiers[34] = #"NEC Corporation"#
companyIdentifiers[35] = #"WavePlus Technology Co., Ltd."#
companyIdentifiers[36] = #"Alcatel"#
companyIdentifiers[37] = #"NXP Semiconductors (formerly Philips Semiconductors)"#
companyIdentifiers[38] = #"C Technologies"#
companyIdentifiers[39] = #"Open Interface"#
companyIdentifiers[40] = #"R F Micro Devices"#
companyIdentifiers[41] = #"Hitachi Ltd"#
companyIdentifiers[42] = #"Symbol Technologies, Inc."#
companyIdentifiers[43] = #"Tenovis"#
companyIdentifiers[44] = #"Macronix International Co. Ltd."#
companyIdentifiers[45] = #"GCT Semiconductor"#
companyIdentifiers[46] = #"Norwood Systems"#
companyIdentifiers[47] = #"MewTel Technology Inc."#
companyIdentifiers[48] = #"ST Microelectronics"#
companyIdentifiers[49] = #"Synopsys, Inc."#
companyIdentifiers[50] = #"Red-M (Communications) Ltd"#
companyIdentifiers[51] = #"Commil Ltd"#
companyIdentifiers[52] = #"Computer Access Technology Corporation (CATC)"#
companyIdentifiers[53] = #"Eclipse (HQ Espana) S.L."#
companyIdentifiers[54] = #"Renesas Electronics Corporation"#
companyIdentifiers[55] = #"Mobilian Corporation"#
companyIdentifiers[56] = #"Syntronix Corporation"#
companyIdentifiers[57] = #"Integrated System Solution Corp."#
companyIdentifiers[58] = #"Panasonic Holdings Corporation"#
companyIdentifiers[59] = #"Gennum Corporation"#
companyIdentifiers[60] = #"BlackBerry Limited (formerly Research In Motion)"#
companyIdentifiers[61] = #"IPextreme, Inc."#
companyIdentifiers[62] = #"Systems and Chips, Inc"#
companyIdentifiers[63] = #"Bluetooth SIG, Inc"#
companyIdentifiers[64] = #"Seiko Epson Corporation"#
companyIdentifiers[65] = #"Integrated Silicon Solution Taiwan, Inc."#
companyIdentifiers[66] = #"CONWISE Technology Corporation Ltd"#
companyIdentifiers[67] = #"PARROT AUTOMOTIVE SAS"#
companyIdentifiers[68] = #"Socket Mobile"#
companyIdentifiers[69] = #"Atheros Communications, Inc."#
companyIdentifiers[70] = #"MediaTek, Inc."#
companyIdentifiers[71] = #"Bluegiga"#
companyIdentifiers[72] = #"Marvell Technology Group Ltd."#
companyIdentifiers[73] = #"3DSP Corporation"#
companyIdentifiers[74] = #"Accel Semiconductor Ltd."#
companyIdentifiers[75] = #"Continental Automotive Systems"#
companyIdentifiers[76] = #"Apple, Inc."#
companyIdentifiers[77] = #"Staccato Communications, Inc."#
companyIdentifiers[78] = #"Avago Technologies"#
companyIdentifiers[79] = #"APT Ltd."#
companyIdentifiers[80] = #"SiRF Technology, Inc."#
companyIdentifiers[81] = #"Tzero Technologies, Inc."#
companyIdentifiers[82] = #"J&M Corporation"#
companyIdentifiers[83] = #"Free2move AB"#
companyIdentifiers[84] = #"3DiJoy Corporation"#
companyIdentifiers[85] = #"Plantronics, Inc."#
companyIdentifiers[86] = #"Sony Ericsson Mobile Communications"#
companyIdentifiers[87] = #"Harman International Industries, Inc."#
companyIdentifiers[88] = #"Vizio, Inc."#
companyIdentifiers[89] = #"Nordic Semiconductor ASA"#
companyIdentifiers[90] = #"EM Microelectronic-Marin SA"#
companyIdentifiers[91] = #"Ralink Technology Corporation"#
companyIdentifiers[92] = #"Belkin International, Inc."#
companyIdentifiers[93] = #"Realtek Semiconductor Corporation"#
companyIdentifiers[94] = #"Stonestreet One, LLC"#
companyIdentifiers[95] = #"Wicentric, Inc."#
companyIdentifiers[96] = #"RivieraWaves S.A.S"#
companyIdentifiers[97] = #"RDA Microelectronics"#
companyIdentifiers[98] = #"Gibson Guitars"#
companyIdentifiers[99] = #"MiCommand Inc."#
companyIdentifiers[100] = #"Band XI International, LLC"#
companyIdentifiers[101] = #"HP, Inc."#
companyIdentifiers[102] = #"9Solutions Oy"#
companyIdentifiers[103] = #"GN Netcom A/S"#
companyIdentifiers[104] = #"General Motors"#
companyIdentifiers[105] = #"A&D Engineering, Inc."#
companyIdentifiers[106] = #"MindTree Ltd."#
companyIdentifiers[107] = #"Polar Electro OY"#
companyIdentifiers[108] = #"Beautiful Enterprise Co., Ltd."#
companyIdentifiers[109] = #"BriarTek, Inc"#
companyIdentifiers[110] = #"Summit Data Communications, Inc."#
companyIdentifiers[111] = #"Sound ID"#
companyIdentifiers[112] = #"Monster, LLC"#
companyIdentifiers[113] = #"connectBlue AB"#
companyIdentifiers[114] = #"ShangHai Super Smart Electronics Co. Ltd."#
companyIdentifiers[115] = #"Group Sense Ltd."#
companyIdentifiers[116] = #"Zomm, LLC"#
companyIdentifiers[117] = #"Samsung Electronics Co. Ltd."#
companyIdentifiers[118] = #"Creative Technology Ltd."#
companyIdentifiers[119] = #"Laird Technologies"#
companyIdentifiers[120] = #"Nike, Inc."#
companyIdentifiers[121] = #"lesswire AG"#
companyIdentifiers[122] = #"MStar Semiconductor, Inc."#
companyIdentifiers[123] = #"Hanlynn Technologies"#
companyIdentifiers[124] = #"A & R Cambridge"#
companyIdentifiers[125] = #"Seers Technology Co., Ltd."#
companyIdentifiers[126] = #"Sports Tracking Technologies Ltd."#
companyIdentifiers[127] = #"Autonet Mobile"#
companyIdentifiers[128] = #"DeLorme Publishing Company, Inc."#
companyIdentifiers[129] = #"WuXi Vimicro"#
companyIdentifiers[130] = #"Sennheiser Communications A/S"#
companyIdentifiers[131] = #"TimeKeeping Systems, Inc."#
companyIdentifiers[132] = #"Ludus Helsinki Ltd."#
companyIdentifiers[133] = #"BlueRadios, Inc."#
companyIdentifiers[134] = #"Equinux AG"#
companyIdentifiers[135] = #"Garmin International, Inc."#
companyIdentifiers[136] = #"Ecotest"#
companyIdentifiers[137] = #"GN ReSound A/S"#
companyIdentifiers[138] = #"Jawbone"#
companyIdentifiers[139] = #"Topcon Positioning Systems, LLC"#
companyIdentifiers[140] = #"Gimbal Inc. (formerly Qualcomm Labs, Inc. and Qualcomm Retail Solutions, Inc.)"#
companyIdentifiers[141] = #"Zscan Software"#
companyIdentifiers[142] = #"Quintic Corp"#
companyIdentifiers[143] = #"Telit Wireless Solutions GmbH (formerly Stollmann E+V GmbH)"#
companyIdentifiers[144] = #"Funai Electric Co., Ltd."#
companyIdentifiers[145] = #"Advanced PANMOBIL systems GmbH & Co. KG"#
companyIdentifiers[146] = #"ThinkOptics, Inc."#
companyIdentifiers[147] = #"Universal Electronics, Inc."#
companyIdentifiers[148] = #"Airoha Technology Corp."#
companyIdentifiers[149] = #"NEC Lighting, Ltd."#
companyIdentifiers[150] = #"ODM Technology, Inc."#
companyIdentifiers[151] = #"ConnecteDevice Ltd."#
companyIdentifiers[152] = #"zero1.tv GmbH"#
companyIdentifiers[153] = #"i.Tech Dynamic Global Distribution Ltd."#
companyIdentifiers[154] = #"Alpwise"#
companyIdentifiers[155] = #"Jiangsu Toppower Automotive Electronics Co., Ltd."#
companyIdentifiers[156] = #"Colorfy, Inc."#
companyIdentifiers[157] = #"Geoforce Inc."#
companyIdentifiers[158] = #"Bose Corporation"#
companyIdentifiers[159] = #"Suunto Oy"#
companyIdentifiers[160] = #"Kensington Computer Products Group"#
companyIdentifiers[161] = #"SR-Medizinelektronik"#
companyIdentifiers[162] = #"Vertu Corporation Limited"#
companyIdentifiers[163] = #"Meta Watch Ltd."#
companyIdentifiers[164] = #"LINAK A/S"#
companyIdentifiers[165] = #"OTL Dynamics LLC"#
companyIdentifiers[166] = #"Panda Ocean Inc."#
companyIdentifiers[167] = #"Visteon Corporation"#
companyIdentifiers[168] = #"ARP Devices Limited"#
companyIdentifiers[169] = #"MARELLI EUROPE S.P.A. (formerly Magneti Marelli S.p.A.)"#
companyIdentifiers[170] = #"CAEN RFID srl"#
companyIdentifiers[171] = #"Ingenieur-Systemgruppe Zahn GmbH"#
companyIdentifiers[172] = #"Green Throttle Games"#
companyIdentifiers[173] = #"Peter Systemtechnik GmbH"#
companyIdentifiers[174] = #"Omegawave Oy"#
companyIdentifiers[175] = #"Cinetix"#
companyIdentifiers[176] = #"Passif Semiconductor Corp"#
companyIdentifiers[177] = #"Saris Cycling Group, Inc"#
companyIdentifiers[178] = #"Bekey A/S"#
companyIdentifiers[179] = #"Clarinox Technologies Pty. Ltd."#
companyIdentifiers[180] = #"BDE Technology Co., Ltd."#
companyIdentifiers[181] = #"Swirl Networks"#
companyIdentifiers[182] = #"Meso international"#
companyIdentifiers[183] = #"TreLab Ltd"#
companyIdentifiers[184] = #"Qualcomm Innovation Center, Inc. (QuIC)"#
companyIdentifiers[185] = #"Johnson Controls, Inc."#
companyIdentifiers[186] = #"Starkey Laboratories Inc."#
companyIdentifiers[187] = #"S-Power Electronics Limited"#
companyIdentifiers[188] = #"Ace Sensor Inc"#
companyIdentifiers[189] = #"Aplix Corporation"#
companyIdentifiers[190] = #"AAMP of America"#
companyIdentifiers[191] = #"Stalmart Technology Limited"#
companyIdentifiers[192] = #"AMICCOM Electronics Corporation"#
companyIdentifiers[193] = #"Shenzhen Excelsecu Data Technology Co.,Ltd"#
companyIdentifiers[194] = #"Geneq Inc."#
companyIdentifiers[195] = #"adidas AG"#
companyIdentifiers[196] = #"LG Electronics"#
companyIdentifiers[197] = #"Onset Computer Corporation"#
companyIdentifiers[198] = #"Selfly BV"#
companyIdentifiers[199] = #"Quuppa Oy."#
companyIdentifiers[200] = #"GeLo Inc"#
companyIdentifiers[201] = #"Evluma"#
companyIdentifiers[202] = #"MC10"#
companyIdentifiers[203] = #"Binauric SE"#
companyIdentifiers[204] = #"Beats Electronics"#
companyIdentifiers[205] = #"Microchip Technology Inc."#
companyIdentifiers[206] = #"Elgato Systems GmbH"#
companyIdentifiers[207] = #"ARCHOS SA"#
companyIdentifiers[208] = #"Dexcom, Inc."#
companyIdentifiers[209] = #"Polar Electro Europe B.V."#
companyIdentifiers[210] = #"Dialog Semiconductor B.V."#
companyIdentifiers[211] = #"Taixingbang Technology (HK) Co,. LTD."#
companyIdentifiers[212] = #"Kawantech"#
companyIdentifiers[213] = #"Austco Communication Systems"#
companyIdentifiers[214] = #"Timex Group USA, Inc."#
companyIdentifiers[215] = #"Qualcomm Technologies, Inc."#
companyIdentifiers[216] = #"Qualcomm Connected Experiences, Inc."#
companyIdentifiers[217] = #"Voyetra Turtle Beach"#
companyIdentifiers[218] = #"txtr GmbH"#
companyIdentifiers[219] = #"Biosentronics"#
companyIdentifiers[220] = #"Procter & Gamble"#
companyIdentifiers[221] = #"Hosiden Corporation"#
companyIdentifiers[222] = #"Muzik LLC"#
companyIdentifiers[223] = #"Misfit Wearables Corp"#
companyIdentifiers[224] = #"Google"#
companyIdentifiers[225] = #"Danlers Ltd"#
companyIdentifiers[226] = #"Semilink Inc"#
companyIdentifiers[227] = #"inMusic Brands, Inc"#
companyIdentifiers[228] = #"Laird Connectivity, Inc. formerly L.S. Research Inc."#
companyIdentifiers[229] = #"Eden Software Consultants Ltd."#
companyIdentifiers[230] = #"Freshtemp"#
companyIdentifiers[231] = #"KS Technologies"#
companyIdentifiers[232] = #"ACTS Technologies"#
companyIdentifiers[233] = #"Vtrack Systems"#
companyIdentifiers[234] = #"Nielsen-Kellerman Company"#
companyIdentifiers[235] = #"Server Technology Inc."#
companyIdentifiers[236] = #"BioResearch Associates"#
companyIdentifiers[237] = #"Jolly Logic, LLC"#
companyIdentifiers[238] = #"Above Average Outcomes, Inc."#
companyIdentifiers[239] = #"Bitsplitters GmbH"#
companyIdentifiers[240] = #"PayPal, Inc."#
companyIdentifiers[241] = #"Witron Technology Limited"#
companyIdentifiers[242] = #"Morse Project Inc."#
companyIdentifiers[243] = #"Kent Displays Inc."#
companyIdentifiers[244] = #"Nautilus Inc."#
companyIdentifiers[245] = #"Smartifier Oy"#
companyIdentifiers[246] = #"Elcometer Limited"#
companyIdentifiers[247] = #"VSN Technologies, Inc."#
companyIdentifiers[248] = #"AceUni Corp., Ltd."#
companyIdentifiers[249] = #"StickNFind"#
companyIdentifiers[250] = #"Crystal Code AB"#
companyIdentifiers[251] = #"KOUKAAM a.s."#
companyIdentifiers[252] = #"Delphi Corporation"#
companyIdentifiers[253] = #"ValenceTech Limited"#
companyIdentifiers[254] = #"Stanley Black and Decker"#
companyIdentifiers[255] = #"Typo Products, LLC"#
companyIdentifiers[256] = #"TomTom International BV"#
companyIdentifiers[257] = #"Fugoo, Inc."#
companyIdentifiers[258] = #"Keiser Corporation"#
companyIdentifiers[259] = #"Bang & Olufsen A/S"#
companyIdentifiers[260] = #"PLUS Location Systems Pty Ltd"#
companyIdentifiers[261] = #"Ubiquitous Computing Technology Corporation"#
companyIdentifiers[262] = #"Innovative Yachtter Solutions"#
companyIdentifiers[263] = #"William Demant Holding A/S"#
companyIdentifiers[264] = #"Chicony Electronics Co., Ltd."#
companyIdentifiers[265] = #"Atus BV"#
companyIdentifiers[266] = #"Codegate Ltd"#
companyIdentifiers[267] = #"ERi, Inc"#
companyIdentifiers[268] = #"Transducers Direct, LLC"#
companyIdentifiers[269] = #"DENSO TEN LIMITED (formerly Fujitsu Ten LImited)"#
companyIdentifiers[270] = #"Audi AG"#
companyIdentifiers[271] = #"HiSilicon Technologies CO., LIMITED"#
companyIdentifiers[272] = #"Nippon Seiki Co., Ltd."#
companyIdentifiers[273] = #"Steelseries ApS"#
companyIdentifiers[274] = #"Visybl Inc."#
companyIdentifiers[275] = #"Openbrain Technologies, Co., Ltd."#
companyIdentifiers[276] = #"Xensr"#
companyIdentifiers[277] = #"e.solutions"#
companyIdentifiers[278] = #"10AK Technologies"#
companyIdentifiers[279] = #"Wimoto Technologies Inc"#
companyIdentifiers[280] = #"Radius Networks, Inc."#
companyIdentifiers[281] = #"Wize Technology Co., Ltd."#
companyIdentifiers[282] = #"Qualcomm Labs, Inc."#
companyIdentifiers[283] = #"Hewlett Packard Enterprise"#
companyIdentifiers[284] = #"Baidu"#
companyIdentifiers[285] = #"Arendi AG"#
companyIdentifiers[286] = #"Skoda Auto a.s."#
companyIdentifiers[287] = #"Volkswagen AG"#
companyIdentifiers[288] = #"Porsche AG"#
companyIdentifiers[289] = #"Sino Wealth Electronic Ltd."#
companyIdentifiers[290] = #"AirTurn, Inc."#
companyIdentifiers[291] = #"Kinsa, Inc"#
companyIdentifiers[292] = #"HID Global"#
companyIdentifiers[293] = #"SEAT es"#
companyIdentifiers[294] = #"Promethean Ltd."#
companyIdentifiers[295] = #"Salutica Allied Solutions"#
companyIdentifiers[296] = #"GPSI Group Pty Ltd"#
companyIdentifiers[297] = #"Nimble Devices Oy"#
companyIdentifiers[298] = #"Changzhou Yongse Infotech Co., Ltd."#
companyIdentifiers[299] = #"SportIQ"#
companyIdentifiers[300] = #"TEMEC Instruments B.V."#
companyIdentifiers[301] = #"Sony Corporation"#
companyIdentifiers[302] = #"ASSA ABLOY"#
companyIdentifiers[303] = #"Clarion Co. Inc."#
companyIdentifiers[304] = #"Warehouse Innovations"#
companyIdentifiers[305] = #"Cypress Semiconductor"#
companyIdentifiers[306] = #"MADS Inc"#
companyIdentifiers[307] = #"Blue Maestro Limited"#
companyIdentifiers[308] = #"Resolution Products, Ltd."#
companyIdentifiers[309] = #"Aireware LLC"#
companyIdentifiers[310] = #"Silvair, Inc."#
companyIdentifiers[311] = #"Prestigio Plaza Ltd."#
companyIdentifiers[312] = #"NTEO Inc."#
companyIdentifiers[313] = #"Focus Systems Corporation"#
companyIdentifiers[314] = #"Tencent Holdings Ltd."#
companyIdentifiers[315] = #"Allegion"#
companyIdentifiers[316] = #"Murata Manufacturing Co., Ltd."#
companyIdentifiers[317] = #"WirelessWERX"#
companyIdentifiers[318] = #"Nod, Inc."#
companyIdentifiers[319] = #"B&B Manufacturing Company"#
companyIdentifiers[320] = #"Alpine Electronics (China) Co., Ltd"#
companyIdentifiers[321] = #"FedEx Services"#
companyIdentifiers[322] = #"Grape Systems Inc."#
companyIdentifiers[323] = #"Bkon Connect"#
companyIdentifiers[324] = #"Lintech GmbH"#
companyIdentifiers[325] = #"Novatel Wireless"#
companyIdentifiers[326] = #"Ciright"#
companyIdentifiers[327] = #"Mighty Cast, Inc."#
companyIdentifiers[328] = #"Ambimat Electronics"#
companyIdentifiers[329] = #"Perytons Ltd."#
companyIdentifiers[330] = #"Tivoli Audio, LLC"#
companyIdentifiers[331] = #"Master Lock"#
companyIdentifiers[332] = #"Mesh-Net Ltd"#
companyIdentifiers[333] = #"HUIZHOU DESAY SV AUTOMOTIVE CO., LTD."#
companyIdentifiers[334] = #"Tangerine, Inc."#
companyIdentifiers[335] = #"B&W Group Ltd."#
companyIdentifiers[336] = #"Pioneer Corporation"#
companyIdentifiers[337] = #"OnBeep"#
companyIdentifiers[338] = #"Vernier Software & Technology"#
companyIdentifiers[339] = #"ROL Ergo"#
companyIdentifiers[340] = #"Pebble Technology"#
companyIdentifiers[341] = #"NETATMO"#
companyIdentifiers[342] = #"Accumulate AB"#
companyIdentifiers[343] = #"Anhui Huami Information Technology Co., Ltd."#
companyIdentifiers[344] = #"Inmite s.r.o."#
companyIdentifiers[345] = #"ChefSteps, Inc."#
companyIdentifiers[346] = #"micas AG"#
companyIdentifiers[347] = #"Biomedical Research Ltd."#
companyIdentifiers[348] = #"Pitius Tec S.L."#
companyIdentifiers[349] = #"Estimote, Inc."#
companyIdentifiers[350] = #"Unikey Technologies, Inc."#
companyIdentifiers[351] = #"Timer Cap Co."#
companyIdentifiers[352] = #"Awox formerly AwoX"#
companyIdentifiers[353] = #"yikes"#
companyIdentifiers[354] = #"MADSGlobalNZ Ltd."#
companyIdentifiers[355] = #"PCH International"#
companyIdentifiers[356] = #"Qingdao Yeelink Information Technology Co., Ltd."#
companyIdentifiers[357] = #"Milwaukee Tool (Formally Milwaukee Electric Tools)"#
companyIdentifiers[358] = #"MISHIK Pte Ltd"#
companyIdentifiers[359] = #"Ascensia Diabetes Care US Inc."#
companyIdentifiers[360] = #"Spicebox LLC"#
companyIdentifiers[361] = #"emberlight"#
companyIdentifiers[362] = #"Emerson Digital Cold Chain, Inc."#
companyIdentifiers[363] = #"Qblinks"#
companyIdentifiers[364] = #"MYSPHERA"#
companyIdentifiers[365] = #"LifeScan Inc"#
companyIdentifiers[366] = #"Volantic AB"#
companyIdentifiers[367] = #"Podo Labs, Inc"#
companyIdentifiers[368] = #"Roche Diabetes Care AG"#
companyIdentifiers[369] = #"Amazon.com Services LLC"#
companyIdentifiers[370] = #"Connovate Technology Private Limited"#
companyIdentifiers[371] = #"Kocomojo, LLC"#
companyIdentifiers[372] = #"Everykey Inc."#
companyIdentifiers[373] = #"Dynamic Controls"#
companyIdentifiers[374] = #"SentriLock"#
companyIdentifiers[375] = #"I-SYST inc."#
companyIdentifiers[376] = #"CASIO COMPUTER CO., LTD."#
companyIdentifiers[377] = #"LAPIS Technology Co., Ltd. formerly LAPIS Semiconductor Co., Ltd."#
companyIdentifiers[378] = #"Telemonitor, Inc."#
companyIdentifiers[379] = #"taskit GmbH"#
companyIdentifiers[380] = #"Mercedes-Benz Group AG"#
companyIdentifiers[381] = #"BatAndCat"#
companyIdentifiers[382] = #"BluDotz Ltd"#
companyIdentifiers[383] = #"XTel Wireless ApS"#
companyIdentifiers[384] = #"Gigaset Communications GmbH"#
companyIdentifiers[385] = #"Gecko Health Innovations, Inc."#
companyIdentifiers[386] = #"HOP Ubiquitous"#
companyIdentifiers[387] = #"Walt Disney"#
companyIdentifiers[388] = #"Nectar"#
companyIdentifiers[389] = #"bel'apps LLC"#
companyIdentifiers[390] = #"CORE Lighting Ltd"#
companyIdentifiers[391] = #"Seraphim Sense Ltd"#
companyIdentifiers[392] = #"Unico RBC"#
companyIdentifiers[393] = #"Physical Enterprises Inc."#
companyIdentifiers[394] = #"Able Trend Technology Limited"#
companyIdentifiers[395] = #"Konica Minolta, Inc."#
companyIdentifiers[396] = #"Wilo SE"#
companyIdentifiers[397] = #"Extron Design Services"#
companyIdentifiers[398] = #"Fitbit, Inc."#
companyIdentifiers[399] = #"Fireflies Systems"#
companyIdentifiers[400] = #"Intelletto Technologies Inc."#
companyIdentifiers[401] = #"FDK CORPORATION"#
companyIdentifiers[402] = #"Cloudleaf, Inc"#
companyIdentifiers[403] = #"Maveric Automation LLC"#
companyIdentifiers[404] = #"Acoustic Stream Corporation"#
companyIdentifiers[405] = #"Zuli"#
companyIdentifiers[406] = #"Paxton Access Ltd"#
companyIdentifiers[407] = #"WiSilica Inc."#
companyIdentifiers[408] = #"VENGIT Korlatolt Felelossegu Tarsasag"#
companyIdentifiers[409] = #"SALTO SYSTEMS S.L."#
companyIdentifiers[410] = #"TRON Forum (formerly T-Engine Forum)"#
companyIdentifiers[411] = #"CUBETECH s.r.o."#
companyIdentifiers[412] = #"Cokiya Incorporated"#
companyIdentifiers[413] = #"CVS Health"#
companyIdentifiers[414] = #"Ceruus"#
companyIdentifiers[415] = #"Strainstall Ltd"#
companyIdentifiers[416] = #"Channel Enterprises (HK) Ltd."#
companyIdentifiers[417] = #"FIAMM"#
companyIdentifiers[418] = #"GIGALANE.CO.,LTD"#
companyIdentifiers[419] = #"EROAD"#
companyIdentifiers[420] = #"Mine Safety Appliances"#
companyIdentifiers[421] = #"Icon Health and Fitness"#
companyIdentifiers[422] = #"Wille Engineering (formely as Asandoo GmbH)"#
companyIdentifiers[423] = #"ENERGOUS CORPORATION"#
companyIdentifiers[424] = #"Taobao"#
companyIdentifiers[425] = #"Canon Inc."#
companyIdentifiers[426] = #"Geophysical Technology Inc."#
companyIdentifiers[427] = #"Facebook, Inc."#
companyIdentifiers[428] = #"Trividia Health, Inc."#
companyIdentifiers[429] = #"FlightSafety International"#
companyIdentifiers[430] = #"Earlens Corporation"#
companyIdentifiers[431] = #"Sunrise Micro Devices, Inc."#
companyIdentifiers[432] = #"Star Micronics Co., Ltd."#
companyIdentifiers[433] = #"Netizens Sp. z o.o."#
companyIdentifiers[434] = #"Nymi Inc."#
companyIdentifiers[435] = #"Nytec, Inc."#
companyIdentifiers[436] = #"Trineo Sp. z o.o."#
companyIdentifiers[437] = #"Nest Labs Inc."#
companyIdentifiers[438] = #"LM Technologies Ltd"#
companyIdentifiers[439] = #"General Electric Company"#
companyIdentifiers[440] = #"i+D3 S.L."#
companyIdentifiers[441] = #"HANA Micron"#
companyIdentifiers[442] = #"Stages Cycling LLC"#
companyIdentifiers[443] = #"Cochlear Bone Anchored Solutions AB"#
companyIdentifiers[444] = #"SenionLab AB"#
companyIdentifiers[445] = #"Syszone Co., Ltd"#
companyIdentifiers[446] = #"Pulsate Mobile Ltd."#
companyIdentifiers[447] = #"Hong Kong HunterSun Electronic Limited"#
companyIdentifiers[448] = #"pironex GmbH"#
companyIdentifiers[449] = #"BRADATECH Corp."#
companyIdentifiers[450] = #"Transenergooil AG"#
companyIdentifiers[451] = #"Bunch"#
companyIdentifiers[452] = #"DME Microelectronics"#
companyIdentifiers[453] = #"Bitcraze AB"#
companyIdentifiers[454] = #"HASWARE Inc."#
companyIdentifiers[455] = #"Abiogenix Inc."#
companyIdentifiers[456] = #"Poly-Control ApS"#
companyIdentifiers[457] = #"Avi-on"#
companyIdentifiers[458] = #"Laerdal Medical AS"#
companyIdentifiers[459] = #"Fetch My Pet"#
companyIdentifiers[460] = #"Sam Labs Ltd."#
companyIdentifiers[461] = #"Chengdu Synwing Technology Ltd"#
companyIdentifiers[462] = #"HOUWA SYSTEM DESIGN, k.k."#
companyIdentifiers[463] = #"BSH"#
companyIdentifiers[464] = #"Primus Inter Pares Ltd"#
companyIdentifiers[465] = #"August Home, Inc"#
companyIdentifiers[466] = #"Gill Electronics"#
companyIdentifiers[467] = #"Sky Wave Design"#
companyIdentifiers[468] = #"Newlab S.r.l."#
companyIdentifiers[469] = #"ELAD srl"#
companyIdentifiers[470] = #"G-wearables inc."#
companyIdentifiers[471] = #"Squadrone Systems Inc."#
companyIdentifiers[472] = #"Code Corporation"#
companyIdentifiers[473] = #"Savant Systems LLC"#
companyIdentifiers[474] = #"Logitech International SA"#
companyIdentifiers[475] = #"Innblue Consulting"#
companyIdentifiers[476] = #"iParking Ltd."#
companyIdentifiers[477] = #"Koninklijke Philips Electronics N.V."#
companyIdentifiers[478] = #"Minelab Electronics Pty Limited"#
companyIdentifiers[479] = #"Bison Group Ltd."#
companyIdentifiers[480] = #"Widex A/S"#
companyIdentifiers[481] = #"Jolla Ltd"#
companyIdentifiers[482] = #"Lectronix, Inc."#
companyIdentifiers[483] = #"Caterpillar Inc"#
companyIdentifiers[484] = #"Freedom Innovations"#
companyIdentifiers[485] = #"Dynamic Devices Ltd"#
companyIdentifiers[486] = #"Technology Solutions (UK) Ltd"#
companyIdentifiers[487] = #"IPS Group Inc."#
companyIdentifiers[488] = #"STIR"#
companyIdentifiers[489] = #"Sano, Inc."#
companyIdentifiers[490] = #"Advanced Application Design, Inc."#
companyIdentifiers[491] = #"AutoMap LLC"#
companyIdentifiers[492] = #"Spreadtrum Communications Shanghai Ltd"#
companyIdentifiers[493] = #"CuteCircuit LTD"#
companyIdentifiers[494] = #"Valeo Service"#
companyIdentifiers[495] = #"Fullpower Technologies, Inc."#
companyIdentifiers[496] = #"KloudNation"#
companyIdentifiers[497] = #"Zebra Technologies Corporation"#
companyIdentifiers[498] = #"Itron, Inc."#
companyIdentifiers[499] = #"The University of Tokyo"#
companyIdentifiers[500] = #"UTC Fire and Security"#
companyIdentifiers[501] = #"Cool Webthings Limited"#
companyIdentifiers[502] = #"DJO Global"#
companyIdentifiers[503] = #"Gelliner Limited"#
companyIdentifiers[504] = #"Anyka (Guangzhou) Microelectronics Technology Co, LTD"#
companyIdentifiers[505] = #"Medtronic Inc."#
companyIdentifiers[506] = #"Gozio Inc."#
companyIdentifiers[507] = #"Form Lifting, LLC"#
companyIdentifiers[508] = #"Wahoo Fitness, LLC"#
companyIdentifiers[509] = #"Kontakt Micro-Location Sp. z o.o."#
companyIdentifiers[510] = #"Radio Systems Corporation"#
companyIdentifiers[511] = #"Freescale Semiconductor, Inc."#
companyIdentifiers[512] = #"Verifone Systems Pte Ltd. Taiwan Branch"#
companyIdentifiers[513] = #"AR Timing"#
companyIdentifiers[514] = #"Rigado LLC"#
companyIdentifiers[515] = #"Kemppi Oy"#
companyIdentifiers[516] = #"Tapcentive Inc."#
companyIdentifiers[517] = #"Smartbotics Inc."#
companyIdentifiers[518] = #"Otter Products, LLC"#
companyIdentifiers[519] = #"STEMP Inc."#
companyIdentifiers[520] = #"LumiGeek LLC"#
companyIdentifiers[521] = #"InvisionHeart Inc."#
companyIdentifiers[522] = #"Macnica Inc."#
companyIdentifiers[523] = #"Jaguar Land Rover Limited"#
companyIdentifiers[524] = #"CoroWare Technologies, Inc"#
companyIdentifiers[525] = #"Simplo Technology Co., LTD"#
companyIdentifiers[526] = #"Omron Healthcare Co., LTD"#
companyIdentifiers[527] = #"Comodule GMBH"#
companyIdentifiers[528] = #"ikeGPS"#
companyIdentifiers[529] = #"Telink Semiconductor Co. Ltd"#
companyIdentifiers[530] = #"Interplan Co., Ltd"#
companyIdentifiers[531] = #"Wyler AG"#
companyIdentifiers[532] = #"IK Multimedia Production srl"#
companyIdentifiers[533] = #"Lukoton Experience Oy"#
companyIdentifiers[534] = #"MTI Ltd"#
companyIdentifiers[535] = #"Tech4home, Lda"#
companyIdentifiers[536] = #"Hiotech AB"#
companyIdentifiers[537] = #"DOTT Limited"#
companyIdentifiers[538] = #"Blue Speck Labs, LLC"#
companyIdentifiers[539] = #"Cisco Systems, Inc"#
companyIdentifiers[540] = #"Mobicomm Inc"#
companyIdentifiers[541] = #"Edamic"#
companyIdentifiers[542] = #"Goodnet, Ltd"#
companyIdentifiers[543] = #"Luster Leaf Products Inc"#
companyIdentifiers[544] = #"Manus Machina BV"#
companyIdentifiers[545] = #"Mobiquity Networks Inc"#
companyIdentifiers[546] = #"Praxis Dynamics"#
companyIdentifiers[547] = #"Philip Morris Products S.A."#
companyIdentifiers[548] = #"Comarch SA"#
companyIdentifiers[549] = #"Nestlé Nespresso S.A."#
companyIdentifiers[550] = #"Merlinia A/S"#
companyIdentifiers[551] = #"LifeBEAM Technologies"#
companyIdentifiers[552] = #"Twocanoes Labs, LLC"#
companyIdentifiers[553] = #"Muoverti Limited"#
companyIdentifiers[554] = #"Stamer Musikanlagen GMBH"#
companyIdentifiers[555] = #"Tesla Motors"#
companyIdentifiers[556] = #"Pharynks Corporation"#
companyIdentifiers[557] = #"Lupine"#
companyIdentifiers[558] = #"Siemens AG"#
companyIdentifiers[559] = #"Huami (Shanghai) Culture Communication CO., LTD"#
companyIdentifiers[560] = #"Foster Electric Company, Ltd"#
companyIdentifiers[561] = #"ETA SA"#
companyIdentifiers[562] = #"x-Senso Solutions Kft"#
companyIdentifiers[563] = #"Shenzhen SuLong Communication Ltd"#
companyIdentifiers[564] = #"FengFan (BeiJing) Technology Co, Ltd"#
companyIdentifiers[565] = #"Qrio Inc"#
companyIdentifiers[566] = #"Pitpatpet Ltd"#
companyIdentifiers[567] = #"MSHeli s.r.l."#
companyIdentifiers[568] = #"Trakm8 Ltd"#
companyIdentifiers[569] = #"JIN CO, Ltd"#
companyIdentifiers[570] = #"Alatech Tehnology"#
companyIdentifiers[571] = #"Beijing CarePulse Electronic Technology Co, Ltd"#
companyIdentifiers[572] = #"Awarepoint"#
companyIdentifiers[573] = #"ViCentra B.V."#
companyIdentifiers[574] = #"Raven Industries"#
companyIdentifiers[575] = #"WaveWare Technologies Inc."#
companyIdentifiers[576] = #"Argenox Technologies"#
companyIdentifiers[577] = #"Bragi GmbH"#
companyIdentifiers[578] = #"16Lab Inc"#
companyIdentifiers[579] = #"Masimo Corp"#
companyIdentifiers[580] = #"Iotera Inc"#
companyIdentifiers[581] = #"Endress+Hauser "#
companyIdentifiers[582] = #"ACKme Networks, Inc."#
companyIdentifiers[583] = #"FiftyThree Inc."#
companyIdentifiers[584] = #"Parker Hannifin Corp"#
companyIdentifiers[585] = #"Transcranial Ltd"#
companyIdentifiers[586] = #"Uwatec AG"#
companyIdentifiers[587] = #"Orlan LLC"#
companyIdentifiers[588] = #"Blue Clover Devices"#
companyIdentifiers[589] = #"M-Way Solutions GmbH"#
companyIdentifiers[590] = #"Microtronics Engineering GmbH"#
companyIdentifiers[591] = #"Schneider Schreibgeräte GmbH"#
companyIdentifiers[592] = #"Sapphire Circuits LLC"#
companyIdentifiers[593] = #"Lumo Bodytech Inc."#
companyIdentifiers[594] = #"UKC Technosolution"#
companyIdentifiers[595] = #"Xicato Inc."#
companyIdentifiers[596] = #"Playbrush"#
companyIdentifiers[597] = #"Dai Nippon Printing Co., Ltd."#
companyIdentifiers[598] = #"G24 Power Limited"#
companyIdentifiers[599] = #"AdBabble Local Commerce Inc."#
companyIdentifiers[600] = #"Devialet SA"#
companyIdentifiers[601] = #"ALTYOR"#
companyIdentifiers[602] = #"University of Applied Sciences Valais/Haute Ecole Valaisanne"#
companyIdentifiers[603] = #"Five Interactive, LLC dba Zendo"#
companyIdentifiers[604] = #"NetEase(Hangzhou)Network co.Ltd."#
companyIdentifiers[605] = #"Lexmark International Inc."#
companyIdentifiers[606] = #"Fluke Corporation"#
companyIdentifiers[607] = #"Yardarm Technologies"#
companyIdentifiers[608] = #"SensaRx"#
companyIdentifiers[609] = #"SECVRE GmbH"#
companyIdentifiers[610] = #"Glacial Ridge Technologies"#
companyIdentifiers[611] = #"Identiv, Inc."#
companyIdentifiers[612] = #"DDS, Inc."#
companyIdentifiers[613] = #"SMK Corporation"#
companyIdentifiers[614] = #"Schawbel Technologies LLC"#
companyIdentifiers[615] = #"XMI Systems SA"#
companyIdentifiers[616] = #"Cerevo"#
companyIdentifiers[617] = #"Torrox GmbH & Co KG"#
companyIdentifiers[618] = #"Gemalto"#
companyIdentifiers[619] = #"DEKA Research & Development Corp."#
companyIdentifiers[620] = #"Domster Tadeusz Szydlowski"#
companyIdentifiers[621] = #"Technogym SPA"#
companyIdentifiers[622] = #"FLEURBAEY BVBA"#
companyIdentifiers[623] = #"Aptcode Solutions"#
companyIdentifiers[624] = #"LSI ADL Technology"#
companyIdentifiers[625] = #"Animas Corp"#
companyIdentifiers[626] = #"Alps Alpine Co., Ltd."#
companyIdentifiers[627] = #"OCEASOFT"#
companyIdentifiers[628] = #"Motsai Research"#
companyIdentifiers[629] = #"Geotab"#
companyIdentifiers[630] = #"E.G.O. Elektro-Geraetebau GmbH"#
companyIdentifiers[631] = #"bewhere inc"#
companyIdentifiers[632] = #"Johnson Outdoors Inc"#
companyIdentifiers[633] = #"steute Schaltgerate GmbH & Co. KG"#
companyIdentifiers[634] = #"Ekomini inc."#
companyIdentifiers[635] = #"DEFA AS"#
companyIdentifiers[636] = #"Aseptika Ltd"#
companyIdentifiers[637] = #"HUAWEI Technologies Co., Ltd."#
companyIdentifiers[638] = #"HabitAware, LLC"#
companyIdentifiers[639] = #"ruwido austria gmbh"#
companyIdentifiers[640] = #"ITEC corporation"#
companyIdentifiers[641] = #"StoneL"#
companyIdentifiers[642] = #"Sonova AG"#
companyIdentifiers[643] = #"Maven Machines, Inc."#
companyIdentifiers[644] = #"Synapse Electronics"#
companyIdentifiers[645] = #"WOWTech Canada Ltd."#
companyIdentifiers[646] = #"RF Code, Inc."#
companyIdentifiers[647] = #"Wally Ventures S.L."#
companyIdentifiers[648] = #"Willowbank Electronics Ltd"#
companyIdentifiers[649] = #"SK Telecom"#
companyIdentifiers[650] = #"Jetro AS"#
companyIdentifiers[651] = #"Code Gears LTD"#
companyIdentifiers[652] = #"NANOLINK APS"#
companyIdentifiers[653] = #"IF, LLC"#
companyIdentifiers[654] = #"RF Digital Corp"#
companyIdentifiers[655] = #"Church & Dwight Co., Inc"#
companyIdentifiers[656] = #"Multibit Oy"#
companyIdentifiers[657] = #"CliniCloud Inc"#
companyIdentifiers[658] = #"SwiftSensors"#
companyIdentifiers[659] = #"Blue Bite"#
companyIdentifiers[660] = #"ELIAS GmbH"#
companyIdentifiers[661] = #"Sivantos GmbH"#
companyIdentifiers[662] = #"Petzl"#
companyIdentifiers[663] = #"storm power ltd"#
companyIdentifiers[664] = #"EISST Ltd"#
companyIdentifiers[665] = #"Inexess Technology Simma KG"#
companyIdentifiers[666] = #"Currant, Inc."#
companyIdentifiers[667] = #"C2 Development, Inc."#
companyIdentifiers[668] = #"Blue Sky Scientific, LLC"#
companyIdentifiers[669] = #"ALOTTAZS LABS, LLC"#
companyIdentifiers[670] = #"Kupson spol. s r.o."#
companyIdentifiers[671] = #"Areus Engineering GmbH"#
companyIdentifiers[672] = #"Impossible Camera GmbH"#
companyIdentifiers[673] = #"InventureTrack Systems"#
companyIdentifiers[674] = #"LockedUp"#
companyIdentifiers[675] = #"Itude"#
companyIdentifiers[676] = #"Pacific Lock Company"#
companyIdentifiers[677] = #"Tendyron Corporation ( 天地融科技股份有限公司 )"#
companyIdentifiers[678] = #"Robert Bosch GmbH"#
companyIdentifiers[679] = #"Illuxtron international B.V."#
companyIdentifiers[680] = #"miSport Ltd."#
companyIdentifiers[681] = #"Chargelib"#
companyIdentifiers[682] = #"Doppler Lab"#
companyIdentifiers[683] = #"BBPOS Limited"#
companyIdentifiers[684] = #"RTB Elektronik GmbH & Co. KG"#
companyIdentifiers[685] = #"Rx Networks, Inc."#
companyIdentifiers[686] = #"WeatherFlow, Inc."#
companyIdentifiers[687] = #"Technicolor USA Inc."#
companyIdentifiers[688] = #"Bestechnic(Shanghai),Ltd"#
companyIdentifiers[689] = #"Raden Inc"#
companyIdentifiers[690] = #"JouZen Oy"#
companyIdentifiers[691] = #"CLABER S.P.A."#
companyIdentifiers[692] = #"Hyginex, Inc."#
companyIdentifiers[693] = #"HANSHIN ELECTRIC RAILWAY CO.,LTD."#
companyIdentifiers[694] = #"Schneider Electric"#
companyIdentifiers[695] = #"Oort Technologies LLC"#
companyIdentifiers[696] = #"Chrono Therapeutics"#
companyIdentifiers[697] = #"Rinnai Corporation"#
companyIdentifiers[698] = #"Swissprime Technologies AG"#
companyIdentifiers[699] = #"Koha.,Co.Ltd"#
companyIdentifiers[700] = #"Genevac Ltd"#
companyIdentifiers[701] = #"Chemtronics"#
companyIdentifiers[702] = #"Seguro Technology Sp. z o.o."#
companyIdentifiers[703] = #"Redbird Flight Simulations"#
companyIdentifiers[704] = #"Dash Robotics"#
companyIdentifiers[705] = #"LINE Corporation"#
companyIdentifiers[706] = #"Guillemot Corporation"#
companyIdentifiers[707] = #"Techtronic Power Tools Technology Limited"#
companyIdentifiers[708] = #"Wilson Sporting Goods"#
companyIdentifiers[709] = #"Lenovo (Singapore) Pte Ltd. ( 联想(新加坡) )"#
companyIdentifiers[710] = #"Ayatan Sensors"#
companyIdentifiers[711] = #"Electronics Tomorrow Limited"#
companyIdentifiers[712] = #"OneSpan "#
companyIdentifiers[713] = #"PayRange Inc."#
companyIdentifiers[714] = #"ABOV Semiconductor"#
companyIdentifiers[715] = #"AINA-Wireless Inc."#
companyIdentifiers[716] = #"Eijkelkamp Soil & Water"#
companyIdentifiers[717] = #"BMA ergonomics b.v."#
companyIdentifiers[718] = #"Teva Branded Pharmaceutical Products R&D, Inc."#
companyIdentifiers[719] = #"Anima"#
companyIdentifiers[720] = #"3M"#
companyIdentifiers[721] = #"Empatica Srl"#
companyIdentifiers[722] = #"Afero, Inc."#
companyIdentifiers[723] = #"Powercast Corporation"#
companyIdentifiers[724] = #"Secuyou ApS"#
companyIdentifiers[725] = #"OMRON Corporation"#
companyIdentifiers[726] = #"Send Solutions"#
companyIdentifiers[727] = #"NIPPON SYSTEMWARE CO.,LTD."#
companyIdentifiers[728] = #"Neosfar"#
companyIdentifiers[729] = #"Fliegl Agrartechnik GmbH"#
companyIdentifiers[730] = #"Gilvader"#
companyIdentifiers[731] = #"Digi International Inc (R)"#
companyIdentifiers[732] = #"DeWalch Technologies, Inc."#
companyIdentifiers[733] = #"Flint Rehabilitation Devices, LLC"#
companyIdentifiers[734] = #"Samsung SDS Co., Ltd."#
companyIdentifiers[735] = #"Blur Product Development"#
companyIdentifiers[736] = #"University of Michigan"#
companyIdentifiers[737] = #"Victron Energy BV"#
companyIdentifiers[738] = #"NTT docomo"#
companyIdentifiers[739] = #"Carmanah Technologies Corp."#
companyIdentifiers[740] = #"Bytestorm Ltd."#
companyIdentifiers[741] = #"Espressif Incorporated ( 乐鑫信息科技(上海)有限公司 )"#
companyIdentifiers[742] = #"Unwire"#
companyIdentifiers[743] = #"Connected Yard, Inc."#
companyIdentifiers[744] = #"American Music Environments"#
companyIdentifiers[745] = #"Sensogram Technologies, Inc."#
companyIdentifiers[746] = #"Fujitsu Limited"#
companyIdentifiers[747] = #"Ardic Technology"#
companyIdentifiers[748] = #"Delta Systems, Inc"#
companyIdentifiers[749] = #"HTC Corporation "#
companyIdentifiers[750] = #"Citizen Holdings Co., Ltd. "#
companyIdentifiers[751] = #"SMART-INNOVATION.inc"#
companyIdentifiers[752] = #"Blackrat Software "#
companyIdentifiers[753] = #"The Idea Cave, LLC"#
companyIdentifiers[754] = #"GoPro, Inc."#
companyIdentifiers[755] = #"AuthAir, Inc"#
companyIdentifiers[756] = #"Vensi, Inc."#
companyIdentifiers[757] = #"Indagem Tech LLC"#
companyIdentifiers[758] = #"Intemo Technologies"#
companyIdentifiers[759] = #"DreamVisions co., Ltd."#
companyIdentifiers[760] = #"Runteq Oy Ltd"#
companyIdentifiers[761] = #"IMAGINATION TECHNOLOGIES LTD "#
companyIdentifiers[762] = #"CoSTAR TEchnologies"#
companyIdentifiers[763] = #"Clarius Mobile Health Corp."#
companyIdentifiers[764] = #"Shanghai Frequen Microelectronics Co., Ltd."#
companyIdentifiers[765] = #"Uwanna, Inc."#
companyIdentifiers[766] = #"Lierda Science & Technology Group Co., Ltd."#
companyIdentifiers[767] = #"Silicon Laboratories"#
companyIdentifiers[768] = #"World Moto Inc."#
companyIdentifiers[769] = #"Giatec Scientific Inc."#
companyIdentifiers[770] = #"Loop Devices, Inc"#
companyIdentifiers[771] = #"IACA electronique"#
companyIdentifiers[772] = #"Proxy Technologies, Inc."#
companyIdentifiers[773] = #"Swipp ApS"#
companyIdentifiers[774] = #"Life Laboratory Inc. "#
companyIdentifiers[775] = #"FUJI INDUSTRIAL CO.,LTD."#
companyIdentifiers[776] = #"Surefire, LLC"#
companyIdentifiers[777] = #"Dolby Labs"#
companyIdentifiers[778] = #"Ellisys"#
companyIdentifiers[779] = #"Magnitude Lighting Converters"#
companyIdentifiers[780] = #"Hilti AG"#
companyIdentifiers[781] = #"Devdata S.r.l."#
companyIdentifiers[782] = #"Deviceworx"#
companyIdentifiers[783] = #"Shortcut Labs"#
companyIdentifiers[784] = #"SGL Italia S.r.l."#
companyIdentifiers[785] = #"PEEQ DATA"#
companyIdentifiers[786] = #"Ducere Technologies Pvt Ltd "#
companyIdentifiers[787] = #"DiveNav, Inc. "#
companyIdentifiers[788] = #"RIIG AI Sp. z o.o."#
companyIdentifiers[789] = #"Thermo Fisher Scientific "#
companyIdentifiers[790] = #"AG Measurematics Pvt. Ltd. "#
companyIdentifiers[791] = #"CHUO Electronics CO., LTD. "#
companyIdentifiers[792] = #"Aspenta International "#
companyIdentifiers[793] = #"Eugster Frismag AG "#
companyIdentifiers[794] = #"Wurth Elektronik eiSos GmbH & Co. KG ( formerly Amber wireless GmbH) "#
companyIdentifiers[795] = #"HQ Inc "#
companyIdentifiers[796] = #"Lab Sensor Solutions "#
companyIdentifiers[797] = #"Enterlab ApS "#
companyIdentifiers[798] = #"Eyefi, Inc."#
companyIdentifiers[799] = #"MetaSystem S.p.A. "#
companyIdentifiers[800] = #"SONO ELECTRONICS. CO., LTD "#
companyIdentifiers[801] = #"Jewelbots "#
companyIdentifiers[802] = #"Compumedics Limited "#
companyIdentifiers[803] = #"Rotor Bike Components "#
companyIdentifiers[804] = #"Astro, Inc. "#
companyIdentifiers[805] = #"Amotus Solutions "#
companyIdentifiers[806] = #"Healthwear Technologies (Changzhou)Ltd "#
companyIdentifiers[807] = #"Essex Electronics "#
companyIdentifiers[808] = #"Grundfos A/S"#
companyIdentifiers[809] = #"Eargo, Inc. "#
companyIdentifiers[810] = #"Electronic Design Lab "#
companyIdentifiers[811] = #"ESYLUX "#
companyIdentifiers[812] = #"NIPPON SMT.CO.,Ltd"#
companyIdentifiers[813] = #"BM innovations GmbH "#
companyIdentifiers[814] = #"indoormap"#
companyIdentifiers[815] = #"OttoQ Inc "#
companyIdentifiers[816] = #"North Pole Engineering "#
companyIdentifiers[817] = #"3flares Technologies Inc."#
companyIdentifiers[818] = #"Electrocompaniet A.S. "#
companyIdentifiers[819] = #"Mul-T-Lock"#
companyIdentifiers[820] = #"Corentium AS "#
companyIdentifiers[821] = #"Enlighted Inc"#
companyIdentifiers[822] = #"GISTIC"#
companyIdentifiers[823] = #"AJP2 Holdings, LLC"#
companyIdentifiers[824] = #"COBI GmbH "#
companyIdentifiers[825] = #"Blue Sky Scientific, LLC "#
companyIdentifiers[826] = #"Appception, Inc."#
companyIdentifiers[827] = #"Courtney Thorne Limited "#
companyIdentifiers[828] = #"Virtuosys"#
companyIdentifiers[829] = #"TPV Technology Limited "#
companyIdentifiers[830] = #"Monitra SA"#
companyIdentifiers[831] = #"Automation Components, Inc. "#
companyIdentifiers[832] = #"Letsense s.r.l. "#
companyIdentifiers[833] = #"Etesian Technologies LLC "#
companyIdentifiers[834] = #"GERTEC BRASIL LTDA. "#
companyIdentifiers[835] = #"Drekker Development Pty. Ltd."#
companyIdentifiers[836] = #"Whirl Inc "#
companyIdentifiers[837] = #"Locus Positioning "#
companyIdentifiers[838] = #"Acuity Brands Lighting, Inc "#
companyIdentifiers[839] = #"Prevent Biometrics "#
companyIdentifiers[840] = #"Arioneo"#
companyIdentifiers[841] = #"VersaMe "#
companyIdentifiers[842] = #"Vaddio "#
companyIdentifiers[843] = #"Libratone A/S "#
companyIdentifiers[844] = #"HM Electronics, Inc. "#
companyIdentifiers[845] = #"TASER International, Inc."#
companyIdentifiers[846] = #"SafeTrust Inc. "#
companyIdentifiers[847] = #"Heartland Payment Systems "#
companyIdentifiers[848] = #"Bitstrata Systems Inc. "#
companyIdentifiers[849] = #"Pieps GmbH "#
companyIdentifiers[850] = #"iRiding(Xiamen)Technology Co.,Ltd."#
companyIdentifiers[851] = #"Alpha Audiotronics, Inc. "#
companyIdentifiers[852] = #"TOPPAN FORMS CO.,LTD. "#
companyIdentifiers[853] = #"Sigma Designs, Inc. "#
companyIdentifiers[854] = #"Spectrum Brands, Inc. "#
companyIdentifiers[855] = #"Polymap Wireless "#
companyIdentifiers[856] = #"MagniWare Ltd."#
companyIdentifiers[857] = #"Novotec Medical GmbH "#
companyIdentifiers[858] = #"Medicom Innovation Partner a/s "#
companyIdentifiers[859] = #"Matrix Inc. "#
companyIdentifiers[860] = #"Eaton Corporation "#
companyIdentifiers[861] = #"KYS"#
companyIdentifiers[862] = #"Naya Health, Inc. "#
companyIdentifiers[863] = #"Acromag "#
companyIdentifiers[864] = #"Insulet Corporation "#
companyIdentifiers[865] = #"Wellinks Inc. "#
companyIdentifiers[866] = #"ON Semiconductor"#
companyIdentifiers[867] = #"FREELAP SA "#
companyIdentifiers[868] = #"Favero Electronics Srl "#
companyIdentifiers[869] = #"BioMech Sensor LLC "#
companyIdentifiers[870] = #"BOLTT Sports technologies Private limited"#
companyIdentifiers[871] = #"Saphe International "#
companyIdentifiers[872] = #"Metormote AB "#
companyIdentifiers[873] = #"littleBits "#
companyIdentifiers[874] = #"SetPoint Medical "#
companyIdentifiers[875] = #"BRControls Products BV "#
companyIdentifiers[876] = #"Zipcar "#
companyIdentifiers[877] = #"AirBolt Pty Ltd "#
companyIdentifiers[878] = #"MOTIVE TECHNOLOGIES, INC."#
companyIdentifiers[879] = #"Motiv, Inc. "#
companyIdentifiers[880] = #"Wazombi Labs OÜ "#
companyIdentifiers[881] = #"ORBCOMM"#
companyIdentifiers[882] = #"Nixie Labs, Inc."#
companyIdentifiers[883] = #"AppNearMe Ltd"#
companyIdentifiers[884] = #"Holman Industries"#
companyIdentifiers[885] = #"Expain AS"#
companyIdentifiers[886] = #"Electronic Temperature Instruments Ltd"#
companyIdentifiers[887] = #"Plejd AB"#
companyIdentifiers[888] = #"Propeller Health"#
companyIdentifiers[889] = #"Shenzhen iMCO Electronic Technology Co.,Ltd"#
companyIdentifiers[890] = #"Algoria"#
companyIdentifiers[891] = #"Apption Labs Inc."#
companyIdentifiers[892] = #"Cronologics Corporation"#
companyIdentifiers[893] = #"MICRODIA Ltd."#
companyIdentifiers[894] = #"lulabytes S.L."#
companyIdentifiers[895] = #"Société des Produits Nestlé S.A. (formerly Nestec S.A.)"#
companyIdentifiers[896] = #"LLC "MEGA-F service""#
companyIdentifiers[897] = #"Sharp Corporation"#
companyIdentifiers[898] = #"Precision Outcomes Ltd"#
companyIdentifiers[899] = #"Kronos Incorporated"#
companyIdentifiers[900] = #"OCOSMOS Co., Ltd."#
companyIdentifiers[901] = #"Embedded Electronic Solutions Ltd. dba e2Solutions"#
companyIdentifiers[902] = #"Aterica Inc."#
companyIdentifiers[903] = #"BluStor PMC, Inc."#
companyIdentifiers[904] = #"Kapsch TrafficCom AB"#
companyIdentifiers[905] = #"ActiveBlu Corporation"#
companyIdentifiers[906] = #"Kohler Mira Limited"#
companyIdentifiers[907] = #"Noke"#
companyIdentifiers[908] = #"Appion Inc."#
companyIdentifiers[909] = #"Resmed Ltd"#
companyIdentifiers[910] = #"Crownstone B.V."#
companyIdentifiers[911] = #"Xiaomi Inc."#
companyIdentifiers[912] = #"INFOTECH s.r.o."#
companyIdentifiers[913] = #"Thingsquare AB"#
companyIdentifiers[914] = #"T&D"#
companyIdentifiers[915] = #"LAVAZZA S.p.A."#
companyIdentifiers[916] = #"Netclearance Systems, Inc."#
companyIdentifiers[917] = #"SDATAWAY"#
companyIdentifiers[918] = #"BLOKS GmbH"#
companyIdentifiers[919] = #"LEGO System A/S"#
companyIdentifiers[920] = #"Thetatronics Ltd"#
companyIdentifiers[921] = #"Nikon Corporation"#
companyIdentifiers[922] = #"NeST"#
companyIdentifiers[923] = #"South Silicon Valley Microelectronics"#
companyIdentifiers[924] = #"ALE International"#
companyIdentifiers[925] = #"CareView Communications, Inc."#
companyIdentifiers[926] = #"SchoolBoard Limited"#
companyIdentifiers[927] = #"Molex Corporation"#
companyIdentifiers[928] = #"IVT Wireless Limited"#
companyIdentifiers[929] = #"Alpine Labs LLC"#
companyIdentifiers[930] = #"Candura Instruments"#
companyIdentifiers[931] = #"SmartMovt Technology Co., Ltd"#
companyIdentifiers[932] = #"Token Zero Ltd"#
companyIdentifiers[933] = #"ACE CAD Enterprise Co., Ltd. (ACECAD)"#
companyIdentifiers[934] = #"Medela, Inc"#
companyIdentifiers[935] = #"AeroScout"#
companyIdentifiers[936] = #"Esrille Inc."#
companyIdentifiers[937] = #"THINKERLY SRL"#
companyIdentifiers[938] = #"Exon Sp. z o.o."#
companyIdentifiers[939] = #"Meizu Technology Co., Ltd."#
companyIdentifiers[940] = #"Smablo LTD"#
companyIdentifiers[941] = #"XiQ"#
companyIdentifiers[942] = #"Allswell Inc."#
companyIdentifiers[943] = #"Comm-N-Sense Corp DBA Verigo"#
companyIdentifiers[944] = #"VIBRADORM GmbH"#
companyIdentifiers[945] = #"Otodata Wireless Network Inc."#
companyIdentifiers[946] = #"Propagation Systems Limited"#
companyIdentifiers[947] = #"Midwest Instruments & Controls"#
companyIdentifiers[948] = #"Alpha Nodus, inc."#
companyIdentifiers[949] = #"petPOMM, Inc"#
companyIdentifiers[950] = #"Mattel"#
companyIdentifiers[951] = #"Airbly Inc."#
companyIdentifiers[952] = #"A-Safe Limited"#
companyIdentifiers[953] = #"FREDERIQUE CONSTANT SA"#
companyIdentifiers[954] = #"Maxscend Microelectronics Company Limited"#
companyIdentifiers[955] = #"Abbott"#
companyIdentifiers[956] = #"ASB Bank Ltd"#
companyIdentifiers[957] = #"amadas"#
companyIdentifiers[958] = #"Applied Science, Inc."#
companyIdentifiers[959] = #"iLumi Solutions Inc."#
companyIdentifiers[960] = #"Arch Systems Inc."#
companyIdentifiers[961] = #"Ember Technologies, Inc."#
companyIdentifiers[962] = #"Snapchat Inc"#
companyIdentifiers[963] = #"Casambi Technologies Oy"#
companyIdentifiers[964] = #"Pico Technology Inc."#
companyIdentifiers[965] = #"St. Jude Medical, Inc."#
companyIdentifiers[966] = #"Intricon"#
companyIdentifiers[967] = #"Structural Health Systems, Inc."#
companyIdentifiers[968] = #"Avvel International"#
companyIdentifiers[969] = #"Gallagher Group"#
companyIdentifiers[970] = #"In2things Automation Pvt. Ltd."#
companyIdentifiers[971] = #"SYSDEV Srl"#
companyIdentifiers[972] = #"Vonkil Technologies Ltd"#
companyIdentifiers[973] = #"Wynd Technologies, Inc."#
companyIdentifiers[974] = #"CONTRINEX S.A."#
companyIdentifiers[975] = #"MIRA, Inc."#
companyIdentifiers[976] = #"Watteam Ltd"#
companyIdentifiers[977] = #"Density Inc."#
companyIdentifiers[978] = #"IOT Pot India Private Limited"#
companyIdentifiers[979] = #"Sigma Connectivity AB"#
companyIdentifiers[980] = #"PEG PEREGO SPA"#
companyIdentifiers[981] = #"Wyzelink Systems Inc."#
companyIdentifiers[982] = #"Yota Devices LTD"#
companyIdentifiers[983] = #"FINSECUR"#
companyIdentifiers[984] = #"Zen-Me Labs Ltd"#
companyIdentifiers[985] = #"3IWare Co., Ltd."#
companyIdentifiers[986] = #"EnOcean GmbH"#
companyIdentifiers[987] = #"Instabeat, Inc"#
companyIdentifiers[988] = #"Nima Labs"#
companyIdentifiers[989] = #"Andreas Stihl AG & Co. KG"#
companyIdentifiers[990] = #"Nathan Rhoades LLC"#
companyIdentifiers[991] = #"Grob Technologies, LLC"#
companyIdentifiers[992] = #"Actions (Zhuhai) Technology Co., Limited"#
companyIdentifiers[993] = #"SPD Development Company Ltd"#
companyIdentifiers[994] = #"Sensoan Oy"#
companyIdentifiers[995] = #"Qualcomm Life Inc"#
companyIdentifiers[996] = #"Chip-ing AG"#
companyIdentifiers[997] = #"ffly4u"#
companyIdentifiers[998] = #"IoT Instruments Oy"#
companyIdentifiers[999] = #"TRUE Fitness Technology"#
companyIdentifiers[1000] = #"Reiner Kartengeraete GmbH & Co. KG."#
companyIdentifiers[1001] = #"SHENZHEN LEMONJOY TECHNOLOGY CO., LTD."#
companyIdentifiers[1002] = #"Hello Inc."#
companyIdentifiers[1003] = #"Ozo Edu, Inc."#
companyIdentifiers[1004] = #"Jigowatts Inc."#
companyIdentifiers[1005] = #"BASIC MICRO.COM,INC."#
companyIdentifiers[1006] = #"CUBE TECHNOLOGIES"#
companyIdentifiers[1007] = #"foolography GmbH"#
companyIdentifiers[1008] = #"CLINK"#
companyIdentifiers[1009] = #"Hestan Smart Cooking Inc."#
companyIdentifiers[1010] = #"WindowMaster A/S"#
companyIdentifiers[1011] = #"Flowscape AB"#
companyIdentifiers[1012] = #"PAL Technologies Ltd"#
companyIdentifiers[1013] = #"WHERE, Inc."#
companyIdentifiers[1014] = #"Iton Technology Corp."#
companyIdentifiers[1015] = #"Owl Labs Inc."#
companyIdentifiers[1016] = #"Rockford Corp."#
companyIdentifiers[1017] = #"Becon Technologies Co.,Ltd."#
companyIdentifiers[1018] = #"Vyassoft Technologies Inc"#
companyIdentifiers[1019] = #"Nox Medical"#
companyIdentifiers[1020] = #"Kimberly-Clark"#
companyIdentifiers[1021] = #"Trimble Navigation Ltd."#
companyIdentifiers[1022] = #"Littelfuse"#
companyIdentifiers[1023] = #"Withings"#
companyIdentifiers[1024] = #"i-developer IT Beratung UG"#
companyIdentifiers[1025] = #"Relations Inc."#
companyIdentifiers[1026] = #"Sears Holdings Corporation"#
companyIdentifiers[1027] = #"Gantner Electronic GmbH"#
companyIdentifiers[1028] = #"Authomate Inc"#
companyIdentifiers[1029] = #"Vertex International, Inc."#
companyIdentifiers[1030] = #"Airtago"#
companyIdentifiers[1031] = #"Swiss Audio SA"#
companyIdentifiers[1032] = #"ToGetHome Inc."#
companyIdentifiers[1033] = #"AXIS"#
companyIdentifiers[1034] = #"Openmatics"#
companyIdentifiers[1035] = #"Jana Care Inc."#
companyIdentifiers[1036] = #"Senix Corporation"#
companyIdentifiers[1037] = #"NorthStar Battery Company, LLC"#
companyIdentifiers[1038] = #"SKF (U.K.) Limited"#
companyIdentifiers[1039] = #"CO-AX Technology, Inc."#
companyIdentifiers[1040] = #"Fender Musical Instruments"#
companyIdentifiers[1041] = #"Luidia Inc"#
companyIdentifiers[1042] = #"SEFAM"#
companyIdentifiers[1043] = #"Wireless Cables Inc"#
companyIdentifiers[1044] = #"Lightning Protection International Pty Ltd"#
companyIdentifiers[1045] = #"Uber Technologies Inc"#
companyIdentifiers[1046] = #"SODA GmbH"#
companyIdentifiers[1047] = #"Fatigue Science"#
companyIdentifiers[1048] = #"Reserved"#
companyIdentifiers[1049] = #"Novalogy LTD"#
companyIdentifiers[1050] = #"Friday Labs Limited"#
companyIdentifiers[1051] = #"OrthoAccel Technologies"#
companyIdentifiers[1052] = #"WaterGuru, Inc."#
companyIdentifiers[1053] = #"Benning Elektrotechnik und Elektronik GmbH & Co. KG"#
companyIdentifiers[1054] = #"Dell Computer Corporation"#
companyIdentifiers[1055] = #"Kopin Corporation"#
companyIdentifiers[1056] = #"TecBakery GmbH"#
companyIdentifiers[1057] = #"Backbone Labs, Inc."#
companyIdentifiers[1058] = #"DELSEY SA"#
companyIdentifiers[1059] = #"Chargifi Limited"#
companyIdentifiers[1060] = #"Trainesense Ltd."#
companyIdentifiers[1061] = #"Unify Software and Solutions GmbH & Co. KG"#
companyIdentifiers[1062] = #"Husqvarna AB"#
companyIdentifiers[1063] = #"Focus fleet and fuel management inc"#
companyIdentifiers[1064] = #"SmallLoop, LLC"#
companyIdentifiers[1065] = #"Prolon Inc."#
companyIdentifiers[1066] = #"BD Medical"#
companyIdentifiers[1067] = #"iMicroMed Incorporated"#
companyIdentifiers[1068] = #"Ticto N.V."#
companyIdentifiers[1069] = #"Meshtech AS"#
companyIdentifiers[1070] = #"MemCachier Inc."#
companyIdentifiers[1071] = #"Danfoss A/S"#
companyIdentifiers[1072] = #"SnapStyk Inc."#
companyIdentifiers[1073] = #"Amway Corporation"#
companyIdentifiers[1074] = #"Silk Labs, Inc."#
companyIdentifiers[1075] = #"Pillsy Inc."#
companyIdentifiers[1076] = #"Hatch Baby, Inc."#
companyIdentifiers[1077] = #"Blocks Wearables Ltd."#
companyIdentifiers[1078] = #"Drayson Technologies (Europe) Limited"#
companyIdentifiers[1079] = #"eBest IOT Inc."#
companyIdentifiers[1080] = #"Helvar Ltd"#
companyIdentifiers[1081] = #"Radiance Technologies"#
companyIdentifiers[1082] = #"Nuheara Limited"#
companyIdentifiers[1083] = #"Appside co., ltd."#
companyIdentifiers[1084] = #"DeLaval"#
companyIdentifiers[1085] = #"Coiler Corporation"#
companyIdentifiers[1086] = #"Thermomedics, Inc."#
companyIdentifiers[1087] = #"Tentacle Sync GmbH"#
companyIdentifiers[1088] = #"Valencell, Inc."#
companyIdentifiers[1089] = #"iProtoXi Oy"#
companyIdentifiers[1090] = #"SECOM CO., LTD."#
companyIdentifiers[1091] = #"Tucker International LLC"#
companyIdentifiers[1092] = #"Metanate Limited"#
companyIdentifiers[1093] = #"Kobian Canada Inc."#
companyIdentifiers[1094] = #"NETGEAR, Inc."#
companyIdentifiers[1095] = #"Fabtronics Australia Pty Ltd"#
companyIdentifiers[1096] = #"Grand Centrix GmbH"#
companyIdentifiers[1097] = #"1UP USA.com llc"#
companyIdentifiers[1098] = #"SHIMANO INC."#
companyIdentifiers[1099] = #"Nain Inc."#
companyIdentifiers[1100] = #"LifeStyle Lock, LLC"#
companyIdentifiers[1101] = #"VEGA Grieshaber KG"#
companyIdentifiers[1102] = #"Xtrava Inc."#
companyIdentifiers[1103] = #"TTS Tooltechnic Systems AG & Co. KG"#
companyIdentifiers[1104] = #"Teenage Engineering AB"#
companyIdentifiers[1105] = #"Tunstall Nordic AB"#
companyIdentifiers[1106] = #"Svep Design Center AB"#
companyIdentifiers[1107] = #"Qorvo Utrecht B.V. formerly GreenPeak Technologies BV"#
companyIdentifiers[1108] = #"Sphinx Electronics GmbH & Co KG"#
companyIdentifiers[1109] = #"Atomation"#
companyIdentifiers[1110] = #"Nemik Consulting Inc"#
companyIdentifiers[1111] = #"RF INNOVATION"#
companyIdentifiers[1112] = #"Mini Solution Co., Ltd."#
companyIdentifiers[1113] = #"Lumenetix, Inc"#
companyIdentifiers[1114] = #"2048450 Ontario Inc"#
companyIdentifiers[1115] = #"SPACEEK LTD"#
companyIdentifiers[1116] = #"Delta T Corporation"#
companyIdentifiers[1117] = #"Boston Scientific Corporation"#
companyIdentifiers[1118] = #"Nuviz, Inc."#
companyIdentifiers[1119] = #"Real Time Automation, Inc."#
companyIdentifiers[1120] = #"Kolibree"#
companyIdentifiers[1121] = #"vhf elektronik GmbH"#
companyIdentifiers[1122] = #"Bonsai Systems GmbH"#
companyIdentifiers[1123] = #"Fathom Systems Inc."#
companyIdentifiers[1124] = #"Bellman & Symfon"#
companyIdentifiers[1125] = #"International Forte Group LLC"#
companyIdentifiers[1126] = #"CycleLabs Solutions inc."#
companyIdentifiers[1127] = #"Codenex Oy"#
companyIdentifiers[1128] = #"Kynesim Ltd"#
companyIdentifiers[1129] = #"Palago AB"#
companyIdentifiers[1130] = #"INSIGMA INC."#
companyIdentifiers[1131] = #"PMD Solutions"#
companyIdentifiers[1132] = #"Qingdao Realtime Technology Co., Ltd."#
companyIdentifiers[1133] = #"BEGA Gantenbrink-Leuchten KG"#
companyIdentifiers[1134] = #"Pambor Ltd."#
companyIdentifiers[1135] = #"Develco Products A/S"#
companyIdentifiers[1136] = #"iDesign s.r.l."#
companyIdentifiers[1137] = #"TiVo Corp"#
companyIdentifiers[1138] = #"Control-J Pty Ltd"#
companyIdentifiers[1139] = #"Steelcase, Inc."#
companyIdentifiers[1140] = #"iApartment co., ltd."#
companyIdentifiers[1141] = #"Icom inc."#
companyIdentifiers[1142] = #"Oxstren Wearable Technologies Private Limited"#
companyIdentifiers[1143] = #"Blue Spark Technologies"#
companyIdentifiers[1144] = #"FarSite Communications Limited"#
companyIdentifiers[1145] = #"mywerk system GmbH"#
companyIdentifiers[1146] = #"Sinosun Technology Co., Ltd."#
companyIdentifiers[1147] = #"MIYOSHI ELECTRONICS CORPORATION"#
companyIdentifiers[1148] = #"POWERMAT LTD"#
companyIdentifiers[1149] = #"Occly LLC"#
companyIdentifiers[1150] = #"OurHub Dev IvS"#
companyIdentifiers[1151] = #"Pro-Mark, Inc."#
companyIdentifiers[1152] = #"Dynometrics Inc."#
companyIdentifiers[1153] = #"Quintrax Limited"#
companyIdentifiers[1154] = #"POS Tuning Udo Vosshenrich GmbH & Co. KG"#
companyIdentifiers[1155] = #"Multi Care Systems B.V."#
companyIdentifiers[1156] = #"Revol Technologies Inc"#
companyIdentifiers[1157] = #"SKIDATA AG"#
companyIdentifiers[1158] = #"DEV TECNOLOGIA INDUSTRIA, COMERCIO E MANUTENCAO DE EQUIPAMENTOS LTDA. - ME"#
companyIdentifiers[1159] = #"Centrica Connected Home"#
companyIdentifiers[1160] = #"Automotive Data Solutions Inc"#
companyIdentifiers[1161] = #"Igarashi Engineering"#
companyIdentifiers[1162] = #"Taelek Oy"#
companyIdentifiers[1163] = #"CP Electronics Limited"#
companyIdentifiers[1164] = #"Vectronix AG"#
companyIdentifiers[1165] = #"S-Labs Sp. z o.o."#
companyIdentifiers[1166] = #"Companion Medical, Inc."#
companyIdentifiers[1167] = #"BlueKitchen GmbH"#
companyIdentifiers[1168] = #"Matting AB"#
companyIdentifiers[1169] = #"SOREX - Wireless Solutions GmbH"#
companyIdentifiers[1170] = #"ADC Technology, Inc."#
companyIdentifiers[1171] = #"Lynxemi Pte Ltd"#
companyIdentifiers[1172] = #"SENNHEISER electronic GmbH & Co. KG"#
companyIdentifiers[1173] = #"LMT Mercer Group, Inc"#
companyIdentifiers[1174] = #"Polymorphic Labs LLC"#
companyIdentifiers[1175] = #"Cochlear Limited"#
companyIdentifiers[1176] = #"METER Group, Inc. USA"#
companyIdentifiers[1177] = #"Ruuvi Innovations Ltd."#
companyIdentifiers[1178] = #"Situne AS"#
companyIdentifiers[1179] = #"nVisti, LLC"#
companyIdentifiers[1180] = #"DyOcean"#
companyIdentifiers[1181] = #"Uhlmann & Zacher GmbH"#
companyIdentifiers[1182] = #"AND!XOR LLC"#
companyIdentifiers[1183] = #"tictote AB"#
companyIdentifiers[1184] = #"Vypin, LLC"#
companyIdentifiers[1185] = #"PNI Sensor Corporation"#
companyIdentifiers[1186] = #"ovrEngineered, LLC"#
companyIdentifiers[1187] = #"GT-tronics HK Ltd"#
companyIdentifiers[1188] = #"Herbert Waldmann GmbH & Co. KG"#
companyIdentifiers[1189] = #"Guangzhou FiiO Electronics Technology Co.,Ltd"#
companyIdentifiers[1190] = #"Vinetech Co., Ltd"#
companyIdentifiers[1191] = #"Dallas Logic Corporation"#
companyIdentifiers[1192] = #"BioTex, Inc."#
companyIdentifiers[1193] = #"DISCOVERY SOUND TECHNOLOGY, LLC"#
companyIdentifiers[1194] = #"LINKIO SAS"#
companyIdentifiers[1195] = #"Harbortronics, Inc."#
companyIdentifiers[1196] = #"Undagrid B.V."#
companyIdentifiers[1197] = #"Shure Inc"#
companyIdentifiers[1198] = #"ERM Electronic Systems LTD"#
companyIdentifiers[1199] = #"BIOROWER Handelsagentur GmbH"#
companyIdentifiers[1200] = #"Weba Sport und Med. Artikel GmbH"#
companyIdentifiers[1201] = #"Kartographers Technologies Pvt. Ltd."#
companyIdentifiers[1202] = #"The Shadow on the Moon"#
companyIdentifiers[1203] = #"mobike (Hong Kong) Limited"#
companyIdentifiers[1204] = #"Inuheat Group AB"#
companyIdentifiers[1205] = #"Swiftronix AB"#
companyIdentifiers[1206] = #"Diagnoptics Technologies"#
companyIdentifiers[1207] = #"Analog Devices, Inc."#
companyIdentifiers[1208] = #"Soraa Inc."#
companyIdentifiers[1209] = #"CSR Building Products Limited"#
companyIdentifiers[1210] = #"Crestron Electronics, Inc."#
companyIdentifiers[1211] = #"Neatebox Ltd"#
companyIdentifiers[1212] = #"Draegerwerk AG & Co. KGaA"#
companyIdentifiers[1213] = #"AlbynMedical"#
companyIdentifiers[1214] = #"Averos FZCO"#
companyIdentifiers[1215] = #"VIT Initiative, LLC"#
companyIdentifiers[1216] = #"Statsports International"#
companyIdentifiers[1217] = #"Sospitas, s.r.o."#
companyIdentifiers[1218] = #"Dmet Products Corp."#
companyIdentifiers[1219] = #"Mantracourt Electronics Limited"#
companyIdentifiers[1220] = #"TeAM Hutchins AB"#
companyIdentifiers[1221] = #"Seibert Williams Glass, LLC"#
companyIdentifiers[1222] = #"Insta GmbH"#
companyIdentifiers[1223] = #"Svantek Sp. z o.o."#
companyIdentifiers[1224] = #"Shanghai Flyco Electrical Appliance Co., Ltd."#
companyIdentifiers[1225] = #"Thornwave Labs Inc"#
companyIdentifiers[1226] = #"Steiner-Optik GmbH"#
companyIdentifiers[1227] = #"Novo Nordisk A/S"#
companyIdentifiers[1228] = #"Enflux Inc."#
companyIdentifiers[1229] = #"Safetech Products LLC"#
companyIdentifiers[1230] = #"GOOOLED S.R.L."#
companyIdentifiers[1231] = #"DOM Sicherheitstechnik GmbH & Co. KG"#
companyIdentifiers[1232] = #"Olympus Corporation"#
companyIdentifiers[1233] = #"KTS GmbH"#
companyIdentifiers[1234] = #"Anloq Technologies Inc."#
companyIdentifiers[1235] = #"Queercon, Inc"#
companyIdentifiers[1236] = #"5th Element Ltd"#
companyIdentifiers[1237] = #"Gooee Limited"#
companyIdentifiers[1238] = #"LUGLOC LLC"#
companyIdentifiers[1239] = #"Blincam, Inc."#
companyIdentifiers[1240] = #"FUJIFILM Corporation"#
companyIdentifiers[1241] = #"RandMcNally"#
companyIdentifiers[1242] = #"Franceschi Marina snc"#
companyIdentifiers[1243] = #"Engineered Audio, LLC."#
companyIdentifiers[1244] = #"IOTTIVE (OPC) PRIVATE LIMITED"#
companyIdentifiers[1245] = #"4MOD Technology"#
companyIdentifiers[1246] = #"Lutron Electronics Co., Inc."#
companyIdentifiers[1247] = #"Emerson"#
companyIdentifiers[1248] = #"Guardtec, Inc."#
companyIdentifiers[1249] = #"REACTEC LIMITED"#
companyIdentifiers[1250] = #"EllieGrid"#
companyIdentifiers[1251] = #"Under Armour"#
companyIdentifiers[1252] = #"Woodenshark"#
companyIdentifiers[1253] = #"Avack Oy"#
companyIdentifiers[1254] = #"Smart Solution Technology, Inc."#
companyIdentifiers[1255] = #"REHABTRONICS INC."#
companyIdentifiers[1256] = #"STABILO International"#
companyIdentifiers[1257] = #"Busch Jaeger Elektro GmbH"#
companyIdentifiers[1258] = #"Pacific Bioscience Laboratories, Inc"#
companyIdentifiers[1259] = #"Bird Home Automation GmbH"#
companyIdentifiers[1260] = #"Motorola Solutions"#
companyIdentifiers[1261] = #"R9 Technology, Inc."#
companyIdentifiers[1262] = #"Auxivia"#
companyIdentifiers[1263] = #"DaisyWorks, Inc"#
companyIdentifiers[1264] = #"Kosi Limited"#
companyIdentifiers[1265] = #"Theben AG"#
companyIdentifiers[1266] = #"InDreamer Techsol Private Limited"#
companyIdentifiers[1267] = #"Cerevast Medical"#
companyIdentifiers[1268] = #"ZanCompute Inc."#
companyIdentifiers[1269] = #"Pirelli Tyre S.P.A."#
companyIdentifiers[1270] = #"McLear Limited"#
companyIdentifiers[1271] = #"Shenzhen Huiding Technology Co.,Ltd."#
companyIdentifiers[1272] = #"Convergence Systems Limited"#
companyIdentifiers[1273] = #"Interactio"#
companyIdentifiers[1274] = #"Androtec GmbH"#
companyIdentifiers[1275] = #"Benchmark Drives GmbH & Co. KG"#
companyIdentifiers[1276] = #"SwingLync L. L. C."#
companyIdentifiers[1277] = #"Tapkey GmbH"#
companyIdentifiers[1278] = #"Woosim Systems Inc."#
companyIdentifiers[1279] = #"Microsemi Corporation"#
companyIdentifiers[1280] = #"Wiliot LTD."#
companyIdentifiers[1281] = #"Polaris IND"#
companyIdentifiers[1282] = #"Specifi-Kali LLC"#
companyIdentifiers[1283] = #"Locoroll, Inc"#
companyIdentifiers[1284] = #"PHYPLUS Inc"#
companyIdentifiers[1285] = #"InPlay, Inc."#
companyIdentifiers[1286] = #"Hager"#
companyIdentifiers[1287] = #"Yellowcog"#
companyIdentifiers[1288] = #"Axes System sp. z o. o."#
companyIdentifiers[1289] = #"myLIFTER Inc."#
companyIdentifiers[1290] = #"Shake-on B.V."#
companyIdentifiers[1291] = #"Vibrissa Inc."#
companyIdentifiers[1292] = #"OSRAM GmbH"#
companyIdentifiers[1293] = #"TRSystems GmbH"#
companyIdentifiers[1294] = #"Yichip Microelectronics (Hangzhou) Co.,Ltd."#
companyIdentifiers[1295] = #"Foundation Engineering LLC"#
companyIdentifiers[1296] = #"UNI-ELECTRONICS, INC."#
companyIdentifiers[1297] = #"Brookfield Equinox LLC"#
companyIdentifiers[1298] = #"Soprod SA"#
companyIdentifiers[1299] = #"9974091 Canada Inc."#
companyIdentifiers[1300] = #"FIBRO GmbH"#
companyIdentifiers[1301] = #"RB Controls Co., Ltd."#
companyIdentifiers[1302] = #"Footmarks"#
companyIdentifiers[1303] = #"Amtronic Sverige AB (formerly Amcore AB)"#
companyIdentifiers[1304] = #"MAMORIO.inc"#
companyIdentifiers[1305] = #"Tyto Life LLC"#
companyIdentifiers[1306] = #"Leica Camera AG"#
companyIdentifiers[1307] = #"Angee Technologies Ltd."#
companyIdentifiers[1308] = #"EDPS"#
companyIdentifiers[1309] = #"OFF Line Co., Ltd."#
companyIdentifiers[1310] = #"Detect Blue Limited"#
companyIdentifiers[1311] = #"Setec Pty Ltd"#
companyIdentifiers[1312] = #"Target Corporation"#
companyIdentifiers[1313] = #"IAI Corporation"#
companyIdentifiers[1314] = #"NS Tech, Inc."#
companyIdentifiers[1315] = #"MTG Co., Ltd."#
companyIdentifiers[1316] = #"Hangzhou iMagic Technology Co., Ltd"#
companyIdentifiers[1317] = #"HONGKONG NANO IC TECHNOLOGIES CO., LIMITED"#
companyIdentifiers[1318] = #"Honeywell International Inc."#
companyIdentifiers[1319] = #"Albrecht JUNG"#
companyIdentifiers[1320] = #"Lunera Lighting Inc."#
companyIdentifiers[1321] = #"Lumen UAB"#
companyIdentifiers[1322] = #"Keynes Controls Ltd"#
companyIdentifiers[1323] = #"Novartis AG"#
companyIdentifiers[1324] = #"Geosatis SA"#
companyIdentifiers[1325] = #"EXFO, Inc."#
companyIdentifiers[1326] = #"LEDVANCE GmbH"#
companyIdentifiers[1327] = #"Center ID Corp."#
companyIdentifiers[1328] = #"Adolene, Inc."#
companyIdentifiers[1329] = #"D&M Holdings Inc."#
companyIdentifiers[1330] = #"CRESCO Wireless, Inc."#
companyIdentifiers[1331] = #"Nura Operations Pty Ltd"#
companyIdentifiers[1332] = #"Frontiergadget, Inc."#
companyIdentifiers[1333] = #"Smart Component Technologies Limited"#
companyIdentifiers[1334] = #"ZTR Control Systems LLC"#
companyIdentifiers[1335] = #"MetaLogics Corporation"#
companyIdentifiers[1336] = #"Medela AG"#
companyIdentifiers[1337] = #"OPPLE Lighting Co., Ltd"#
companyIdentifiers[1338] = #"Savitech Corp.,"#
companyIdentifiers[1339] = #"prodigy"#
companyIdentifiers[1340] = #"Screenovate Technologies Ltd"#
companyIdentifiers[1341] = #"TESA SA"#
companyIdentifiers[1342] = #"CLIM8 LIMITED"#
companyIdentifiers[1343] = #"Silergy Corp"#
companyIdentifiers[1344] = #"SilverPlus, Inc"#
companyIdentifiers[1345] = #"Sharknet srl"#
companyIdentifiers[1346] = #"Mist Systems, Inc."#
companyIdentifiers[1347] = #"MIWA LOCK CO.,Ltd"#
companyIdentifiers[1348] = #"OrthoSensor, Inc."#
companyIdentifiers[1349] = #"Candy Hoover Group s.r.l"#
companyIdentifiers[1350] = #"Apexar Technologies S.A."#
companyIdentifiers[1351] = #"LOGICDATA d.o.o."#
companyIdentifiers[1352] = #"Knick Elektronische Messgeraete GmbH & Co. KG"#
companyIdentifiers[1353] = #"Smart Technologies and Investment Limited"#
companyIdentifiers[1354] = #"Linough Inc."#
companyIdentifiers[1355] = #"Advanced Electronic Designs, Inc."#
companyIdentifiers[1356] = #"Carefree Scott Fetzer Co Inc"#
companyIdentifiers[1357] = #"Sensome"#
companyIdentifiers[1358] = #"FORTRONIK storitve d.o.o."#
companyIdentifiers[1359] = #"Sinnoz"#
companyIdentifiers[1360] = #"Versa Networks, Inc."#
companyIdentifiers[1361] = #"Sylero"#
companyIdentifiers[1362] = #"Avempace SARL"#
companyIdentifiers[1363] = #"Nintendo Co., Ltd."#
companyIdentifiers[1364] = #"National Instruments"#
companyIdentifiers[1365] = #"KROHNE Messtechnik GmbH"#
companyIdentifiers[1366] = #"Otodynamics Ltd"#
companyIdentifiers[1367] = #"Arwin Technology Limited"#
companyIdentifiers[1368] = #"benegear, inc."#
companyIdentifiers[1369] = #"Newcon Optik"#
companyIdentifiers[1370] = #"CANDY HOUSE, Inc."#
companyIdentifiers[1371] = #"FRANKLIN TECHNOLOGY INC"#
companyIdentifiers[1372] = #"Lely"#
companyIdentifiers[1373] = #"Valve Corporation"#
companyIdentifiers[1374] = #"Hekatron Vertriebs GmbH"#
companyIdentifiers[1375] = #"PROTECH S.A.S. DI GIRARDI ANDREA & C."#
companyIdentifiers[1376] = #"Sarita CareTech APS (formerly Sarita CareTech IVS)"#
companyIdentifiers[1377] = #"Finder S.p.A."#
companyIdentifiers[1378] = #"Thalmic Labs Inc."#
companyIdentifiers[1379] = #"Steinel Vertrieb GmbH"#
companyIdentifiers[1380] = #"Beghelli Spa"#
companyIdentifiers[1381] = #"Beijing Smartspace Technologies Inc."#
companyIdentifiers[1382] = #"CORE TRANSPORT TECHNOLOGIES NZ LIMITED"#
companyIdentifiers[1383] = #"Xiamen Everesports Goods Co., Ltd"#
companyIdentifiers[1384] = #"Bodyport Inc."#
companyIdentifiers[1385] = #"Audionics System, INC."#
companyIdentifiers[1386] = #"Flipnavi Co.,Ltd."#
companyIdentifiers[1387] = #"Rion Co., Ltd."#
companyIdentifiers[1388] = #"Long Range Systems, LLC"#
companyIdentifiers[1389] = #"Redmond Industrial Group LLC"#
companyIdentifiers[1390] = #"VIZPIN INC."#
companyIdentifiers[1391] = #"BikeFinder AS"#
companyIdentifiers[1392] = #"Consumer Sleep Solutions LLC"#
companyIdentifiers[1393] = #"PSIKICK, INC."#
companyIdentifiers[1394] = #"AntTail.com"#
companyIdentifiers[1395] = #"Lighting Science Group Corp."#
companyIdentifiers[1396] = #"AFFORDABLE ELECTRONICS INC"#
companyIdentifiers[1397] = #"Integral Memroy Plc"#
companyIdentifiers[1398] = #"Globalstar, Inc."#
companyIdentifiers[1399] = #"True Wearables, Inc."#
companyIdentifiers[1400] = #"Wellington Drive Technologies Ltd"#
companyIdentifiers[1401] = #"Ensemble Tech Private Limited"#
companyIdentifiers[1402] = #"OMNI Remotes"#
companyIdentifiers[1403] = #"Duracell U.S. Operations Inc."#
companyIdentifiers[1404] = #"Toor Technologies LLC"#
companyIdentifiers[1405] = #"Instinct Performance"#
companyIdentifiers[1406] = #"Beco, Inc"#
companyIdentifiers[1407] = #"Scuf Gaming International, LLC"#
companyIdentifiers[1408] = #"ARANZ Medical Limited"#
companyIdentifiers[1409] = #"LYS TECHNOLOGIES LTD"#
companyIdentifiers[1410] = #"Breakwall Analytics, LLC"#
companyIdentifiers[1411] = #"Code Blue Communications"#
companyIdentifiers[1412] = #"Gira Giersiepen GmbH & Co. KG"#
companyIdentifiers[1413] = #"Hearing Lab Technology"#
companyIdentifiers[1414] = #"LEGRAND"#
companyIdentifiers[1415] = #"Derichs GmbH"#
companyIdentifiers[1416] = #"ALT-TEKNIK LLC"#
companyIdentifiers[1417] = #"Star Technologies"#
companyIdentifiers[1418] = #"START TODAY CO.,LTD."#
companyIdentifiers[1419] = #"Maxim Integrated Products"#
companyIdentifiers[1420] = #"MERCK Kommanditgesellschaft auf Aktien"#
companyIdentifiers[1421] = #"Jungheinrich Aktiengesellschaft"#
companyIdentifiers[1422] = #"Oculus VR, LLC"#
companyIdentifiers[1423] = #"HENDON SEMICONDUCTORS PTY LTD"#
companyIdentifiers[1424] = #"Pur3 Ltd"#
companyIdentifiers[1425] = #"Viasat Group S.p.A."#
companyIdentifiers[1426] = #"IZITHERM"#
companyIdentifiers[1427] = #"Spaulding Clinical Research"#
companyIdentifiers[1428] = #"Kohler Company"#
companyIdentifiers[1429] = #"Inor Process AB"#
companyIdentifiers[1430] = #"My Smart Blinds"#
companyIdentifiers[1431] = #"RadioPulse Inc"#
companyIdentifiers[1432] = #"rapitag GmbH"#
companyIdentifiers[1433] = #"Lazlo326, LLC."#
companyIdentifiers[1434] = #"Teledyne Lecroy, Inc."#
companyIdentifiers[1435] = #"Dataflow Systems Limited"#
companyIdentifiers[1436] = #"Macrogiga Electronics"#
companyIdentifiers[1437] = #"Tandem Diabetes Care"#
companyIdentifiers[1438] = #"Polycom, Inc."#
companyIdentifiers[1439] = #"Fisher & Paykel Healthcare"#
companyIdentifiers[1440] = #"RCP Software Oy"#
companyIdentifiers[1441] = #"Shanghai Xiaoyi Technology Co.,Ltd."#
companyIdentifiers[1442] = #"ADHERIUM(NZ) LIMITED"#
companyIdentifiers[1443] = #"Axiomware Systems Incorporated"#
companyIdentifiers[1444] = #"O. E. M. Controls, Inc."#
companyIdentifiers[1445] = #"Kiiroo BV"#
companyIdentifiers[1446] = #"Telecon Mobile Limited"#
companyIdentifiers[1447] = #"Sonos Inc"#
companyIdentifiers[1448] = #"Tom Allebrandi Consulting"#
companyIdentifiers[1449] = #"Monidor"#
companyIdentifiers[1450] = #"Tramex Limited"#
companyIdentifiers[1451] = #"Nofence AS"#
companyIdentifiers[1452] = #"GoerTek Dynaudio Co., Ltd."#
companyIdentifiers[1453] = #"INIA"#
companyIdentifiers[1454] = #"CARMATE MFG.CO.,LTD"#
companyIdentifiers[1455] = #"OV LOOP, INC. (formerly ONvocal)"#
companyIdentifiers[1456] = #"NewTec GmbH"#
companyIdentifiers[1457] = #"Medallion Instrumentation Systems"#
companyIdentifiers[1458] = #"CAREL INDUSTRIES S.P.A."#
companyIdentifiers[1459] = #"Parabit Systems, Inc."#
companyIdentifiers[1460] = #"White Horse Scientific ltd"#
companyIdentifiers[1461] = #"verisilicon"#
companyIdentifiers[1462] = #"Elecs Industry Co.,Ltd."#
companyIdentifiers[1463] = #"Beijing Pinecone Electronics Co.,Ltd."#
companyIdentifiers[1464] = #"Ambystoma Labs Inc."#
companyIdentifiers[1465] = #"Suzhou Pairlink Network Technology"#
companyIdentifiers[1466] = #"igloohome"#
companyIdentifiers[1467] = #"Oxford Metrics plc"#
companyIdentifiers[1468] = #"Leviton Mfg. Co., Inc."#
companyIdentifiers[1469] = #"ULC Robotics Inc."#
companyIdentifiers[1470] = #"RFID Global by Softwork SrL"#
companyIdentifiers[1471] = #"Real-World-Systems Corporation"#
companyIdentifiers[1472] = #"Nalu Medical, Inc."#
companyIdentifiers[1473] = #"P.I.Engineering"#
companyIdentifiers[1474] = #"Grote Industries"#
companyIdentifiers[1475] = #"Runtime, Inc."#
companyIdentifiers[1476] = #"Codecoup sp. z o.o. sp. k."#
companyIdentifiers[1477] = #"SELVE GmbH & Co. KG"#
companyIdentifiers[1478] = #"Smart Animal Training Systems, LLC"#
companyIdentifiers[1479] = #"Lippert Components, INC"#
companyIdentifiers[1480] = #"SOMFY SAS"#
companyIdentifiers[1481] = #"TBS Electronics B.V."#
companyIdentifiers[1482] = #"MHL Custom Inc"#
companyIdentifiers[1483] = #"LucentWear LLC"#
companyIdentifiers[1484] = #"WATTS ELECTRONICS"#
companyIdentifiers[1485] = #"RJ Brands LLC"#
companyIdentifiers[1486] = #"V-ZUG Ltd"#
companyIdentifiers[1487] = #"Biowatch SA"#
companyIdentifiers[1488] = #"Anova Applied Electronics"#
companyIdentifiers[1489] = #"Lindab AB"#
companyIdentifiers[1490] = #"frogblue TECHNOLOGY GmbH"#
companyIdentifiers[1491] = #"Acurable Limited"#
companyIdentifiers[1492] = #"LAMPLIGHT Co., Ltd."#
companyIdentifiers[1493] = #"TEGAM, Inc."#
companyIdentifiers[1494] = #"Zhuhai Jieli technology Co.,Ltd"#
companyIdentifiers[1495] = #"modum.io AG"#
companyIdentifiers[1496] = #"Farm Jenny LLC"#
companyIdentifiers[1497] = #"Toyo Electronics Corporation"#
companyIdentifiers[1498] = #"Applied Neural Research Corp"#
companyIdentifiers[1499] = #"Avid Identification Systems, Inc."#
companyIdentifiers[1500] = #"Petronics Inc."#
companyIdentifiers[1501] = #"essentim GmbH"#
companyIdentifiers[1502] = #"QT Medical INC."#
companyIdentifiers[1503] = #"VIRTUALCLINIC.DIRECT LIMITED"#
companyIdentifiers[1504] = #"Viper Design LLC"#
companyIdentifiers[1505] = #"Human, Incorporated"#
companyIdentifiers[1506] = #"stAPPtronics GmbH"#
companyIdentifiers[1507] = #"Elemental Machines, Inc."#
companyIdentifiers[1508] = #"Taiyo Yuden Co., Ltd"#
companyIdentifiers[1509] = #"INEO ENERGY& SYSTEMS"#
companyIdentifiers[1510] = #"Motion Instruments Inc."#
companyIdentifiers[1511] = #"PressurePro"#
companyIdentifiers[1512] = #"COWBOY"#
companyIdentifiers[1513] = #"iconmobile GmbH"#
companyIdentifiers[1514] = #"ACS-Control-System GmbH"#
companyIdentifiers[1515] = #"Bayerische Motoren Werke AG"#
companyIdentifiers[1516] = #"Gycom Svenska AB"#
companyIdentifiers[1517] = #"Fuji Xerox Co., Ltd"#
companyIdentifiers[1518] = #"Glide Inc."#
companyIdentifiers[1519] = #"SIKOM AS"#
companyIdentifiers[1520] = #"beken"#
companyIdentifiers[1521] = #"The Linux Foundation"#
companyIdentifiers[1522] = #"Try and E CO.,LTD."#
companyIdentifiers[1523] = #"SeeScan"#
companyIdentifiers[1524] = #"Clearity, LLC"#
companyIdentifiers[1525] = #"GS TAG"#
companyIdentifiers[1526] = #"DPTechnics"#
companyIdentifiers[1527] = #"TRACMO, INC."#
companyIdentifiers[1528] = #"Anki Inc."#
companyIdentifiers[1529] = #"Hagleitner Hygiene International GmbH"#
companyIdentifiers[1530] = #"Konami Sports Life Co., Ltd."#
companyIdentifiers[1531] = #"Arblet Inc."#
companyIdentifiers[1532] = #"Masbando GmbH"#
companyIdentifiers[1533] = #"Innoseis"#
companyIdentifiers[1534] = #"Niko nv"#
companyIdentifiers[1535] = #"Wellnomics Ltd"#
companyIdentifiers[1536] = #"iRobot Corporation"#
companyIdentifiers[1537] = #"Schrader Electronics"#
companyIdentifiers[1538] = #"Geberit International AG"#
companyIdentifiers[1539] = #"Fourth Evolution Inc"#
companyIdentifiers[1540] = #"Cell2Jack LLC"#
companyIdentifiers[1541] = #"FMW electronic Futterer u. Maier-Wolf OHG"#
companyIdentifiers[1542] = #"John Deere"#
companyIdentifiers[1543] = #"Rookery Technology Ltd"#
companyIdentifiers[1544] = #"KeySafe-Cloud"#
companyIdentifiers[1545] = #"BUCHI Labortechnik AG"#
companyIdentifiers[1546] = #"IQAir AG"#
companyIdentifiers[1547] = #"Triax Technologies Inc"#
companyIdentifiers[1548] = #"Vuzix Corporation"#
companyIdentifiers[1549] = #"TDK Corporation"#
companyIdentifiers[1550] = #"Blueair AB"#
companyIdentifiers[1551] = #"Signify Netherlands"#
companyIdentifiers[1552] = #"ADH GUARDIAN USA LLC"#
companyIdentifiers[1553] = #"Beurer GmbH"#
companyIdentifiers[1554] = #"Playfinity AS"#
companyIdentifiers[1555] = #"Hans Dinslage GmbH"#
companyIdentifiers[1556] = #"OnAsset Intelligence, Inc."#
companyIdentifiers[1557] = #"INTER ACTION Corporation"#
companyIdentifiers[1558] = #"OS42 UG (haftungsbeschraenkt)"#
companyIdentifiers[1559] = #"WIZCONNECTED COMPANY LIMITED"#
companyIdentifiers[1560] = #"Audio-Technica Corporation"#
companyIdentifiers[1561] = #"Six Guys Labs, s.r.o."#
companyIdentifiers[1562] = #"R.W. Beckett Corporation"#
companyIdentifiers[1563] = #"silex technology, inc."#
companyIdentifiers[1564] = #"Univations Limited"#
companyIdentifiers[1565] = #"SENS Innovation ApS"#
companyIdentifiers[1566] = #"Diamond Kinetics, Inc."#
companyIdentifiers[1567] = #"Phrame Inc."#
companyIdentifiers[1568] = #"Forciot Oy"#
companyIdentifiers[1569] = #"Noordung d.o.o."#
companyIdentifiers[1570] = #"Beam Labs, LLC"#
companyIdentifiers[1571] = #"Philadelphia Scientific (U.K.) Limited"#
companyIdentifiers[1572] = #"Biovotion AG"#
companyIdentifiers[1573] = #"Square Panda, Inc."#
companyIdentifiers[1574] = #"Amplifico"#
companyIdentifiers[1575] = #"WEG S.A."#
companyIdentifiers[1576] = #"Ensto Oy"#
companyIdentifiers[1577] = #"PHONEPE PVT LTD"#
companyIdentifiers[1578] = #"Lunatico Astronomia SL"#
companyIdentifiers[1579] = #"MinebeaMitsumi Inc."#
companyIdentifiers[1580] = #"ASPion GmbH"#
companyIdentifiers[1581] = #"Vossloh-Schwabe Deutschland GmbH"#
companyIdentifiers[1582] = #"Procept"#
companyIdentifiers[1583] = #"ONKYO Corporation"#
companyIdentifiers[1584] = #"Asthrea D.O.O."#
companyIdentifiers[1585] = #"Fortiori Design LLC"#
companyIdentifiers[1586] = #"Hugo Muller GmbH & Co KG"#
companyIdentifiers[1587] = #"Wangi Lai PLT"#
companyIdentifiers[1588] = #"Fanstel Corp"#
companyIdentifiers[1589] = #"Crookwood"#
companyIdentifiers[1590] = #"ELECTRONICA INTEGRAL DE SONIDO S.A."#
companyIdentifiers[1591] = #"GiP Innovation Tools GmbH"#
companyIdentifiers[1592] = #"LX SOLUTIONS PTY LIMITED"#
companyIdentifiers[1593] = #"Shenzhen Minew Technologies Co., Ltd."#
companyIdentifiers[1594] = #"Prolojik Limited"#
companyIdentifiers[1595] = #"Kromek Group Plc"#
companyIdentifiers[1596] = #"Contec Medical Systems Co., Ltd."#
companyIdentifiers[1597] = #"Xradio Technology Co.,Ltd."#
companyIdentifiers[1598] = #"The Indoor Lab, LLC"#
companyIdentifiers[1599] = #"LDL TECHNOLOGY"#
companyIdentifiers[1600] = #"Dish Network LLC"#
companyIdentifiers[1601] = #"Revenue Collection Systems FRANCE SAS"#
companyIdentifiers[1602] = #"Bluetrum Technology Co.,Ltd"#
companyIdentifiers[1603] = #"makita corporation"#
companyIdentifiers[1604] = #"Apogee Instruments"#
companyIdentifiers[1605] = #"BM3"#
companyIdentifiers[1606] = #"SGV Group Holding GmbH & Co. KG"#
companyIdentifiers[1607] = #"MED-EL"#
companyIdentifiers[1608] = #"Ultune Technologies"#
companyIdentifiers[1609] = #"Ryeex Technology Co.,Ltd."#
companyIdentifiers[1610] = #"Open Research Institute, Inc."#
companyIdentifiers[1611] = #"Scale-Tec, Ltd"#
companyIdentifiers[1612] = #"Zumtobel Group AG"#
companyIdentifiers[1613] = #"iLOQ Oy"#
companyIdentifiers[1614] = #"KRUXWorks Technologies Private Limited"#
companyIdentifiers[1615] = #"Digital Matter Pty Ltd"#
companyIdentifiers[1616] = #"Coravin, Inc."#
companyIdentifiers[1617] = #"Stasis Labs, Inc."#
companyIdentifiers[1618] = #"ITZ Innovations- und Technologiezentrum GmbH"#
companyIdentifiers[1619] = #"Meggitt SA"#
companyIdentifiers[1620] = #"Ledlenser GmbH & Co. KG"#
companyIdentifiers[1621] = #"Renishaw PLC"#
companyIdentifiers[1622] = #"ZhuHai AdvanPro Technology Company Limited"#
companyIdentifiers[1623] = #"Meshtronix Limited"#
companyIdentifiers[1624] = #"Payex Norge AS"#
companyIdentifiers[1625] = #"UnSeen Technologies Oy"#
companyIdentifiers[1626] = #"Zound Industries International AB"#
companyIdentifiers[1627] = #"Sesam Solutions BV"#
companyIdentifiers[1628] = #"PixArt Imaging Inc."#
companyIdentifiers[1629] = #"Panduit Corp."#
companyIdentifiers[1630] = #"Alo AB"#
companyIdentifiers[1631] = #"Ricoh Company Ltd"#
companyIdentifiers[1632] = #"RTC Industries, Inc."#
companyIdentifiers[1633] = #"Mode Lighting Limited"#
companyIdentifiers[1634] = #"Particle Industries, Inc."#
companyIdentifiers[1635] = #"Advanced Telemetry Systems, Inc."#
companyIdentifiers[1636] = #"RHA TECHNOLOGIES LTD"#
companyIdentifiers[1637] = #"Pure International Limited"#
companyIdentifiers[1638] = #"WTO Werkzeug-Einrichtungen GmbH"#
companyIdentifiers[1639] = #"Spark Technology Labs Inc."#
companyIdentifiers[1640] = #"Bleb Technology srl"#
companyIdentifiers[1641] = #"Livanova USA, Inc."#
companyIdentifiers[1642] = #"Brady Worldwide Inc."#
companyIdentifiers[1643] = #"DewertOkin GmbH"#
companyIdentifiers[1644] = #"Ztove ApS"#
companyIdentifiers[1645] = #"Venso EcoSolutions AB"#
companyIdentifiers[1646] = #"Eurotronik Kranj d.o.o."#
companyIdentifiers[1647] = #"Hug Technology Ltd"#
companyIdentifiers[1648] = #"Gema Switzerland GmbH"#
companyIdentifiers[1649] = #"Buzz Products Ltd."#
companyIdentifiers[1650] = #"Kopi"#
companyIdentifiers[1651] = #"Innova Ideas Limited"#
companyIdentifiers[1652] = #"BeSpoon"#
companyIdentifiers[1653] = #"Deco Enterprises, Inc."#
companyIdentifiers[1654] = #"Expai Solutions Private Limited"#
companyIdentifiers[1655] = #"Innovation First, Inc."#
companyIdentifiers[1656] = #"SABIK Offshore GmbH"#
companyIdentifiers[1657] = #"4iiii Innovations Inc."#
companyIdentifiers[1658] = #"The Energy Conservatory, Inc."#
companyIdentifiers[1659] = #"I.FARM, INC."#
companyIdentifiers[1660] = #"Tile, Inc."#
companyIdentifiers[1661] = #"Form Athletica Inc."#
companyIdentifiers[1662] = #"MbientLab Inc"#
companyIdentifiers[1663] = #"NETGRID S.N.C. DI BISSOLI MATTEO, CAMPOREALE SIMONE, TOGNETTI FEDERICO"#
companyIdentifiers[1664] = #"Mannkind Corporation"#
companyIdentifiers[1665] = #"Trade FIDES a.s."#
companyIdentifiers[1666] = #"Photron Limited"#
companyIdentifiers[1667] = #"Eltako GmbH"#
companyIdentifiers[1668] = #"Dermalapps, LLC"#
companyIdentifiers[1669] = #"Greenwald Industries"#
companyIdentifiers[1670] = #"inQs Co., Ltd."#
companyIdentifiers[1671] = #"Cherry GmbH"#
companyIdentifiers[1672] = #"Amsted Digital Solutions Inc."#
companyIdentifiers[1673] = #"Tacx b.v."#
companyIdentifiers[1674] = #"Raytac Corporation"#
companyIdentifiers[1675] = #"Jiangsu Teranovo Tech Co., Ltd."#
companyIdentifiers[1676] = #"Changzhou Sound Dragon Electronics and Acoustics Co., Ltd"#
companyIdentifiers[1677] = #"JetBeep Inc."#
companyIdentifiers[1678] = #"Razer Inc."#
companyIdentifiers[1679] = #"JRM Group Limited"#
companyIdentifiers[1680] = #"Eccrine Systems, Inc."#
companyIdentifiers[1681] = #"Curie Point AB"#
companyIdentifiers[1682] = #"Georg Fischer AG"#
companyIdentifiers[1683] = #"Hach - Danaher"#
companyIdentifiers[1684] = #"T&A Laboratories LLC"#
companyIdentifiers[1685] = #"Koki Holdings Co., Ltd."#
companyIdentifiers[1686] = #"Gunakar Private Limited"#
companyIdentifiers[1687] = #"Stemco Products Inc"#
companyIdentifiers[1688] = #"Wood IT Security, LLC"#
companyIdentifiers[1689] = #"RandomLab SAS"#
companyIdentifiers[1690] = #"Adero, Inc. (formerly as TrackR, Inc.)"#
companyIdentifiers[1691] = #"Dragonchip Limited"#
companyIdentifiers[1692] = #"Noomi AB"#
companyIdentifiers[1693] = #"Vakaros LLC"#
companyIdentifiers[1694] = #"Delta Electronics, Inc."#
companyIdentifiers[1695] = #"FlowMotion Technologies AS"#
companyIdentifiers[1696] = #"OBIQ Location Technology Inc."#
companyIdentifiers[1697] = #"Cardo Systems, Ltd"#
companyIdentifiers[1698] = #"Globalworx GmbH"#
companyIdentifiers[1699] = #"Nymbus, LLC"#
companyIdentifiers[1700] = #"Sanyo Techno Solutions Tottori Co., Ltd."#
companyIdentifiers[1701] = #"TEKZITEL PTY LTD"#
companyIdentifiers[1702] = #"Roambee Corporation"#
companyIdentifiers[1703] = #"Chipsea Technologies (ShenZhen) Corp."#
companyIdentifiers[1704] = #"GD Midea Air-Conditioning Equipment Co., Ltd."#
companyIdentifiers[1705] = #"Soundmax Electronics Limited"#
companyIdentifiers[1706] = #"Produal Oy"#
companyIdentifiers[1707] = #"HMS Industrial Networks AB"#
companyIdentifiers[1708] = #"Ingchips Technology Co., Ltd."#
companyIdentifiers[1709] = #"InnovaSea Systems Inc."#
companyIdentifiers[1710] = #"SenseQ Inc."#
companyIdentifiers[1711] = #"Shoof Technologies"#
companyIdentifiers[1712] = #"BRK Brands, Inc."#
companyIdentifiers[1713] = #"SimpliSafe, Inc."#
companyIdentifiers[1714] = #"Tussock Innovation 2013 Limited"#
companyIdentifiers[1715] = #"The Hablab ApS"#
companyIdentifiers[1716] = #"Sencilion Oy"#
companyIdentifiers[1717] = #"Wabilogic Ltd."#
companyIdentifiers[1718] = #"Sociometric Solutions, Inc."#
companyIdentifiers[1719] = #"iCOGNIZE GmbH"#
companyIdentifiers[1720] = #"ShadeCraft, Inc"#
companyIdentifiers[1721] = #"Beflex Inc."#
companyIdentifiers[1722] = #"Beaconzone Ltd"#
companyIdentifiers[1723] = #"Leaftronix Analogic Solutions Private Limited"#
companyIdentifiers[1724] = #"TWS Srl"#
companyIdentifiers[1725] = #"ABB Oy"#
companyIdentifiers[1726] = #"HitSeed Oy"#
companyIdentifiers[1727] = #"Delcom Products Inc."#
companyIdentifiers[1728] = #"CAME S.p.A."#
companyIdentifiers[1729] = #"Alarm.com Holdings, Inc"#
companyIdentifiers[1730] = #"Measurlogic Inc."#
companyIdentifiers[1731] = #"King I Electronics.Co.,Ltd"#
companyIdentifiers[1732] = #"Dream Labs GmbH"#
companyIdentifiers[1733] = #"Urban Compass, Inc"#
companyIdentifiers[1734] = #"Simm Tronic Limited"#
companyIdentifiers[1735] = #"Somatix Inc"#
companyIdentifiers[1736] = #"Storz & Bickel GmbH & Co. KG"#
companyIdentifiers[1737] = #"MYLAPS B.V."#
companyIdentifiers[1738] = #"Shenzhen Zhongguang Infotech Technology Development Co., Ltd"#
companyIdentifiers[1739] = #"Dyeware, LLC"#
companyIdentifiers[1740] = #"Dongguan SmartAction Technology Co.,Ltd."#
companyIdentifiers[1741] = #"DIG Corporation"#
companyIdentifiers[1742] = #"FIOR & GENTZ"#
companyIdentifiers[1743] = #"Belparts N.V."#
companyIdentifiers[1744] = #"Etekcity Corporation"#
companyIdentifiers[1745] = #"Meyer Sound Laboratories, Incorporated"#
companyIdentifiers[1746] = #"CeoTronics AG"#
companyIdentifiers[1747] = #"TriTeq Lock and Security, LLC"#
companyIdentifiers[1748] = #"DYNAKODE TECHNOLOGY PRIVATE LIMITED"#
companyIdentifiers[1749] = #"Sensirion AG"#
companyIdentifiers[1750] = #"JCT Healthcare Pty Ltd"#
companyIdentifiers[1751] = #"FUBA Automotive Electronics GmbH"#
companyIdentifiers[1752] = #"AW Company"#
companyIdentifiers[1753] = #"Shanghai Mountain View Silicon Co.,Ltd."#
companyIdentifiers[1754] = #"Zliide Technologies ApS"#
companyIdentifiers[1755] = #"Automatic Labs, Inc."#
companyIdentifiers[1756] = #"Industrial Network Controls, LLC"#
companyIdentifiers[1757] = #"Intellithings Ltd."#
companyIdentifiers[1758] = #"Navcast, Inc."#
companyIdentifiers[1759] = #"Hubbell Lighting, Inc."#
companyIdentifiers[1760] = #"Avaya Inc. "#
companyIdentifiers[1761] = #"Milestone AV Technologies LLC"#
companyIdentifiers[1762] = #"Alango Technologies Ltd"#
companyIdentifiers[1763] = #"Spinlock Ltd"#
companyIdentifiers[1764] = #"Aluna"#
companyIdentifiers[1765] = #"OPTEX CO.,LTD."#
companyIdentifiers[1766] = #"NIHON DENGYO KOUSAKU"#
companyIdentifiers[1767] = #"VELUX A/S"#
companyIdentifiers[1768] = #"Almendo Technologies GmbH"#
companyIdentifiers[1769] = #"Zmartfun Electronics, Inc."#
companyIdentifiers[1770] = #"SafeLine Sweden AB"#
companyIdentifiers[1771] = #"Houston Radar LLC"#
companyIdentifiers[1772] = #"Sigur"#
companyIdentifiers[1773] = #"J Neades Ltd"#
companyIdentifiers[1774] = #"Avantis Systems Limited"#
companyIdentifiers[1775] = #"ALCARE Co., Ltd."#
companyIdentifiers[1776] = #"Chargy Technologies, SL"#
companyIdentifiers[1777] = #"Shibutani Co., Ltd."#
companyIdentifiers[1778] = #"Trapper Data AB"#
companyIdentifiers[1779] = #"Alfred International Inc."#
companyIdentifiers[1780] = #"Touché Technology Ltd"#
companyIdentifiers[1781] = #"Vigil Technologies Inc."#
companyIdentifiers[1782] = #"Vitulo Plus BV"#
companyIdentifiers[1783] = #"WILKA Schliesstechnik GmbH"#
companyIdentifiers[1784] = #"BodyPlus Technology Co.,Ltd"#
companyIdentifiers[1785] = #"happybrush GmbH"#
companyIdentifiers[1786] = #"Enequi AB"#
companyIdentifiers[1787] = #"Sartorius AG"#
companyIdentifiers[1788] = #"Tom Communication Industrial Co.,Ltd."#
companyIdentifiers[1789] = #"ESS Embedded System Solutions Inc."#
companyIdentifiers[1790] = #"Mahr GmbH"#
companyIdentifiers[1791] = #"Redpine Signals Inc"#
companyIdentifiers[1792] = #"TraqFreq LLC"#
companyIdentifiers[1793] = #"PAFERS TECH"#
companyIdentifiers[1794] = #"Akciju sabiedriba "SAF TEHNIKA""#
companyIdentifiers[1795] = #"Beijing Jingdong Century Trading Co., Ltd."#
companyIdentifiers[1796] = #"JBX Designs Inc."#
companyIdentifiers[1797] = #"AB Electrolux"#
companyIdentifiers[1798] = #"Wernher von Braun Center for ASdvanced Research"#
companyIdentifiers[1799] = #"Essity Hygiene and Health Aktiebolag"#
companyIdentifiers[1800] = #"Be Interactive Co., Ltd"#
companyIdentifiers[1801] = #"Carewear Corp."#
companyIdentifiers[1802] = #"Huf Hülsbeck & Fürst GmbH & Co. KG"#
companyIdentifiers[1803] = #"Element Products, Inc."#
companyIdentifiers[1804] = #"Beijing Winner Microelectronics Co.,Ltd"#
companyIdentifiers[1805] = #"SmartSnugg Pty Ltd"#
companyIdentifiers[1806] = #"FiveCo Sarl"#
companyIdentifiers[1807] = #"California Things Inc."#
companyIdentifiers[1808] = #"Audiodo AB"#
companyIdentifiers[1809] = #"ABAX AS"#
companyIdentifiers[1810] = #"Bull Group Company Limited"#
companyIdentifiers[1811] = #"Respiri Limited"#
companyIdentifiers[1812] = #"MindPeace Safety LLC"#
companyIdentifiers[1813] = #"MBARC LABS Inc"#
companyIdentifiers[1814] = #"Altonics"#
companyIdentifiers[1815] = #"iQsquare BV"#
companyIdentifiers[1816] = #"IDIBAIX enginneering"#
companyIdentifiers[1817] = #"ECSG"#
companyIdentifiers[1818] = #"REVSMART WEARABLE HK CO LTD"#
companyIdentifiers[1819] = #"Precor"#
companyIdentifiers[1820] = #"F5 Sports, Inc"#
companyIdentifiers[1821] = #"exoTIC Systems"#
companyIdentifiers[1822] = #"DONGGUAN HELE ELECTRONICS CO., LTD"#
companyIdentifiers[1823] = #"Dongguan Liesheng Electronic Co.Ltd"#
companyIdentifiers[1824] = #"Oculeve, Inc."#
companyIdentifiers[1825] = #"Clover Network, Inc."#
companyIdentifiers[1826] = #"Xiamen Eholder Electronics Co.Ltd"#
companyIdentifiers[1827] = #"Ford Motor Company"#
companyIdentifiers[1828] = #"Guangzhou SuperSound Information Technology Co.,Ltd"#
companyIdentifiers[1829] = #"Tedee Sp. z o.o."#
companyIdentifiers[1830] = #"PHC Corporation"#
companyIdentifiers[1831] = #"STALKIT AS"#
companyIdentifiers[1832] = #"Eli Lilly and Company"#
companyIdentifiers[1833] = #"SwaraLink Technologies"#
companyIdentifiers[1834] = #"JMR embedded systems GmbH"#
companyIdentifiers[1835] = #"Bitkey Inc."#
companyIdentifiers[1836] = #"GWA Hygiene GmbH"#
companyIdentifiers[1837] = #"Safera Oy"#
companyIdentifiers[1838] = #"Open Platform Systems LLC"#
companyIdentifiers[1839] = #"OnePlus Electronics (Shenzhen) Co., Ltd."#
companyIdentifiers[1840] = #"Wildlife Acoustics, Inc."#
companyIdentifiers[1841] = #"ABLIC Inc."#
companyIdentifiers[1842] = #"Dairy Tech, Inc."#
companyIdentifiers[1843] = #"Iguanavation, Inc."#
companyIdentifiers[1844] = #"DiUS Computing Pty Ltd"#
companyIdentifiers[1845] = #"UpRight Technologies LTD"#
companyIdentifiers[1846] = #"FrancisFund, LLC"#
companyIdentifiers[1847] = #"LLC Navitek"#
companyIdentifiers[1848] = #"Glass Security Pte Ltd"#
companyIdentifiers[1849] = #"Jiangsu Qinheng Co., Ltd."#
companyIdentifiers[1850] = #"Chandler Systems Inc."#
companyIdentifiers[1851] = #"Fantini Cosmi s.p.a."#
companyIdentifiers[1852] = #"Acubit ApS"#
companyIdentifiers[1853] = #"Beijing Hao Heng Tian Tech Co., Ltd."#
companyIdentifiers[1854] = #"Bluepack S.R.L."#
companyIdentifiers[1855] = #"Beijing Unisoc Technologies Co., Ltd."#
companyIdentifiers[1856] = #"HITIQ LIMITED"#
companyIdentifiers[1857] = #"MAC SRL"#
companyIdentifiers[1858] = #"DML LLC"#
companyIdentifiers[1859] = #"Sanofi"#
companyIdentifiers[1860] = #"SOCOMEC"#
companyIdentifiers[1861] = #"WIZNOVA, Inc."#
companyIdentifiers[1862] = #"Seitec Elektronik GmbH"#
companyIdentifiers[1863] = #"OR Technologies Pty Ltd"#
companyIdentifiers[1864] = #"GuangZhou KuGou Computer Technology Co.Ltd"#
companyIdentifiers[1865] = #"DIAODIAO (Beijing) Technology Co., Ltd."#
companyIdentifiers[1866] = #"Illusory Studios LLC"#
companyIdentifiers[1867] = #"Sarvavid Software Solutions LLP"#
companyIdentifiers[1868] = #"iopool s.a."#
companyIdentifiers[1869] = #"Amtech Systems, LLC"#
companyIdentifiers[1870] = #"EAGLE DETECTION SA"#
companyIdentifiers[1871] = #"MEDIATECH S.R.L."#
companyIdentifiers[1872] = #"Hamilton Professional Services of Canada Incorporated"#
companyIdentifiers[1873] = #"Changsha JEMO IC Design Co.,Ltd"#
companyIdentifiers[1874] = #"Elatec GmbH"#
companyIdentifiers[1875] = #"JLG Industries, Inc."#
companyIdentifiers[1876] = #"Michael Parkin"#
companyIdentifiers[1877] = #"Brother Industries, Ltd"#
companyIdentifiers[1878] = #"Lumens For Less, Inc"#
companyIdentifiers[1879] = #"ELA Innovation"#
companyIdentifiers[1880] = #"umanSense AB"#
companyIdentifiers[1881] = #"Shanghai InGeek Cyber Security Co., Ltd."#
companyIdentifiers[1882] = #"HARMAN CO.,LTD."#
companyIdentifiers[1883] = #"Smart Sensor Devices AB"#
companyIdentifiers[1884] = #"Antitronics Inc."#
companyIdentifiers[1885] = #"RHOMBUS SYSTEMS, INC."#
companyIdentifiers[1886] = #"Katerra Inc."#
companyIdentifiers[1887] = #"Remote Solution Co., LTD."#
companyIdentifiers[1888] = #"Vimar SpA"#
companyIdentifiers[1889] = #"Mantis Tech LLC"#
companyIdentifiers[1890] = #"TerOpta Ltd"#
companyIdentifiers[1891] = #"PIKOLIN S.L."#
companyIdentifiers[1892] = #"WWZN Information Technology Company Limited"#
companyIdentifiers[1893] = #"Voxx International"#
companyIdentifiers[1894] = #"ART AND PROGRAM, INC."#
companyIdentifiers[1895] = #"NITTO DENKO ASIA TECHNICAL CENTRE PTE. LTD."#
companyIdentifiers[1896] = #"Peloton Interactive Inc."#
companyIdentifiers[1897] = #"Force Impact Technologies"#
companyIdentifiers[1898] = #"Dmac Mobile Developments, LLC"#
companyIdentifiers[1899] = #"Engineered Medical Technologies"#
companyIdentifiers[1900] = #"Noodle Technology inc"#
companyIdentifiers[1901] = #"Graesslin GmbH"#
companyIdentifiers[1902] = #"WuQi technologies, Inc."#
companyIdentifiers[1903] = #"Successful Endeavours Pty Ltd"#
companyIdentifiers[1904] = #"InnoCon Medical ApS"#
companyIdentifiers[1905] = #"Corvex Connected Safety"#
companyIdentifiers[1906] = #"Thirdwayv Inc."#
companyIdentifiers[1907] = #"Echoflex Solutions Inc."#
companyIdentifiers[1908] = #"C-MAX Asia Limited"#
companyIdentifiers[1909] = #"4eBusiness GmbH"#
companyIdentifiers[1910] = #"Cyber Transport Control GmbH"#
companyIdentifiers[1911] = #"Cue"#
companyIdentifiers[1912] = #"KOAMTAC INC."#
companyIdentifiers[1913] = #"Loopshore Oy"#
companyIdentifiers[1914] = #"Niruha Systems Private Limited"#
companyIdentifiers[1915] = #"AmaterZ, Inc."#
companyIdentifiers[1916] = #"radius co., ltd."#
companyIdentifiers[1917] = #"Sensority, s.r.o."#
companyIdentifiers[1918] = #"Sparkage Inc."#
companyIdentifiers[1919] = #"Glenview Software Corporation"#
companyIdentifiers[1920] = #"Finch Technologies Ltd."#
companyIdentifiers[1921] = #"Qingping Technology (Beijing) Co., Ltd."#
companyIdentifiers[1922] = #"DeviceDrive AS"#
companyIdentifiers[1923] = #"ESEMBER LIMITED LIABILITY COMPANY"#
companyIdentifiers[1924] = #"audifon GmbH & Co. KG"#
companyIdentifiers[1925] = #"O2 Micro, Inc."#
companyIdentifiers[1926] = #"HLP Controls Pty Limited"#
companyIdentifiers[1927] = #"Pangaea Solution"#
companyIdentifiers[1928] = #"BubblyNet, LLC"#
companyIdentifiers[1930] = #"The Wildflower Foundation"#
companyIdentifiers[1931] = #"Optikam Tech Inc."#
companyIdentifiers[1932] = #"MINIBREW HOLDING B.V"#
companyIdentifiers[1933] = #"Cybex GmbH"#
companyIdentifiers[1934] = #"FUJIMIC NIIGATA, INC."#
companyIdentifiers[1935] = #"Hanna Instruments, Inc."#
companyIdentifiers[1936] = #"KOMPAN A/S"#
companyIdentifiers[1937] = #"Scosche Industries, Inc."#
companyIdentifiers[1938] = #"Provo Craft"#
companyIdentifiers[1939] = #"AEV spol. s r.o."#
companyIdentifiers[1940] = #"The Coca-Cola Company"#
companyIdentifiers[1941] = #"GASTEC CORPORATION"#
companyIdentifiers[1942] = #"StarLeaf Ltd"#
companyIdentifiers[1943] = #"Water-i.d. GmbH"#
companyIdentifiers[1944] = #"HoloKit, Inc."#
companyIdentifiers[1945] = #"PlantChoir Inc."#
companyIdentifiers[1946] = #"GuangDong Oppo Mobile Telecommunications Corp., Ltd."#
companyIdentifiers[1947] = #"CST ELECTRONICS (PROPRIETARY) LIMITED"#
companyIdentifiers[1948] = #"Sky UK Limited"#
companyIdentifiers[1949] = #"Digibale Pty Ltd"#
companyIdentifiers[1950] = #"Smartloxx GmbH"#
companyIdentifiers[1951] = #"Pune Scientific LLP"#
companyIdentifiers[1952] = #"Regent Beleuchtungskorper AG"#
companyIdentifiers[1953] = #"Apollo Neuroscience, Inc."#
companyIdentifiers[1954] = #"Roku, Inc."#
companyIdentifiers[1955] = #"Comcast Cable"#
companyIdentifiers[1956] = #"Xiamen Mage Information Technology Co., Ltd."#
companyIdentifiers[1957] = #"RAB Lighting, Inc."#
companyIdentifiers[1958] = #"Musen Connect, Inc."#
companyIdentifiers[1959] = #"Zume, Inc."#
companyIdentifiers[1960] = #"conbee GmbH"#
companyIdentifiers[1961] = #"Bruel & Kjaer Sound & Vibration"#
companyIdentifiers[1962] = #"The Kroger Co."#
companyIdentifiers[1963] = #"Granite River Solutions, Inc."#
companyIdentifiers[1964] = #"LoupeDeck Oy"#
companyIdentifiers[1965] = #"New H3C Technologies Co.,Ltd"#
companyIdentifiers[1966] = #"Aurea Solucoes Tecnologicas Ltda."#
companyIdentifiers[1967] = #"Hong Kong Bouffalo Lab Limited"#
companyIdentifiers[1968] = #"GV Concepts Inc."#
companyIdentifiers[1969] = #"Thomas Dynamics, LLC"#
companyIdentifiers[1970] = #"Moeco IOT Inc."#
companyIdentifiers[1971] = #"2N TELEKOMUNIKACE a.s."#
companyIdentifiers[1972] = #"Hormann KG Antriebstechnik"#
companyIdentifiers[1973] = #"CRONO CHIP, S.L."#
companyIdentifiers[1974] = #"Soundbrenner Limited"#
companyIdentifiers[1975] = #"ETABLISSEMENTS GEORGES RENAULT"#
companyIdentifiers[1976] = #"iSwip"#
companyIdentifiers[1977] = #"Epona Biotec Limited"#
companyIdentifiers[1978] = #"Battery-Biz Inc."#
companyIdentifiers[1979] = #"EPIC S.R.L."#
companyIdentifiers[1980] = #"KD CIRCUITS LLC"#
companyIdentifiers[1981] = #"Genedrive Diagnostics Ltd"#
companyIdentifiers[1982] = #"Axentia Technologies AB"#
companyIdentifiers[1983] = #"REGULA Ltd."#
companyIdentifiers[1984] = #"Biral AG"#
companyIdentifiers[1985] = #"A.W. Chesterton Company"#
companyIdentifiers[1986] = #"Radinn AB"#
companyIdentifiers[1987] = #"CIMTechniques, Inc."#
companyIdentifiers[1988] = #"Johnson Health Tech NA"#
companyIdentifiers[1989] = #"June Life, Inc."#
companyIdentifiers[1990] = #"Bluenetics GmbH"#
companyIdentifiers[1991] = #"iaconicDesign Inc."#
companyIdentifiers[1992] = #"WRLDS Creations AB"#
companyIdentifiers[1993] = #"Skullcandy, Inc."#
companyIdentifiers[1994] = #"Modul-System HH AB"#
companyIdentifiers[1995] = #"West Pharmaceutical Services, Inc."#
companyIdentifiers[1996] = #"Barnacle Systems Inc."#
companyIdentifiers[1997] = #"Smart Wave Technologies Canada Inc"#
companyIdentifiers[1998] = #"Shanghai Top-Chip Microelectronics Tech. Co., LTD"#
companyIdentifiers[1999] = #"NeoSensory, Inc."#
companyIdentifiers[2000] = #"Hangzhou Tuya Information Technology Co., Ltd"#
companyIdentifiers[2001] = #"Shanghai Panchip Microelectronics Co., Ltd"#
companyIdentifiers[2002] = #"React Accessibility Limited"#
companyIdentifiers[2003] = #"LIVNEX Co.,Ltd."#
companyIdentifiers[2004] = #"Kano Computing Limited"#
companyIdentifiers[2005] = #"hoots classic GmbH"#
companyIdentifiers[2006] = #"ecobee Inc."#
companyIdentifiers[2007] = #"Nanjing Qinheng Microelectronics Co., Ltd"#
companyIdentifiers[2008] = #"SOLUTIONS AMBRA INC."#
companyIdentifiers[2009] = #"Micro-Design, Inc."#
companyIdentifiers[2010] = #"STARLITE Co., Ltd."#
companyIdentifiers[2011] = #"Remedee Labs"#
companyIdentifiers[2012] = #"ThingOS GmbH"#
companyIdentifiers[2013] = #"Linear Circuits"#
companyIdentifiers[2014] = #"Unlimited Engineering SL"#
companyIdentifiers[2015] = #"Snap-on Incorporated"#
companyIdentifiers[2016] = #"Edifier International Limited"#
companyIdentifiers[2017] = #"Lucie Labs"#
companyIdentifiers[2018] = #"Alfred Kaercher SE & Co. KG"#
companyIdentifiers[2019] = #"Audiowise Technology Inc."#
companyIdentifiers[2020] = #"Geeksme S.L."#
companyIdentifiers[2021] = #"Minut, Inc."#
companyIdentifiers[2022] = #"Waybeyond Limited"#
companyIdentifiers[2023] = #"Komfort IQ, Inc."#
companyIdentifiers[2024] = #"Packetcraft, Inc."#
companyIdentifiers[2025] = #"Häfele GmbH & Co KG"#
companyIdentifiers[2026] = #"ShapeLog, Inc."#
companyIdentifiers[2027] = #"NOVABASE S.R.L."#
companyIdentifiers[2028] = #"Frecce LLC"#
companyIdentifiers[2029] = #"Joule IQ, INC."#
companyIdentifiers[2030] = #"KidzTek LLC"#
companyIdentifiers[2031] = #"Aktiebolaget Sandvik Coromant"#
companyIdentifiers[2032] = #"e-moola.com Pty Ltd"#
companyIdentifiers[2033] = #"Zimi Innovations Pty Ltd"#
companyIdentifiers[2034] = #"SERENE GROUP, INC"#
companyIdentifiers[2035] = #"DIGISINE ENERGYTECH CO. LTD."#
companyIdentifiers[2036] = #"MEDIRLAB Orvosbiologiai Fejleszto Korlatolt Felelossegu Tarsasag"#
companyIdentifiers[2037] = #"Byton North America Corporation"#
companyIdentifiers[2038] = #"Shenzhen TonliScience and Technology Development Co.,Ltd"#
companyIdentifiers[2039] = #"Cesar Systems Ltd."#
companyIdentifiers[2040] = #"quip NYC Inc."#
companyIdentifiers[2041] = #"Direct Communication Solutions, Inc."#
companyIdentifiers[2042] = #"Klipsch Group, Inc."#
companyIdentifiers[2043] = #"Access Co., Ltd"#
companyIdentifiers[2044] = #"Renault SA"#
companyIdentifiers[2045] = #"JSK CO., LTD."#
companyIdentifiers[2046] = #"BIROTA"#
companyIdentifiers[2047] = #"maxon motor ltd."#
companyIdentifiers[2048] = #"Optek"#
companyIdentifiers[2049] = #"CRONUS ELECTRONICS LTD"#
companyIdentifiers[2050] = #"NantSound, Inc."#
companyIdentifiers[2051] = #"Domintell s.a."#
companyIdentifiers[2052] = #"Andon Health Co.,Ltd"#
companyIdentifiers[2053] = #"Urbanminded Ltd"#
companyIdentifiers[2054] = #"TYRI Sweden AB"#
companyIdentifiers[2055] = #"ECD Electronic Components GmbH Dresden"#
companyIdentifiers[2056] = #"SISTEMAS KERN, SOCIEDAD ANÓMINA"#
companyIdentifiers[2057] = #"Trulli Audio"#
companyIdentifiers[2058] = #"Altaneos"#
companyIdentifiers[2059] = #"Nanoleaf Canada Limited"#
companyIdentifiers[2060] = #"Ingy B.V."#
companyIdentifiers[2061] = #"Azbil Co."#
companyIdentifiers[2062] = #"TATTCOM LLC"#
companyIdentifiers[2063] = #"Paradox Engineering SA"#
companyIdentifiers[2064] = #"LECO Corporation"#
companyIdentifiers[2065] = #"Becker Antriebe GmbH"#
companyIdentifiers[2066] = #"Mstream Technologies., Inc."#
companyIdentifiers[2067] = #"Flextronics International USA Inc."#
companyIdentifiers[2068] = #"Ossur hf."#
companyIdentifiers[2069] = #"SKC Inc"#
companyIdentifiers[2070] = #"SPICA SYSTEMS LLC"#
companyIdentifiers[2071] = #"Wangs Alliance Corporation"#
companyIdentifiers[2072] = #"tatwah SA"#
companyIdentifiers[2073] = #"Hunter Douglas Inc"#
companyIdentifiers[2074] = #"Shenzhen Conex"#
companyIdentifiers[2075] = #"DIM3"#
companyIdentifiers[2076] = #"Bobrick Washroom Equipment, Inc."#
companyIdentifiers[2077] = #"Potrykus Holdings and Development LLC"#
companyIdentifiers[2078] = #"iNFORM Technology GmbH"#
companyIdentifiers[2079] = #"eSenseLab LTD"#
companyIdentifiers[2080] = #"Brilliant Home Technology, Inc."#
companyIdentifiers[2081] = #"INOVA Geophysical, Inc."#
companyIdentifiers[2082] = #"adafruit industries"#
companyIdentifiers[2083] = #"Nexite Ltd"#
companyIdentifiers[2084] = #"8Power Limited"#
companyIdentifiers[2085] = #"CME PTE. LTD."#
companyIdentifiers[2086] = #"Hyundai Motor Company"#
companyIdentifiers[2087] = #"Kickmaker"#
companyIdentifiers[2088] = #"Shanghai Suisheng Information Technology Co., Ltd."#
companyIdentifiers[2089] = #"HEXAGON"#
companyIdentifiers[2090] = #"Mitutoyo Corporation"#
companyIdentifiers[2091] = #"shenzhen fitcare electronics Co.,Ltd"#
companyIdentifiers[2092] = #"INGICS TECHNOLOGY CO., LTD."#
companyIdentifiers[2093] = #"INCUS PERFORMANCE LTD."#
companyIdentifiers[2094] = #"ABB S.p.A."#
companyIdentifiers[2095] = #"Blippit AB"#
companyIdentifiers[2096] = #"Core Health and Fitness LLC"#
companyIdentifiers[2097] = #"Foxble, LLC"#
companyIdentifiers[2098] = #"Intermotive,Inc."#
companyIdentifiers[2099] = #"Conneqtech B.V."#
companyIdentifiers[2100] = #"RIKEN KEIKI CO., LTD.,"#
companyIdentifiers[2101] = #"Canopy Growth Corporation"#
companyIdentifiers[2102] = #"Bitwards Oy"#
companyIdentifiers[2103] = #"vivo Mobile Communication Co., Ltd."#
companyIdentifiers[2104] = #"Etymotic Research, Inc."#
companyIdentifiers[2105] = #"A puissance 3"#
companyIdentifiers[2106] = #"BPW Bergische Achsen Kommanditgesellschaft"#
companyIdentifiers[2107] = #"Piaggio Fast Forward"#
companyIdentifiers[2108] = #"BeerTech LTD"#
companyIdentifiers[2109] = #"Tokenize, Inc."#
companyIdentifiers[2110] = #"Zorachka LTD"#
companyIdentifiers[2111] = #"D-Link Corp."#
companyIdentifiers[2112] = #"Down Range Systems LLC"#
companyIdentifiers[2113] = #"General Luminaire (Shanghai) Co., Ltd."#
companyIdentifiers[2114] = #"Tangshan HongJia electronic technology co., LTD."#
companyIdentifiers[2115] = #"FRAGRANCE DELIVERY TECHNOLOGIES LTD"#
companyIdentifiers[2116] = #"Pepperl + Fuchs GmbH"#
companyIdentifiers[2117] = #"Dometic Corporation"#
companyIdentifiers[2118] = #"USound GmbH"#
companyIdentifiers[2119] = #"DNANUDGE LIMITED"#
companyIdentifiers[2120] = #"JUJU JOINTS CANADA CORP."#
companyIdentifiers[2121] = #"Dopple Technologies B.V."#
companyIdentifiers[2122] = #"ARCOM"#
companyIdentifiers[2123] = #"Biotechware SRL"#
companyIdentifiers[2124] = #"ORSO Inc."#
companyIdentifiers[2125] = #"SafePort"#
companyIdentifiers[2126] = #"Carol Cole Company"#
companyIdentifiers[2127] = #"Embedded Fitness B.V."#
companyIdentifiers[2128] = #"Yealink (Xiamen) Network Technology Co.,LTD"#
companyIdentifiers[2129] = #"Subeca, Inc."#
companyIdentifiers[2130] = #"Cognosos, Inc."#
companyIdentifiers[2131] = #"Pektron Group Limited"#
companyIdentifiers[2132] = #"Tap Sound System"#
companyIdentifiers[2133] = #"Helios Hockey, Inc."#
companyIdentifiers[2134] = #"Canopy Growth Corporation"#
companyIdentifiers[2135] = #"Parsyl Inc"#
companyIdentifiers[2136] = #"SOUNDBOKS"#
companyIdentifiers[2137] = #"BlueUp"#
companyIdentifiers[2138] = #"DAKATECH"#
companyIdentifiers[2139] = #"RICOH ELECTRONIC DEVICES CO., LTD."#
companyIdentifiers[2140] = #"ACOS CO.,LTD."#
companyIdentifiers[2141] = #"Guilin Zhishen Information Technology Co.,Ltd."#
companyIdentifiers[2142] = #"Krog Systems LLC"#
companyIdentifiers[2143] = #"COMPEGPS TEAM,SOCIEDAD LIMITADA"#
companyIdentifiers[2144] = #"Alflex Products B.V."#
companyIdentifiers[2145] = #"SmartSensor Labs Ltd"#
companyIdentifiers[2146] = #"SmartDrive"#
companyIdentifiers[2147] = #"Yo-tronics Technology Co., Ltd."#
companyIdentifiers[2148] = #"Rafaelmicro"#
companyIdentifiers[2149] = #"Emergency Lighting Products Limited"#
companyIdentifiers[2150] = #"LAONZ Co.,Ltd"#
companyIdentifiers[2151] = #"Western Digital Techologies, Inc."#
companyIdentifiers[2152] = #"WIOsense GmbH & Co. KG"#
companyIdentifiers[2153] = #"EVVA Sicherheitstechnologie GmbH"#
companyIdentifiers[2154] = #"Odic Incorporated"#
companyIdentifiers[2155] = #"Pacific Track, LLC"#
companyIdentifiers[2156] = #"Revvo Technologies, Inc."#
companyIdentifiers[2157] = #"Biometrika d.o.o."#
companyIdentifiers[2158] = #"Vorwerk Elektrowerke GmbH & Co. KG"#
companyIdentifiers[2159] = #"Trackunit A/S"#
companyIdentifiers[2160] = #"Wyze Labs, Inc"#
companyIdentifiers[2161] = #"Dension Elektronikai Kft. (formerly: Dension Audio Systems Ltd.)"#
companyIdentifiers[2162] = #"11 Health & Technologies Limited"#
companyIdentifiers[2163] = #"Innophase Incorporated"#
companyIdentifiers[2164] = #"Treegreen Limited"#
companyIdentifiers[2165] = #"Berner International LLC"#
companyIdentifiers[2166] = #"SmartResQ ApS"#
companyIdentifiers[2167] = #"Tome, Inc."#
companyIdentifiers[2168] = #"The Chamberlain Group, Inc."#
companyIdentifiers[2169] = #"MIZUNO Corporation"#
companyIdentifiers[2170] = #"ZRF, LLC"#
companyIdentifiers[2171] = #"BYSTAMP"#
companyIdentifiers[2172] = #"Crosscan GmbH"#
companyIdentifiers[2173] = #"Konftel AB"#
companyIdentifiers[2174] = #"1bar.net Limited"#
companyIdentifiers[2175] = #"Phillips Connect Technologies LLC"#
companyIdentifiers[2176] = #"imagiLabs AB"#
companyIdentifiers[2177] = #"Optalert"#
companyIdentifiers[2178] = #"PSYONIC, Inc."#
companyIdentifiers[2179] = #"Wintersteiger AG"#
companyIdentifiers[2180] = #"Controlid Industria, Comercio de Hardware e Servicos de Tecnologia Ltda"#
companyIdentifiers[2181] = #"LEVOLOR INC"#
companyIdentifiers[2182] = #"Xsens Technologies B.V."#
companyIdentifiers[2183] = #"Hydro-Gear Limited Partnership"#
companyIdentifiers[2184] = #"EnPointe Fencing Pty Ltd"#
companyIdentifiers[2185] = #"XANTHIO"#
companyIdentifiers[2186] = #"sclak s.r.l."#
companyIdentifiers[2187] = #"Tricorder Arraay Technologies LLC"#
companyIdentifiers[2188] = #"GB Solution co.,Ltd"#
companyIdentifiers[2189] = #"Soliton Systems K.K."#
companyIdentifiers[2190] = #"GIGA-TMS INC"#
companyIdentifiers[2191] = #"Tait International Limited"#
companyIdentifiers[2192] = #"NICHIEI INTEC CO., LTD."#
companyIdentifiers[2193] = #"SmartWireless GmbH & Co. KG"#
companyIdentifiers[2194] = #"Ingenieurbuero Birnfeld UG (haftungsbeschraenkt)"#
companyIdentifiers[2195] = #"Maytronics Ltd"#
companyIdentifiers[2196] = #"EPIFIT"#
companyIdentifiers[2197] = #"Gimer medical"#
companyIdentifiers[2198] = #"Nokian Renkaat Oyj"#
companyIdentifiers[2199] = #"Current Lighting Solutions LLC"#
companyIdentifiers[2200] = #"Sensibo, Inc."#
companyIdentifiers[2201] = #"SFS unimarket AG"#
companyIdentifiers[2202] = #"Private limited company "Teltonika""#
companyIdentifiers[2203] = #"Saucon Technologies"#
companyIdentifiers[2204] = #"Embedded Devices Co. Company"#
companyIdentifiers[2205] = #"J-J.A.D.E. Enterprise LLC"#
companyIdentifiers[2206] = #"i-SENS, inc."#
companyIdentifiers[2207] = #"Witschi Electronic Ltd"#
companyIdentifiers[2208] = #"Aclara Technologies LLC"#
companyIdentifiers[2209] = #"EXEO TECH CORPORATION"#
companyIdentifiers[2210] = #"Epic Systems Co., Ltd."#
companyIdentifiers[2211] = #"Hoffmann SE"#
companyIdentifiers[2212] = #"Realme Chongqing Mobile Telecommunications Corp., Ltd."#
companyIdentifiers[2213] = #"UMEHEAL Ltd"#
companyIdentifiers[2214] = #"Intelligenceworks Inc."#
companyIdentifiers[2215] = #"TGR 1.618 Limited"#
companyIdentifiers[2216] = #"Shanghai Kfcube Inc"#
companyIdentifiers[2217] = #"Fraunhofer IIS"#
companyIdentifiers[2218] = #"SZ DJI TECHNOLOGY CO.,LTD"#
companyIdentifiers[2219] = #"Coburn Technology, LLC"#
companyIdentifiers[2220] = #"Topre Corporation"#
companyIdentifiers[2221] = #"Kayamatics Limited"#
companyIdentifiers[2222] = #"Moticon ReGo AG"#
companyIdentifiers[2223] = #"Polidea Sp. z o.o."#
companyIdentifiers[2224] = #"Trivedi Advanced Technologies LLC"#
companyIdentifiers[2225] = #"CORE|vision BV"#
companyIdentifiers[2226] = #"PF SCHWEISSTECHNOLOGIE GMBH"#
companyIdentifiers[2227] = #"IONIQ Skincare GmbH & Co. KG"#
companyIdentifiers[2228] = #"Sengled Co., Ltd."#
companyIdentifiers[2229] = #"TransferFi"#
companyIdentifiers[2230] = #"Boehringer Ingelheim Vetmedica GmbH"#
companyIdentifiers[2231] = #"ABB Inc"#
companyIdentifiers[2232] = #"Check Technology Solutions LLC"#
companyIdentifiers[2233] = #"U-Shin Ltd."#
companyIdentifiers[2234] = #"HYPER ICE, INC."#
companyIdentifiers[2235] = #"Tokai-rika co.,ltd."#
companyIdentifiers[2236] = #"Prevayl Limited"#
companyIdentifiers[2237] = #"bf1systems limited"#
companyIdentifiers[2238] = #"ubisys technologies GmbH"#
companyIdentifiers[2239] = #"SIRC Co., Ltd."#
companyIdentifiers[2240] = #"Accent Advanced Systems SLU"#
companyIdentifiers[2241] = #"Rayden.Earth LTD"#
companyIdentifiers[2242] = #"Lindinvent AB"#
companyIdentifiers[2243] = #"CHIPOLO d.o.o."#
companyIdentifiers[2244] = #"CellAssist, LLC"#
companyIdentifiers[2245] = #"J. Wagner GmbH"#
companyIdentifiers[2246] = #"Integra Optics Inc"#
companyIdentifiers[2247] = #"Monadnock Systems Ltd."#
companyIdentifiers[2248] = #"Liteboxer Technologies Inc."#
companyIdentifiers[2249] = #"Noventa AG"#
companyIdentifiers[2250] = #"Nubia Technology Co.,Ltd."#
companyIdentifiers[2251] = #"JT INNOVATIONS LIMITED"#
companyIdentifiers[2252] = #"TGM TECHNOLOGY CO., LTD."#
companyIdentifiers[2253] = #"ifly"#
companyIdentifiers[2254] = #"ZIMI CORPORATION"#
companyIdentifiers[2255] = #"betternotstealmybike UG (with limited liability)"#
companyIdentifiers[2256] = #"ESTOM Infotech Kft."#
companyIdentifiers[2257] = #"Sensovium Inc."#
companyIdentifiers[2258] = #"Virscient Limited"#
companyIdentifiers[2259] = #"Novel Bits, LLC"#
companyIdentifiers[2260] = #"ADATA Technology Co., LTD."#
companyIdentifiers[2261] = #"KEYes"#
companyIdentifiers[2262] = #"Nome Oy"#
companyIdentifiers[2263] = #"Inovonics Corp"#
companyIdentifiers[2264] = #"WARES"#
companyIdentifiers[2265] = #"Pointr Labs Limited"#
companyIdentifiers[2266] = #"Miridia Technology Incorporated"#
companyIdentifiers[2267] = #"Tertium Technology"#
companyIdentifiers[2268] = #"SHENZHEN AUKEY E BUSINESS CO., LTD"#
companyIdentifiers[2269] = #"code-Q"#
companyIdentifiers[2270] = #"Tyco Electronics Corporation a TE Connectivity Ltd Company"#
companyIdentifiers[2271] = #"IRIS OHYAMA CO.,LTD."#
companyIdentifiers[2272] = #"Philia Technology"#
companyIdentifiers[2273] = #"KOZO KEIKAKU ENGINEERING Inc."#
companyIdentifiers[2274] = #"Shenzhen Simo Technology co. LTD"#
companyIdentifiers[2275] = #"Republic Wireless, Inc."#
companyIdentifiers[2276] = #"Rashidov ltd"#
companyIdentifiers[2277] = #"Crowd Connected Ltd"#
companyIdentifiers[2278] = #"Eneso Tecnologia de Adaptacion S.L."#
companyIdentifiers[2279] = #"Barrot Technology Limited"#
companyIdentifiers[2280] = #"Naonext"#
companyIdentifiers[2281] = #"Taiwan Intelligent Home Corp."#
companyIdentifiers[2282] = #"COWBELL ENGINEERING CO.,LTD."#
companyIdentifiers[2283] = #"Beijing Big Moment Technology Co., Ltd."#
companyIdentifiers[2284] = #"Denso Corporation"#
companyIdentifiers[2285] = #"IMI Hydronic Engineering International SA"#
companyIdentifiers[2286] = #"ASKEY"#
companyIdentifiers[2287] = #"Cumulus Digital Systems, Inc"#
companyIdentifiers[2288] = #"Joovv, Inc."#
companyIdentifiers[2289] = #"The L.S. Starrett Company"#
companyIdentifiers[2290] = #"Microoled"#
companyIdentifiers[2291] = #"PSP - Pauli Services & Products GmbH"#
companyIdentifiers[2292] = #"Kodimo Technologies Company Limited"#
companyIdentifiers[2293] = #"Tymtix Technologies Private Limited"#
companyIdentifiers[2294] = #"Dermal Photonics Corporation"#
companyIdentifiers[2295] = #"MTD Products Inc & Affiliates"#
companyIdentifiers[2296] = #"instagrid GmbH"#
companyIdentifiers[2297] = #"Spacelabs Medical Inc."#
companyIdentifiers[2298] = #"Troo Corporation"#
companyIdentifiers[2299] = #"Darkglass Electronics Oy"#
companyIdentifiers[2300] = #"Hill-Rom"#
companyIdentifiers[2301] = #"BioIntelliSense, Inc."#
companyIdentifiers[2302] = #"Ketronixs Sdn Bhd"#
companyIdentifiers[2303] = #"Plastimold Products, Inc"#
companyIdentifiers[2304] = #"Beijing Zizai Technology Co., LTD."#
companyIdentifiers[2305] = #"Lucimed"#
companyIdentifiers[2306] = #"TSC Auto-ID Technology Co., Ltd."#
companyIdentifiers[2307] = #"DATAMARS, Inc."#
companyIdentifiers[2308] = #"SUNCORPORATION"#
companyIdentifiers[2309] = #"Yandex Services AG"#
companyIdentifiers[2310] = #"Scope Logistical Solutions"#
companyIdentifiers[2311] = #"User Hello, LLC"#
companyIdentifiers[2312] = #"Pinpoint Innovations Limited"#
companyIdentifiers[2313] = #"70mai Co.,Ltd."#
companyIdentifiers[2314] = #"Zhuhai Hoksi Technology CO.,LTD"#
companyIdentifiers[2315] = #"EMBR labs, INC"#
companyIdentifiers[2316] = #"Radiawave Technologies Co.,Ltd."#
companyIdentifiers[2317] = #"IOT Invent GmbH"#
companyIdentifiers[2318] = #"OPTIMUSIOT TECH LLP"#
companyIdentifiers[2319] = #"VC Inc."#
companyIdentifiers[2320] = #"ASR Microelectronics (Shanghai) Co., Ltd."#
companyIdentifiers[2321] = #"Douglas Lighting Controls Inc."#
companyIdentifiers[2322] = #"Nerbio Medical Software Platforms Inc"#
companyIdentifiers[2323] = #"Braveheart Wireless, Inc."#
companyIdentifiers[2324] = #"INEO-SENSE"#
companyIdentifiers[2325] = #"Honda Motor Co., Ltd."#
companyIdentifiers[2326] = #"Ambient Sensors LLC"#
companyIdentifiers[2327] = #"ASR Microelectronics(ShenZhen)Co., Ltd."#
companyIdentifiers[2328] = #"Technosphere Labs Pvt. Ltd."#
companyIdentifiers[2329] = #"NO SMD LIMITED"#
companyIdentifiers[2330] = #"Albertronic BV"#
companyIdentifiers[2331] = #"Luminostics, Inc."#
companyIdentifiers[2332] = #"Oblamatik AG"#
companyIdentifiers[2333] = #"Innokind, Inc."#
companyIdentifiers[2334] = #"Melbot Studios, Sociedad Limitada"#
companyIdentifiers[2335] = #"Myzee Technology"#
companyIdentifiers[2336] = #"Omnisense Limited"#
companyIdentifiers[2337] = #"KAHA PTE. LTD."#
companyIdentifiers[2338] = #"Shanghai MXCHIP Information Technology Co., Ltd."#
companyIdentifiers[2339] = #"JSB TECH PTE LTD"#
companyIdentifiers[2340] = #"Fundacion Tecnalia Research and Innovation"#
companyIdentifiers[2341] = #"Yukai Engineering Inc."#
companyIdentifiers[2342] = #"Gooligum Technologies Pty Ltd"#
companyIdentifiers[2343] = #"ROOQ GmbH"#
companyIdentifiers[2344] = #"AiRISTA"#
companyIdentifiers[2345] = #"Qingdao Haier Technology Co., Ltd."#
companyIdentifiers[2346] = #"Sappl Verwaltungs- und Betriebs GmbH"#
companyIdentifiers[2347] = #"TekHome"#
companyIdentifiers[2348] = #"PCI Private Limited"#
companyIdentifiers[2349] = #"Leggett & Platt, Incorporated"#
companyIdentifiers[2350] = #"PS GmbH"#
companyIdentifiers[2351] = #"C.O.B.O. SpA"#
companyIdentifiers[2352] = #"James Walker RotaBolt Limited"#
companyIdentifiers[2353] = #"BREATHINGS Co., Ltd."#
companyIdentifiers[2354] = #"BarVision, LLC"#
companyIdentifiers[2355] = #"SRAM"#
companyIdentifiers[2356] = #"KiteSpring Inc."#
companyIdentifiers[2357] = #"Reconnect, Inc."#
companyIdentifiers[2358] = #"Elekon AG"#
companyIdentifiers[2359] = #"RealThingks GmbH"#
companyIdentifiers[2360] = #"Henway Technologies, LTD."#
companyIdentifiers[2361] = #"ASTEM Co.,Ltd."#
companyIdentifiers[2362] = #"LinkedSemi Microelectronics (Xiamen) Co., Ltd"#
companyIdentifiers[2363] = #"ENSESO LLC"#
companyIdentifiers[2364] = #"Xenoma Inc."#
companyIdentifiers[2365] = #"Adolf Wuerth GmbH & Co KG"#
companyIdentifiers[2366] = #"Catalyft Labs, Inc."#
companyIdentifiers[2367] = #"JEPICO Corporation"#
companyIdentifiers[2368] = #"Hero Workout GmbH"#
companyIdentifiers[2369] = #"Rivian Automotive, LLC"#
companyIdentifiers[2370] = #"TRANSSION HOLDINGS LIMITED"#
companyIdentifiers[2371] = #"Reserved"#
companyIdentifiers[2372] = #"Agitron d.o.o."#
companyIdentifiers[2373] = #"Globe (Jiangsu) Co., Ltd"#
companyIdentifiers[2374] = #"AMC International Alfa Metalcraft Corporation AG"#
companyIdentifiers[2375] = #"First Light Technologies Ltd."#
companyIdentifiers[2376] = #"Wearable Link Limited"#
companyIdentifiers[2377] = #"Metronom Health Europe"#
companyIdentifiers[2378] = #"Zwift, Inc."#
companyIdentifiers[2379] = #"Kindeva Drug Delivery L.P."#
companyIdentifiers[2380] = #"GimmiSys GmbH"#
companyIdentifiers[2381] = #"tkLABS INC."#
companyIdentifiers[2382] = #"PassiveBolt, Inc."#
companyIdentifiers[2383] = #"Limited Liability Company "Mikrotikls""#
companyIdentifiers[2384] = #"Capetech"#
companyIdentifiers[2385] = #"PPRS"#
companyIdentifiers[2386] = #"Apptricity Corporation"#
companyIdentifiers[2387] = #"LogiLube, LLC"#
companyIdentifiers[2388] = #"Julbo"#
companyIdentifiers[2389] = #"Breville Group"#
companyIdentifiers[2390] = #"Kerlink"#
companyIdentifiers[2391] = #"Ohsung Electronics"#
companyIdentifiers[2392] = #"ZTE Corporation"#
companyIdentifiers[2393] = #"HerdDogg, Inc"#
companyIdentifiers[2394] = #"Selekt Bilgisayar, lletisim Urunleri lnsaat Sanayi ve Ticaret Limited Sirketi"#
companyIdentifiers[2395] = #"Lismore Instruments Limited"#
companyIdentifiers[2396] = #"LogiLube, LLC"#
companyIdentifiers[2397] = #"ETC"#
companyIdentifiers[2398] = #"BioEchoNet inc."#
companyIdentifiers[2399] = #"NUANCE HEARING LTD"#
companyIdentifiers[2400] = #"Sena Technologies Inc."#
companyIdentifiers[2401] = #"Linkura AB"#
companyIdentifiers[2402] = #"GL Solutions K.K."#
companyIdentifiers[2403] = #"Moonbird BV"#
companyIdentifiers[2404] = #"Countrymate Technology Limited"#
companyIdentifiers[2405] = #"Asahi Kasei Corporation"#
companyIdentifiers[2406] = #"PointGuard, LLC"#
companyIdentifiers[2407] = #"Neo Materials and Consulting Inc."#
companyIdentifiers[2408] = #"Actev Motors, Inc."#
companyIdentifiers[2409] = #"Woan Technology (Shenzhen) Co., Ltd."#
companyIdentifiers[2410] = #"dricos, Inc."#
companyIdentifiers[2411] = #"Guide ID B.V."#
companyIdentifiers[2412] = #"9374-7319 Quebec inc"#
companyIdentifiers[2413] = #"Gunwerks, LLC"#
companyIdentifiers[2414] = #"Band Industries, inc."#
companyIdentifiers[2415] = #"Lund Motion Products, Inc."#
companyIdentifiers[2416] = #"IBA Dosimetry GmbH"#
companyIdentifiers[2417] = #"GA"#
companyIdentifiers[2418] = #"Closed Joint Stock Company "Zavod Flometr" ("Zavod Flometr" CJSC)"#
companyIdentifiers[2419] = #"Popit Oy"#
companyIdentifiers[2420] = #"ABEYE"#
companyIdentifiers[2421] = #"BlueIOT(Beijing) Technology Co.,Ltd"#
companyIdentifiers[2422] = #"Fauna Audio GmbH"#
companyIdentifiers[2423] = #"TOYOTA motor corporation"#
companyIdentifiers[2424] = #"ZifferEins GmbH & Co. KG"#
companyIdentifiers[2425] = #"BIOTRONIK SE & Co. KG"#
companyIdentifiers[2426] = #"CORE CORPORATION"#
companyIdentifiers[2427] = #"CTEK Sweden AB"#
companyIdentifiers[2428] = #"Thorley Industries, LLC"#
companyIdentifiers[2429] = #"CLB B.V."#
companyIdentifiers[2430] = #"SonicSensory Inc"#
companyIdentifiers[2431] = #"ISEMAR S.R.L."#
companyIdentifiers[2432] = #"DEKRA TESTING AND CERTIFICATION, S.A.U."#
companyIdentifiers[2433] = #"Bernard Krone Holding SE & Co.KG"#
companyIdentifiers[2434] = #"ELPRO-BUCHS AG"#
companyIdentifiers[2435] = #"Feedback Sports LLC"#
companyIdentifiers[2436] = #"TeraTron GmbH"#
companyIdentifiers[2437] = #"Lumos Health Inc."#
companyIdentifiers[2438] = #"Cello Hill, LLC"#
companyIdentifiers[2439] = #"TSE BRAKES, INC."#
companyIdentifiers[2440] = #"BHM-Tech Produktionsgesellschaft m.b.H"#
companyIdentifiers[2441] = #"WIKA Alexander Wiegand SE & Co.KG"#
companyIdentifiers[2442] = #"Biovigil"#
companyIdentifiers[2443] = #"Mequonic Engineering, S.L."#
companyIdentifiers[2444] = #"bGrid B.V."#
companyIdentifiers[2445] = #"C3-WIRELESS, LLC"#
companyIdentifiers[2446] = #"ADVEEZ"#
companyIdentifiers[2447] = #"Aktiebolaget Regin"#
companyIdentifiers[2448] = #"Anton Paar GmbH"#
companyIdentifiers[2449] = #"Telenor ASA"#
companyIdentifiers[2450] = #"Big Kaiser Precision Tooling Ltd"#
companyIdentifiers[2451] = #"Absolute Audio Labs B.V."#
companyIdentifiers[2452] = #"VT42 Pty Ltd"#
companyIdentifiers[2453] = #"Bronkhorst High-Tech B.V."#
companyIdentifiers[2454] = #"C. & E. Fein GmbH"#
companyIdentifiers[2455] = #"NextMind"#
companyIdentifiers[2456] = #"Pixie Dust Technologies, Inc."#
companyIdentifiers[2457] = #"eTactica ehf"#
companyIdentifiers[2458] = #"New Audio LLC"#
companyIdentifiers[2459] = #"Sendum Wireless Corporation"#
companyIdentifiers[2460] = #"deister electronic GmbH"#
companyIdentifiers[2461] = #"YKK AP Inc."#
companyIdentifiers[2462] = #"Step One Limited"#
companyIdentifiers[2463] = #"Koya Medical, Inc."#
companyIdentifiers[2464] = #"Proof Diagnostics, Inc."#
companyIdentifiers[2465] = #"VOS Systems, LLC"#
companyIdentifiers[2466] = #"ENGAGENOW DATA SCIENCES PRIVATE LIMITED"#
companyIdentifiers[2467] = #"ARDUINO SA"#
companyIdentifiers[2468] = #"KUMHO ELECTRICS, INC"#
companyIdentifiers[2469] = #"Security Enhancement Systems, LLC"#
companyIdentifiers[2470] = #"BEIJING ELECTRIC VEHICLE CO.,LTD"#
companyIdentifiers[2471] = #"Paybuddy ApS"#
companyIdentifiers[2472] = #"KHN Solutions Inc"#
companyIdentifiers[2473] = #"Nippon Ceramic Co.,Ltd."#
companyIdentifiers[2474] = #"PHOTODYNAMIC INCORPORATED"#
companyIdentifiers[2475] = #"DashLogic, Inc."#
companyIdentifiers[2476] = #"Ambiq"#
companyIdentifiers[2477] = #"Narhwall Inc."#
companyIdentifiers[2478] = #"Pozyx NV"#
companyIdentifiers[2479] = #"ifLink Open Community"#
companyIdentifiers[2480] = #"Deublin Company, LLC"#
companyIdentifiers[2481] = #"BLINQY"#
companyIdentifiers[2482] = #"DYPHI"#
companyIdentifiers[2483] = #"BlueX Microelectronics Corp Ltd."#
companyIdentifiers[2484] = #"PentaLock Aps."#
companyIdentifiers[2485] = #"AUTEC Gesellschaft fuer Automationstechnik mbH"#
companyIdentifiers[2486] = #"Pegasus Technologies, Inc."#
companyIdentifiers[2487] = #"Bout Labs, LLC"#
companyIdentifiers[2488] = #"PlayerData Limited"#
companyIdentifiers[2489] = #"SAVOY ELECTRONIC LIGHTING"#
companyIdentifiers[2490] = #"Elimo Engineering Ltd"#
companyIdentifiers[2491] = #"SkyStream Corporation"#
companyIdentifiers[2492] = #"Aerosens LLC"#
companyIdentifiers[2493] = #"Centre Suisse d'Electronique et de Microtechnique SA"#
companyIdentifiers[2494] = #"Vessel Ltd."#
companyIdentifiers[2495] = #"Span.IO, Inc."#
companyIdentifiers[2496] = #"AnotherBrain inc."#
companyIdentifiers[2497] = #"Rosewill"#
companyIdentifiers[2498] = #"Universal Audio, Inc."#
companyIdentifiers[2499] = #"JAPAN TOBACCO INC."#
companyIdentifiers[2500] = #"UVISIO"#
companyIdentifiers[2501] = #"HungYi Microelectronics Co.,Ltd."#
companyIdentifiers[2502] = #"Honor Device Co., Ltd."#
companyIdentifiers[2503] = #"Combustion, LLC"#
companyIdentifiers[2504] = #"XUNTONG"#
companyIdentifiers[2505] = #"CrowdGlow Ltd"#
companyIdentifiers[2506] = #"Mobitrace"#
companyIdentifiers[2507] = #"Hx Engineering, LLC"#
companyIdentifiers[2508] = #"Senso4s d.o.o."#
companyIdentifiers[2509] = #"Blyott"#
companyIdentifiers[2510] = #"Julius Blum GmbH"#
companyIdentifiers[2511] = #"BlueStreak IoT, LLC"#
companyIdentifiers[2512] = #"Chess Wise B.V."#
companyIdentifiers[2513] = #"ABLEPAY TECHNOLOGIES AS"#
companyIdentifiers[2514] = #"Temperature Sensitive Solutions Systems Sweden AB"#
companyIdentifiers[2515] = #"HeartHero, inc."#
companyIdentifiers[2516] = #"ORBIS Inc."#
companyIdentifiers[2517] = #"GEAR RADIO ELECTRONICS CORP."#
companyIdentifiers[2518] = #"EAR TEKNIK ISITME VE ODIOMETRI CIHAZLARI SANAYI VE TICARET ANONIM SIRKETI"#
companyIdentifiers[2519] = #"Coyotta"#
companyIdentifiers[2520] = #"Synergy Tecnologia em Sistemas Ltda"#
companyIdentifiers[2521] = #"VivoSensMedical GmbH"#
companyIdentifiers[2522] = #"Nagravision SA"#
companyIdentifiers[2523] = #"Bionic Avionics Inc."#
companyIdentifiers[2524] = #"AON2 Ltd."#
companyIdentifiers[2525] = #"Innoware Development AB"#
companyIdentifiers[2526] = #"JLD Technology Solutions, LLC"#
companyIdentifiers[2527] = #"Magnus Technology Sdn Bhd"#
companyIdentifiers[2528] = #"Preddio Technologies Inc."#
companyIdentifiers[2529] = #"Tag-N-Trac Inc"#
companyIdentifiers[2530] = #"Wuhan Linptech Co.,Ltd."#
companyIdentifiers[2531] = #"Friday Home Aps"#
companyIdentifiers[2532] = #"CPS AS"#
companyIdentifiers[2533] = #"Mobilogix"#
companyIdentifiers[2534] = #"Masonite Corporation"#
companyIdentifiers[2535] = #"Kabushikigaisha HANERON"#
companyIdentifiers[2536] = #"Melange Systems Pvt. Ltd."#
companyIdentifiers[2537] = #"LumenRadio AB"#
companyIdentifiers[2538] = #"Athlos Oy"#
companyIdentifiers[2539] = #"KEAN ELECTRONICS PTY LTD"#
companyIdentifiers[2540] = #"Yukon advanced optics worldwide, UAB"#
companyIdentifiers[2541] = #"Sibel Inc."#
companyIdentifiers[2542] = #"OJMAR SA"#
companyIdentifiers[2543] = #"Steinel Solutions AG"#
companyIdentifiers[2544] = #"WatchGas B.V."#
companyIdentifiers[2545] = #"OM Digital Solutions Corporation"#
companyIdentifiers[2546] = #"Audeara Pty Ltd"#
companyIdentifiers[2547] = #"Beijing Zero Zero Infinity Technology Co.,Ltd."#
companyIdentifiers[2548] = #"Spectrum Technologies, Inc."#
companyIdentifiers[2549] = #"OKI Electric Industry Co., Ltd"#
companyIdentifiers[2550] = #"Mobile Action Technology Inc."#
companyIdentifiers[2551] = #"SENSATEC Co., Ltd."#
companyIdentifiers[2552] = #"R.O. S.R.L."#
companyIdentifiers[2553] = #"Hangzhou Yaguan Technology Co. LTD"#
companyIdentifiers[2554] = #"Listen Technologies Corporation"#
companyIdentifiers[2555] = #"TOITU CO., LTD."#
companyIdentifiers[2556] = #"Confidex"#
companyIdentifiers[2557] = #"Keep Technologies, Inc."#
companyIdentifiers[2558] = #"Lichtvision Engineering GmbH"#
companyIdentifiers[2559] = #"AIRSTAR"#
companyIdentifiers[2560] = #"Ampler Bikes OU"#
companyIdentifiers[2561] = #"Cleveron AS"#
companyIdentifiers[2562] = #"Ayxon-Dynamics GmbH"#
companyIdentifiers[2563] = #"donutrobotics Co., Ltd."#
companyIdentifiers[2564] = #"Flosonics Medical"#
companyIdentifiers[2565] = #"Southwire Company, LLC"#
companyIdentifiers[2566] = #"Shanghai wuqi microelectronics Co.,Ltd"#
companyIdentifiers[2567] = #"Reflow Pty Ltd"#
companyIdentifiers[2568] = #"Oras Oy"#
companyIdentifiers[2569] = #"ECCT"#
companyIdentifiers[2570] = #"Volan Technology Inc."#
companyIdentifiers[2571] = #"SIANA Systems"#
companyIdentifiers[2572] = #"Shanghai Yidian Intelligent Technology Co., Ltd."#
companyIdentifiers[2573] = #"Blue Peacock GmbH"#
companyIdentifiers[2574] = #"Roland Corporation"#
companyIdentifiers[2575] = #"LIXIL Corporation"#
companyIdentifiers[2576] = #"SUBARU Corporation"#
companyIdentifiers[2577] = #"Sensolus"#
companyIdentifiers[2578] = #"Dyson Technology Limited"#
companyIdentifiers[2579] = #"Tec4med LifeScience GmbH"#
companyIdentifiers[2580] = #"CROXEL, INC."#
companyIdentifiers[2581] = #"Syng Inc"#
companyIdentifiers[2582] = #"RIDE VISION LTD"#
companyIdentifiers[2583] = #"Plume Design Inc"#
companyIdentifiers[2584] = #"Cambridge Animal Technologies Ltd"#
companyIdentifiers[2585] = #"Maxell, Ltd."#
companyIdentifiers[2586] = #"Link Labs, Inc."#
companyIdentifiers[2587] = #"Embrava Pty Ltd"#
companyIdentifiers[2588] = #"INPEAK S.C."#
companyIdentifiers[2589] = #"API-K"#
companyIdentifiers[2590] = #"CombiQ AB"#
companyIdentifiers[2591] = #"DeVilbiss Healthcare LLC"#
companyIdentifiers[2592] = #"Jiangxi Innotech Technology Co., Ltd"#
companyIdentifiers[2593] = #"Apollogic Sp. z o.o."#
companyIdentifiers[2594] = #"DAIICHIKOSHO CO., LTD."#
companyIdentifiers[2595] = #"BIXOLON CO.,LTD"#
companyIdentifiers[2596] = #"Atmosic Technologies, Inc."#
companyIdentifiers[2597] = #"Eran Financial Services LLC"#
companyIdentifiers[2598] = #"Louis Vuitton"#
companyIdentifiers[2599] = #"AYU DEVICES PRIVATE LIMITED"#
companyIdentifiers[2600] = #"NanoFlex"#
companyIdentifiers[2601] = #"Worthcloud Technology Co.,Ltd"#
companyIdentifiers[2602] = #"Yamaha Corporation"#
companyIdentifiers[2603] = #"PaceBait IVS"#
companyIdentifiers[2604] = #"Shenzhen H&T Intelligent Control Co., Ltd"#
companyIdentifiers[2605] = #"Shenzhen Feasycom Technology Co., Ltd."#
companyIdentifiers[2606] = #"Zuma Array Limited"#
companyIdentifiers[2607] = #"Instamic, Inc."#
companyIdentifiers[2608] = #"Air-Weigh"#
companyIdentifiers[2609] = #"Nevro Corp."#
companyIdentifiers[2610] = #"Pinnacle Technology, Inc."#
companyIdentifiers[2611] = #"WMF AG"#
companyIdentifiers[2612] = #"Luxer Corporation"#
companyIdentifiers[2613] = #"safectory GmbH"#
companyIdentifiers[2614] = #"NGK SPARK PLUG CO., LTD."#
companyIdentifiers[2615] = #"2587702 Ontario Inc."#
companyIdentifiers[2616] = #"Bouffalo Lab (Nanjing)., Ltd."#
companyIdentifiers[2617] = #"BLUETICKETING SRL"#
companyIdentifiers[2618] = #"Incotex Co. Ltd."#
companyIdentifiers[2619] = #"Galileo Technology Limited"#
companyIdentifiers[2620] = #"Siteco GmbH"#
companyIdentifiers[2621] = #"DELABIE"#
companyIdentifiers[2622] = #"Hefei Yunlian Semiconductor Co., Ltd"#
companyIdentifiers[2623] = #"Shenzhen Yopeak Optoelectronics Technology Co., Ltd."#
companyIdentifiers[2624] = #"GEWISS S.p.A."#
companyIdentifiers[2625] = #"OPEX Corporation"#
companyIdentifiers[2626] = #"Motionalysis, Inc."#
companyIdentifiers[2627] = #"Busch Systems International Inc."#
companyIdentifiers[2628] = #"Novidan, Inc."#
companyIdentifiers[2629] = #"3SI Security Systems, Inc"#
companyIdentifiers[2630] = #"Beijing HC-Infinite Technology Limited"#
companyIdentifiers[2631] = #"The Wand Company Ltd"#
companyIdentifiers[2632] = #"JRC Mobility Inc."#
companyIdentifiers[2633] = #"Venture Research Inc."#
companyIdentifiers[2634] = #"Map Large, Inc."#
companyIdentifiers[2635] = #"MistyWest Energy and Transport Ltd."#
companyIdentifiers[2636] = #"SiFli Technologies (shanghai) Inc."#
companyIdentifiers[2637] = #"Lockn Technologies Private Limited"#
companyIdentifiers[2638] = #"Toytec Corporation"#
companyIdentifiers[2639] = #"VANMOOF Global Holding B.V."#
companyIdentifiers[2640] = #"Nextscape Inc."#
companyIdentifiers[2641] = #"CSIRO"#
companyIdentifiers[2642] = #"Follow Sense Europe B.V."#
companyIdentifiers[2643] = #"KKM COMPANY LIMITED"#
companyIdentifiers[2644] = #"SQL Technologies Corp."#
companyIdentifiers[2645] = #"Inugo Systems Limited"#
companyIdentifiers[2646] = #"ambie"#
companyIdentifiers[2647] = #"Meizhou Guo Wei Electronics Co., Ltd"#
companyIdentifiers[2648] = #"Indigo Diabetes"#
companyIdentifiers[2649] = #"TourBuilt, LLC"#
companyIdentifiers[2650] = #"Sontheim Industrie Elektronik GmbH"#
companyIdentifiers[2651] = #"LEGIC Identsystems AG"#
companyIdentifiers[2652] = #"Innovative Design Labs Inc."#
companyIdentifiers[2653] = #"MG Energy Systems B.V."#
companyIdentifiers[2654] = #"LaceClips llc"#
companyIdentifiers[2655] = #"stryker"#
companyIdentifiers[2656] = #"DATANG SEMICONDUCTOR TECHNOLOGY CO.,LTD"#
companyIdentifiers[2657] = #"Smart Parks B.V."#
companyIdentifiers[2658] = #"MOKO TECHNOLOGY Ltd"#
companyIdentifiers[2659] = #"Gremsy JSC"#
companyIdentifiers[2660] = #"Geopal system A/S"#
companyIdentifiers[2661] = #"Lytx, INC."#
companyIdentifiers[2662] = #"JUSTMORPH PTE. LTD."#
companyIdentifiers[2663] = #"Beijing SuperHexa Century Technology CO. Ltd"#
companyIdentifiers[2664] = #"Focus Ingenieria SRL"#
companyIdentifiers[2665] = #"HAPPIEST BABY, INC."#
companyIdentifiers[2666] = #"Scribble Design Inc."#
companyIdentifiers[2667] = #"Olympic Ophthalmics, Inc."#
companyIdentifiers[2668] = #"Pokkels"#
companyIdentifiers[2669] = #"KUUKANJYOKIN Co.,Ltd."#
companyIdentifiers[2670] = #"Pac Sane Limited"#
companyIdentifiers[2671] = #"Warner Bros."#
companyIdentifiers[2672] = #"Ooma"#
companyIdentifiers[2673] = #"Senquip Pty Ltd"#
companyIdentifiers[2674] = #"Jumo GmbH & Co. KG"#
companyIdentifiers[2675] = #"Innohome Oy"#
companyIdentifiers[2676] = #"MICROSON S.A."#
companyIdentifiers[2677] = #"Delta Cycle Corporation"#
companyIdentifiers[2678] = #"Synaptics Incorporated"#
companyIdentifiers[2679] = #"JMD PACIFIC PTE. LTD."#
companyIdentifiers[2680] = #"Shenzhen Sunricher Technology Limited"#
companyIdentifiers[2681] = #"Webasto SE"#
companyIdentifiers[2682] = #"Emlid Limited"#
companyIdentifiers[2683] = #"UniqAir Oy"#
companyIdentifiers[2684] = #"WAFERLOCK"#
companyIdentifiers[2685] = #"Freedman Electronics Pty Ltd"#
companyIdentifiers[2686] = #"KEBA Handover Automation GmbH"#
companyIdentifiers[2687] = #"Intuity Medical"#
companyIdentifiers[2688] = #"Cleer Limited"#
companyIdentifiers[2689] = #"Universal Biosensors Pty Ltd"#
companyIdentifiers[2690] = #"Corsair"#
companyIdentifiers[2691] = #"Rivata, Inc."#
companyIdentifiers[2692] = #"Greennote Inc,"#
companyIdentifiers[2693] = #"Snowball Technology Co., Ltd."#
companyIdentifiers[2694] = #"ALIZENT International"#
companyIdentifiers[2695] = #"Shanghai Smart System Technology Co., Ltd"#
companyIdentifiers[2696] = #"PSA Peugeot Citroen"#
companyIdentifiers[2697] = #"SES-Imagotag"#
companyIdentifiers[2698] = #"HAINBUCH SPANNENDE TECHNIK"#
companyIdentifiers[2699] = #"SANlight GmbH"#
companyIdentifiers[2700] = #"DelpSys, s.r.o."#
companyIdentifiers[2701] = #"JCM TECHNOLOGIES S.A."#
companyIdentifiers[2702] = #"Perfect Company"#
companyIdentifiers[2703] = #"TOTO LTD."#
companyIdentifiers[2704] = #"Shenzhen Grandsun Electronic Co.,Ltd."#
companyIdentifiers[2705] = #"Monarch International Inc."#
companyIdentifiers[2706] = #"Carestream Dental LLC"#
companyIdentifiers[2707] = #"GiPStech S.r.l."#
companyIdentifiers[2708] = #"OOBIK Inc."#
companyIdentifiers[2709] = #"Pamex Inc."#
companyIdentifiers[2710] = #"Lightricity Ltd"#
companyIdentifiers[2711] = #"SensTek"#
companyIdentifiers[2712] = #"Foil, Inc."#
companyIdentifiers[2713] = #"Shanghai high-flying electronics technology Co.,Ltd"#
companyIdentifiers[2714] = #"TEMKIN ASSOCIATES, LLC"#
companyIdentifiers[2715] = #"Eello LLC"#
companyIdentifiers[2716] = #"Xi'an Fengyu Information Technology Co., Ltd."#
companyIdentifiers[2717] = #"Canon Finetech Nisca Inc."#
companyIdentifiers[2718] = #"LifePlus, Inc."#
companyIdentifiers[2719] = #"ista International GmbH"#
companyIdentifiers[2720] = #"Loy Tec electronics GmbH"#
companyIdentifiers[2721] = #"LINCOGN TECHNOLOGY CO. LIMITED"#
companyIdentifiers[2722] = #"Care Bloom, LLC"#
companyIdentifiers[2723] = #"DIC Corporation"#
companyIdentifiers[2724] = #"FAZEPRO LLC"#
companyIdentifiers[2725] = #"Shenzhen Uascent Technology Co., Ltd"#
companyIdentifiers[2726] = #"Realityworks, inc."#
companyIdentifiers[2727] = #"Urbanista AB"#
companyIdentifiers[2728] = #"Zencontrol Pty Ltd"#
companyIdentifiers[2729] = #"Mrinq Technologies LLC"#
companyIdentifiers[2730] = #"Computime International Ltd"#
companyIdentifiers[2731] = #"Anhui Listenai Co"#
companyIdentifiers[2732] = #"OSM HK Limited"#
companyIdentifiers[2733] = #"Adevo Consulting AB"#
companyIdentifiers[2734] = #"PS Engineering, Inc."#
companyIdentifiers[2735] = #"AIAIAI ApS"#
companyIdentifiers[2736] = #"Visiontronic s.r.o."#
companyIdentifiers[2737] = #"InVue Security Products Inc"#
companyIdentifiers[2738] = #"TouchTronics, Inc."#
companyIdentifiers[2739] = #"INNER RANGE PTY. LTD."#
companyIdentifiers[2740] = #"Ellenby Technologies, Inc."#
companyIdentifiers[2741] = #"Elstat Ltd [ Formerly Elstat Electronics Ltd.]"#
companyIdentifiers[2742] = #"Xenter, Inc."#
companyIdentifiers[2743] = #"LogTag North America Inc."#
companyIdentifiers[2744] = #"Sens.ai Incorporated"#
companyIdentifiers[2745] = #"STL"#
companyIdentifiers[2746] = #"Open Bionics Ltd."#
companyIdentifiers[2747] = #"R-DAS, s.r.o."#
companyIdentifiers[2748] = #"KCCS Mobile Engineering Co., Ltd."#
companyIdentifiers[2749] = #"Inventas AS"#
companyIdentifiers[2750] = #"Robkoo Information & Technologies Co., Ltd."#
companyIdentifiers[2751] = #"PAUL HARTMANN AG"#
companyIdentifiers[2752] = #"Omni-ID USA, INC."#
companyIdentifiers[2753] = #"Shenzhen Jingxun Technology Co., Ltd."#
companyIdentifiers[2754] = #"RealMega Microelectronics technology (Shanghai) Co. Ltd."#
companyIdentifiers[2755] = #"Kenzen, Inc."#
companyIdentifiers[2756] = #"CODIUM"#
companyIdentifiers[2757] = #"Flexoptix GmbH"#
companyIdentifiers[2758] = #"Barnes Group Inc."#
companyIdentifiers[2759] = #"Chengdu Aich Technology Co.,Ltd"#
companyIdentifiers[2760] = #"Keepin Co., Ltd."#
companyIdentifiers[2761] = #"Swedlock AB"#
companyIdentifiers[2762] = #"Shenzhen CoolKit Technology Co., Ltd"#
companyIdentifiers[2763] = #"ise Individuelle Software und Elektronik GmbH"#
companyIdentifiers[2764] = #"Nuvoton"#
companyIdentifiers[2765] = #"Visuallex Sport International Limited"#
companyIdentifiers[2766] = #"KOBATA GAUGE MFG. CO., LTD."#
companyIdentifiers[2767] = #"CACI Technologies"#
companyIdentifiers[2768] = #"Nordic Strong ApS"#
companyIdentifiers[2769] = #"EAGLE KINGDOM TECHNOLOGIES LIMITED"#
companyIdentifiers[2770] = #"Lautsprecher Teufel GmbH"#
companyIdentifiers[2771] = #"SSV Software Systems GmbH"#
companyIdentifiers[2772] = #"Zhuhai Pantum Electronisc Co., Ltd"#
companyIdentifiers[2773] = #"Streamit B.V."#
companyIdentifiers[2774] = #"nymea GmbH"#
companyIdentifiers[2775] = #"AL-KO Geraete GmbH"#
companyIdentifiers[2776] = #"Franz Kaldewei GmbH&Co KG"#
companyIdentifiers[2777] = #"Shenzhen Aimore. Co.,Ltd"#
companyIdentifiers[2778] = #"Codefabrik GmbH"#
companyIdentifiers[2779] = #"Reelables, Inc."#
companyIdentifiers[2780] = #"Duravit AG "#
companyIdentifiers[2781] = #"Boss Audio"#
companyIdentifiers[2782] = #"Vocera Communications, Inc."#
companyIdentifiers[2783] = #"Douglas Dynamics L.L.C."#
companyIdentifiers[2784] = #"Viceroy Devices Corporation"#
companyIdentifiers[2785] = #"ChengDu ForThink Technology Co., Ltd."#
companyIdentifiers[2786] = #"IMATRIX SYSTEMS, INC."#
companyIdentifiers[2787] = #"GlobalMed"#
companyIdentifiers[2788] = #"DALI Alliance"#
companyIdentifiers[2789] = #"unu GmbH"#
companyIdentifiers[2790] = #"Hexology"#
companyIdentifiers[2791] = #"Sunplus Technology Co., Ltd."#
companyIdentifiers[2792] = #"LEVEL, s.r.o."#
companyIdentifiers[2793] = #"FLIR Systems AB"#
companyIdentifiers[2794] = #"Borda Technology"#
companyIdentifiers[2795] = #"Square, Inc."#
companyIdentifiers[2796] = #"FUTEK ADVANCED SENSOR TECHNOLOGY, INC"#
companyIdentifiers[2797] = #"Saxonar GmbH"#
companyIdentifiers[2798] = #"Velentium, LLC"#
companyIdentifiers[2799] = #"GLP German Light Products GmbH"#
companyIdentifiers[2800] = #"Leupold & Stevens, Inc."#
companyIdentifiers[2801] = #"CRADERS,CO.,LTD"#
companyIdentifiers[2802] = #"Shanghai All Link Microelectronics Co.,Ltd"#
companyIdentifiers[2803] = #"701x Inc."#
companyIdentifiers[2804] = #"Radioworks Microelectronics PTY LTD"#
companyIdentifiers[2805] = #"Unitech Electronic Inc."#
companyIdentifiers[2806] = #"AMETEK, Inc."#
companyIdentifiers[2807] = #"Irdeto"#
companyIdentifiers[2808] = #"First Design System Inc."#
companyIdentifiers[2809] = #"Unisto AG"#
companyIdentifiers[2810] = #"Chengdu Ambit Technology Co., Ltd."#
companyIdentifiers[2811] = #"SMT ELEKTRONIK GmbH"#
companyIdentifiers[2812] = #"Cerebrum Sensor Technologies Inc."#
companyIdentifiers[2813] = #"Weber Sensors, LLC"#
companyIdentifiers[2814] = #"Earda Technologies Co.,Ltd"#
companyIdentifiers[2815] = #"FUSEAWARE LIMITED"#
companyIdentifiers[2816] = #"Flaircomm Microelectronics Inc."#
companyIdentifiers[2817] = #"RESIDEO TECHNOLOGIES, INC."#
companyIdentifiers[2818] = #"IORA Technology Development Ltd. Sti."#
companyIdentifiers[2819] = #"Precision Triathlon Systems Limited"#
companyIdentifiers[2820] = #"I-PERCUT"#
companyIdentifiers[2821] = #"Marquardt GmbH"#
companyIdentifiers[2822] = #"FAZUA GmbH"#
companyIdentifiers[2823] = #"Workaround Gmbh"#
companyIdentifiers[2824] = #"Shenzhen Qianfenyi Intelligent Technology Co., LTD"#
companyIdentifiers[2825] = #"soonisys"#
companyIdentifiers[2826] = #"Belun Technology Company Limited"#
companyIdentifiers[2827] = #"Sanistaal A/S"#
companyIdentifiers[2828] = #"BluPeak"#
companyIdentifiers[2829] = #"SANYO DENKO Co.,Ltd."#
companyIdentifiers[2830] = #"Honda Lock Mfg. Co.,Ltd."#
companyIdentifiers[2831] = #"B.E.A. S.A."#
companyIdentifiers[2832] = #"Alfa Laval Corporate AB"#
companyIdentifiers[2833] = #"ThermoWorks, Inc."#
companyIdentifiers[2834] = #"ToughBuilt Industries LLC"#
companyIdentifiers[2835] = #"IOTOOLS"#
companyIdentifiers[2836] = #"Olumee"#
companyIdentifiers[2837] = #"NAOS JAPAN K.K."#
companyIdentifiers[2838] = #"Guard RFID Solutions Inc."#
companyIdentifiers[2839] = #"SIG SAUER, INC."#
companyIdentifiers[2840] = #"DECATHLON SE"#
companyIdentifiers[2841] = #"WBS PROJECT H PTY LTD"#
companyIdentifiers[2842] = #"Roca Sanitario, S.A."#
companyIdentifiers[2843] = #"Enerpac Tool Group Corp."#
companyIdentifiers[2844] = #"Nanoleq AG"#
companyIdentifiers[2845] = #"Accelerated Systems"#
companyIdentifiers[2846] = #"PB INC."#
companyIdentifiers[2847] = #"Beijing ESWIN Computing Technology Co., Ltd."#
companyIdentifiers[2848] = #"TKH Security B.V."#
companyIdentifiers[2849] = #"ams AG"#
companyIdentifiers[2850] = #"Hygiene IQ, LLC."#
companyIdentifiers[2851] = #"iRhythm Technologies, Inc."#
companyIdentifiers[2852] = #"BeiJing ZiJie TiaoDong KeJi Co.,Ltd."#
companyIdentifiers[2853] = #"NIBROTECH LTD"#
companyIdentifiers[2854] = #"Baracoda Daily Healthtech."#
companyIdentifiers[2855] = #"Lumi United Technology Co., Ltd"#
companyIdentifiers[2856] = #"CHACON"#
companyIdentifiers[2857] = #"Tech-Venom Entertainment Private Limited"#
companyIdentifiers[2858] = #"ACL Airshop B.V."#
companyIdentifiers[2859] = #"MAINBOT"#
companyIdentifiers[2860] = #"ILLUMAGEAR, Inc."#
companyIdentifiers[2861] = #"REDARC ELECTRONICS PTY LTD"#
companyIdentifiers[2862] = #"MOCA System Inc."#
companyIdentifiers[2863] = #"Duke Manufacturing Co"#
companyIdentifiers[2864] = #"ART SPA"#
companyIdentifiers[2865] = #"Silver Wolf Vehicles Inc."#
companyIdentifiers[2866] = #"Hala Systems, Inc."#
companyIdentifiers[2867] = #"ARMATURA LLC"#
companyIdentifiers[2868] = #"CONZUMEX INDUSTRIES PRIVATE LIMITED"#
companyIdentifiers[2869] = #"BH Sens"#
companyIdentifiers[2870] = #"SINTEF"#
companyIdentifiers[2871] = #"Omnivoltaic Energy Solutions Limited Company"#
companyIdentifiers[2872] = #"WISYCOM S.R.L."#
companyIdentifiers[2873] = #"Red 100 Lighting Co., ltd."#
companyIdentifiers[2874] = #"Impact Biosystems, Inc."#
companyIdentifiers[2875] = #"AIC semiconductor (Shanghai) Co., Ltd."#
companyIdentifiers[2876] = #"Dodge Industrial, Inc."#
companyIdentifiers[2877] = #"REALTIMEID AS"#
companyIdentifiers[2878] = #"ISEO Serrature S.p.a."#
companyIdentifiers[2879] = #"MindRhythm, Inc."#
companyIdentifiers[2880] = #"Havells India Limited"#
companyIdentifiers[2881] = #"Sentrax GmbH"#
companyIdentifiers[2882] = #"TSI"#
companyIdentifiers[2883] = #"INCITAT ENVIRONNEMENT"#
companyIdentifiers[2884] = #"nFore Technology Co., Ltd."#
companyIdentifiers[2885] = #"Electronic Sensors, Inc."#
companyIdentifiers[2886] = #"Bird Rides, Inc."#
companyIdentifiers[2887] = #"Gentex Corporation "#
companyIdentifiers[2888] = #"NIO USA, Inc."#
companyIdentifiers[2889] = #"SkyHawke Technologies"#
companyIdentifiers[2890] = #"Nomono AS"#
companyIdentifiers[2891] = #"EMS Integrators, LLC"#
companyIdentifiers[2892] = #"BiosBob.Biz"#
companyIdentifiers[2893] = #"Adam Hall GmbH"#
companyIdentifiers[2894] = #"ICP Systems B.V."#
companyIdentifiers[2895] = #"Breezi.io, Inc."#
companyIdentifiers[2896] = #"Mesh Systems LLC"#
companyIdentifiers[2897] = #"FUN FACTORY GmbH"#
companyIdentifiers[2898] = #"ZIIP Inc"#
companyIdentifiers[2899] = #"SHENZHEN KAADAS INTELLIGENT TECHNOLOGY CO.,Ltd"#
companyIdentifiers[2900] = #"Emotion Fitness GmbH & Co. KG"#
companyIdentifiers[2901] = #"H G M Automotive Electronics, Inc."#
companyIdentifiers[2902] = #"BORA - Vertriebs GmbH & Co KG"#
companyIdentifiers[2903] = #"CONVERTRONIX TECHNOLOGIES AND SERVICES LLP"#
companyIdentifiers[2904] = #"TOKAI-DENSHI INC"#
companyIdentifiers[2905] = #"Versa Group B.V."#
companyIdentifiers[2906] = #"H.P. Shelby Manufacturing, LLC."#
companyIdentifiers[2907] = #"Shenzhen ImagineVision Technology Limited"#
companyIdentifiers[2908] = #"Exponential Power, Inc."#
companyIdentifiers[2909] = #"Fujian Newland Auto-ID Tech. Co., Ltd."#
companyIdentifiers[2910] = #"CELLCONTROL, INC."#
companyIdentifiers[2911] = #"Rivieh, Inc."#
companyIdentifiers[2912] = #"RATOC Systems, Inc."#
companyIdentifiers[2913] = #"Sentek Pty Ltd"#
companyIdentifiers[2914] = #"NOVEA ENERGIES"#
companyIdentifiers[2915] = #"Innolux Corporation"#
companyIdentifiers[2916] = #"NingBo klite Electric Manufacture Co.,LTD"#
companyIdentifiers[2917] = #"The Apache Software Foundation"#
companyIdentifiers[2918] = #"MITSUBISHI ELECTRIC AUTOMATION (THAILAND) COMPANY LIMITED"#
companyIdentifiers[2919] = #"CleanSpace Technology Pty Ltd"#
companyIdentifiers[2920] = #"Quha oy"#
companyIdentifiers[2921] = #"Addaday"#
companyIdentifiers[2922] = #"Dymo"#
companyIdentifiers[2923] = #"Samsara Networks, Inc"#
companyIdentifiers[2924] = #"Sensitech, Inc."#
companyIdentifiers[2925] = #"SOLUM CO., LTD"#
companyIdentifiers[2926] = #"React Mobile"#
companyIdentifiers[2927] = #"Shenzhen Malide Technology Co.,Ltd"#
companyIdentifiers[2928] = #"JDRF Electromag Engineering Inc"#
companyIdentifiers[2929] = #"lilbit ODM AS"#
companyIdentifiers[2930] = #"Geeknet, Inc."#
companyIdentifiers[2931] = #"HARADA INDUSTRY CO., LTD."#
companyIdentifiers[2932] = #"BQN"#
companyIdentifiers[2933] = #"Triple W Japan Inc."#
companyIdentifiers[2934] = #"MAX-co., ltd"#
companyIdentifiers[2935] = #"Aixlink(Chengdu) Co., Ltd."#
companyIdentifiers[2936] = #"FIELD DESIGN INC."#
companyIdentifiers[2937] = #"Sankyo Air Tech Co.,Ltd."#
companyIdentifiers[2938] = #"Shenzhen KTC Technology Co.,Ltd."#
companyIdentifiers[2939] = #"Hardcoder Oy"#
companyIdentifiers[2940] = #"Scangrip A/S"#
companyIdentifiers[2941] = #"FoundersLane GmbH"#
companyIdentifiers[2942] = #"Offcode Oy"#
companyIdentifiers[2943] = #"ICU tech GmbH"#
companyIdentifiers[2944] = #"AXELIFE"#
companyIdentifiers[2945] = #"SCM Group"#
companyIdentifiers[2946] = #"Mammut Sports Group AG"#
companyIdentifiers[2947] = #"Taiga Motors Inc."#
companyIdentifiers[2948] = #"Presidio Medical, Inc."#
companyIdentifiers[2949] = #"VIMANA TECH PTY LTD"#
companyIdentifiers[2950] = #"Trek Bicycle"#
companyIdentifiers[2951] = #"Ampetronic Ltd"#
companyIdentifiers[2952] = #"Muguang (Guangdong) Intelligent Lighting Technology Co., Ltd"#
companyIdentifiers[2953] = #"Rotronic AG"#
companyIdentifiers[2954] = #"Seiko Instruments Inc."#
companyIdentifiers[2955] = #"American Technology Components, Incorporated"#
companyIdentifiers[2956] = #"MOTREX"#
companyIdentifiers[2957] = #"Pertech Industries Inc"#
companyIdentifiers[2958] = #"Gentle Energy Corp."#
companyIdentifiers[2959] = #"Senscomm Semiconductor Co., Ltd."#
companyIdentifiers[2960] = #"Ineos Automotive Limited"#
companyIdentifiers[2961] = #"Alfen ICU B.V."#
companyIdentifiers[2962] = #"Citisend Solutions, SL"#
companyIdentifiers[2963] = #"Hangzhou BroadLink Technology Co., Ltd."#
companyIdentifiers[2964] = #"Dreem SAS"#
companyIdentifiers[2965] = #"Netwake GmbH"#
companyIdentifiers[2966] = #"Telecom Design"#
companyIdentifiers[2967] = #"SILVER TREE LABS, INC."#
companyIdentifiers[2968] = #"Gymstory B.V."#
companyIdentifiers[2969] = #"The Goodyear Tire & Rubber Company"#
companyIdentifiers[2970] = #"Beijing Wisepool Infinite Intelligence Technology Co.,Ltd"#
companyIdentifiers[2971] = #"GISMAN"#
companyIdentifiers[2972] = #"Komatsu Ltd."#
companyIdentifiers[2973] = #"Sensoria Holdings LTD"#
companyIdentifiers[2974] = #"Audio Partnership Plc"#
companyIdentifiers[2975] = #"Group Lotus Limited"#
companyIdentifiers[2976] = #"Data Sciences International"#
companyIdentifiers[2977] = #"Bunn-O-Matic Corporation"#
companyIdentifiers[2978] = #"TireCheck GmbH"#
companyIdentifiers[2979] = #"Sonova Consumer Hearing GmbH"#
companyIdentifiers[2980] = #"Vervent Audio Group"#
companyIdentifiers[2981] = #"SONICOS ENTERPRISES, LLC"#
companyIdentifiers[2982] = #"Nissan Motor Co., Ltd."#
companyIdentifiers[2983] = #"hearX Group (Pty) Ltd"#
companyIdentifiers[2984] = #"GLOWFORGE INC."#
companyIdentifiers[2985] = #"Allterco Robotics ltd"#
companyIdentifiers[2986] = #"Infinitegra, Inc."#
companyIdentifiers[2987] = #"Grandex International Corporation"#
companyIdentifiers[2988] = #"Machfu Inc."#
companyIdentifiers[2989] = #"Roambotics, Inc."#
companyIdentifiers[2990] = #"Soma Labs LLC"#
companyIdentifiers[2991] = #"NITTO KOGYO CORPORATION"#
companyIdentifiers[2992] = #"Ecolab Inc."#
companyIdentifiers[2993] = #"Beijing ranxin intelligence technology Co.,LTD"#
companyIdentifiers[2994] = #"Fjorden Electra AS"#
companyIdentifiers[2995] = #"Flender GmbH"#
companyIdentifiers[2996] = #"New Cosmos USA, Inc."#
companyIdentifiers[2997] = #"Xirgo Technologies, LLC"#
companyIdentifiers[2998] = #"Build With Robots Inc."#
companyIdentifiers[2999] = #"IONA Tech LLC"#
companyIdentifiers[3000] = #"INNOVAG PTY. LTD."#
companyIdentifiers[3001] = #"SaluStim Group Oy"#
companyIdentifiers[3002] = #"Huso, INC"#
companyIdentifiers[3003] = #"SWISSINNO SOLUTIONS AG"#
companyIdentifiers[3004] = #"T2REALITY SOLUTIONS PRIVATE LIMITED"#
companyIdentifiers[3005] = #"ETHEORY PTY LTD"#
companyIdentifiers[3006] = #"SAAB Aktiebolag"#
companyIdentifiers[3007] = #"HIMSA II K/S"#
companyIdentifiers[3008] = #"READY FOR SKY LLP"#
companyIdentifiers[3009] = #"Miele & Cie. KG"#
companyIdentifiers[3010] = #"EntWick Co."#
companyIdentifiers[3011] = #"MCOT INC."#
companyIdentifiers[3012] = #"TECHTICS ENGINEERING B.V."#
companyIdentifiers[3013] = #"Aperia Technologies, Inc."#
companyIdentifiers[3014] = #"TCL COMMUNICATION EQUIPMENT CO.,LTD."#
companyIdentifiers[3015] = #"Signtle Inc."#
companyIdentifiers[3016] = #"OTF Distribution, LLC"#
companyIdentifiers[3017] = #"Neuvatek Inc."#
companyIdentifiers[3018] = #"Perimeter Technologies, Inc."#
companyIdentifiers[3019] = #"Divesoft s.r.o."#
companyIdentifiers[3020] = #"Sylvac sa"#
companyIdentifiers[3021] = #"Amiko srl"#
companyIdentifiers[3022] = #"Neurosity, Inc."#
companyIdentifiers[3023] = #"LL Tec Group LLC"#
companyIdentifiers[3024] = #"Durag GmbH"#
companyIdentifiers[3025] = #"Hubei Yuanshidai Technology Co., Ltd."#
companyIdentifiers[3026] = #"IDEC"#
companyIdentifiers[3027] = #"Procon Analytics, LLC"#
companyIdentifiers[3028] = #"ndd Medizintechnik AG"#
companyIdentifiers[3029] = #"Super B Lithium Power B.V."#
companyIdentifiers[3030] = #"Injoinic"#
companyIdentifiers[3031] = #"VINFAST TRADING AND PRODUCTION JOINT STOCK COMPANY"#
return companyIdentifiers
}()
}
#endif
| mit | 34f89e2f9d155ca2f1584010e08066a8 | 57.82874 | 116 | 0.647984 | 3.859615 | false | false | false | false |
eurofurence/ef-app_ios | Eurofurence/SwiftUI/Modules/Event/EventFeedbackForm.swift | 1 | 9337 | import EurofurenceKit
import SwiftUI
struct EventFeedbackForm: View {
@ObservedObject var event: Event
@ObservedObject var feedback: Event.FeedbackForm
@State private var isPresentingDiscardAlert = false
@State private var state: FeedbackState = .preparing
@State private var feedbackSubmissionError: Error?
@State private var isPresentingFeedbackSubmissionErrorAlert = false
@Environment(\.dismiss) private var dismiss
@Environment(\.errorNotificationHaptic) private var errorNotificationHaptic
private enum FeedbackState {
case preparing
case sending
case sent
}
var body: some View {
NavigationView {
EditFeedbackForm(event: event, feedback: feedback)
.toolbar {
ToolbarItem(placement: .cancellationAction) {
Button {
isPresentingDiscardAlert = true
} label: {
Text("Cancel")
}
.disabled(state == .sending)
}
ToolbarItem(placement: .confirmationAction) {
Button {
sendFeedback()
} label: {
if state == .sending {
ProgressView()
} else {
Text("Send")
.bold()
}
}
.disabled(state == .sending)
}
}
.alert("Discard Feedback", isPresented: $isPresentingDiscardAlert) {
Button(role: .cancel) {
isPresentingDiscardAlert = false
} label: {
Text("Continue Editing")
}
Button(role: .destructive) {
dismiss()
} label: {
Text("Discard")
}
}
.navigationTitle("Event Feedback")
.navigationBarTitleDisplayMode(.inline)
.interactiveDismissDisabled()
.alert(
"Feedback Not Sent",
isPresented: $isPresentingFeedbackSubmissionErrorAlert,
presenting: feedbackSubmissionError
) { _ in
Button {
sendFeedback()
} label: {
Text("Try Again")
}
Button(role: .cancel) {
} label: {
Text("Cancel")
}
}
}
}
private func sendFeedback() {
withAnimation {
state = .sending
}
Task(priority: .userInitiated) {
do {
try await feedback.submit()
dismiss()
} catch {
withAnimation {
errorNotificationHaptic()
isPresentingFeedbackSubmissionErrorAlert = true
feedbackSubmissionError = error
state = .preparing
}
}
}
}
private struct EditFeedbackForm: View {
@ObservedObject var event: Event
@ObservedObject var feedback: Event.FeedbackForm
@ScaledMetric(relativeTo: .body) private var titleToLocationSpacing: CGFloat = 10
var body: some View {
Form {
heading
inputControls
}
}
@ViewBuilder private var heading: some View {
HStack {
VStack(alignment: .leading, spacing: titleToLocationSpacing) {
Text(verbatim: event.title)
.font(.largeTitle)
.bold()
VStack {
AlignedLabelContainer {
Label {
Text(verbatim: event.day.name)
} icon: {
Image(systemName: "calendar")
}
Label {
FormattedShortTime(event.startDate)
} icon: {
Image(systemName: "clock")
}
Label {
Text(verbatim: event.room.shortName)
} icon: {
Image(systemName: "mappin.circle")
}
EventHostsLabel(event)
}
}
}
Spacer()
}
.listRowInsets(EdgeInsets())
.background(Color.formHeading)
}
@ViewBuilder private var inputControls: some View {
Section {
HStack {
Spacer()
StarRating(
rating: eventRatingBinding,
minRating: Event.Rating.smallestPossibleRatingValue,
maxRating: Event.Rating.largestPossibleRatingValue
)
.frame(maxHeight: 44)
Spacer()
}
.background(Color.formHeading)
.listRowInsets(EdgeInsets())
} header: {
Text("Rating")
}
Section {
if #available(iOS 16.0, *) {
TextField(
"Additional Comments",
text: $feedback.additionalComments,
prompt: Text("Anything else you would like us to know"),
axis: .vertical
)
} else {
// This one's a little screwy but good enough.
PlaceholderTextEditor(
text: $feedback.additionalComments,
placeholder: Text("Anything else you would like us to know")
.foregroundColor(.secondary)
)
}
} header: {
Text("Additional Comments")
} footer: {
Text("EVENT_FEEDBACK_FOOTER")
}
}
private var eventRatingBinding: Binding<Int> {
Binding(
get: { feedback.rating.value },
set: { newValue in feedback.rating = Event.Rating(newValue) }
)
}
}
private struct PlaceholderTextEditor<Placeholder>: View where Placeholder: View {
@Binding var text: String
var placeholder: Placeholder
var body: some View {
ZStack(alignment: .center) {
if text.isEmpty {
placeholder
}
TextEditor(text: $text)
}
}
}
}
struct EventFeedbackForm_Previews: PreviewProvider {
static var previews: some View {
EurofurenceModel.preview { model in
let dealersDen = model.event(for: .dealersDen)
let dealersDenFeedback = successfulFeedback(for: dealersDen, in: model)
EventFeedbackForm(event: dealersDen, feedback: dealersDenFeedback)
.previewDisplayName("Succeeds Sending Feedback")
let unsuccessfulFeedback = unsuccessfulFeedback(for: dealersDen, in: model)
EventFeedbackForm(event: dealersDen, feedback: unsuccessfulFeedback)
.previewDisplayName("Fails Sending Feedback")
}
}
private static func successfulFeedback(for event: Event, in model: EurofurenceModel) -> Event.FeedbackForm {
do {
let feedback = try event.prepareFeedback()
model.prepareSuccessfulFeedbackResponse(
event: event,
rating: 3,
comments: "Successful Feedback"
)
return feedback
} catch {
fatalError("Previewing event does not support feedback. Event=\(event)")
}
}
private static func unsuccessfulFeedback(for event: Event, in model: EurofurenceModel) -> Event.FeedbackForm {
do {
let feedback = try event.prepareFeedback()
model.prepareUnsuccessfulFeedbackResponse(
event: event,
rating: 3,
comments: "Unsuccessful Feedback"
)
return feedback
} catch {
fatalError("Previewing event does not support feedback. Event=\(event)")
}
}
}
| mit | acad7405a0bf6f195c5bb42d73e304ef | 33.453875 | 114 | 0.431188 | 6.7028 | false | false | false | false |
klone1127/yuan | Pods/ESPullToRefresh/Sources/Animator/ESRefreshHeaderAnimator.swift | 3 | 5856 | //
// ESRefreshHeaderView.swift
//
// Created by egg swift on 16/4/7.
// Copyright (c) 2013-2016 ESPullToRefresh (https://github.com/eggswift/pull-to-refresh)
// Icon from http://www.iconfont.cn
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
import Foundation
import QuartzCore
import UIKit
open class ESRefreshHeaderAnimator: UIView, ESRefreshProtocol, ESRefreshAnimatorProtocol, ESRefreshImpactProtocol {
open var pullToRefreshDescription = "Pull to refresh" {
didSet {
if pullToRefreshDescription != oldValue {
titleLabel.text = pullToRefreshDescription;
}
}
}
open var releaseToRefreshDescription = "Release to refresh"
open var loadingDescription = "Loading..."
open var view: UIView { return self }
open var insets: UIEdgeInsets = UIEdgeInsets.zero
open var trigger: CGFloat = 60.0
open var executeIncremental: CGFloat = 60.0
open var state: ESRefreshViewState = .pullToRefresh
fileprivate let imageView: UIImageView = {
let imageView = UIImageView.init()
if #available(iOS 8, *) {
imageView.image = UIImage(named: "icon_pull_to_refresh_arrow", in: Bundle(for: ESRefreshHeaderAnimator.self), compatibleWith: nil)
} else {
imageView.image = UIImage(named: "icon_pull_to_refresh_arrow")
}
return imageView
}()
fileprivate let titleLabel: UILabel = {
let label = UILabel.init(frame: CGRect.zero)
label.font = UIFont.systemFont(ofSize: 14.0)
label.textColor = UIColor.init(white: 0.625, alpha: 1.0)
label.textAlignment = .left
return label
}()
fileprivate let indicatorView: UIActivityIndicatorView = {
let indicatorView = UIActivityIndicatorView.init(activityIndicatorStyle: .gray)
indicatorView.isHidden = true
return indicatorView
}()
public override init(frame: CGRect) {
super.init(frame: frame)
titleLabel.text = pullToRefreshDescription
self.addSubview(imageView)
self.addSubview(titleLabel)
self.addSubview(indicatorView)
}
public required init(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
open func refreshAnimationBegin(view: ESRefreshComponent) {
indicatorView.startAnimating()
indicatorView.isHidden = false
imageView.isHidden = true
titleLabel.text = loadingDescription
imageView.transform = CGAffineTransform(rotationAngle: 0.000001 - CGFloat(M_PI))
}
open func refreshAnimationEnd(view: ESRefreshComponent) {
indicatorView.stopAnimating()
indicatorView.isHidden = true
imageView.isHidden = false
titleLabel.text = pullToRefreshDescription
imageView.transform = CGAffineTransform.identity
}
open func refresh(view: ESRefreshComponent, progressDidChange progress: CGFloat) {
// Do nothing
}
open func refresh(view: ESRefreshComponent, stateDidChange state: ESRefreshViewState) {
guard self.state != state else {
return
}
self.state = state
switch state {
case .refreshing, .autoRefreshing:
titleLabel.text = loadingDescription
self.setNeedsLayout()
break
case .releaseToRefresh:
titleLabel.text = releaseToRefreshDescription
self.setNeedsLayout()
self.impact()
UIView.animate(withDuration: 0.2, delay: 0.0, options: UIViewAnimationOptions(), animations: {
[weak self] in
self?.imageView.transform = CGAffineTransform(rotationAngle: 0.000001 - CGFloat(M_PI))
}) { (animated) in }
break
case .pullToRefresh:
titleLabel.text = pullToRefreshDescription
self.setNeedsLayout()
UIView.animate(withDuration: 0.2, delay: 0.0, options: UIViewAnimationOptions(), animations: {
[weak self] in
self?.imageView.transform = CGAffineTransform.identity
}) { (animated) in }
break
default:
break
}
}
open override func layoutSubviews() {
super.layoutSubviews()
let s = self.bounds.size
let w = s.width
let h = s.height
UIView.performWithoutAnimation {
titleLabel.sizeToFit()
titleLabel.center = CGPoint.init(x: w / 2.0, y: h / 2.0)
indicatorView.center = CGPoint.init(x: titleLabel.frame.origin.x - 16.0, y: h / 2.0)
imageView.frame = CGRect.init(x: titleLabel.frame.origin.x - 28.0, y: (h - 18.0) / 2.0, width: 18.0, height: 18.0)
}
}
}
| mit | 34c8825da816daff9d12124123419ac5 | 37.526316 | 142 | 0.650786 | 4.803938 | false | false | false | false |
MaartenBrijker/project | project/External/AudioKit-master/AudioKit/Common/Nodes/Effects/Distortion/Bit Crusher/AKBitCrusher.swift | 1 | 4660 | //
// AKBitCrusher.swift
// AudioKit
//
// Created by Aurelius Prochazka, revision history on Github.
// Copyright (c) 2016 Aurelius Prochazka. All rights reserved.
//
import AVFoundation
/// This will digitally degrade a signal.
///
/// - parameter input: Input node to process
/// - parameter bitDepth: The bit depth of signal output. Typically in range (1-24). Non-integer values are OK.
/// - parameter sampleRate: The sample rate of signal output.
///
public class AKBitCrusher: AKNode, AKToggleable {
// MARK: - Properties
internal var internalAU: AKBitCrusherAudioUnit?
internal var token: AUParameterObserverToken?
private var bitDepthParameter: AUParameter?
private var sampleRateParameter: AUParameter?
/// Ramp Time represents the speed at which parameters are allowed to change
public var rampTime: Double = AKSettings.rampTime {
willSet(newValue) {
if rampTime != newValue {
internalAU?.rampTime = newValue
internalAU?.setUpParameterRamp()
}
}
}
/// The bit depth of signal output. Typically in range (1-24). Non-integer values are OK.
public var bitDepth: Double = 8 {
willSet(newValue) {
if bitDepth != newValue {
if internalAU!.isSetUp() {
bitDepthParameter?.setValue(Float(newValue), originator: token!)
} else {
internalAU?.bitDepth = Float(newValue)
}
}
}
}
/// The sample rate of signal output.
public var sampleRate: Double = 10000 {
willSet(newValue) {
if sampleRate != newValue {
if internalAU!.isSetUp() {
sampleRateParameter?.setValue(Float(newValue), originator: token!)
} else {
internalAU?.sampleRate = Float(newValue)
}
}
}
}
/// Tells whether the node is processing (ie. started, playing, or active)
public var isStarted: Bool {
return internalAU!.isPlaying()
}
// MARK: - Initialization
/// Initialize this bitcrusher node
///
/// - parameter input: Input node to process
/// - parameter bitDepth: The bit depth of signal output. Typically in range (1-24). Non-integer values are OK.
/// - parameter sampleRate: The sample rate of signal output.
///
public init(
_ input: AKNode,
bitDepth: Double = 8,
sampleRate: Double = 10000) {
self.bitDepth = bitDepth
self.sampleRate = sampleRate
var description = AudioComponentDescription()
description.componentType = kAudioUnitType_Effect
description.componentSubType = 0x62746372 /*'btcr'*/
description.componentManufacturer = 0x41754b74 /*'AuKt'*/
description.componentFlags = 0
description.componentFlagsMask = 0
AUAudioUnit.registerSubclass(
AKBitCrusherAudioUnit.self,
asComponentDescription: description,
name: "Local AKBitCrusher",
version: UInt32.max)
super.init()
AVAudioUnit.instantiateWithComponentDescription(description, options: []) {
avAudioUnit, error in
guard let avAudioUnitEffect = avAudioUnit else { return }
self.avAudioNode = avAudioUnitEffect
self.internalAU = avAudioUnitEffect.AUAudioUnit as? AKBitCrusherAudioUnit
AudioKit.engine.attachNode(self.avAudioNode)
input.addConnectionPoint(self)
}
guard let tree = internalAU?.parameterTree else { return }
bitDepthParameter = tree.valueForKey("bitDepth") as? AUParameter
sampleRateParameter = tree.valueForKey("sampleRate") as? AUParameter
token = tree.tokenByAddingParameterObserver {
address, value in
dispatch_async(dispatch_get_main_queue()) {
if address == self.bitDepthParameter!.address {
self.bitDepth = Double(value)
} else if address == self.sampleRateParameter!.address {
self.sampleRate = Double(value)
}
}
}
internalAU?.bitDepth = Float(bitDepth)
internalAU?.sampleRate = Float(sampleRate)
}
// MARK: - Control
/// Function to start, play, or activate the node, all do the same thing
public func start() {
self.internalAU!.start()
}
/// Function to stop or bypass the node, both are equivalent
public func stop() {
self.internalAU!.stop()
}
}
| apache-2.0 | 6dc43799ae05bcce66a8bf25317e7ecf | 32.285714 | 115 | 0.608369 | 5.253664 | false | false | false | false |
gewill/Feeyue | Feeyue/Main/Twitter/TwitterStatusCell.swift | 1 | 8068 | //
// TwitterStatusCell.swift
// Feeyue
//
// Created by Will on 2018/7/3.
// Copyright © 2018 Will. All rights reserved.
//
import UIKit
import Kingfisher
import SnapKit
import BonMot
import SwifterSwift
class TwitterStatusCell: UITableViewCell {
@IBOutlet private weak var avatarIV: UIImageView!
@IBOutlet private weak var userNameL: QMUILabel!
@IBOutlet private weak var subTitleL: QMUILabel!
@IBOutlet private weak var moreActionIV: UIImageView!
@IBOutlet private weak var textL: TwitterActiveLabel!
@IBOutlet private weak var imageContainerV: QMUIFloatLayoutView!
@IBOutlet private weak var imageContainerVHeight: NSLayoutConstraint!
@IBOutlet private weak var replyB: QMUIButton!
@IBOutlet private weak var retweetB: QMUIButton!
@IBOutlet private weak var likeB: QMUIButton!
@IBOutlet private weak var shareB: QMUIButton!
var avatarTapped: VoidClosure?
var userNameTapped: ((String) -> Void)?
var replyBTapped: VoidClosure?
var retweetBTapped: VoidClosure?
var likeBTapped: ((QMUIButton?) -> Void)?
var shareBTapped: VoidClosure?
private var photosCountMax: Int = 9
private var photoWidth = floor((ScreenWidth - 10 * 4) / 3)
private let padding: CGFloat = 10
private var photoImageViews: [UIImageView] = []
private var photos: [URL] = [] {
didSet {
// set height by photo count
var row: Int = 0
var section: Int = 3
var height: CGFloat = 0
switch photos.count {
case 0:
break
case 1, 2, 3:
row = 1
section = photos.count
case 4:
row = 2
section = 2
case 5, 6:
row = 2
default:
row = 3
}
switch photos.count {
case 1:
var ratio: CGFloat = 2
if let size = self.status?.extended_entities?.media.first?.sizes?.large {
ratio = size.width.cgFloat / size.height.cgFloat
if ratio == 0 { ratio = 2 }
}
ratio = max(9 / 16, ratio)
self.photoWidth = floor(ScreenWidth - self.padding * 2)
height = self.photoWidth / ratio + padding * 2
self.imageContainerVHeight.constant = height
self.imageContainerV.minimumItemSize = CGSize(width: self.photoWidth, height: self.photoWidth / ratio)
case 4:
self.photoWidth = floor((ScreenWidth - self.padding * (section.cgFloat + 1)) / section.cgFloat)
height = self.photoWidth + padding * 3
self.imageContainerVHeight.constant = height
self.imageContainerV.minimumItemSize = CGSize(width: self.photoWidth, height: self.photoWidth / 2)
default:
self.photoWidth = floor((ScreenWidth - self.padding * (section.cgFloat + 1)) / section.cgFloat)
height = (self.photoWidth + self.padding) * row.cgFloat + padding
self.imageContainerVHeight.constant = height
self.imageContainerV.minimumItemSize = CGSize(width: self.photoWidth, height: self.photoWidth)
}
self.imageContainerV.maximumItemSize = self.imageContainerV.minimumItemSize
let imageRect: CGRect = CGRect(x: padding, y: padding, width: ScreenWidth - self.padding * 2, height: height - padding * 2)
self.imageContainerV.roundCorners(UIRectCorner.allCorners, roundedRect: imageRect, radius: 6)
photoImageViews.enumerated()
.forEach {
if $0.offset < photos.count {
$0.element.kf.setImage(with: photos[$0.offset], placeholder: PlaceholderView.randomColor())
} else {
$0.element.image = nil
}
}
}
}
var status: TwitterStatus? {
didSet {
guard let status = status else {
initState()
return
}
let roundCorner = RoundCornerImageProcessor(cornerRadius: 100, targetSize: CGSize(width: 200, height: 200), roundingCorners: RectCorner.all, backgroundColor: nil)
avatarIV.kf.setImage(
with: status.user?.profileImageUrlHttps?.urlValue,
placeholder: #imageLiteral(resourceName: "round_placeholder"),
options: [.processor(roundCorner)]
)
userNameL.text = status.user?.name
subTitleL.attributedText = status.createdAt.timeAgoUpToDay.styled(with: StringStyleHelper.styleColor4) + " via ".styled(with: StringStyleHelper.styleColor6) + status.source.styled(with: StringStyleHelper.styleColor4)
textL.text = status.displayText
likeB.setImage(status.favorited ? R.image.star_filled():R.image.star(), for: .normal)
self.photos = status.extended_entities?.media
.compactMap {
$0.media_url_https.medium.urlValue
} ?? []
}
}
override func awakeFromNib() {
super.awakeFromNib()
setupImageContainerV()
self.avatarIV.isUserInteractionEnabled = true
self.avatarIV.bk_(whenTapped: { [weak self] in
self?.avatarTapped?()
})
textL.customize { label in
label.handleHashtagTap {
gw_print($0)
}
label.handleMentionTap { [weak self] in
self?.userNameTapped?($0)
}
label.handleURLTap {
openURL($0.absoluteString)
}
}
replyB.bk_(whenTapped:{[weak self] in
self?.replyBTapped?()
})
retweetB.bk_(whenTapped:{[weak self] in
self?.retweetBTapped?()
})
likeB.bk_(whenTapped:{[weak self] in
self?.likeBTapped?(self?.shareB)
})
shareB.bk_(whenTapped:{[weak self] in
self?.shareBTapped?()
})
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
}
override func prepareForReuse() {
super.prepareForReuse()
initState()
}
private func setupImageContainerV() {
guard self.photoImageViews.isEmpty == true else { return }
imageContainerV.padding = UIEdgeInsets(top: padding, left: padding, bottom: 0, right: 0)
imageContainerV.itemMargins = UIEdgeInsets(top: 0, left: 0, bottom: padding, right: padding)
imageContainerV.minimumItemSize = CGSize(width: photoWidth, height: photoWidth)
imageContainerV.maximumItemSize = imageContainerV.minimumItemSize
(0..<photosCountMax).forEach { index in
let iv = UIImageView()
// use kingfisher placeholder is better.
// iv.backgroundColor = UIColor.random
iv.contentMode = UIView.ContentMode.scaleAspectFill
iv.clipsToBounds = true
iv.isUserInteractionEnabled = true
iv.bk_(whenTapped: { [weak self] in
guard let strongSelf = self else { return }
guard let status = strongSelf.status else { return }
gw_presentTwitterPhotos(status: status, index: index, pictureSettingsType: .adaptive, originImage: iv.image, animatedFromView: iv)
})
self.imageContainerV.addSubview(iv)
self.photoImageViews.append(iv)
}
photos = []
}
private func initState() {
avatarIV.image = nil
userNameL.text = ""
subTitleL.text = ""
textL.text = ""
photoImageViews.forEach { $0.image = nil }
// imageSV.arrangedSubviews.forEach {
// imageSV.removeArrangedSubview($0)
// }
// imageSVHeight.constant = 0
// imageSVBottom.constant = -12
}
}
| mit | 1e30390c74f1e8ec74321ae4447ae68a | 35.337838 | 228 | 0.582001 | 4.736935 | false | false | false | false |
makhiye/flagMatching | flag Matching/Game[Conflict].swift | 1 | 1767 | //
// Game.swift
// flag Matching
//
// Created by ishmael on 7/19/17.
// Copyright © 2017 ishmael.mthombeni. All rights reserved.
//
import Foundation
import AVFoundation
protocol MatchingGameDelegate {
func game(_ game: Game, hideCards cards: [Int])
}
struct Game {
var deckOfCards = DeckOfCards()
let synthesizer = AVSpeechSynthesizer()
var gameDelegate: MatchingGameDelegate?
var unmatchedCardsRevealed: [Int] = [] // card index numbers that have been revealed
mutating func flipCard(atIndexNumber index: Int) -> Bool {
if unmatchedCardsRevealed.count < 2 {
unmatchedCardsRevealed.append(index)
if unmatchedCardsRevealed.count == 2 {
let card1Name = deckOfCards.dealtCards[unmatchedCardsRevealed[0]]
let card2Name = deckOfCards.dealtCards[unmatchedCardsRevealed[1]]
if card1Name == card2Name{
self.speakCard(number: index)
}
}
return true
}else{
resetUnmatchedcards()
return false
}
}
mutating func resetUnmatchedcards() {
self.gameDelegate?.game(self, hideCards: unmatchedCardsRevealed)
unmatchedCardsRevealed.removeAll()
}
func speakCard(number cardTag: Int){
synthesizer.stopSpeaking(at: .immediate)
let utterance = AVSpeechUtterance(string: deckOfCards.dealtCards[cardTag])
synthesizer.speak(utterance)
}
}
| mit | e0401fc01aa01b2872211d45dfa1438a | 22.864865 | 88 | 0.542469 | 5.104046 | false | false | false | false |
baquiax/ImageProcessor | ImageProcessor.playground/Contents.swift | 1 | 954 | //Alexander Baquiax ([email protected])
import UIKit
let image = UIImage(named: "sample")
if (image != nil) {
/*
* You can use the next defult filters:
* - "increase 50% of brightness"
* - "increase contrast by 2"
* - "gamma 1.5"
* - "middle threshold"
* - "duplicate intesity of red"
* - "invert"
*/
//Applying default filter by String name
var rgbaImage = RGBAImage(image: image!);
var ip = ImageProcessor(image: rgbaImage!);
let resultImage = ip.applyDefaultFilter(name: "increase contrast by 2").toUIImage();
//Applying multiple filters
var rgbaImage2 = RGBAImage(image: image!);
var ip2 = ImageProcessor(image: rgbaImage2!);
let filters : [Filter] = [Contrast(factor: 2), IncreaseIntensity(increaseFactor: 2, color: Colors.Green), IncreaseIntensity(increaseFactor: 2, color: Colors.Red)];
let resultImage2 = ip2.applyFilters(filters: filters).toUIImage()
}
| mit | 52d8264c044a7b549399fd92805c39fd | 31.896552 | 167 | 0.661426 | 3.741176 | false | false | false | false |
mooneywang/MJCompatible | MJCompatible/Page1.playground/Contents.swift | 1 | 419 | //: Playground - noun: a place where people can play
import UIKit
var str = "Hello, playground"
let array1 = ["1", "2", "3", "4", "5", "6"]
let array2 = array1.map({ Int($0)! }).filter({ return $0 % 2 == 0 })
print(array1)
print(array2)
let str1 = "swift is amazing!"
class Student: NSObject {
let name: String
let age: Int
init(name n: String, age a: Int) {
name = n
age = a
}
}
| mit | ed415246ac33a72d212176a4f0afa343 | 17.217391 | 68 | 0.568019 | 2.971631 | false | false | false | false |
zisko/swift | test/IRGen/COFF-objc-sections.swift | 1 | 1000 | // RUN: %swift -target x86_64-unknown-windows-msvc -parse-stdlib -enable-objc-interop -disable-objc-attr-requires-foundation-module -I %S/Inputs/usr/include -emit-ir %s -o - | %FileCheck %s -check-prefix CHECK-COFF
// REQUIRES: OS=windows
import ObjCInterop
@objc
class C {
}
extension C : P {
public func method() {
f(I())
}
}
@_objc_non_lazy_realization
class D {
}
// CHECK-COFF-NOT: @"$S4main1CCMf" = {{.*}}, section "__DATA,__objc_data, regular"
// CHECK-COFF: @"\01l_OBJC_LABEL_PROTOCOL_$_P" = {{.*}}, section ".objc_protolist$B"
// CHECK-COFF: @"\01l_OBJC_PROTOCOL_REFERENCE_$_P" = {{.*}}, section ".objc_protorefs$B"
// CHECK-COFF: @"OBJC_CLASS_REF_$_I" = {{.*}}, section ".objc_classrefs$B"
// CHECK-COFF: @"\01L_selector(init)" = {{.*}}, section ".objc_selrefs$B"
// CHECK-COFF: @objc_classes = {{.*}}, section ".objc_classlist$B"
// CHECK-COFF: @objc_categories = {{.*}}, section ".objc_catlist$B"
// CHECK-COFF: @objc_non_lazy_classes = {{.*}}, section ".objc_nlclslist$B"
| apache-2.0 | 6319f05eefdc986f4d6271caed0c7daa | 33.482759 | 214 | 0.633 | 2.95858 | false | false | false | false |
snailjj/iOSDemos | SnailSwiftDemos/SnailSwiftDemos/Skills/ViewControllers/WAddressBookViewController.swift | 2 | 7860 | //
// WAddressBookViewController.swift
// SnailSwiftDemos
//
// Created by Jian Wu on 2016/12/6.
// Copyright © 2016年 Snail. All rights reserved.
//
import UIKit
import AddressBook
import AddressBookUI
import Contacts
import ContactsUI
class WAddressBookViewController: CustomViewController,UITableViewDelegate,UITableViewDataSource {
var allPeoples = [AddressPeople]()
@IBOutlet weak var aTableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
leftBtn.isHidden = false
navTitleLabel.text = "AddressBook"
aTableView.register(UITableViewCell.self, forCellReuseIdentifier: "AddressBookCell")
requestContactStore()
}
//MARK: - UITableViewDelegate methods
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return allPeoples.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "AddressBookCell", for: indexPath)
let people = allPeoples[indexPath.row]
cell.textLabel?.text = people.firstName + people.lastName + "\(people.phoneNumber)"
return cell
}
//===================iOS9及之后======================
var contactStore : CNContactStore!
//MARK: - 请求访问通讯录权并初始化数据
func requestContactStore() {
contactStore = CNContactStore()
if CNContactStore.authorizationStatus(for: .contacts) == .notDetermined {
contactStore.requestAccess(for: .contacts, completionHandler: { (success, error) in
if success {
self.getAllPerson()
}else{
print("error---\(error)")
}
})
}else if CNContactStore.authorizationStatus(for: .contacts) == .authorized{
self.getAllPerson()
}else{
print("未能访问通讯录-----\(CNContactStore.authorizationStatus)")
}
}
func getAllPerson() {
do{
// let request = CNContactFetchRequest()
// let con = try contactStore.enumerateContacts(with: request, usingBlock: { (contact, obj) in
// print(contact.phoneNumbers.count)
// })
}catch{
}
}
/*
//===================iOS8及之前======================
var addressBook : ABAddressBook!
//MARK: - 请求访问通讯录权并初始化数据
func requestAddressBook() {
addressBook = ABAddressBookCreate() as ABAddressBook!
//请求访问用户通讯录
ABAddressBookRequestAccessWithCompletion(addressBook) { (granted, error) in
if !granted {
print("未获取通讯录权限")
}
self.getAllPerson()
}
}
func getAllPerson() {
let authorization = ABAddressBookGetAuthorizationStatus()
if authorization != .authorized{
print("未获取权限")
return
}
//取得通讯录所有人记录
let temp = ABAddressBookCopyArrayOfAllPeople(addressBook).takeRetainedValue() as [AnyObject]!
temp?.forEach({ (con) in
let people = AddressPeople()
people.lastName = ABRecordCopyValue(con, kABPersonLastNameProperty).takeRetainedValue() as! String
people.firstName = ABRecordCopyValue(con, kABPersonFirstNameProperty).takeRetainedValue() as! String
people.nikeName = ABRecordCopyValue(con, kABPersonNicknameProperty).takeRetainedValue() as! String
let phoneValues = ABRecordCopyValue(con, kABPersonPhoneProperty).takeRetainedValue()
if phoneValues != nil{
for i in 0..<ABMultiValueGetCount(phoneValues) {
let phoneNumber = AddressPhone()
//获取标签名
var label = ABMultiValueCopyLabelAtIndex(phoneValues, i).takeRetainedValue() as! CFString
//转为本地标签名(能看懂的 比如,home、work)
let localLabel = ABAddressBookCopyLocalizedLabel(label).takeRetainedValue() as! String
phoneNumber.pLabel = localLabel
let phoneNum = ABMultiValueCopyValueAtIndex(phoneValues, i).takeRetainedValue() as! String
phoneNumber.pNumber = phoneNum
people.phoneNumber.append(phoneNumber)
}
}
allPeoples.append(people)
})
}
//MARK: - 添加一个联系人
func addRecord() {
//定义一个错误标记对象,判断是否成功
var error:Unmanaged<CFError>?
//创建一个联系人对象
var newContact:ABRecord! = ABPersonCreate().takeRetainedValue()
var success:Bool = false
//设置昵称
success = ABRecordSetValue(newContact, kABPersonNicknameProperty, "Snail" as CFTypeRef!, &error)
//设置联系人电话
let phones:ABMutableMultiValue = ABMultiValueCreateMutable(
ABPropertyType(kABStringPropertyType)).takeRetainedValue()
success = ABMultiValueAddValueAndLabel(phones, "123456" as CFTypeRef!, "公司" as CFString!, nil)
print("设置电话条目:\(success)")
success = ABRecordSetValue(newContact, kABPersonPhoneProperty, phones, nil)
print("设置电话结果:\(success)")
//保存联系人
success = ABAddressBookAddRecord(addressBook, newContact, &error)
//修改数据库
success = ABAddressBookSave(addressBook, &error)
print("是否修改成功")
}
//编辑联系人
func editRecord(){
//定义一个错误标记对象,判断是否成功
var error:Unmanaged<CFError>?
var sysContacts:NSArray = ABAddressBookCopyArrayOfAllPeople(addressBook).takeRetainedValue() as NSArray
//遍历通讯录
for contact in sysContacts {
//获取姓名
var lastName = ABRecordCopyValue(contact as ABRecord!, kABPersonLastNameProperty)?.takeRetainedValue() as! String? ?? ""
print("姓:\(lastName)")
var firstName = ABRecordCopyValue(contact as ABRecord!, kABPersonFirstNameProperty)?.takeRetainedValue() as! String? ?? ""
print("名:\(firstName)")
var success:Bool = false
if lastName == "李" && firstName == "大木"{
//设置联系人新对象昵称
success = ABRecordSetValue(contact as ABRecord!, kABPersonNicknameProperty, "小李子" as CFTypeRef!, &error)
print("设置昵称结果:\(success)")
}
}
//保存数据库
var success = ABAddressBookSave(addressBook, &error)
print("修改数据库是否成功:\(success)")
}
//编辑联系人
func deleteRecord(){
//定义一个错误标记对象,判断是否成功
var error:Unmanaged<CFError>?
var sysContacts:NSArray = ABAddressBookCopyArrayOfAllPeople(addressBook).takeRetainedValue() as NSArray
//遍历通讯录
for contact in sysContacts {
//获取姓名
var lastName = ABRecordCopyValue(contact as ABRecord!, kABPersonLastNameProperty)?.takeRetainedValue() as! String? ?? ""
print("姓:\(lastName)")
var firstName = ABRecordCopyValue(contact as ABRecord!, kABPersonFirstNameProperty)?.takeRetainedValue() as! String? ?? ""
var success:Bool = false
if lastName == "李" && firstName == "大木"{
//设置联系人新对象昵称
success = ABAddressBookRemoveRecord(addressBook, contact as ABRecord!, nil)
print("设置昵称结果:\(success)")
}
}
//保存数据库
var success = ABAddressBookSave(addressBook, &error)
print("修改数据库是否成功:\(success)")
}
*/
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
| apache-2.0 | a9f638b82e91c299c3de499547d3fc62 | 32.541667 | 127 | 0.643478 | 4.836449 | false | false | false | false |
shashank3369/GifMaker | GifMaker_Swift_Template/RegiftCaption.swift | 4 | 2086 | //
// RegiftCaption.swift
// GifMaker_Swift_Template
//
// Created by Gabrielle Miller-Messner on 4/22/16.
// Modified from http://stackoverflow.com/questions/6992830/how-to-write-text-on-image-in-objective-c-iphone
//
import UIKit
import Foundation
import CoreGraphics
extension Regift {
func addCaption(_ image: CGImage, text: NSString, font: UIFont) -> CGImage {
let image = UIImage(cgImage:image)
// Text attributes
let color = UIColor.white
var attributes = [NSForegroundColorAttributeName:color, NSFontAttributeName:font, NSStrokeColorAttributeName : UIColor.black, NSStrokeWidthAttributeName : -4] as [String : Any]
// Get scale factor
let testSize:CGSize = text.size(attributes: attributes)
let scaleFactor = testSize.height/360
// Apply scale factor to attributes
let scaledFont: UIFont = UIFont(name: "HelveticaNeue-CondensedBlack", size:image.size.height * scaleFactor)!
attributes[NSFontAttributeName] = scaledFont
// Text size
let size:CGSize = text.size(attributes: attributes)
let adjustedWidth = ceil(size.width)
let adjustedHeight = ceil(size.height)
// Draw image
UIGraphicsBeginImageContext(image.size)
let firstRect = CGRect(x: 0,y: 0,width: image.size.width,height: image.size.height)
image.draw(in: firstRect)
// Draw text
let sideMargin = (image.size.width - adjustedWidth)/2.0
let bottomMargin = image.size.height/6.0
let textOrigin = CGPoint(x: sideMargin, y: image.size.height - bottomMargin)
let secondRect = CGRect(x: textOrigin.x,y: textOrigin.y, width: adjustedWidth, height: adjustedHeight)
text.draw(with: secondRect, options:.usesLineFragmentOrigin, attributes: attributes, context:nil)
// Capture combined image and text
let newImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return newImage!.cgImage!
}
}
| mit | ee1b77b22e8456ddfea4d248bcfef1d8 | 38.358491 | 184 | 0.668265 | 4.544662 | false | false | false | false |
herrkaefer/AccelerateWatch | AccelerateWatch/Classes/DSBuffer.swift | 1 | 10726 | /// DSBuffer
///
/// Created by Yang Liu (gloolar [at] gmail [dot] com) on 16/6/20.
/// Copyright © 2016年 Yang Liu. All rights reserved.
import Foundation
/// Fixed-length buffer for windowed signal processing
public class DSBuffer {
private var buffer: OpaquePointer
private var size: Int
private var fftIsSupported: Bool
private var fftData: [dsbuffer_complex]?
private var fftIsUpdated: Bool?
// MARK: Initializer and deinitializer
/// Initializer
///
/// - parameter size: Buffer length. If you set fftIsSupperted to be true, the size should be **even** number
/// - parameter fftIsSupported: Whether FFT will be performed on the buffer
/// - returns: DSBuffer object
///
/// *Tips*:
///
/// - If you do not need to perform FFT on the buffer, set fftIsSupperted to be false could save 50% memory.
/// - If you need to perform FFT, set buffer size to power of 2 could accelerate more.
init(_ size: Int, fftIsSupported: Bool = true) {
if (fftIsSupported && size % 2 == 1) {
print(String(format: "WARNING: size must be even for FFT. Reset size to: %d.", size+1))
self.size = size + 1
}
else {
self.size = size
}
self.buffer = dsbuffer_new(size, fftIsSupported)
self.fftIsSupported = fftIsSupported
if (fftIsSupported) {
self.fftData = [dsbuffer_complex](repeating: dsbuffer_complex(real: 0.0, imag: 0.0), count: self.size/2+1)
self.fftIsUpdated = false
}
}
/// :nodoc: deinitializer
deinit {
dsbuffer_free_unsafe(self.buffer)
}
// MARK: Regular operations
/// Push new value to buffer (and the foremost will be dropped)
///
/// - parameter value: New value to be added
func push(_ value: Float) {
dsbuffer_push(self.buffer, value)
if (self.fftIsSupported) {
self.fftIsUpdated = false
}
}
/// Get data by index
func dataAt(_ index: Int) -> Float {
return dsbuffer_at(self.buffer, index)
}
/// Get Buffer size
var bufferSize: Int {
return self.size
}
/// Dump buffer as array
var data: [Float] {
var dumped = [Float](repeating: 0.0, count: self.size)
dsbuffer_dump(self.buffer, &dumped)
return dumped
}
/// Reset buffer to be zero filled
func clear() {
dsbuffer_clear(self.buffer)
if (self.fftIsSupported) {
self.fftIsUpdated = false
}
}
/// Print buffer
func printBuffer(_ dataFormat: String) {
print("DSBuffer size: \(self.size)")
for idx in 0..<self.size {
print(String(format: dataFormat, dsbuffer_at(self.buffer, idx)), terminator: " ")
}
print("\n")
}
// MARK: Vector-like operations
/// Add value to each buffer data
func add(_ withValue: Float) -> [Float] {
var result = [Float](repeating: 0.0, count: self.size)
dsbuffer_add(self.buffer, withValue, &result)
return result
}
/// Multiply each buffer data with value
func multiply(_ withValue: Float) -> [Float] {
var result = [Float](repeating: 0.0, count: self.size)
dsbuffer_multiply(self.buffer, withValue, &result)
return result
}
/// Modulus by value of each buffer data
func mod(_ withValue: Float) -> [Float] {
var result = [Float](repeating: 0.0, count: self.size)
dsbuffer_mod(self.buffer, withValue, &result)
return result
}
/// Remove mean value
var centralized: [Float] {
var result = [Float](repeating: 0.0, count: self.size)
dsbuffer_remove_mean(self.buffer, &result)
return result
}
/// Normalize vector to have unit length
///
/// - parameter centralized: Should remove mean?
func normalizedToUnitLength(_ centralized: Bool) -> [Float] {
var result = [Float](repeating: 0.0, count: self.size)
dsbuffer_normalize_to_unit_length(self.buffer, centralized, &result)
return result
}
/// Normalize vector to have unit variance
///
/// - parameter centralized: Should remove mean?
func normalizedToUnitVariance(_ centralized: Bool) -> [Float] {
var result = [Float](repeating: 0.0, count: self.size)
dsbuffer_normalize_to_unit_variance(self.buffer, centralized, &result)
return result
}
/// Perform dot production with array
func dotProduct(_ with: [Float]) -> Float {
assert(self.size == with.count)
return dsbuffer_dot_product(self.buffer, with)
}
// MARK: Time-domain features
/// Mean value
var mean: Float {
return dsbuffer_mean(self.buffer)
}
/// Mean value
var sum: Float {
return dsbuffer_sum(self.buffer)
}
/// Vector length
var length: Float {
return dsbuffer_length(self.buffer)
}
/// Square of length
var energy: Float {
return dsbuffer_energy(self.buffer)
}
/// Max value
var max: Float {
return dsbuffer_max(self.buffer)
}
/// Min value
var min: Float {
return dsbuffer_min(self.buffer)
}
/// Variance
var variance: Float {
return dsbuffer_variance(self.buffer)
}
/// Standard deviation
var std: Float {
return dsbuffer_std(self.buffer)
}
// MARK: FFT & frequency-domain features
// Perform FFT if it is not updated
private func updateFFT() {
assert (self.fftIsSupported)
if (!self.fftIsUpdated!) {
_ = fft()
}
}
/// Perform FFT
///
/// **Note for FFT related methods**:
///
/// - Set fftIsSupported to true when creating the buffer.
/// - Buffer size should be even. If you pass odd size when creating the buffer, it is automatically increased by 1.
/// - Only results in nfft/2+1 complex frequency bins from DC to Nyquist are returned.
func fft() -> (real: [Float], imaginary: [Float]) {
assert (self.fftIsSupported, "FFT is not supported on this buffer")
dsbuffer_fftr(self.buffer, &self.fftData!)
self.fftIsUpdated = true
return (self.fftData!.map{$0.real}, self.fftData!.map{$0.imag})
}
/// FFT sample frequencies
///
/// - returns: array of size nfft/2+1
func fftFrequencies(_ fs: Float) -> [Float] {
assert (self.fftIsSupported)
var fftFreq = [Float](repeating: 0.0, count: self.size/2+1)
dsbuffer_fft_freq(self.buffer, fs, &fftFreq)
return fftFreq
}
/// FFT magnitudes, i.e. abs(fft())
///
/// - returns: array of size nfft/2+1
func fftMagnitudes() -> [Float] {
updateFFT()
return self.fftData!.map{sqrt($0.real*$0.real + $0.imag*$0.imag)}
}
/// Square of FFT magnitudes, i.e. (abs(fft()))^2
///
/// - returns: array of size nfft/2+1
func squaredPowerSpectrum() -> [Float] {
updateFFT()
var sps = self.fftData!.map{($0.real*$0.real + $0.imag*$0.imag) * 2}
sps[0] /= 2.0 // DC
return sps
}
/// Mean-squared power spectrum, i.e. (abs(fft()))^2 / N
///
/// - returns: array of size nfft/2+1
func meanSquaredPowerSpectrum() -> [Float] {
updateFFT()
var pxx = self.fftData!.map{($0.real*$0.real + $0.imag*$0.imag) * 2 / Float(self.size)}
pxx[0] /= 2.0 // DC
return pxx
}
/// Power spectral density (PSD), i.e. (abs(fft()))^2 / (fs*N)
///
/// - returns: array of size nfft/2+1
func powerSpectralDensity(_ fs: Float) -> [Float] {
updateFFT()
var psd = self.fftData!.map{($0.real*$0.real + $0.imag*$0.imag) * 2.0 / (fs * Float(self.size))}
psd[0] /= 2.0 // DC
return psd
}
/// Average power over specific frequency band, i.e. mean(abs(fft(from...to))^2)
func averageBandPower(_ fromFreq: Float = 0, toFreq: Float, fs: Float) -> Float {
assert (fromFreq >= 0)
assert (toFreq <= fs/2.0)
assert (fromFreq <= toFreq)
updateFFT()
// Compute index range corresponding to given frequency band
// f = idx*df = idx*fs/N ==> idx = N*f/fs
let fromIdx = Int(floor(fromFreq * Float(self.size) / fs))
let toIdx = Int(ceil(toFreq * Float(self.size) / fs))
let bandPower = self.fftData![fromIdx...toIdx].map{$0.real*$0.real+$0.imag*$0.imag}
// Averaging
return bandPower.reduce(0.0, +) / Float(toIdx - fromIdx + 1)
}
// MARK: FIR filter
// Setup FIR filter
func setupFIRFilter(_ FIRTaps: [Float]) {
assert (self.size >= FIRTaps.count)
dsbuffer_setup_fir(self.buffer, FIRTaps, FIRTaps.count)
}
/// Get latest FIR output
func latestFIROutput() -> Float {
return dsbuffer_latest_fir_output(self.buffer)
}
/// FIR filtered buffer
func FIRFiltered() -> [Float] {
var output = [Float](repeating: 0.0, count: self.size)
dsbuffer_fir_filter(self.buffer, &output)
return output
}
/// :nodoc: Self test
public class func test() {
print("\nDSBuffer test: ==============\n")
let size = 16
let buf = DSBuffer(size, fftIsSupported: true)
buf.printBuffer("%.2f")
let signalData: [Float] = [1.0, 4, 2, 5, 6, 7, -1, -8]
for value in signalData {
buf.push(value)
// print(buf.signals)
}
buf.printBuffer("%.2f")
let startTime = CFAbsoluteTimeGetCurrent()
let fft = buf.fft()
let deltaTime = CFAbsoluteTimeGetCurrent() - startTime
print("FFT time: \(deltaTime)")
print(fft)
let fftSM = buf.squaredPowerSpectrum()
print(fftSM)
buf.clear()
for _ in 0 ..< 10000 {
let a = Float(arc4random_uniform(100))
buf.push(a)
let signals = buf.data
// print(a)
// print(signals)
assert(signals[size-1] == a)
}
let norm = buf.normalizedToUnitLength(true)
let coeff = vDotProduct(norm, v2: norm)
print(String(format: "coeff: %.2f\n", coeff))
print("\nDSBuffer test OK.\n\n")
}
}
| mit | ef0bd274aef951ca9803dfa39261340a | 27.070681 | 120 | 0.55367 | 3.914932 | false | false | false | false |
Ben21hao/edx-app-ios-new | Source/CourseAnnouncementsViewController.swift | 1 | 9275 | //
// CourseAnnouncementsViewController.swift
// edX
//
// Created by Ehmad Zubair Chughtai on 07/05/2015.
// Copyright (c) 2015 edX. All rights reserved.
//
import UIKit
import edXCore
private let notificationLabelLeadingOffset = 20.0
private let notificationLabelTrailingOffset = -10.0
private let notificationBarHeight = 50.0
@objc protocol CourseAnnouncementsViewControllerEnvironment : OEXConfigProvider, DataManagerProvider, NetworkManagerProvider, ReachabilityProvider, OEXRouterProvider {}
extension RouterEnvironment : CourseAnnouncementsViewControllerEnvironment {}
private func announcementsDeserializer(response: NSHTTPURLResponse, json: JSON) -> Result<[OEXAnnouncement]> {
return json.array.toResult().map {
return $0.map {
return OEXAnnouncement(dictionary: $0.dictionaryObject ?? [:])
}
}
}
class CourseAnnouncementsViewController: OfflineSupportViewController, UIWebViewDelegate,UIGestureRecognizerDelegate {
private let environment: CourseAnnouncementsViewControllerEnvironment
let courseID: String
private let loadController = LoadStateViewController()
private let announcementsLoader = BackedStream<[OEXAnnouncement]>()
private let webView: UIWebView
private let notificationBar : UIView
private let notificationLabel : UILabel
private let notificationSwitch : UISwitch
private let fontStyle = OEXTextStyle(weight : .Normal, size: .Base, color: OEXStyles.sharedStyles().neutralBlack())
private let switchStyle = OEXStyles.sharedStyles().standardSwitchStyle()
//自定义标题
private var titleL : UILabel?
init(environment: CourseAnnouncementsViewControllerEnvironment, courseID: String) {
self.courseID = courseID
self.environment = environment
self.webView = UIWebView()
self.notificationBar = UIView(frame: CGRectZero)
self.notificationBar.clipsToBounds = true
self.notificationLabel = UILabel(frame: CGRectZero)
self.notificationSwitch = UISwitch(frame: CGRectZero)
super.init(env: environment)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
super.viewDidLoad()
let leftButton = UIButton.init(frame: CGRectMake(0, 0, 48, 48))
leftButton.setImage(UIImage.init(named: "backImagee"), forState: .Normal)
leftButton.imageEdgeInsets = UIEdgeInsetsMake(0, -23, 0, 23)
leftButton.addTarget(self, action: #selector(leftBarItemAction), forControlEvents: .TouchUpInside)
self.navigationController?.interactivePopGestureRecognizer?.enabled = true
self.navigationController?.interactivePopGestureRecognizer?.delegate = self
let leftBarItem = UIBarButtonItem.init(customView: leftButton)
self.navigationItem.leftBarButtonItem = leftBarItem
addSubviews()
setConstraints()
setStyles()
self.view.backgroundColor = OEXStyles.sharedStyles().standardBackgroundColor()
webView.backgroundColor = OEXStyles.sharedStyles().standardBackgroundColor()
webView.opaque = false
loadController.setupInController(self, contentView: self.webView)
notificationSwitch.oex_addAction({[weak self] _ in
if let owner = self {
owner.environment.dataManager.pushSettings.setPushDisabled(!owner.notificationSwitch.on, forCourseID: owner.courseID)
}}, forEvents: UIControlEvents.ValueChanged)
self.webView.delegate = self
announcementsLoader.listen(self) {[weak self] in
switch $0 {
case let .Success(announcements):
self?.useAnnouncements(announcements)
case let .Failure(error):
if !(self?.announcementsLoader.active ?? false) {
self?.loadController.state = LoadState.failed(error)
}
}
}
}
private static func requestForCourse(course: OEXCourse) -> NetworkRequest<[OEXAnnouncement]> {
let announcementsURL = course.course_updates ?? "".oex_formatWithParameters([:])
return NetworkRequest(method: .GET,
path: announcementsURL,
requiresAuth: true,
deserializer: .JSONResponse(announcementsDeserializer)
)
}
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
self.loadContent()
}
override func reloadViewData() {
loadContent()
}
func leftBarItemAction() {
self.navigationController?.popViewControllerAnimated(true)
}
private func loadContent() {
if !announcementsLoader.active {
let networkManager = environment.networkManager
announcementsLoader.backWithStream(
environment.dataManager.enrollmentManager.streamForCourseWithID(courseID).transform {
let request = CourseAnnouncementsViewController.requestForCourse($0.course)
return networkManager.streamForRequest(request, persistResponse: true)
}
)
}
}
//MARK: - Setup UI
private func addSubviews() {
self.view.addSubview(webView)
self.view.addSubview(notificationBar)
notificationBar.addSubview(notificationLabel)
notificationBar.addSubview(notificationSwitch)
}
private func setConstraints() {
notificationLabel.snp_makeConstraints { (make) -> Void in
make.leading.equalTo(notificationBar.snp_leading).offset(notificationLabelLeadingOffset)
make.centerY.equalTo(notificationBar)
make.trailing.equalTo(notificationSwitch)
}
notificationSwitch.snp_makeConstraints { (make) -> Void in
make.centerY.equalTo(notificationBar)
make.trailing.equalTo(notificationBar).offset(notificationLabelTrailingOffset)
}
notificationBar.snp_makeConstraints { (make) -> Void in
make.top.equalTo(self.view)
make.leading.equalTo(self.view)
make.trailing.equalTo(self.view)
if environment.config.pushNotificationsEnabled {
make.height.equalTo(notificationBarHeight)
}
else {
make.height.equalTo(0)
}
}
notificationBar.hidden = true
webView.snp_makeConstraints { (make) -> Void in
// make.top.equalTo(notificationBar.snp_bottom)
make.top.equalTo(self.view)//隐藏上面的允许接收通知bar
make.leading.equalTo(self.view)
make.trailing.equalTo(self.view)
make.bottom.equalTo(self.view)
}
}
private func setStyles() {
self.titleViewLabel.text = Strings.courseAnnouncements
notificationBar.backgroundColor = OEXStyles.sharedStyles().standardBackgroundColor()
switchStyle.applyToSwitch(notificationSwitch)
notificationLabel.attributedText = fontStyle.attributedStringWithText(Strings.notificationsEnabled)
notificationSwitch.on = !environment.dataManager.pushSettings.isPushDisabledForCourseWithID(courseID)
}
//MARK: - Presenter
private func useAnnouncements(announcements: [OEXAnnouncement]) {
guard announcements.count > 0 else {
self.loadController.state = LoadState.empty(icon: nil, message: Strings.announcementUnavailable)
return
}
var html:String = String()
for (index,announcement) in announcements.enumerate() {
html += "<div class=\"announcement-header\">\(announcement.heading!)</div>"
html += "<hr class=\"announcement\"/>"
html += announcement.content ?? ""
if(index + 1 < announcements.count)
{
html += "<div class=\"announcement-separator\"/></div>"
}
}
let displayHTML = OEXStyles.sharedStyles().styleHTMLContent(html, stylesheet: "handouts-announcements") ?? ""
let baseURL = self.environment.config.apiHostURL()
self.webView.loadHTMLString(displayHTML, baseURL: baseURL)
}
//MARK: - UIWebViewDeleagte
func webView(webView: UIWebView, shouldStartLoadWithRequest request: NSURLRequest, navigationType: UIWebViewNavigationType) -> Bool {
if (navigationType != UIWebViewNavigationType.Other) {
if let URL = request.URL {
UIApplication.sharedApplication().openURL(URL)
return false
}
}
return true
}
func webViewDidFinishLoad(webView: UIWebView) {
self.loadController.state = .Loaded
}
func webView(webView: UIWebView, didFailLoadWithError error: NSError?) {
self.loadController.state = LoadState.failed(error)
}
}
// Testing only
extension CourseAnnouncementsViewController {
var t_showingNotificationBar : Bool {
return self.notificationBar.bounds.size.height > 0
}
}
| apache-2.0 | fbd5af7608a20d4e2ccc6f1622c9e5f8 | 37.352697 | 168 | 0.656713 | 5.449882 | false | false | false | false |
FabioTacke/RingSig | Sources/RingSig/RingSig.swift | 1 | 10026 | //
// RingSig.swift
// RingSig
//
// Created by Fabio Tacke on 14.06.17.
//
//
import Foundation
import BigInt
import CryptoSwift
public class RingSig {
/// Signs the given message using the ring signature scheme
///
/// - Parameters:
/// - message: The message to be signed
/// - nonSignersPublicKeys: Array of `RSA.PublicKey` objects of those who do not actually sign the message
/// - signerKeyPair: The `RSA.KeyPair` of the signer who actually signs the message
/// - Returns: Signature of the message
public static func ringSign(message: Data, nonSignersPublicKeys: [RSA.PublicKey], signerKeyPair: RSA.KeyPair) -> Signature {
return ringSign(message: BigUInt(message), nonSignersPublicKeys: nonSignersPublicKeys, signerKeyPair: signerKeyPair)
}
/// Signs the given message using the ring signature scheme
///
/// - Parameters:
/// - message: The message to be signed
/// - nonSignersPublicKeys: Array of `RSA.PublicKey` objects of those who do not actually sign the message
/// - signerKeyPair: The `RSA.KeyPair` of the signer who actually signs the message
/// - Returns: Signature of the message
public static func ringSign(message: BigUInt, nonSignersPublicKeys: [RSA.PublicKey], signerKeyPair: RSA.KeyPair) -> Signature {
// Sort public keys so that the verifier cannot obtain the signer's identity from the order of the keys
let publicKeys = (nonSignersPublicKeys + [signerKeyPair.publicKey]).sorted { $0.n < $1.n }
let signerIndex = publicKeys.index(of: signerKeyPair.publicKey)!
// 0. Choose a moduli for all the calculations that is sufficiently great
let commonModulus = commonB(publicKeys: publicKeys)
// 1. Compute the key as k = h(m)
let k = calculateDigest(message: message)
// 2. Pick a random glue value
let glue = BigUInt.randomInteger(withMaximumWidth: commonModulus.bitWidth)
// 3. Pick random values x_i for the non-signers and compute y_i
var xValues: [BigUInt] = publicKeys.map { _ in BigUInt.randomInteger(withMaximumWidth: commonModulus.bitWidth) }
let yValues: [BigUInt?] = publicKeys.map { publicKey in publicKey != signerKeyPair.publicKey ? g(x: xValues[publicKeys.index(of: publicKey)!], publicKey: publicKey, commonModulus: commonModulus) : nil
}
// 4. Solve the ring equation for y_s of the signer
let yS = solve(arguments: yValues, key: k, glue: glue, commonModulus: commonModulus)
// 5. Invert the signer's trap-door permutation
xValues[signerIndex] = gInverse(y: yS, keyPair: signerKeyPair)
return Signature(publicKeys: publicKeys, glue: glue, xValues: xValues)
}
/// Verifies a given ring signature
///
/// - Parameters:
/// - message: The message that is signed
/// - signature: The corresponding signature
/// - Returns: `true` if the signature matches the message, `false` otherwise
public static func ringSigVerify(message: Data, signature: Signature) -> Bool {
return ringSigVerify(message: BigUInt(message), signature: signature)
}
/// Verifies a given ring signature
///
/// - Parameters:
/// - message: The message that is signed
/// - signature: The corresponding signature
/// - Returns: `true` if the signature matches the message, `false` otherwise
public static func ringSigVerify(message: BigUInt, signature: Signature) -> Bool {
precondition(signature.publicKeys.count == signature.xValues.count)
// 1. Apply the trap-door permutations
let commonModulus = commonB(publicKeys: signature.publicKeys)
let yValues: [BigUInt] = zip(signature.xValues, signature.publicKeys).map { (x, publicKey) in
return g(x: x, publicKey: publicKey, commonModulus: commonModulus)
}
// 2. Compute the key as k = h(m)
let k = calculateDigest(message: message)
// 3. Check combination equation
return C(arguments: yValues, key: k, glue: signature.glue, commonModulus: commonModulus) == signature.glue
}
/// Calculates the SHA256 hash digest of the given input.
///
/// - Parameter message: The message whose hash digest is going to be computed
/// - Returns: SHA256 hash digest of the given message
internal static func calculateDigest(message: BigUInt) -> BigUInt {
return BigUInt(message.serialize().sha256())
}
/// Because all the usual RSA signature calculations use different moduli `n_i`, we need to choose a modulus b that is greater than the greatest modulus n_i.
/// In particular we are going to choose b to be at least 160 bit greater than the greatest of the `n_i` as suggested in the paper.
/// Furthermore we might add a few bits more in order to reach a multiple of the block size of the encryption algorithm (in this case 128 bit for AES).
///
/// - Parameter publicKeys: The public keys that specify the individual moduli
/// - Returns: `(2^b) - 1` where `b` is greater than the width of the greatest `n_i` and a multiple of the AES block size
internal static func commonB(publicKeys: [RSA.PublicKey]) -> BigUInt {
let nMax = publicKeys.reduce(1) { (result, publicKey) in
return publicKey.n > result ? publicKey.n : result
}
var sufficientBits = nMax.bitWidth + 160
if sufficientBits % 128 > 0 {
sufficientBits += 128 - (sufficientBits % 128)
}
return (BigUInt(1) << sufficientBits) - 1
}
/// Computes the extended trap-door permutation `g_i` as described in the paper.
///
/// - Parameters:
/// - x: Input argument
/// - publicKey: The public key holds the modulus needed for the calculation
/// - modulus: The common modulus used for all the calculations
/// - Returns: `g(x) = qn+f(r)` where `x = qn+r` and `f(r)` is the RSA encryption operation `r^e mod n`
internal static func g(x: BigUInt, publicKey: RSA.PublicKey, commonModulus: BigUInt) -> BigUInt {
let q = x / publicKey.n
var result = x
if (q + 1) * publicKey.n <= commonModulus {
let r = x - (q * publicKey.n)
let fr = r.power(RSA.PublicKey.e, modulus: publicKey.n)
result = (q * publicKey.n) + fr
}
return result
}
/// Computes the inverse function of `g(x)`
///
/// - Parameters:
/// - y: The result of the function equation `y = g(x)`
/// - keyPair: The key pair of the signer
/// - Returns: `x` so that `g(x)=y`
internal static func gInverse(y: BigUInt, keyPair: RSA.KeyPair) -> BigUInt {
// y = g(x) = q * n + f(r)
let q = y / keyPair.publicKey.n
// <=> y - q * n = f(r)
let fr = y - q * keyPair.publicKey.n
// <=> f^{-1}(y - q * n) = r
let r = fr.power(keyPair.privateKey, modulus: keyPair.publicKey.n)
// x = q * n + r
return q * keyPair.publicKey.n + r
}
/// Encrypts the given message under the specified key using AES-256 CBC.
///
/// - Requires: Message length must be a multiple of the block size of 32 bytes.
/// - Parameters:
/// - message: The message to be encrypted.
/// - key: The (symmetric) key.
/// - Returns: Ciphertext of AES-256 CBC encrypted message.
internal static func encrypt(message: Array<UInt8>, key: BigUInt) -> BigUInt {
precondition(message.count % 16 == 0)
let aes = try! AES(key: key.serialize().bytes, blockMode: CBC(iv: ">RingSiggiSgniR<".data(using: .utf8)!.bytes), padding: .noPadding)
let ciphertext = try! aes.encrypt(message)
return BigUInt(Data(bytes: ciphertext))
}
/// Decrypts the given ciphertext under the specified key using AES-256 CBC.
///
/// - Parameters:
/// - cipher: The ciphertext to be decrypted.
/// - key: The (symmetric) key.
/// - Returns: Plaintext of AES-256 CBC decrypted ciphertext.
internal static func decrypt(cipher: Array<UInt8>, key: BigUInt) -> BigUInt {
let aes = try! AES(key: key.serialize().bytes, blockMode: CBC(iv: ">RingSiggiSgniR<".data(using: .utf8)!.bytes), padding: .noPadding)
let plaintext = try! aes.decrypt(cipher)
return BigUInt(Data(bytes: plaintext))
}
/// Computes the combination function described in the paper.
///
/// - Parameters:
/// - arguments: The arguments passed into the function
/// - key: The (symmetric) key to be used for the encryption algorithm
/// - glue: The chosen glue value
/// - commonModulus: The common modulus used for all the calculations
/// - Returns: Result of the function
internal static func C(arguments: [BigUInt], key: BigUInt, glue: BigUInt, commonModulus: BigUInt) -> BigUInt {
var result = glue
for argument in arguments {
let plaintext = argument ^ result
result = encrypt(message: plaintext.bytesWithPadding(to: commonModulus.bitWidth / 8), key: key)
}
return result
}
/// Solve the ring equation C_k,v(y_1, ..., y_r) = v for a given y_i
///
/// - Requires: Exactly one of the y_i (the y_i to solve the equation for) must be nil
/// - Parameters:
/// - arguments: The y_i values
/// - key: The (symmetric) key used for the encryption algorithm
/// - glue: The glue value
/// - commonModulus: The common modulus used for all the calculations
/// - Returns: The computed value for y_i
internal static func solve(arguments: [BigUInt?], key: BigUInt, glue: BigUInt, commonModulus: BigUInt) -> BigUInt {
var remainingArguments = arguments
var temp = glue
while remainingArguments.last != nil {
temp = decrypt(cipher: temp.bytesWithPadding(to: commonModulus.bitWidth / 8), key: key)
if let nextArgument = remainingArguments.removeLast() {
// y_i of a non-signer
temp ^= nextArgument
} else {
// We reached the slot of the signer's y_i for which we want to solve the ring equation
temp ^= C(arguments: remainingArguments as! [BigUInt], key: key, glue: glue, commonModulus: commonModulus)
break
}
}
return temp
}
public struct Signature {
public let publicKeys: [RSA.PublicKey]
public let glue: BigUInt
public let xValues: [BigUInt]
}
}
| mit | bc07cb5bab674a08ea84a2c42e028516 | 42.591304 | 204 | 0.671055 | 3.96755 | false | false | false | false |
MadAppGang/SmartLog | iOS/Pods/CoreStore/Sources/CoreStoreObject+Querying.swift | 2 | 14017 | //
// CoreStoreObject+Querying.swift
// CoreStore
//
// Copyright © 2017 John Rommel Estropia
//
// 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 CoreData
import Foundation
// MARK: - DynamicObject
public extension DynamicObject where Self: CoreStoreObject {
/**
Extracts the keyPath string from a `CoreStoreObject.Value` property.
```
let keyPath: String = Person.keyPath { $0.nickname }
```
*/
public static func keyPath<O: CoreStoreObject, V: ImportableAttributeType>(_ attribute: (Self) -> ValueContainer<O>.Required<V>) -> String {
return attribute(self.meta).keyPath
}
/**
Extracts the keyPath string from a `CoreStoreObject.Value` property.
```
let keyPath: String = Person.keyPath { $0.nickname }
```
*/
public static func keyPath<O: CoreStoreObject, V: ImportableAttributeType>(_ attribute: (Self) -> ValueContainer<O>.Optional<V>) -> String {
return attribute(self.meta).keyPath
}
/**
Extracts the keyPath string from a `CoreStoreObject.Relationship` property.
```
let keyPath: String = Person.keyPath { $0.pets }
```
*/
public static func keyPath<O: CoreStoreObject, D: CoreStoreObject>(_ relationship: (Self) -> RelationshipContainer<O>.ToOne<D>) -> String {
return relationship(self.meta).keyPath
}
/**
Extracts the keyPath string from a `CoreStoreObject.Relationship` property.
```
let keyPath: String = Person.keyPath { $0.pets }
```
*/
public static func keyPath<O: CoreStoreObject, D: CoreStoreObject>(_ relationship: (Self) -> RelationshipContainer<O>.ToManyOrdered<D>) -> String {
return relationship(self.meta).keyPath
}
/**
Extracts the keyPath string from a `CoreStoreObject.Relationship` property.
```
let keyPath: String = Person.keyPath { $0.pets }
```
*/
public static func keyPath<O: CoreStoreObject, D: CoreStoreObject>(_ relationship: (Self) -> RelationshipContainer<O>.ToManyUnordered<D>) -> String {
return relationship(self.meta).keyPath
}
/**
Creates a `Where` clause from a `CoreStoreObject.Value` property.
```
let person = CoreStore.fetchOne(From<Person>(), Person.where { $0.nickname == "John" })
```
*/
public static func `where`(_ condition: (Self) -> Where) -> Where {
return condition(self.meta)
}
/**
Creates an `OrderBy` clause from a `CoreStoreObject.Value` property.
```
let person = CoreStore.fetchAll(From<Person>(), Person.orderBy(ascending: { $0.age }))
```
*/
public static func orderBy<O: CoreStoreObject, V: ImportableAttributeType>(ascending attribute: (Self) -> ValueContainer<O>.Required<V>) -> OrderBy {
return OrderBy(.ascending(attribute(self.meta).keyPath))
}
/**
Creates an `OrderBy` clause from a `CoreStoreObject.Value` property.
```
let person = CoreStore.fetchAll(From<Person>(), Person.orderBy(ascending: { $0.age }))
```
*/
public static func orderBy<O: CoreStoreObject, V: ImportableAttributeType>(ascending attribute: (Self) -> ValueContainer<O>.Optional<V>) -> OrderBy {
return OrderBy(.ascending(attribute(self.meta).keyPath))
}
/**
Creates an `OrderBy` clause from a `CoreStoreObject.Value` property.
```
let person = CoreStore.fetchAll(From<Person>(), Person.orderBy(descending: { $0.age }))
```
*/
public static func orderBy<O: CoreStoreObject, V: ImportableAttributeType>(descending attribute: (Self) -> ValueContainer<O>.Required<V>) -> OrderBy {
return OrderBy(.descending(attribute(self.meta).keyPath))
}
/**
Creates an `OrderBy` clause from a `CoreStoreObject.Value` property.
```
let person = CoreStore.fetchAll(From<Person>(), Person.orderBy(descending: { $0.age }))
```
*/
public static func orderBy<O: CoreStoreObject, V: ImportableAttributeType>(descending attribute: (Self) -> ValueContainer<O>.Optional<V>) -> OrderBy {
return OrderBy(.descending(attribute(self.meta).keyPath))
}
// MARK: Deprecated
@available(*, deprecated, renamed: "orderBy(ascending:)")
public static func ascending<O: CoreStoreObject, V: ImportableAttributeType>(_ attribute: (Self) -> ValueContainer<O>.Optional<V>) -> OrderBy {
return OrderBy(.ascending(attribute(self.meta).keyPath))
}
@available(*, deprecated, renamed: "orderBy(descending:)")
public static func descending<O: CoreStoreObject, V: ImportableAttributeType>(_ attribute: (Self) -> ValueContainer<O>.Optional<V>) -> OrderBy {
return OrderBy(.descending(attribute(self.meta).keyPath))
}
}
// MARK: - ValueContainer.Required
public extension ValueContainer.Required {
/**
Creates a `Where` clause from a `CoreStoreObject.Value` property.
```
let person = CoreStore.fetchOne(From<Person>(), Person.where { $0.nickname == "John" })
```
*/
@inline(__always)
public static func == (_ attribute: ValueContainer<O>.Required<V>, _ value: V) -> Where {
return Where(attribute.keyPath, isEqualTo: value)
}
/**
Creates a `Where` clause from a `CoreStoreObject.Value` property.
```
let person = CoreStore.fetchOne(From<Person>(), Person.where { $0.nickname != "John" })
```
*/
@inline(__always)
public static func != (_ attribute: ValueContainer<O>.Required<V>, _ value: V) -> Where {
return !Where(attribute.keyPath, isEqualTo: value)
}
/**
Creates a `Where` clause from a `CoreStoreObject.Value` property.
```
let person = CoreStore.fetchOne(From<Person>(), Person.where { $0.age < 20 })
```
*/
@inline(__always)
public static func < (_ attribute: ValueContainer<O>.Required<V>, _ value: V) -> Where {
return Where("%K < %@", attribute.keyPath, value)
}
/**
Creates a `Where` clause from a `CoreStoreObject.Value` property.
```
let person = CoreStore.fetchOne(From<Person>(), Person.where { $0.age > 20 })
```
*/
@inline(__always)
public static func > (_ attribute: ValueContainer<O>.Required<V>, _ value: V) -> Where {
return Where("%K > %@", attribute.keyPath, value)
}
/**
Creates a `Where` clause from a `CoreStoreObject.Value` property.
```
let person = CoreStore.fetchOne(From<Person>(), Person.where { $0.age <= 20 })
```
*/
@inline(__always)
public static func <= (_ attribute: ValueContainer<O>.Required<V>, _ value: V) -> Where {
return Where("%K <= %@", attribute.keyPath, value)
}
/**
Creates a `Where` clause from a `CoreStoreObject.Value` property.
```
let person = CoreStore.fetchOne(From<Person>(), Person.where { $0.age >= 20 })
```
*/
@inline(__always)
public static func >= (_ attribute: ValueContainer<O>.Required<V>, _ value: V) -> Where {
return Where("%K >= %@", attribute.keyPath, value)
}
/**
Creates a `Where` clause from a `CoreStoreObject.Value` property.
```
let dog = CoreStore.fetchOne(From<Dog>(), Dog.where { ["Pluto", "Snoopy", "Scooby"] ~= $0.nickname })
```
*/
@inline(__always)
public static func ~= <S: Sequence>(_ sequence: S, _ attribute: ValueContainer<O>.Required<V>) -> Where where S.Iterator.Element == V {
return Where(attribute.keyPath, isMemberOf: sequence)
}
}
// MARK: - ValueContainer.Optional
public extension ValueContainer.Optional {
/**
Creates a `Where` clause from a `CoreStoreObject.Value` property.
```
let person = CoreStore.fetchOne(From<Person>(), Person.where { $0.nickname == "John" })
```
*/
@inline(__always)
public static func == (_ attribute: ValueContainer<O>.Optional<V>, _ value: V?) -> Where {
return Where(attribute.keyPath, isEqualTo: value)
}
/**
Creates a `Where` clause from a `CoreStoreObject.Value` property.
```
let person = CoreStore.fetchOne(From<Person>(), Person.where { $0.nickname != "John" })
```
*/
@inline(__always)
public static func != (_ attribute: ValueContainer<O>.Optional<V>, _ value: V?) -> Where {
return !Where(attribute.keyPath, isEqualTo: value)
}
/**
Creates a `Where` clause from a `CoreStoreObject.Value` property.
```
let person = CoreStore.fetchOne(From<Person>(), Person.where { $0.age < 20 })
```
*/
@inline(__always)
public static func < (_ attribute: ValueContainer<O>.Optional<V>, _ value: V?) -> Where {
if let value = value {
return Where("%K < %@", attribute.keyPath, value)
}
else {
return Where("%K < nil", attribute.keyPath)
}
}
/**
Creates a `Where` clause from a `CoreStoreObject.Value` property.
```
let person = CoreStore.fetchOne(From<Person>(), Person.where { $0.age > 20 })
```
*/
@inline(__always)
public static func > (_ attribute: ValueContainer<O>.Optional<V>, _ value: V?) -> Where {
if let value = value {
return Where("%K > %@", attribute.keyPath, value)
}
else {
return Where("%K > nil", attribute.keyPath)
}
}
/**
Creates a `Where` clause from a `CoreStoreObject.Value` property.
```
let person = CoreStore.fetchOne(From<Person>(), Person.where { $0.age <= 20 })
```
*/
@inline(__always)
public static func <= (_ attribute: ValueContainer<O>.Optional<V>, _ value: V?) -> Where {
if let value = value {
return Where("%K <= %@", attribute.keyPath, value)
}
else {
return Where("%K <= nil", attribute.keyPath)
}
}
/**
Creates a `Where` clause from a `CoreStoreObject.Value` property.
```
let person = CoreStore.fetchOne(From<Person>(), Person.where { $0.age >= 20 })
```
*/
@inline(__always)
public static func >= (_ attribute: ValueContainer<O>.Optional<V>, _ value: V?) -> Where {
if let value = value {
return Where("%K >= %@", attribute.keyPath, value)
}
else {
return Where("%K >= nil", attribute.keyPath)
}
}
/**
Creates a `Where` clause from a `CoreStoreObject.Value` property.
```
let dog = CoreStore.fetchOne(From<Dog>(), Dog.where { ["Pluto", "Snoopy", "Scooby"] ~= $0.nickname })
```
*/
@inline(__always)
public static func ~= <S: Sequence>(_ sequence: S, _ attribute: ValueContainer<O>.Optional<V>) -> Where where S.Iterator.Element == V {
return Where(attribute.keyPath, isMemberOf: sequence)
}
}
// MARK: - RelationshipContainer.ToOne
public extension RelationshipContainer.ToOne {
/**
Creates a `Where` clause from a `CoreStoreObject.Relationship` property.
```
let dog = CoreStore.fetchOne(From<Dog>(), Dog.where { $0.master == me })
```
*/
@inline(__always)
public static func == (_ relationship: RelationshipContainer<O>.ToOne<D>, _ object: D?) -> Where {
return Where(relationship.keyPath, isEqualTo: object)
}
/**
Creates a `Where` clause from a `CoreStoreObject.Relationship` property.
```
let dog = CoreStore.fetchOne(From<Dog>(), Dog.where { $0.master != me })
```
*/
@inline(__always)
public static func != (_ relationship: RelationshipContainer<O>.ToOne<D>, _ object: D?) -> Where {
return !Where(relationship.keyPath, isEqualTo: object)
}
/**
Creates a `Where` clause from a `CoreStoreObject.Relationship` property.
```
let dog = CoreStore.fetchOne(From<Dog>(), Dog.where { $0.master ~= me })
```
*/
@inline(__always)
public static func ~= (_ relationship: RelationshipContainer<O>.ToOne<D>, _ object: D?) -> Where {
return Where(relationship.keyPath, isEqualTo: object)
}
/**
Creates a `Where` clause from a `CoreStoreObject.Relationship` property.
```
let dog = CoreStore.fetchOne(From<Dog>(), Dog.where { [john, joe, bob] ~= $0.master })
```
*/
@inline(__always)
public static func ~= <S: Sequence>(_ sequence: S, _ relationship: RelationshipContainer<O>.ToOne<D>) -> Where where S.Iterator.Element == D {
return Where(relationship.keyPath, isMemberOf: sequence)
}
}
| mit | 2e0e8ea45a16b68421d27b8cd5e56b14 | 32.371429 | 155 | 0.597317 | 4.337976 | false | false | false | false |
beckasaurus/skin-ios | skin/skin/Product.swift | 1 | 717 | //
// Product.swift
// skin
//
// Created by Becky on 9/11/17.
// Copyright © 2017 Becky Henderson. All rights reserved.
//
import Foundation
import RealmSwift
final class Product: Object {
dynamic var id: String = UUID().uuidString
dynamic var name = ""
dynamic var brand: String?
let price = RealmOptional<Double>()
dynamic var link: String?
dynamic var expirationDate: Date?
dynamic var category: String = ProductCategory.active.rawValue
dynamic var ingredients: String?
let rating = RealmOptional<Int>()
let numberUsed = RealmOptional<Int>()
let numberInStash = RealmOptional<Int>()
let willRepurchase = RealmOptional<Bool>()
override static func primaryKey() -> String? {
return "id"
}
}
| mit | efa751ee738756f9cf3e5f72fc3c8ae2 | 23.689655 | 63 | 0.726257 | 3.671795 | false | false | false | false |
mogstad/Delta | tests/processor_spec.swift | 1 | 6860 | import Foundation
import Quick
import Nimble
@testable import Delta
struct Model: DeltaItem, Equatable {
var identifier: Int
var count: Int
var deltaIdentifier: Int { return self.identifier }
init(identifier: Int, count: Int = 0) {
self.identifier = identifier
self.count = count
}
}
func ==(lhs: Model, rhs: Model) -> Bool {
return lhs.identifier == rhs.identifier && lhs.count == rhs.count
}
class DeltaProcessorSpec: QuickSpec {
override func spec() {
describe("changes(from, to)") {
var records: [DeltaChange]!
describe("Adding nodes") {
beforeEach {
let from = [Model(identifier: 1)]
let to = [Model(identifier: 1), Model(identifier: 2)]
records = self.records(from, to: to)
expect(records.count).to(equal(1))
}
it("creates “add” record") {
let record = DeltaChange.add(index: 1)
expect(records[0]).to(equal(record))
}
}
describe("Removing nodes") {
beforeEach {
let from = [Model(identifier: 1), Model(identifier: 2)]
let to = [Model(identifier: 1)]
records = self.records(from, to: to)
expect(records.count).to(equal(1))
}
it("creates “remove” record") {
let record = DeltaChange.remove(index: 1)
expect(records[0]).to(equal(record))
}
}
describe("Changing nodes") {
beforeEach {
let from = [Model(identifier: 1, count: 10)]
let to = [Model(identifier: 1, count: 5)]
records = self.records(from, to: to)
expect(records.count).to(equal(1))
}
it("creates “change” record") {
let record = DeltaChange.change(index: 0, from: 0)
expect(records[0]).to(equal(record))
}
}
describe("Changing a node and removing a node") {
beforeEach {
let from = [
Model(identifier: 0),
Model(identifier: 1, count: 10)
]
let to = [
Model(identifier: 1, count: 5)
]
records = self.records(from, to: to)
expect(records.count).to(equal(2))
}
it("creates “remove” record") {
let record = DeltaChange.remove(index: 0)
expect(records[0]).to(equal(record))
}
it("creates “change” record") {
let record = DeltaChange.change(index: 0, from: 1)
expect(records[1]).to(equal(record))
}
}
describe("Removing and adding") {
beforeEach {
let from = [Model(identifier: 16) ,Model(identifier: 64), Model(identifier: 32)]
let to = [Model(identifier: 16), Model(identifier: 256), Model(identifier: 32)]
records = self.records(from, to: to)
expect(records.count).to(equal(2))
}
it("creates “remove” record") {
let record = DeltaChange.remove(index: 1)
expect(records[0]).to(equal(record))
}
it("creates “add” record") {
let record = DeltaChange.add(index: 1)
expect(records[1]).to(equal(record))
}
}
describe("Moving a record in a set") {
beforeEach {
let from = [Model(identifier: 1), Model(identifier: 3), Model(identifier: 2)]
let to = [Model(identifier: 1), Model(identifier: 2), Model(identifier: 3)]
records = self.records(from, to: to)
expect(records.count).to(equal(1))
}
it("creates “move” record") {
let record = DeltaChange.move(index: 2, from: 1)
expect(records[0]).to(equal(record))
}
}
describe("Moving multiple items in a set set") {
beforeEach {
let from = [
Model(identifier: 1),
Model(identifier: 3),
Model(identifier: 6),
Model(identifier: 2),
Model(identifier: 5),
Model(identifier: 4)
]
let to = [
Model(identifier: 1),
Model(identifier: 2),
Model(identifier: 3),
Model(identifier: 4),
Model(identifier: 5),
Model(identifier: 6)
]
records = self.records(from, to: to)
expect(records.count).to(equal(3))
}
it("moves the record") {
let record = DeltaChange.move(index: 2, from: 1)
let record1 = DeltaChange.move(index: 5, from: 2)
let record2 = DeltaChange.move(index: 4, from: 4)
expect(records[0]).to(equal(record))
expect(records[1]).to(equal(record1))
expect(records[2]).to(equal(record2))
}
}
describe("Moving an item and appending an item") {
beforeEach {
let from = [
Model(identifier: 1),
Model(identifier: 3),
Model(identifier: 6)
]
let to = [
Model(identifier: 4),
Model(identifier: 1),
Model(identifier: 6),
Model(identifier: 3)
]
records = self.records(from, to: to)
expect(records.count).to(equal(2))
}
it("moves the record") {
let record = DeltaChange.move(index: 3, from: 1)
expect(records[1]).to(equal(record))
}
}
describe("Removing an item and appending another item") {
beforeEach {
let from = [
Model(identifier: 4),
Model(identifier: 1),
Model(identifier: 3),
Model(identifier: 6)
]
let to = [
Model(identifier: 1),
Model(identifier: 6),
Model(identifier: 3)
]
records = self.records(from, to: to)
expect(records.count).to(equal(2))
}
it("moves the record") {
let record = DeltaChange.move(index: 2, from: 2)
expect(records[1]).to(equal(record))
}
}
describe("Removing an item while moving another") {
beforeEach {
let from = [
Model(identifier: 0),
Model(identifier: 1),
Model(identifier: 2),
]
let to = [
Model(identifier: 2),
Model(identifier: 1),
]
records = self.records(from, to: to)
expect(records.count).to(equal(2))
}
it("moves the record") {
let removeRecord = DeltaChange.remove(index: 0)
expect(records[0]).to(equal(removeRecord))
let moveRecord = DeltaChange.move(index: 0, from: 2)
expect(records[1]).to(equal(moveRecord))
}
}
}
}
fileprivate func records(_ from: [Model], to: [Model]) -> [DeltaChange] {
return changes(from: from, to: to)
}
}
| mit | 0e6289dc420cbfabad5f78cbc5c81753 | 27.214876 | 90 | 0.521236 | 4.066706 | false | false | false | false |
jiangboLee/huangpian | liubai/Camera/ViewController/CameraController.swift | 1 | 30945 | //
// CameraController.swift
// liubai
//
// Created by 李江波 on 2017/2/26.
// Copyright © 2017年 lijiangbo. All rights reserved.
//
import UIKit
import GPUImage
import SVProgressHUD
import Photos
class CameraController: UIViewController {
lazy var videoCamera: GPUImageStillCamera = {
let videoCamera = GPUImageStillCamera(sessionPreset: AVCaptureSessionPresetHigh, cameraPosition: AVCaptureDevicePosition.front)
videoCamera?.outputImageOrientation = .portrait
//镜像
videoCamera?.horizontallyMirrorRearFacingCamera = false
videoCamera?.horizontallyMirrorFrontFacingCamera = true
return videoCamera!
}()
var filterVideoView: GPUImageView?
var filter: GPUImageOutput?
var flashMode: AVCaptureFlashMode = .off
var focusLayer: CALayer?
var beginScale: CGFloat = 1.0
var endScale: CGFloat = 1.0
var takePhotoImg: UIImageView?
//相册属性
fileprivate var AlbumItems: [AlbumItem] = [] // 相册列表
//带缓存的图片管理对象
lazy var imageManager = PHCachingImageManager()
var albumitemsCount = 0
//滤镜视图
lazy var filterView: FilterCollectionView = {
let filterView = FilterCollectionView()
filterView.clickItem = { (i) in
self.chooseFilter(i)
}
self.view.addSubview(filterView)
filterView.snp.makeConstraints({ (make) in
make.right.left.equalTo(self.view)
make.height.equalTo(80)
make.bottom.equalTo(self.view.snp.bottomMargin).offset(-80)
})
return filterView
}()
var clearView: UIView!
//按钮
var closeButton: UIButton!
var OrientationButton: UIButton!
var flashButton: UIButton!
var mirrorButton: UIButton!
var allPhotoesButton: UIButton!
var takePhotoButton: UIButton!
var filterButton: UIButton!
//保存按钮
lazy var takePhoto_Save: UIButton = {
let takePhoto_Save = UIButton(type: .custom)
takePhoto_Save.setBackgroundImage(#imageLiteral(resourceName: "save_icon_save"), for: .normal)
self.view.addSubview(takePhoto_Save)
takePhoto_Save.snp.makeConstraints { (make) in
make.bottom.equalTo(self.view.snp.bottomMargin).offset(-12)
make.centerX.equalTo(self.view)
}
takePhoto_Save.addTarget(self, action: #selector(takePhotoSave), for: .touchUpInside)
return takePhoto_Save
}()
//取消按钮
lazy var takePhoto_Cancel: UIButton = {
let takePhoto_Cancel = UIButton(type: .custom)
takePhoto_Cancel.setBackgroundImage(#imageLiteral(resourceName: "save_icon_back"), for: .normal)
self.view.addSubview(takePhoto_Cancel)
takePhoto_Cancel.snp.makeConstraints { (make) in
make.centerY.equalTo(self.takePhoto_Save)
make.left.equalTo(self.view).offset(18)
}
takePhoto_Cancel.addTarget(self, action: #selector(takePhotoCancel), for: .touchUpInside)
return takePhoto_Cancel
}()
//分享按钮
lazy var takePhoto_Share: UIButton = {
let takePhoto_Share = UIButton(type: .custom)
takePhoto_Share.setBackgroundImage(#imageLiteral(resourceName: "save_icon_share"), for: .normal)
self.view.addSubview(takePhoto_Share)
takePhoto_Share.snp.makeConstraints { (make) in
make.centerY.equalTo(self.takePhoto_Save)
make.right.equalTo(self.view).offset(-18)
}
takePhoto_Share.addTarget(self, action: #selector(sharePhoto), for: .touchUpInside)
return takePhoto_Share
}()
//是否拍照还是照片处理
var isTakePhoto: Bool = true
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = UIColor.white
//创建滤镜
let beautifulFilter = GPUImageBeautifyFilter()
//创建预览视图
let filterView = GPUImageView(frame: UIScreen.main.bounds)
filterView.fillMode = kGPUImageFillModePreserveAspectRatioAndFill
view.addSubview(filterView)
filterVideoView = filterView
//为摄像头添加滤镜
videoCamera.addTarget(beautifulFilter)
//把滤镜挂在view上
beautifulFilter.addTarget(filterView)
filter = beautifulFilter
//启动摄像头
// videoCamera.startCapture();
//所有按钮的父视图
clearView = UIView(frame: UIScreen.main.bounds)
clearView.backgroundColor = UIColor.clear
// clearView.isUserInteractionEnabled = false
view.addSubview(clearView)
//设置聚焦图片
setFocusImage(image: #imageLiteral(resourceName: "takepic_icon_focus"))
//关闭
closeButton = UIButton(type: .custom)
closeButton.setBackgroundImage(#imageLiteral(resourceName: "takepic_icon_close"), for: .normal)
clearView.addSubview(closeButton)
closeButton.snp.makeConstraints { (make) in
make.top.equalTo(view.snp.topMargin).offset(15)
make.left.equalTo(view).offset(15)
}
closeButton.addTarget(self, action: #selector(closeClick), for: .touchUpInside)
//切换摄像头按钮
OrientationButton = UIButton(type: .custom)
OrientationButton.setBackgroundImage(#imageLiteral(resourceName: "takepic_icon_reverse"), for: .normal)
clearView.addSubview(OrientationButton)
OrientationButton.snp.makeConstraints { (make) in
make.right.equalTo(view).offset(-22)
make.centerY.equalTo(closeButton)
}
OrientationButton.addTarget(self, action: #selector(changeOrientation), for: .touchUpInside)
clearView.layoutSubviews() //提前确定约束
//闪光灯
flashButton = UIButton(type: .custom)
flashButton.setBackgroundImage(#imageLiteral(resourceName: "takepic_icon_flashlight_normal"), for: .normal)
clearView.addSubview(flashButton)
let width = (OrientationButton.center.x - closeButton.center.x) / 3
flashButton.snp.makeConstraints { (make) in
make.centerY.equalTo(closeButton)
make.centerX.equalTo(OrientationButton).offset(-width)
}
flashButton.addTarget(self, action: #selector(flashModeChange(button:)), for: .touchUpInside)
//镜像
mirrorButton = UIButton(type: .custom)
mirrorButton.setBackgroundImage(#imageLiteral(resourceName: "takepic_icon_mirror"), for: .normal)
clearView.addSubview(mirrorButton)
mirrorButton.snp.makeConstraints { (make) in
make.centerY.equalTo(closeButton)
make.centerX.equalTo(closeButton).offset(width)
}
mirrorButton.addTarget(self, action: #selector(mirrorChange), for: .touchUpInside)
//拍照
takePhotoButton = UIButton(type: .custom)
takePhotoButton.setBackgroundImage(#imageLiteral(resourceName: "takepic_icon_takepicButton"), for: .normal)
clearView.addSubview(takePhotoButton)
takePhotoButton.snp.makeConstraints { (make) in
make.bottom.equalTo(view.snp.bottomMargin).offset(-30)
make.centerX.equalTo(view)
}
takePhotoButton.addTarget(self, action: #selector(takePhoto), for: .touchUpInside)
//相册按钮
allPhotoesButton = UIButton(type: .custom)
allPhotoesButton.setBackgroundImage(#imageLiteral(resourceName: "takepic_icon_photoAlbum"), for: .normal)
clearView.addSubview(allPhotoesButton)
allPhotoesButton.snp.makeConstraints { (make) in
make.centerY.equalTo(takePhotoButton)
make.right.equalTo(takePhotoButton.snp.left).offset(-76.5)
}
allPhotoesButton.addTarget(self, action: #selector(openAllPhotoes), for: .touchUpInside)
//滤镜按钮
filterButton = UIButton(type: .custom)
filterButton.setBackgroundImage(#imageLiteral(resourceName: "takepic_icon_filter"), for: .normal)
clearView.addSubview(filterButton)
filterButton.snp.makeConstraints { (make) in
make.centerY.equalTo(takePhotoButton)
make.left.equalTo(takePhotoButton.snp.right).offset(76.5)
}
filterButton.addTarget(self, action: #selector(openFilters(button:)), for: .touchUpInside)
}
//MARK: 关闭
func closeClick() {
dismiss(animated: true, completion: nil)
}
//MARK: 点开滤镜
func openFilters(button: UIButton) {
button.isSelected = !button.isSelected
if button.isSelected {
filterView.isHidden = false
takePhotoButton.setBackgroundImage(#imageLiteral(resourceName: "takepic_filter_icon_elected"), for: .normal)
takePhotoButton.snp.updateConstraints({ (make) in
make.bottom.equalTo(view.snp.bottomMargin).offset(-8)
})
} else {
filterView.isHidden = true
takePhotoButton.setBackgroundImage(#imageLiteral(resourceName: "takepic_icon_takepicButton"), for: .normal)
takePhotoButton.snp.updateConstraints({ (make) in
make.bottom.equalTo(view.snp.bottomMargin).offset(-30)
})
}
}
//选择滤镜
func chooseFilter(_ item: Int) {
videoCamera.removeAllTargets()
switch item {
case 0:
filter = GPUImageBeautifyFilter()
break
case 1:
filter = GPUImageFilter()
break
case 2:
filter = GPUImageSepiaFilter()
break
case 3:
filter = GPUImageHueFilter()
break
case 4:
filter = GPUImageSmoothToonFilter()
break
case 5:
filter = GPUImageSketchFilter()
break
case 6:
filter = GPUImageGlassSphereFilter()
break
case 7:
filter = GPUImageEmbossFilter()
break
case 8:
filter = GPUImageTiltShiftFilter()
break
default:
break
}
videoCamera.addTarget(filter as! GPUImageInput!)
filter?.addTarget(filterVideoView)
}
//MARK: 打开相簿
func openAllPhotoes() {
let size = AllPhotoesFlowLayout().itemSize
let itemArr = getAlbumItem()
let result1 = itemArr.first?.fetchResult
albumitemsCount = 0
guard let result = result1 else { return }
getAlbumItemFetchResults(assetsFetchResults: result, thumbnailSize: size) { (imageArr,assets) in
let allPhotoesVC = AllPhotosController()
allPhotoesVC.imageArr = imageArr
allPhotoesVC.assets = assets
allPhotoesVC.itemArr = itemArr
allPhotoesVC.nowAlbum = result
allPhotoesVC.imgArrAdd = { (nowAlbum) in
self.fetchImage(assetsFetchResults: nowAlbum, thumbnailSize: size) { (imageArr,assets) in
allPhotoesVC.imageArr += imageArr
allPhotoesVC.assets? += assets
}
}
allPhotoesVC.coverImg = {
self.getAlbumCoverImg(itemArr, finishedCallBack: { (coverImgArr) in
allPhotoesVC.coverImgArr = coverImgArr
})
}
allPhotoesVC.refreshAlbum = { (albumResult) in
self.albumitemsCount = 0
self.getAlbumItemFetchResults(assetsFetchResults: albumResult, thumbnailSize: size, finishedCallBack: { (imageArr, assets) in
allPhotoesVC.imageArr = imageArr
allPhotoesVC.assets = assets
})
}
self.present(allPhotoesVC, animated: true, completion: nil)
}
}
//MARK: 获取所有相册首页
func getAlbumCoverImg(_ albumItems: [AlbumItem], finishedCallBack: @escaping (_ result: [UIImage])->()) {
var coverImgArr: [UIImage] = []
for i in 0..<albumItems.count {
let album = albumItems[i]
cachingImageManager()
let options = PHImageRequestOptions()
options.isSynchronous = true
imageManager.requestImage(for: album.fetchResult[0], targetSize: CGSize(width: 56, height: 56), contentMode: .aspectFit, options: options, resultHandler: { (image, _) in
coverImgArr.append(image!)
if i == albumItems.count - 1 {
finishedCallBack(coverImgArr)
}
})
}
}
// MARK: - 获取指定的相册缩略图列表
private func getAlbumItemFetchResults(assetsFetchResults: PHFetchResult<PHAsset>, thumbnailSize: CGSize, finishedCallBack: @escaping (_ result: [UIImage], _ assets: [PHAsset]) -> ()) {
cachingImageManager()
fetchImage(assetsFetchResults: assetsFetchResults, thumbnailSize: thumbnailSize) { (imageArr,assets) in
finishedCallBack(imageArr,assets)
}
}
//缓存管理
fileprivate func cachingImageManager() {
imageManager.stopCachingImagesForAllAssets()
}
//获取图片
fileprivate func fetchImage(assetsFetchResults: PHFetchResult<PHAsset>, thumbnailSize: CGSize, finishedCallBack: @escaping (_ imageArr: [UIImage], _ assets: [PHAsset]) -> () ) {
var imageArr: [UIImage] = []
var assets: [PHAsset] = []
var a = -1
if albumitemsCount == assetsFetchResults.count {
return
}
if albumitemsCount < assetsFetchResults.count {
albumitemsCount += 60
}
if albumitemsCount > assetsFetchResults.count {
a = albumitemsCount - 60
if a < 0 {
a = 0
}
albumitemsCount = assetsFetchResults.count
}
for i in ((a == -1) ? (albumitemsCount-60) : a)..<albumitemsCount {
let asset = assetsFetchResults[i]
let options = PHImageRequestOptions()
options.isSynchronous = true
options.isNetworkAccessAllowed = true
imageManager.requestImage(for: asset, targetSize: thumbnailSize, contentMode: .aspectFit, options: options, resultHandler: { (image, nfo) in
imageArr.append(image!)
assets.append(asset)
//!!!一定要回到主线程刷新
DispatchQueue.main.async {
if i == self.albumitemsCount - 1 {
finishedCallBack(imageArr, assets)
return
}
}
})
}
}
// MARK: - 获取相册列表
func getAlbumItem() -> [AlbumItem] {
AlbumItems.removeAll()
let smartOptions = PHFetchOptions()
let smartAlbums = PHAssetCollection.fetchAssetCollections(with: .smartAlbum, subtype: .albumRegular, options: smartOptions)
self.convertCollection(smartAlbums as! PHFetchResult<AnyObject>)
let userCollections = PHCollectionList.fetchTopLevelUserCollections(with: nil)
convertCollection(userCollections as! PHFetchResult<AnyObject>)
//相册按包含的照片数量排序(降序)
AlbumItems.sort { (item1, item2) -> Bool in
return item1.fetchResult.count > item2.fetchResult.count
}
return AlbumItems
}
//转化处理获取到的相簿
private func convertCollection(_ collection: PHFetchResult<AnyObject>) {
for i in 0..<collection.count {
let resultsOptions = PHFetchOptions()
resultsOptions.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: false)]
resultsOptions.predicate = NSPredicate(format: "mediaType = %d", PHAssetMediaType.image.rawValue)
guard let c = collection[i] as? PHAssetCollection else { return }
let assetsFetchResult = PHAsset.fetchAssets(in: c, options: resultsOptions)
//没有图片的空相簿不显示
if assetsFetchResult.count > 0 {
AlbumItems.append(AlbumItem(title: c.localizedTitle, fetchResult: assetsFetchResult))
}
}
}
//MARK: 拍照
func takePhoto() {
videoCamera.capturePhotoAsImageProcessedUp(toFilter: filter) { (photo: UIImage?, error: Error?) in
guard let img = photo else {return}
self.takePhotoImg = UIImageView(image: img)
let scale = img.size.width / img.size.height
let height = SCREENW / scale
self.takePhotoImg!.frame = CGRect(x: 0, y: (SCREENH - height)/2, width: SCREENW, height: height)
self.filterVideoView?.addSubview(self.takePhotoImg!)
self.clearView.isHidden = true
self.filterView.isHidden = true
self.takePhoto_Save.isHidden = false
self.takePhoto_Cancel.isHidden = false
self.takePhoto_Share.isHidden = false
}
}
func takePhotoSave() {
let lastStatus = PHPhotoLibrary.authorizationStatus()
PHPhotoLibrary.requestAuthorization { (status) in
//回到主线程
DispatchQueue.main.async {
if status == PHAuthorizationStatus.denied {
if lastStatus == PHAuthorizationStatus.notDetermined {
SVProgressHUD.showError(withStatus: "保存失败")
return
}
SVProgressHUD.showError(withStatus: "失败!请在系统设置中开启访问相册权限")
} else if status == PHAuthorizationStatus.authorized {
self.saveImageToCustomAblum()
} else if status == PHAuthorizationStatus.restricted {
SVProgressHUD.showError(withStatus: "系统原因,无法访问相册")
}
}
}
}
func saveImageToCustomAblum() {
guard let assets = asyncSaveImageWithPhotos() else {
SVProgressHUD.showError(withStatus: "保存失败")
return
}
guard let assetCollection = getAssetCollectionWithAppNameAndCreateIfNo()
else {
SVProgressHUD.showError(withStatus: "相册创建失败")
return
}
PHPhotoLibrary.shared().performChanges({
let collectionChangeRequest = PHAssetCollectionChangeRequest(for: assetCollection)
collectionChangeRequest?.insertAssets(assets, at: IndexSet(integer: 0))
}) { (success, error) in
if success {
SVProgressHUD.showSuccess(withStatus: "保存成功")
DispatchQueue.main.async {
self.takePhotoCancel()
}
} else {
SVProgressHUD.showError(withStatus: "保存失败")
}
}
}
//同步方式保存图片到系统的相机胶卷中---返回的是当前保存成功后相册图片对象集合
func asyncSaveImageWithPhotos() -> PHFetchResult<PHAsset>? {
var createdAssetID = ""
let error: ()? = try? PHPhotoLibrary.shared().performChangesAndWait {
createdAssetID = (PHAssetChangeRequest.creationRequestForAsset(from: (self.takePhotoImg?.image)!).placeholderForCreatedAsset?.localIdentifier)!
}
if error == nil {
SVProgressHUD.showError(withStatus: "保存失败")
return nil
} else {
SVProgressHUD.showSuccess(withStatus: "保存成功")
return PHAsset.fetchAssets(withLocalIdentifiers: [createdAssetID], options: nil)
}
}
//拥有与 APP 同名的自定义相册--如果没有则创建
func getAssetCollectionWithAppNameAndCreateIfNo() -> PHAssetCollection? {
let title = Bundle.main.infoDictionary?[String(kCFBundleNameKey)] as? String
let collections = PHAssetCollection.fetchAssetCollections(with: .album, subtype: .albumRegular, options: nil)
for i in 0..<collections.count {
if title == collections[i].localizedTitle {
return collections[i]
}
}
var createID = ""
let error: ()? = try? PHPhotoLibrary.shared().performChangesAndWait {
let request = PHAssetCollectionChangeRequest.creationRequestForAssetCollection(withTitle: title!)
createID = request.placeholderForCreatedAssetCollection.localIdentifier
}
if error == nil {
return nil
} else {
return PHAssetCollection.fetchAssetCollections(withLocalIdentifiers: [createID], options: nil).firstObject!
}
}
//MARK: 分享
func sharePhoto() {
UMSocialShareUIConfig.shareInstance().shareTitleViewConfig.isShow = true
UMSocialShareUIConfig.shareInstance().shareTitleViewConfig.shareTitleViewTitleString = "分享至"
UMSocialShareUIConfig.shareInstance().sharePageGroupViewConfig.sharePageGroupViewPostionType = .bottom
UMSocialShareUIConfig.shareInstance().sharePageScrollViewConfig.shareScrollViewPageMaxColumnCountForPortraitAndBottom = 3
UMSocialShareUIConfig.shareInstance().shareCancelControlConfig.isShow = false
UMSocialShareUIConfig.shareInstance().shareContainerConfig.isShareContainerHaveGradient = false
UMSocialUIManager.showShareMenuViewInWindow { (platformType, userInfo) in
let messageObject = UMSocialMessageObject.init()
let shareObject = UMShareImageObject.init()
shareObject.thumbImage = UIImage(named: "AppIcon")
shareObject.shareImage = self.takePhotoImg?.image
messageObject.shareObject = shareObject
UMSocialManager.default().share(to: platformType, messageObject: messageObject, currentViewController: self, completion: { (data, error) in
if error != nil {
} else {
}
})
}
}
//MARK: 取消保存
func takePhotoCancel() {
if isTakePhoto {
self.takePhotoImg?.isHidden = true
self.takePhotoImg?.removeFromSuperview()
self.clearView.isHidden = false
if self.filterButton.isSelected {
self.filterView.isHidden = false
} else {
self.filterView.isHidden = true
}
self.takePhoto_Save.isHidden = true
self.takePhoto_Cancel.isHidden = true
self.takePhoto_Share.isHidden = true
}
}
//MARK: 聚焦
func setFocusImage(image: UIImage) {
let tap = UITapGestureRecognizer(target: self, action: #selector(focus(tap:)))
clearView.addGestureRecognizer(tap)
let pinch = UIPinchGestureRecognizer(target: self, action: #selector(focusDisdance(pinch:)))
clearView.addGestureRecognizer(pinch)
pinch.delegate = self
let imageView = UIImageView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
imageView.image = image
focusLayer = imageView.layer
filterVideoView?.layer.addSublayer(focusLayer!)
focusLayer?.isHidden = true
}
func focus(tap: UITapGestureRecognizer) {
filterVideoView?.isUserInteractionEnabled = false
var touchPoint = tap.location(in: tap.view)
layerAnimationWithPoint(point: touchPoint)
if videoCamera.cameraPosition() == AVCaptureDevicePosition.back {
touchPoint = CGPoint(x: touchPoint.y / (tap.view?.bounds.size.height)!, y:1 - touchPoint.x / (tap.view?.bounds.size.width)!)
} else {
touchPoint = CGPoint(x: touchPoint.y / (tap.view?.bounds.size.height)!, y: touchPoint.x / (tap.view?.bounds.size.width)!)
}
if videoCamera.inputCamera.isExposureModeSupported(.autoExpose) && videoCamera.inputCamera.isExposurePointOfInterestSupported {
try? videoCamera.inputCamera.lockForConfiguration()
videoCamera.inputCamera.exposurePointOfInterest = touchPoint
videoCamera.inputCamera.exposureMode = .autoExpose
if videoCamera.inputCamera.isFocusPointOfInterestSupported && videoCamera.inputCamera.isFocusModeSupported(.autoFocus) {
videoCamera.inputCamera.focusPointOfInterest = touchPoint
videoCamera.inputCamera.focusMode = .autoFocus
}
videoCamera.inputCamera.unlockForConfiguration()
}
}
/// 聚焦动画
func layerAnimationWithPoint(point: CGPoint) {
guard let fLayer = focusLayer else {
return
}
fLayer.isHidden = false
CATransaction.begin()
CATransaction.setDisableActions(true)
fLayer.position = point
fLayer.transform = CATransform3DMakeScale(2.0, 2.0, 1.0)
CATransaction.commit()
let animation = CABasicAnimation(keyPath: "transform")
animation.toValue = NSValue.init(caTransform3D: CATransform3DMakeScale(1.0, 1.0, 1.0))
animation.delegate = self
animation.duration = 0.3
animation.repeatCount = 1
animation.isRemovedOnCompletion = false
animation.fillMode = kCAFillModeForwards
fLayer.add(animation, forKey: "animation")
}
func focusDisdance(pinch: UIPinchGestureRecognizer) {
endScale = beginScale * pinch.scale
if endScale < 1.0 {
endScale = 1.0
}
let maxScale: CGFloat = 4.0
if endScale > maxScale {
endScale = maxScale
}
UIView.animate(withDuration: 0.25) {
try? self.videoCamera.inputCamera.lockForConfiguration()
self.videoCamera.inputCamera.videoZoomFactor = self.endScale
self.videoCamera.inputCamera.unlockForConfiguration()
}
}
//MARK: 开关闪光灯
//开关闪光灯
func flashModeChange(button: UIButton) {
if flashMode == .off {
if videoCamera.inputCamera.hasFlash && videoCamera.inputCamera.hasTorch {
try? videoCamera.inputCamera.lockForConfiguration()
if videoCamera.inputCamera.isTorchModeSupported(.on) {
videoCamera.inputCamera.torchMode = .on
videoCamera.inputCamera.flashMode = .on
flashMode = .on
button.setBackgroundImage(#imageLiteral(resourceName: "takepic_icon_flashlight_selected"), for: .normal)
}
videoCamera.inputCamera.unlockForConfiguration()
} else {
LJBAlertView.sharedAlertView.alert(titleName: "提示", message: "只有后置摄像头支持闪光灯哦😁", buttonTitle: "确定", tager: self)
}
} else {
if videoCamera.inputCamera.hasFlash && videoCamera.inputCamera.hasTorch {
try? videoCamera.inputCamera.lockForConfiguration()
if videoCamera.inputCamera.isTorchModeSupported(.off) {
videoCamera.inputCamera.torchMode = .off
videoCamera.inputCamera.flashMode = .off
flashMode = .off
button.setBackgroundImage(#imageLiteral(resourceName: "takepic_icon_flashlight_normal"), for: .normal)
}
videoCamera.inputCamera.unlockForConfiguration()
}
}
}
//MARK: 镜像变化
/// 镜像变化
func mirrorChange() {
if videoCamera.horizontallyMirrorFrontFacingCamera == false {
videoCamera.horizontallyMirrorFrontFacingCamera = true
} else {
videoCamera.horizontallyMirrorFrontFacingCamera = false
}
}
//MARK: 前后摄像头转换
/// 前后摄像头转换
func changeOrientation() {
videoCamera.stopCapture()
if videoCamera.cameraPosition() == AVCaptureDevicePosition.front {
videoCamera = GPUImageStillCamera(sessionPreset: AVCaptureSessionPresetHigh, cameraPosition: AVCaptureDevicePosition.back)
} else if videoCamera.cameraPosition() == AVCaptureDevicePosition.back {
videoCamera = GPUImageStillCamera(sessionPreset: AVCaptureSessionPresetHigh, cameraPosition: AVCaptureDevicePosition.front)
}
videoCamera.outputImageOrientation = UIInterfaceOrientation.portrait
//镜像
videoCamera.horizontallyMirrorRearFacingCamera = false
videoCamera.horizontallyMirrorFrontFacingCamera = true
videoCamera.addTarget(filter as! GPUImageInput!)
filter?.addTarget(filterVideoView)
beginScale = 1.0
endScale = 1.0
videoCamera.startCapture()
}
deinit {
cachingImageManager()
AlbumItems = []
}
override var prefersStatusBarHidden: Bool {
return true
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
videoCamera.startCapture()
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
videoCamera.stopCapture()
}
}
extension CameraController: UIGestureRecognizerDelegate {
func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
if gestureRecognizer.isKind(of: UIPinchGestureRecognizer.self) {
beginScale = endScale
}
return true
}
}
extension CameraController: CAAnimationDelegate {
func animationDidStop(_ anim: CAAnimation, finished flag: Bool) {
perform(#selector(focusLayerNormal), with: self, afterDelay: 0.5)
}
func focusLayerNormal() {
filterVideoView?.isUserInteractionEnabled = true
focusLayer?.isHidden = true
}
}
// MARK:- =============相册
class AlbumItem {
//相簿名称
var title: String?
//相簿内资源
var fetchResult: PHFetchResult<PHAsset>
init(title: String?, fetchResult: PHFetchResult<PHAsset>) {
self.title = title
self.fetchResult = fetchResult
}
}
| apache-2.0 | e31b11e58f03209a8f34d78a202d789c | 37.5 | 188 | 0.61029 | 5.115888 | false | false | false | false |
UIKit0/VPNOn | VPNOn/LTVPNStatusCell.swift | 25 | 1344 | //
// LTVPNStatusCell.swift
// VPNOn
//
// Created by Lex Tang on 12/12/14.
// Copyright (c) 2014 LexTang.com. All rights reserved.
//
import UIKit
import NetworkExtension
let kLTVPNStatusCellID = "StatusCell"
class LTVPNStatusCell : UITableViewCell {
@IBOutlet weak var statusLabel: LTMorphingLabel!
@IBOutlet weak var VPNSwitch: UISwitch!
func delay(delay:Double, closure:()->()) {
dispatch_after(
dispatch_time(
DISPATCH_TIME_NOW,
Int64(delay * Double(NSEC_PER_SEC))
),
dispatch_get_main_queue(), closure)
}
func configureCellWithStatus(status: NEVPNStatus) {
switch status {
case NEVPNStatus.Connecting:
statusLabel.text = "Connecting..."
VPNSwitch.enabled = false
break
case NEVPNStatus.Connected:
statusLabel.text = "Connected"
VPNSwitch.setOn(true, animated: true)
VPNSwitch.enabled = true
break
case NEVPNStatus.Disconnecting:
statusLabel.text = "Disconnecting..."
VPNSwitch.enabled = false
break
default:
VPNSwitch.setOn(false, animated: true)
VPNSwitch.enabled = true
statusLabel.text = "Not Connected"
}
}
} | mit | 7eacc97f9fcd4977e5d6751f2a505332 | 26.44898 | 56 | 0.583333 | 4.421053 | false | false | false | false |
yukiasai/Nori | Sources/Operators.swift | 1 | 299 | //
// Operators.swift
// Nori
//
// Created by yukiasai on 11/22/16.
// Copyright © 2016 yukiasai. All rights reserved.
//
infix operator ??=
public func ??=<T>(left: inout T?, right: T?) {
left = right ?? left
}
public func ??=<T>(left: inout T, right: T?) {
left = right ?? left
}
| mit | baa2564041ade83fefd615bcab1206c0 | 16.529412 | 51 | 0.583893 | 2.838095 | false | false | false | false |
ja-mes/experiments | iOS/mvc-test/mvc-test/ViewController.swift | 1 | 675 | //
// ViewController.swift
// mvc-test
//
// Created by James Brown on 8/14/16.
// Copyright © 2016 James Brown. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var fullName: UILabel!
@IBOutlet weak var renameField: UITextField!
var person = Person(first: "Joe", last: "Blah")
override func viewDidLoad() {
super.viewDidLoad()
fullName.text = person.fullName
}
@IBAction func renamePressed(_ sender: AnyObject) {
if let txt = renameField.text {
person.firstName = txt
fullName.text = person.fullName
}
}
}
| mit | 4e7b04d878af8ea5ed4b53b1b3ba8ab7 | 18.823529 | 55 | 0.605341 | 4.348387 | false | false | false | false |
wibosco/WhiteBoardCodingChallenges | WhiteBoardCodingChallenges/Challenges/CrackingTheCodingInterview/PalindromePermutation/PalindromePermutation.swift | 1 | 1773 | //
// PalindromePermutation.swift
// WhiteBoardCodingChallenges
//
// Created by William Boles on 30/05/2016.
// Copyright © 2016 Boles. All rights reserved.
//
import Foundation
//CtCI 1.4
class PalindromePermutation: NSObject {
class func premutationCanBePalindrome(original: String) -> Bool {
let spacesRemovedOriginal = original.replacingOccurrences(of: " ", with: "").lowercased()
if spacesRemovedOriginal.count < 2 {
return false
}
//Not sure if we need this shortcut?
if spacesRemovedOriginal.count == 2 {
if spacesRemovedOriginal[spacesRemovedOriginal.startIndex] == spacesRemovedOriginal[spacesRemovedOriginal.index(spacesRemovedOriginal.endIndex, offsetBy: -1)] {
return true
} else {
return false
}
}
let occurrences = countOccurrencesOfCharacters(original: spacesRemovedOriginal)
var foundOddValue = false
for count in occurrences.values {
if count % 2 != 0 {
if foundOddValue {
return false
} else {
foundOddValue = true
}
}
}
return true
}
class func countOccurrencesOfCharacters(original: String) -> [String : Int] {
var occurrences = [String : Int]()
for character in original {
if occurrences[String(character)] != nil {
let count = occurrences[String(character)]!
occurrences[String(character)] = count+1
} else {
occurrences[String(character)] = 1
}
}
return occurrences
}
}
| mit | 55fea6b6e7b85ec839ac979a2a6f8459 | 27.126984 | 172 | 0.558691 | 5.211765 | false | false | false | false |
mpangburn/RayTracer | RayTracer/View Controllers/FrequentlyAskedQuestionsTableViewController.swift | 1 | 4153 | //
// FrequentlyAskedQuestionsTableViewController.swift
// RayTracer
//
// Created by Michael Pangburn on 7/27/17.
// Copyright © 2017 Michael Pangburn. All rights reserved.
//
import UIKit
final class FrequentlyAskedQuestionsTableViewController: InformationTableViewController {
override func viewDidLoad() {
super.viewDidLoad()
self.title = NSLocalizedString("FAQs", comment: "The title text for the screen displaying frequently asked questions")
}
enum Section: Int {
case longRenderingTime
case invisibleSphere
case blackSphere
case frameSlidersMoving
static let count = 4
}
enum Row: Int {
case question
case answer
static let count = 2
}
// MARK: - Table view data source
override func numberOfSections(in tableView: UITableView) -> Int {
return Section.count
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return Row.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: basicCellReuseIdentifier, for: indexPath)
cell.textLabel?.numberOfLines = 0
let row = Row(rawValue: indexPath.row)!
let calloutFont = UIFont.preferredFont(forTextStyle: .callout)
var text: String
switch row {
case .question:
let boldDescriptor = calloutFont.fontDescriptor.withSymbolicTraits(.traitBold)!
let boldCalloutFont = UIFont(descriptor: boldDescriptor, size: 0)
cell.textLabel?.font = boldCalloutFont
text = "\(indexPath.section + 1). "
case .answer:
cell.textLabel?.font = calloutFont
text = "• "
}
switch Section(rawValue: indexPath.section)! {
case .longRenderingTime:
switch row {
case .question:
text += NSLocalizedString("Why does my image take so long to render?", comment: "The text for the question regarding long rendering time")
case .answer:
text += NSLocalizedString("Pixel-by-pixel image rendering is a computationally intensive task. Reduce the size of the frame to improve rendering time.", comment: "The answer to the question regarding long rendering time")
}
case .invisibleSphere:
switch row {
case .question:
text += NSLocalizedString("Why can't I see my sphere?", comment: "The text for the question regarding an invisible sphere")
case .answer:
text += NSLocalizedString("Many factors affect a sphere's visibility in the scene: its position, its radius, the other spheres in the scene, the eye point, and the view frame.", comment: "The answer to the question regarding an invisible sphere")
}
case .blackSphere:
switch row {
case .question:
text += NSLocalizedString("Why is my sphere black?", comment: "The text for the question regarding spheres appearing black")
case .answer:
text += NSLocalizedString("A sphere will appear black if the ambient component of its finish is zero, i.e. the sphere reflects no ambient light.", comment: "The answer to the question regarding spheres appearing black")
}
case .frameSlidersMoving:
switch row {
case .question:
text += NSLocalizedString("Why are the frame sliders moving together?", comment: "The text for the question regarding frame sliders moving together")
case .answer:
text += NSLocalizedString("When the frame's aspect ratio is set to a value other than freeform, the frame's coordinate bounds and size are automatically adjusted to fit that aspect ratio when their values are changed.", comment: "The answer to the question regarding frame sliders moving together")
}
}
cell.textLabel?.text = text
return cell
}
}
| mit | eedfae6ba63db6f98dfc5ecabe4c8e9b | 41.346939 | 314 | 0.649639 | 5.279898 | false | false | false | false |
zhou9734/Warm | Warm/Classes/Home/View/SubjectSalonTableViewCell.swift | 1 | 4381 | //
// SubjectSalonTableViewCell.swift
// Warm
//
// Created by zhoucj on 16/9/23.
// Copyright © 2016年 zhoucj. All rights reserved.
//
import UIKit
class SubjectSalonTableViewCell: UITableViewCell {
//type = 2
var item: WItem?{
didSet{
guard let _item = item else{
return
}
guard let salon = _item.salon else {
return
}
guard let user = salon.user else {
return
}
postImageView.sd_setImageWithURL(NSURL(string: salon.avatar!), placeholderImage: placeholderImage)
descLbl.text = salon.title
iconImageView.sd_setImageWithURL(NSURL(string: user.avatar!), placeholderImage: placeholderImage)
nicknameLbl.text = user.nickname
contentView.layoutIfNeeded()
}
}
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
setupConstaint()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func setupUI(){
contentView.addSubview(bgView)
contentView.addSubview(postImageView)
contentView.addSubview(tagImageView)
contentView.addSubview(descLbl)
contentView.addSubview(iconImageView)
contentView.addSubview(nicknameLbl)
}
private func setupConstaint(){
bgView.snp_makeConstraints { (make) -> Void in
make.left.equalTo(contentView.snp_left).offset(15)
make.right.equalTo(contentView.snp_right).offset(-15)
make.top.equalTo(contentView.snp_top).offset(10)
make.bottom.equalTo(contentView.snp_bottom).offset(-10)
}
postImageView.snp_makeConstraints { (make) -> Void in
make.top.equalTo(bgView.snp_top).offset(10)
make.left.equalTo(bgView.snp_left).offset(10)
make.bottom.equalTo(bgView.snp_bottom).offset(-10)
make.width.equalTo(ScreenWidth * 0.5)
}
tagImageView.snp_makeConstraints { (make) -> Void in
make.top.equalTo(bgView.snp_top).offset(5)
make.left.equalTo(bgView.snp_left).offset(5)
make.width.equalTo(50)
make.height.equalTo(19)
}
descLbl.snp_makeConstraints { (make) -> Void in
make.top.equalTo(bgView.snp_top).offset(10)
make.left.equalTo(postImageView.snp_right).offset(10)
make.right.equalTo(bgView.snp_right).offset(-10)
make.height.equalTo(55)
}
iconImageView.snp_makeConstraints { (make) -> Void in
make.bottom.equalTo(bgView.snp_bottom).offset(-10)
make.left.equalTo(postImageView.snp_right).offset(10)
make.size.equalTo(CGSize(width: 24, height: 24))
}
nicknameLbl.snp_makeConstraints { (make) -> Void in
make.left.equalTo(iconImageView.snp_right).offset(3)
make.bottom.equalTo(bgView.snp_bottom).offset(-15)
make.right.equalTo(bgView.snp_right).offset(-10)
}
}
private lazy var bgView: UIView = {
let v = UIView()
v.backgroundColor = SpliteColor
v.layer.cornerRadius = 6
v.layer.masksToBounds = true
return v
}()
private lazy var postImageView : UIImageView = {
let iv = UIImageView()
let bgSize = self.bgView.frame.size
return iv
}()
private lazy var tagImageView: UIImageView = {
let iv = UIImageView()
iv.image = UIImage(named: "shalonLabel_35x13_")
return iv
}()
private lazy var descLbl: UILabel = {
let lbl = UILabel()
lbl.numberOfLines = 0
lbl.textColor = UIColor.grayColor()
lbl.textAlignment = .Left
lbl.font = UIFont.systemFontOfSize(15)
return lbl
}()
private lazy var iconImageView: UIImageView = {
let iv = UIImageView()
iv.layer.cornerRadius = 12
iv.layer.masksToBounds = true
return iv
}()
private lazy var nicknameLbl: UILabel = {
let lbl = UILabel()
lbl.textColor = UIColor.darkGrayColor()
lbl.textAlignment = .Left
lbl.font = UIFont.systemFontOfSize(14)
return lbl
}()
}
| mit | f448897428e26e8d8144c081ea86a44f | 33.472441 | 110 | 0.602558 | 4.369261 | false | false | false | false |
february29/Learning | swift/Fch_Contact/Pods/HandyJSON/Source/Measuable.swift | 4 | 2772 | //
// Measuable.swift
// HandyJSON
//
// Created by zhouzhuo on 15/07/2017.
// Copyright © 2017 aliyun. All rights reserved.
//
import Foundation
typealias Byte = Int8
public protocol _Measurable {}
extension _Measurable {
// locate the head of a struct type object in memory
mutating func headPointerOfStruct() -> UnsafeMutablePointer<Byte> {
return withUnsafeMutablePointer(to: &self) {
return UnsafeMutableRawPointer($0).bindMemory(to: Byte.self, capacity: MemoryLayout<Self>.stride)
}
}
// locating the head of a class type object in memory
mutating func headPointerOfClass() -> UnsafeMutablePointer<Byte> {
let opaquePointer = Unmanaged.passUnretained(self as AnyObject).toOpaque()
let mutableTypedPointer = opaquePointer.bindMemory(to: Byte.self, capacity: MemoryLayout<Self>.stride)
return UnsafeMutablePointer<Byte>(mutableTypedPointer)
}
// locating the head of an object
mutating func headPointer() -> UnsafeMutablePointer<Byte> {
if Self.self is AnyClass {
return self.headPointerOfClass()
} else {
return self.headPointerOfStruct()
}
}
func isNSObjectType() -> Bool {
return (type(of: self) as? NSObject.Type) != nil
}
func getBridgedPropertyList() -> Set<String> {
if let anyClass = type(of: self) as? AnyClass {
return _getBridgedPropertyList(anyClass: anyClass)
}
return []
}
func _getBridgedPropertyList(anyClass: AnyClass) -> Set<String> {
if !(anyClass is HandyJSON.Type) {
return []
}
var propertyList = Set<String>()
if let superClass = class_getSuperclass(anyClass), superClass != NSObject.self {
propertyList = propertyList.union(_getBridgedPropertyList(anyClass: superClass))
}
let count = UnsafeMutablePointer<UInt32>.allocate(capacity: 1)
if let props = class_copyPropertyList(anyClass, count) {
for i in 0 ..< count.pointee {
let name = String(cString: property_getName(props.advanced(by: Int(i)).pointee))
propertyList.insert(name)
}
}
return propertyList
}
// memory size occupy by self object
static func size() -> Int {
return MemoryLayout<Self>.size
}
// align
static func align() -> Int {
return MemoryLayout<Self>.alignment
}
// Returns the offset to the next integer that is greater than
// or equal to Value and is a multiple of Align. Align must be
// non-zero.
static func offsetToAlignment(value: Int, align: Int) -> Int {
let m = value % align
return m == 0 ? 0 : (align - m)
}
}
| mit | 2e8a3755845570e403a0f0e40c2ecf6c | 30.134831 | 110 | 0.629737 | 4.476575 | false | false | false | false |
manhpro/website | iOSQuiz-master/iOSQuiz-master/LeoiOSQuiz/Classes/Services/API/APIUrl.swift | 1 | 530 | //
// APIUrl.swift
// LeoiOSQuiz
//
// Created by NeoLap on 4/15/17.
// Copyright © 2017 Leo LE. All rights reserved.
//
import UIKit
struct APIUrl {
static let endPoint = "https://api.yelp.com/v3/"
//Get access token
static let getAccessToken = "https://api.yelp.com/oauth2/token?grant_type=client_credentials&client_id=%@&client_secret=%@"
//Get retaurants
static let getRestaurants = endPoint + "businesses/search"
static let getRestaurantReviews = endPoint + "businesses/%@/reviews"
}
| cc0-1.0 | 63b5b22d87f8e4300e112acbdae21ff6 | 25.45 | 127 | 0.676749 | 3.480263 | false | false | false | false |
felimuno/FMProgressBarView | FMProgressBarView/FMProgressBarView.swift | 1 | 8392 | //
// FMProgressBarView.swift
// FMProgressBarViewDemo
//
// Created by felipe munoz on 7/8/15.
// Copyright (c) 2015 felipe munoz. All rights reserved.
//
import UIKit
@IBDesignable public class FMProgressBarView: UIView {
// Our custom view from the XIB file
var view: UIView!
@IBOutlet weak var backgroundImage: UIImageView!
var loadingImage:UIImage!
var completedImage:UIImage!
override init(frame: CGRect) {
super.init(frame: frame)
xibSetup()
}
required public init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
xibSetup()
}
@IBInspectable public var borderColor: UIColor = UIColor.clearColor() {
didSet {
layer.borderColor = borderColor.CGColor
}
}
@IBInspectable public var cornerRadius: CGFloat = 1.0 {
didSet {
layer.cornerRadius = cornerRadius
}
}
@IBInspectable public var borderWidth: CGFloat = 1.0 {
didSet {
layer.borderWidth = borderWidth
self.updateBar()
}
}
@IBInspectable public var title: String = "" {
didSet {
self.updateImages()
self.updateBar()
}
}
@IBInspectable public var titleLoadingColor: UIColor = UIColor.blackColor() {
didSet {
self.updateImages()
self.updateBar()
}
}
@IBInspectable public var titleCompletedColor: UIColor = UIColor.blueColor() {
didSet {
self.updateImages()
self.updateBar()
}
}
@IBInspectable public var backgroundLoadingColor: UIColor = UIColor.redColor() {
didSet {
self.updateImages()
self.updateBar()
}
}
@IBInspectable public var backgroundCompletedColor: UIColor = UIColor.yellowColor() {
didSet {
self.updateImages()
self.updateBar()
}
}
@IBInspectable public var backgroundImageLoading: UIImage? = nil {
didSet {
self.updateImages()
self.updateBar()
}
}
@IBInspectable public var backgroundImageCompleted: UIImage? = nil {
didSet {
self.updateImages()
self.updateBar()
}
}
@IBInspectable public var progressPercent: CGFloat = 0 {
didSet {
if(progressPercent >= 0 && progressPercent <= 1.0){
self.updateBar()
}
}
}
@IBInspectable public var useImages: Bool = false {
didSet {
self.updateImages()
self.updateBar()
}
}
public var titleFont: UIFont = UIFont.systemFontOfSize(25.0) {
didSet {
self.updateImages()
self.updateBar()
}
}
func xibSetup() {
view = loadViewFromNib()
// use bounds not frame or it'll be offset
view.frame = bounds
// Make the view stretch with containing view
view.autoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight
// Adding custom subview on top of our view (over any custom drawing > see note below)
addSubview(view)
}
func loadViewFromNib() -> UIView {
let bundle = NSBundle(forClass: self.dynamicType)
let nib = UINib(nibName: "FMProgressBarView", bundle: bundle)
// Assumes UIView is top level and only object in CustomView.xib file
let view = nib.instantiateWithOwner(self, options: nil)[0] as! UIView
return view
}
func updateImages(){
if(!self.useImages || self.backgroundImageLoading == nil || self.backgroundImageCompleted == nil ){
self.loadingImage = self.getBarImage(self.backgroundLoadingColor,textColor:self.titleLoadingColor)
self.completedImage = self.getBarImage(self.backgroundCompletedColor,textColor:self.titleCompletedColor)
}
else{
self.loadingImage = self.getBarCustomImage(self.backgroundImageLoading!, textColor: titleLoadingColor)
self.completedImage = self.getBarCustomImage(self.backgroundImageCompleted!, textColor: self.titleCompletedColor)
}
}
func updateBar(){
if(self.loadingImage == nil || self.completedImage == nil){
self.useImages = false
self.updateImages()
}
self.backgroundImage.image = self.getMixedImages(progressPercent, im1:self.completedImage, im2:self.loadingImage)
self.backgroundImage.clipsToBounds = true
self.layer.masksToBounds = true
}
func getMixedImages(percent:CGFloat,im1:UIImage,im2:UIImage)->UIImage{
UIGraphicsBeginImageContext(im1.size)
im1.drawInRect(CGRectMake(0,0,im1.size.width,im1.size.height))
if(percent > 0 && percent <= 1.0){
var newRect = CGRectMake(0,0,ceil(im1.size.width*percent),im1.size.height)
var croppedImage:CGImageRef = CGImageCreateWithImageInRect (im2.CGImage, newRect)
UIImage(CGImage:croppedImage)!.drawInRect(CGRectMake(0,0,ceil(im1.size.width*percent),im1.size.height))
}
var newImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return newImage
}
/*generating image with color background*/
func getBarImage(color:UIColor, textColor:UIColor)->UIImage{
// Setup text parameters
let aFont = self.titleFont
var loadingText:NSString = self.title as NSString
var style:NSMutableParagraphStyle = NSParagraphStyle.defaultParagraphStyle().mutableCopy() as! NSMutableParagraphStyle
style.alignment = NSTextAlignment.Center
let attr:CFDictionaryRef = [NSFontAttributeName:aFont,NSForegroundColorAttributeName:textColor,NSParagraphStyleAttributeName:style]
var textSize = loadingText.sizeWithAttributes(attr as [NSObject : AnyObject])
//draw text in view
let viewSize = self.view.frame.size
UIGraphicsBeginImageContext(viewSize)
let context = UIGraphicsGetCurrentContext()
// set the fill color
color.setFill()
let rect = CGRectMake(0, 0, viewSize.width, viewSize.height)
CGContextAddRect(context, rect)
CGContextDrawPath(context,kCGPathFill)
loadingText.drawInRect(CGRectMake(rect.origin.x,
rect.origin.y + (rect.size.height - textSize.height)/2.0,
rect.size.width,
textSize.height), withAttributes: attr as [NSObject : AnyObject])
var coloredImg = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return coloredImg
}
/*generating image with custom background*/
func getBarCustomImage(image:UIImage, textColor:UIColor)->UIImage{
// Setup text parameters
let aFont = self.titleFont
var loadingText:NSString = self.title as NSString
var style:NSMutableParagraphStyle = NSParagraphStyle.defaultParagraphStyle().mutableCopy() as! NSMutableParagraphStyle
style.alignment = NSTextAlignment.Center
let attr:CFDictionaryRef = [NSFontAttributeName:aFont,NSForegroundColorAttributeName:textColor,NSParagraphStyleAttributeName:style]
var textSize = loadingText.sizeWithAttributes(attr as [NSObject : AnyObject])
//draw text in view
let viewSize = self.view.frame.size
UIGraphicsBeginImageContext(viewSize)
let context = UIGraphicsGetCurrentContext()
let rect = CGRectMake(0, 0, viewSize.width, viewSize.height)
CGContextDrawImage(context, rect, image.CGImage);
loadingText.drawInRect(CGRectMake(rect.origin.x,
rect.origin.y + (rect.size.height - textSize.height)/2.0,
rect.size.width,
textSize.height), withAttributes: attr as [NSObject : AnyObject])
var coloredImg = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return coloredImg
}
} | mit | 81555b60e1e69ac5385ea00347ea6cc8 | 32.842742 | 139 | 0.617255 | 5.218905 | false | false | false | false |
jesshmusic/MarkovAnalyzer | MarkovAnalyzer/Chord.swift | 1 | 21999 | //
// Chord.swift
// MarkovAn
//
// Created by Fupduck Central MBP on 5/28/15.
// Copyright (c) 2015 Existential Music. All rights reserved.
//
import Cocoa
class Chord: Hashable {
var chordConnections: [Chord: Int]!
var totalOccurences: Int = 1
var totalConnections: Double = 0.0
internal private(set) var chordName: String = "N/A"
internal private(set) var enharmonicChordNames = [String]()
var romanNumeral: String = "I"
var keySig: KeySignature = KeySignature(keyName: "C major")
internal private(set) var root: Note!
internal private(set) var third: Note?
internal private(set) var fifth: Note?
internal private(set) var seventh: Note?
internal private(set) var ninth: Note?
internal private(set) var eleventh: Note?
internal private(set) var thirteenth: Note?
internal private(set) var bass: Note!
// Note values
internal private(set) var chordMembers = [Note]()
internal private(set) var stackedChordMembers = [Note]()
init(root: Note,
third: Note? = nil,
fifth: Note? = nil,
seventh: Note? = nil,
ninth: Note? = nil,
eleventh: Note? = nil,
thirteenth: Note? = nil,
bassNote: Note)
{
self.root = root
self.third = third
self.fifth = fifth
self.seventh = seventh
self.ninth = ninth
self.eleventh = eleventh
self.thirteenth = thirteenth
self.bass = bassNote
self.chordConnections = [Chord: Int]()
self.setChordNameFromMembers()
}
init(notes: [Note]) {
self.bass = self.findLowestNote(notes)
self.stackChordInThirds(notes)
self.setChordNameFromMembers()
self.chordConnections = [Chord: Int]()
print("********\tStack notes: ")
for nextNote in self.stackedChordMembers {
print("\(nextNote.noteName): \t\t\(nextNote.noteNumber)")
}
}
init(chordName: String, rootNoteNumber: Int, bassNoteNumber: Int) {
self.chordName = chordName
self.root = Note(noteNumber: rootNoteNumber)
self.bass = Note(noteNumber: bassNoteNumber)
}
init() {
self.chordConnections = [Chord: Int]()
}
// init(chordName: String, romanNumeral: String? = nil) {
// self.chordName = chordName
// if romanNumeral != nil {
// self.romanNumeral = romanNumeral!
// }
// self.chordConnections = [Chord: Int]()
// }
var hashValue: Int {
return self.chordName.hashValue
}
func selectEnharmonic(chordName: String) {
if let selectedEnharmonicIndex = self.enharmonicChordNames.indexOf(chordName) {
self.chordName = self.enharmonicChordNames[selectedEnharmonicIndex]
}
}
private func stackChordInThirds(notes: [Note])
{
self.chordMembers = notes
var mutableNotes = [Note]()
for note in notes {
mutableNotes.append(Note(noteNumber: note.noteNumber))
}
let thirdIntervals = [3, 4, 6, 7, 10, 11]
var isStackedInThirds = false
while !isStackedInThirds {
mutableNotes = mutableNotes.sort({$0.noteNumber < $1.noteNumber})
var intervalsChanged = false
for index in 1..<mutableNotes.count {
let interval = mutableNotes[index].noteNumber - mutableNotes[index - 1].noteNumber
if !thirdIntervals.contains(interval) {
mutableNotes[index].noteNumber = mutableNotes[index].noteNumber - 12
intervalsChanged = true
break
}
}
if !intervalsChanged {
isStackedInThirds = true
}
}
// Set individual chord members
self.root = mutableNotes[0]
for index in 1..<mutableNotes.count {
let note = mutableNotes[index]
let interval = note.noteNumber - self.root.noteNumber
switch interval {
case 3, 4:
self.third = self.chordMembers[self.chordMembers.indexOf(note)!]
case 6, 7, 8:
self.fifth = self.chordMembers[self.chordMembers.indexOf(note)!]
case 9, 10, 11:
self.seventh = self.chordMembers[self.chordMembers.indexOf(note)!]
case 13, 14, 15:
self.ninth = self.chordMembers[self.chordMembers.indexOf(note)!]
case 16, 17, 18:
if self.third == nil && interval == 16 {
self.third = self.chordMembers[self.chordMembers.indexOf(note)!]
} else {
self.eleventh = self.chordMembers[self.chordMembers.indexOf(note)!]
}
default:
self.thirteenth = self.chordMembers[self.chordMembers.indexOf(note)!]
}
}
self.stackedChordMembers = mutableNotes
}
private func setChordNameFromMembers() {
var suffix = ""
let rootNoteNumber = self.stackedChordMembers[self.stackedChordMembers.indexOf(self.root)!].noteNumber
var thirdNoteNumber: Int!
var fifthNoteNumber: Int!
var seventhNoteNumber: Int!
var ninthNoteNumber: Int!
var eleventhNoteNumber: Int!
var thirteenthNoteNumber: Int!
var baseChordNames = [String]()
// Create suffix for triad
if self.third != nil {
thirdNoteNumber = self.stackedChordMembers[self.stackedChordMembers.indexOf(self.third!)!].noteNumber
if self.fifth != nil {
fifthNoteNumber = self.stackedChordMembers[self.stackedChordMembers.indexOf(self.fifth!)!].noteNumber
if ((thirdNoteNumber - rootNoteNumber == 3) && (fifthNoteNumber - rootNoteNumber == 7)) {
suffix = suffix + "m"
baseChordNames = self.createBaseChordNames(suffix)
} else if ((thirdNoteNumber - rootNoteNumber == 3) && (fifthNoteNumber - rootNoteNumber == 6)) {
suffix = suffix + "dim"
baseChordNames = self.createBaseChordNames(suffix)
} else if ((thirdNoteNumber - rootNoteNumber == 4) && (fifthNoteNumber - rootNoteNumber == 8)) {
suffix = suffix + "+"
baseChordNames = self.createBaseChordNames(suffix)
} else if ((thirdNoteNumber - rootNoteNumber == 16) && (fifthNoteNumber - rootNoteNumber == 6) && self.seventh != nil) {
if self.seventh!.noteNumber - rootNoteNumber == 10 {
suffix = "7b5"
} else if self.seventh!.noteNumber - rootNoteNumber == 11 {
suffix = "maj7b5"
}
baseChordNames = self.createBaseChordNames("")
} else {
baseChordNames = self.createBaseChordNames("")
}
} else {
if thirdNoteNumber - rootNoteNumber == 3 {
suffix = suffix + "m"
baseChordNames = self.createBaseChordNames(suffix)
} else {
baseChordNames = self.createBaseChordNames("")
}
}
} else if self.fifth != nil {
fifthNoteNumber = self.stackedChordMembers[self.stackedChordMembers.indexOf(self.fifth!)!].noteNumber
if fifthNoteNumber - rootNoteNumber == 7 {
suffix = suffix + "5"
baseChordNames = self.createBaseChordNames("")
} else if fifthNoteNumber - rootNoteNumber == 6 {
suffix = suffix + "dim"
baseChordNames = self.createBaseChordNames(suffix)
}
} else {
baseChordNames = self.createBaseChordNames("")
}
// Suffix could be : "", m, dim, +, 5
// Alter suffix for extended harmonies
if self.seventh != nil {
seventhNoteNumber = self.stackedChordMembers[self.stackedChordMembers.indexOf(self.seventh!)!].noteNumber
if seventhNoteNumber - rootNoteNumber == 9 {
switch suffix {
case "dim":
suffix = suffix + "7"
case "5":
suffix = "b7"
default:
suffix = suffix + "b7"
}
} else if seventhNoteNumber - rootNoteNumber == 10 {
switch suffix {
case "dim":
suffix = "7b5"
case "5":
suffix = "7"
case "7b5":
suffix = "7b5"
case "maj7b5":
suffix = "maj7b5"
default:
suffix = suffix + "7"
}
} else if seventhNoteNumber - rootNoteNumber == 11 {
switch suffix {
case "m":
suffix = "m(maj7)"
case "dim":
suffix = "dim(maj7)"
case "5":
suffix = "maj7"
default:
suffix = suffix + "maj7"
}
}
}
// Suffix could be: "", m, dim, +, 5, dim7, b7, mb7, +b7, 7b5, 7, m7, +7, m(maj7), dim(maj7), maj7, +maj7
if self.ninth != nil {
ninthNoteNumber = self.stackedChordMembers[self.stackedChordMembers.indexOf(self.ninth!)!].noteNumber
if ninthNoteNumber - rootNoteNumber == 13 {
switch suffix {
case "", "5":
suffix = "addb9"
case "m" :
suffix = "m(b9)"
case "dim" :
suffix = "dim(b9)"
case "+" :
suffix = "+(b9)"
case "maj7":
suffix = "maj7(b9)"
case "dim7":
suffix = "dim(b9)"
case "7":
suffix = "(b9)"
case "m(maj7)":
suffix = "mb9(maj7)"
case "dim(maj7)":
suffix = "dimb9(maj7)"
case "m7":
suffix = "m7(b9)"
case "7b5":
suffix = "7b5(b9)"
default:
suffix = suffix + "b9"
}
// suffix = suffix + "b9"
} else if ninthNoteNumber - rootNoteNumber == 14 {
switch suffix {
case "", "5":
suffix = "add9"
case "m" :
suffix = "m(add9)"
case "dim" :
suffix = "dim(add9)"
case "+" :
suffix = "+(add9)"
case "maj7":
suffix = "maj9"
case "dim7":
suffix = "dim9"
case "7":
suffix = "9"
case "m(maj7)":
suffix = "m9(maj7)"
case "dim(maj7)":
suffix = "dim9(maj7)"
case "m7":
suffix = "m9"
case "7b5":
suffix = "m9b5"
default:
suffix = suffix + "9"
}
} else if ninthNoteNumber - rootNoteNumber == 15 {
switch suffix {
case "", "5":
suffix = "add#9"
case "m" :
suffix = "m(add#9)"
case "dim" :
suffix = "dim(add#9)"
case "+" :
suffix = "+(add#9)"
case "maj7":
suffix = "maj7(#9)"
case "dim7":
suffix = "dim(#9)"
case "7":
suffix = "(#9)"
case "m(maj7)":
suffix = "m#9(maj7)"
case "dim(maj7)":
suffix = "dim#9(maj7)"
case "m7":
suffix = "m7(#9)"
case "7b5":
suffix = "7b5(#9)"
default:
suffix = suffix + "#9"
}
// suffix = suffix + "#9"
}
}
// Suffix could be: "", m, dim, +, 5, dim7, b7, mb7, +b7, 7b5, 7, m7, +7, m(maj7), dim(maj7), maj7, +maj7, add9, m(add9), dim(add9), +(add9), maj9, dim9, 9, m9(maj7), dim9(maj7), m9, m9b5
if self.eleventh != nil {
eleventhNoteNumber = self.stackedChordMembers[self.stackedChordMembers.indexOf(self.eleventh!)!].noteNumber
if eleventhNoteNumber - rootNoteNumber == 16 {
switch suffix {
case "", "5":
suffix = "addb11"
case "m" :
suffix = "m(addb11)"
case "dim" :
suffix = "dim(addb11)"
case "+" :
suffix = "+(addb11)"
case "maj9":
suffix = "majb11"
case "dim9":
suffix = "dim(b11)"
case "9":
suffix = "(b11)"
case "m9(maj7)":
suffix = "m b11(maj7)"
case "dim9(maj7)":
suffix = "dim b11(maj7)"
case "m9":
suffix = "m b11"
case "m9b5":
suffix = "m b11b5"
default:
suffix = suffix + "(b11)"
}
} else if eleventhNoteNumber - rootNoteNumber == 17 {
switch suffix {
case "", "5":
suffix = "add11"
case "m" :
suffix = "m(add11)"
case "dim" :
suffix = "dim(add11)"
case "+" :
suffix = "+(add11)"
case "maj9":
suffix = "maj11"
case "dim9":
suffix = "dim11"
case "9":
suffix = "11"
case "m9(maj7)":
suffix = "m11(maj7)"
case "dim9(maj7)":
suffix = "dim11(maj7)"
case "m9":
suffix = "m11"
case "m9b5":
suffix = "m11b5"
default:
suffix = suffix + "(add11)"
}
} else if eleventhNoteNumber - rootNoteNumber == 18 {
switch suffix {
case "", "5":
suffix = "add#11"
case "m" :
suffix = "m(add#11)"
case "dim" :
suffix = "dim(add#11)"
case "+" :
suffix = "+(add#11)"
case "maj9":
suffix = "maj#11"
case "dim9":
suffix = "dim#11"
case "9":
suffix = "(#11)"
case "m9(maj7)":
suffix = "m#11(maj7)"
case "dim9(maj7)":
suffix = "dim#11(maj7)"
case "m9":
suffix = "m#11"
case "m9b5":
suffix = "m#11b5"
default:
suffix = suffix + "(add#11)"
}
}
}
if self.thirteenth != nil {
thirteenthNoteNumber = self.stackedChordMembers[self.stackedChordMembers.indexOf(self.thirteenth!)!].noteNumber
if thirteenthNoteNumber - rootNoteNumber == 20 {
suffix = suffix + "(b13)"
} else if thirteenthNoteNumber - rootNoteNumber == 21{
suffix = suffix + "(13)"
} else if thirteenthNoteNumber - rootNoteNumber == 22 {
suffix = suffix + "(#13)"
}
}
self.appendChordName(suffix, baseChordNames: baseChordNames)
}
private func createBaseChordNames(suffix: String) -> [String] {
var baseChordNames = [String]()
for index in 0..<2 {
let rootNoteName = self.root.enharmonicNoteNames[index]
baseChordNames.append(rootNoteName + suffix)
}
return baseChordNames
}
private func appendChordName(suffix: String, baseChordNames: [String]) {
self.setEnharmonicChordNames(suffix, baseChordNames: baseChordNames)
self.chordName = self.enharmonicChordNames[0]
}
private func setEnharmonicChordNames(chordSuffix: String, var baseChordNames: [String]) {
for index in 0..<2 {
self.enharmonicChordNames.append("\(self.root.enharmonicNoteNames[index])\(chordSuffix)")
}
if chordSuffix == "7" && self.fifth != nil {
for index in 0..<2 {
self.addEnharmonicChordName("\(self.root.enharmonicNoteNames[index])(Ger+6)")
baseChordNames.append(baseChordNames[index])
}
} else if chordSuffix == "7" && self.fifth == nil {
for index in 0..<2 {
self.addEnharmonicChordName("\(self.root.enharmonicNoteNames[index])(It+6)")
baseChordNames.append(baseChordNames[index])
}
} else if chordSuffix == "7b5" {
for index in 0..<2 {
self.addEnharmonicChordName("\(self.root.enharmonicNoteNames[index])(Fre+6)")
baseChordNames.append(self.root.enharmonicNoteNames[index])
}
for index in 0..<2 {
self.addEnharmonicChordName("\(self.fifth!.enharmonicNoteNames[index])(Fre+6)")
baseChordNames.append(self.fifth!.enharmonicNoteNames[index])
}
}
self.addBassNote(baseChordNames)
}
private func addEnharmonicChordName(enChordName: String) {
if !self.enharmonicChordNames.contains(enChordName) {
self.enharmonicChordNames.append(enChordName)
}
}
private func addBassNote(baseChordNames: [String]) {
let slash = "/"
var bassNoteIndex = [Int]()
for baseChordName in baseChordNames {
bassNoteIndex.append(self.getBassNoteIndexForChordBase(baseChordName))
}
for index in 0..<self.enharmonicChordNames.count {
if index < self.bass.enharmonicNoteNames.count {
if self.root.noteName != self.bass.noteName {
self.enharmonicChordNames[index] = self.enharmonicChordNames[index] + slash + self.bass.enharmonicNoteNames[bassNoteIndex[index]]
}
}
}
}
private func getBassNoteIndexForChordBase(baseChord: String) -> Int {
print("Base chord: \(baseChord)")
switch baseChord {
case "C", "Cm", "Cdim", "Db", "Dm", "Ddim", "Eb", "F", "Fm", "Fdim", "Gb", "Gm", "Gdim", "Ab", "Bb":
return 0
case "D", "E", "G", "A", "B", "Bm", "C#m", "Em", "F#m", "G#m", "Am", "C+", "D+", "F+", "G+":
return 1
case "Ebm", "Ebdim", "Gbm", "Gbdim", "Abm", "Abdim", "Bbm", "Bbdim":
return 2
default:
return 3
}
}
func hasChordConnectionToChord(chord: Chord) -> Bool {
var retVal = false
for chordConnection in self.chordConnections {
if chordConnection.0 == chord {
retVal = true
}
}
return retVal
}
func addChordConnection(chord: Chord) {
if self.chordConnections[chord] != nil {
self.chordConnections[chord]!++
} else {
self.chordConnections[chord] = 1
}
self.totalConnections++
}
func removeChordConnection(chord: Chord) {
if self.chordConnections[chord] != nil {
let totConn = --self.chordConnections[chord]!
if totConn == 0 {
self.chordConnections.removeValueForKey(chord)
}
self.totalConnections--
}
}
func getProbabilityOfNextForChord(chord: Chord) -> Double {
if self.chordConnections[chord] != nil {
return Double(self.chordConnections[chord]!) / Double(self.totalConnections)
}
return 0.0
}
private func findLowestNote(notes: [Note]) -> Note {
var lowestNote = Note(noteName: "C", noteNumber: 264)
for note in notes {
if note.noteNumber < lowestNote.noteNumber {
lowestNote = note
}
}
return lowestNote
}
func chordDescription() -> String {
var descriptionString = "\(self.chordName):\n\tRoot:\t\t\(self.root.noteName): \(self.root.noteNumber)\n"
descriptionString = descriptionString + "\t3rd:\t\t\t\(self.third?.noteName): \(self.third?.noteNumber)\n"
descriptionString = descriptionString + "\t5th:\t\t\t\(self.fifth?.noteName): \(self.fifth?.noteNumber)\n"
descriptionString = descriptionString + "\t7th:\t\t\t\(self.seventh?.noteName): \(self.seventh?.noteNumber)\n"
descriptionString = descriptionString + "\t9th:\t\t\t\(self.ninth?.noteName): \(self.ninth?.noteNumber)\n"
descriptionString = descriptionString + "\t11th:\t\t\(self.eleventh?.noteName): \(self.eleventh?.noteNumber)\n"
descriptionString = descriptionString + "\t13th:\t\t\(self.thirteenth?.noteName): \(self.thirteenth?.noteNumber)\n"
descriptionString = descriptionString + "\tBass:\t\t\(self.bass.noteName): \(self.bass.noteNumber)\n\n"
return descriptionString
}
}
func == (chordOne: Chord, chordTwo: Chord) -> Bool {
return chordOne.chordName == chordTwo.chordName
}
| mit | ed1ec4fcbaefa3a37438c4c4a7459984 | 37.192708 | 196 | 0.488159 | 4.235464 | false | false | false | false |
wrutkowski/Lucid-Weather-Clock | Pods/ForecastIO/Source/DataBlock.swift | 1 | 1557 | //
// DataBlock.swift
// ForecastIO
//
// Created by Satyam Ghodasara on 7/18/15.
// Copyright (c) 2015 Satyam. All rights reserved.
//
import Foundation
/// Weather data for a specific location over a period of time.
public struct DataBlock {
/// A human-readable text summary.
public let summary: String?
/// A machine-readable summary of the weather suitable for selecting an icon for display.
public let icon: Icon?
/// `DataPoint`s ordered by time, which describe the weather conditions at the requested location over time.
public let data: Array<DataPoint>?
/**
Creates a new `DataBlock` from a JSON object.
- parameter fromJSON: A JSON object with keys corresponding to the `DataBlock`'s properties.
- returns: A new `DataBlock` filled with data from the given JSON object.
*/
public init(fromJSON json: NSDictionary) {
if let jsonSummary = json["summary"] as? String {
summary = jsonSummary
} else {
summary = nil
}
if let jsonIcon = json["icon"] as? String {
icon = Icon(rawValue: jsonIcon)
} else {
icon = nil
}
if let jsonData = json["data"] as? Array<NSDictionary> {
var tempData = [DataPoint]()
for jsonDataPoint in jsonData {
tempData.append(DataPoint(fromJSON: jsonDataPoint))
}
data = tempData
} else {
data = nil
}
}
}
| mit | 8e644de0183c74255a8d867fed8db39c | 27.833333 | 112 | 0.583173 | 4.59292 | false | false | false | false |
GraphKit/GraphKit | Sources/CompoundString.swift | 5 | 3845 | /*
* The MIT License (MIT)
*
* Copyright (C) 2019, CosmicMind, Inc. <http://cosmicmind.com>.
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import Foundation
/**
Compound strings into a single Predicate.
### Example
```swift
let compoundString: CompoundString = ("T1" && "T2") || !"T3"
let predicate = compoundString.predicate(with "X ==")
print(predicate)
// prints: (X == "T1" AND X == "T2") OR NOT (X == "T3")
```
*/
public struct CompoundString: ExpressibleByStringLiteral {
/// A reference to NSPredicate.
private let predicate: NSPredicate
/**
Initialize a CompoundString with given array of CompoundString by compounding
them into a single predicate using provided logical type.
- Parameter _ compounds: An array of CompoundString.
- Parameter type: An NSCompoundPredicate.LogicalType.
*/
fileprivate init(_ compounds: [CompoundString], type: NSCompoundPredicate.LogicalType) {
self.predicate = NSCompoundPredicate(type: type, subpredicates: compounds.map { $0.predicate })
}
/// Initialze CompoundString with FALSEPREDICATE.
init() {
self.predicate = NSPredicate(value: false)
}
/**
Initialize CompoundString with string literal value.
- Parameter stringLiteral value: An StringLiteralType.
*/
public init(stringLiteral value: StringLiteralType) {
self.predicate = NSPredicate(format: "__REPLACE__ == %@", value)
}
/**
Create a Predicate by replacing placeholder with the given format.
- Parameter with format: A String.
- Returns: A Predicate having the provided format.
*/
internal func predicate(with format: String) -> Predicate {
let format = predicate.predicateFormat.replacingOccurrences(of: "__REPLACE__ ==", with: format)
let predicates = [NSPredicate(format: format)]
return Predicate(predicates)
}
}
/**
An operator to compound given two CompoundString into
a single CompoundString using AND logic.
- Parameter left: A CompoundString.
- Parameter right: A CompoundString.
- Returns: A single CompoundString.
*/
public func &&(left: CompoundString, right: CompoundString) -> CompoundString {
return CompoundString([left, right], type: .and)
}
/**
An operator to compound given two CompoundString into
a single CompoundString using OR logic.
- Parameter left: A CompoundString.
- Parameter right: A CompoundString.
- Returns: A single CompoundString.
*/
public func ||(left: CompoundString, right: CompoundString) -> CompoundString {
return CompoundString([left, right], type: .or)
}
/**
A prefix operator to negate given CompoundString.
- Parameter compound: A CompoundString.
- Returns: A negated CompoundString.
*/
public prefix func !(compound: CompoundString) -> CompoundString {
return CompoundString([compound], type: .not)
}
| agpl-3.0 | 7677b98c9ce9be9681926588f6eacc00 | 35.273585 | 99 | 0.729519 | 4.374289 | false | false | false | false |
allbto/WayThere | ios/WayThere/Pods/Nimble/Nimble/Matchers/RaisesException.swift | 76 | 10051 | import Foundation
internal struct RaiseExceptionMatchResult {
var success: Bool
var nameFailureMessage: FailureMessage?
var reasonFailureMessage: FailureMessage?
var userInfoFailureMessage: FailureMessage?
}
internal func raiseExceptionMatcher(matches: (NSException?, SourceLocation) -> RaiseExceptionMatchResult) -> MatcherFunc<Any> {
return MatcherFunc { actualExpression, failureMessage in
failureMessage.actualValue = nil
var exception: NSException?
var capture = NMBExceptionCapture(handler: ({ e in
exception = e
}), finally: nil)
capture.tryBlock {
actualExpression.evaluate()
return
}
let result = matches(exception, actualExpression.location)
failureMessage.postfixMessage = "raise exception"
if let nameFailureMessage = result.nameFailureMessage {
failureMessage.postfixMessage += " with name \(nameFailureMessage.postfixMessage)"
}
if let reasonFailureMessage = result.reasonFailureMessage {
failureMessage.postfixMessage += " with reason \(reasonFailureMessage.postfixMessage)"
}
if let userInfoFailureMessage = result.userInfoFailureMessage {
failureMessage.postfixMessage += " with userInfo \(userInfoFailureMessage.postfixMessage)"
}
if result.nameFailureMessage == nil && result.reasonFailureMessage == nil
&& result.userInfoFailureMessage == nil {
failureMessage.postfixMessage = "raise any exception"
}
return result.success
}
}
// A Nimble matcher that succeeds when the actual expression raises an exception, which name,
// reason and userInfo match successfully with the provided matchers
public func raiseException(
named: NonNilMatcherFunc<String>? = nil,
reason: NonNilMatcherFunc<String>? = nil,
userInfo: NonNilMatcherFunc<NSDictionary>? = nil) -> MatcherFunc<Any> {
return raiseExceptionMatcher() { exception, location in
var matches = exception != nil
var nameFailureMessage: FailureMessage?
if let nameMatcher = named {
let wrapper = NonNilMatcherWrapper(NonNilBasicMatcherWrapper(nameMatcher))
nameFailureMessage = FailureMessage()
matches = wrapper.matches(
Expression(expression: { exception?.name },
location: location,
isClosure: false),
failureMessage: nameFailureMessage!) && matches
}
var reasonFailureMessage: FailureMessage?
if let reasonMatcher = reason {
let wrapper = NonNilMatcherWrapper(NonNilBasicMatcherWrapper(reasonMatcher))
reasonFailureMessage = FailureMessage()
matches = wrapper.matches(
Expression(expression: { exception?.reason },
location: location,
isClosure: false),
failureMessage: reasonFailureMessage!) && matches
}
var userInfoFailureMessage: FailureMessage?
if let userInfoMatcher = userInfo {
let wrapper = NonNilMatcherWrapper(NonNilBasicMatcherWrapper(userInfoMatcher))
userInfoFailureMessage = FailureMessage()
matches = wrapper.matches(
Expression(expression: { exception?.userInfo },
location: location,
isClosure: false),
failureMessage: userInfoFailureMessage!) && matches
}
return RaiseExceptionMatchResult(
success: matches,
nameFailureMessage: nameFailureMessage,
reasonFailureMessage: reasonFailureMessage,
userInfoFailureMessage: userInfoFailureMessage)
}
}
/// A Nimble matcher that succeeds when the actual expression raises an exception with
/// the specified name, reason, and userInfo.
public func raiseException(#named: String, #reason: String, #userInfo: NSDictionary) -> MatcherFunc<Any> {
return raiseException(named: equal(named), reason: equal(reason), userInfo: equal(userInfo))
}
/// A Nimble matcher that succeeds when the actual expression raises an exception with
/// the specified name and reason.
public func raiseException(#named: String, #reason: String) -> MatcherFunc<Any> {
return raiseException(named: equal(named), reason: equal(reason))
}
/// A Nimble matcher that succeeds when the actual expression raises an exception with
/// the specified name.
public func raiseException(#named: String) -> MatcherFunc<Any> {
return raiseException(named: equal(named))
}
@objc public class NMBObjCRaiseExceptionMatcher : NMBMatcher {
var _name: String?
var _reason: String?
var _userInfo: NSDictionary?
var _nameMatcher: NMBMatcher?
var _reasonMatcher: NMBMatcher?
var _userInfoMatcher: NMBMatcher?
init(name: String?, reason: String?, userInfo: NSDictionary?) {
_name = name
_reason = reason
_userInfo = userInfo
}
init(nameMatcher: NMBMatcher?, reasonMatcher: NMBMatcher?, userInfoMatcher: NMBMatcher?) {
_nameMatcher = nameMatcher
_reasonMatcher = reasonMatcher
_userInfoMatcher = userInfoMatcher
}
public func matches(actualBlock: () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool {
let block: () -> Any? = ({ actualBlock(); return nil })
let expr = Expression(expression: block, location: location)
if _nameMatcher != nil || _reasonMatcher != nil || _userInfoMatcher != nil {
return raiseExceptionMatcher() {
exception, location in
var matches = exception != nil
var nameFailureMessage: FailureMessage?
if let nameMatcher = self._nameMatcher {
nameFailureMessage = FailureMessage()
matches = nameMatcher.matches({ exception?.name },
failureMessage: nameFailureMessage!,
location: location) && matches
}
var reasonFailureMessage: FailureMessage?
if let reasonMatcher = self._reasonMatcher {
reasonFailureMessage = FailureMessage()
matches = reasonMatcher.matches({ exception?.reason },
failureMessage: reasonFailureMessage!,
location: location) && matches
}
var userInfoFailureMessage: FailureMessage?
if let userInfoMatcher = self._userInfoMatcher {
userInfoFailureMessage = FailureMessage()
matches = userInfoMatcher.matches({ exception?.userInfo },
failureMessage: userInfoFailureMessage!,
location: location) && matches
}
return RaiseExceptionMatchResult(
success: matches,
nameFailureMessage: nameFailureMessage,
reasonFailureMessage: reasonFailureMessage,
userInfoFailureMessage: userInfoFailureMessage)
}.matches(expr, failureMessage: failureMessage)
} else if let name = _name, reason = _reason, userInfo = _userInfo {
return raiseException(named: name, reason: reason, userInfo: userInfo).matches(expr, failureMessage: failureMessage)
} else if let name = _name, reason = _reason {
return raiseException(named: name, reason: reason).matches(expr, failureMessage: failureMessage)
} else if let name = _name {
return raiseException(named: name).matches(expr, failureMessage: failureMessage)
} else {
return raiseException().matches(expr, failureMessage: failureMessage)
}
}
public func doesNotMatch(actualBlock: () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool {
return !matches(actualBlock, failureMessage: failureMessage, location: location)
}
public var named: (name: String) -> NMBObjCRaiseExceptionMatcher {
return ({ name in
return NMBObjCRaiseExceptionMatcher(name: name, reason: self._reason, userInfo: self._userInfo)
})
}
public var reason: (reason: String?) -> NMBObjCRaiseExceptionMatcher {
return ({ reason in
return NMBObjCRaiseExceptionMatcher(name: self._name, reason: reason, userInfo: self._userInfo)
})
}
public var userInfo: (userInfo: NSDictionary?) -> NMBObjCRaiseExceptionMatcher {
return ({ userInfo in
return NMBObjCRaiseExceptionMatcher(name: self._name, reason: self._reason, userInfo: userInfo)
})
}
public var withName: (nameMatcher: NMBMatcher) -> NMBObjCRaiseExceptionMatcher {
return ({ nameMatcher in
return NMBObjCRaiseExceptionMatcher(nameMatcher: nameMatcher,
reasonMatcher: self._reasonMatcher, userInfoMatcher: self._userInfoMatcher)
})
}
public var withReason: (reasonMatcher: NMBMatcher) -> NMBObjCRaiseExceptionMatcher {
return ({ reasonMatcher in
return NMBObjCRaiseExceptionMatcher(nameMatcher: self._nameMatcher,
reasonMatcher: reasonMatcher, userInfoMatcher: self._userInfoMatcher)
})
}
public var withUserInfo: (userInfoMatcher: NMBMatcher) -> NMBObjCRaiseExceptionMatcher {
return ({ userInfoMatcher in
return NMBObjCRaiseExceptionMatcher(nameMatcher: self._nameMatcher,
reasonMatcher: self._reasonMatcher, userInfoMatcher: userInfoMatcher)
})
}
}
extension NMBObjCMatcher {
public class func raiseExceptionMatcher() -> NMBObjCRaiseExceptionMatcher {
return NMBObjCRaiseExceptionMatcher(name: nil, reason: nil, userInfo: nil)
}
}
| mit | 64a711fb11dbbeea53f0629397cac186 | 41.588983 | 128 | 0.63914 | 5.898474 | false | false | false | false |
lanjing99/RxSwiftDemo | 10-combining-operators-in-practice/starter/OurPlanet/OurPlanet/Model/EOEvent.swift | 5 | 2475 | /*
* Copyright (c) 2016 Razeware LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import Foundation
struct EOEvent {
let id: String
let title: String
let description: String
let link: URL?
let closeDate: Date?
let categories: [Int]
let locations: [EOLocation]
init?(json: [String: Any]) {
guard let id = json["id"] as? String,
let title = json["title"] as? String,
let description = json["description"] as? String,
let link = json["link"] as? String,
let closeDate = json["closed"] as? String,
let categories = json["categories"] as? [[String: Any]] else {
return nil
}
self.id = id
self.title = title
self.description = description
self.link = URL(string: link)
self.closeDate = EONET.ISODateReader.date(from: closeDate)
self.categories = categories.flatMap { categoryDesc in
guard let catID = categoryDesc["id"] as? Int else {
return nil
}
return catID
}
if let geometries = json["geometries"] as? [[String: Any]] {
locations = geometries.flatMap(EOLocation.init)
} else {
locations = []
}
}
static func compareDates(lhs: EOEvent, rhs: EOEvent) -> Bool {
switch (lhs.closeDate, rhs.closeDate) {
case (nil, nil): return false
case (nil, _): return true
case (_, nil): return false
case (let ldate, let rdate): return ldate! < rdate!
}
}
}
| mit | 9334cf55d4b87b478fc3e94d9f20f13d | 34.869565 | 80 | 0.676768 | 4.104478 | false | false | false | false |
synchromation/Buildasaur | Buildasaur/BranchWatchingViewController.swift | 1 | 6371 | //
// BranchWatchingViewController.swift
// Buildasaur
//
// Created by Honza Dvorsky on 23/05/2015.
// Copyright (c) 2015 Honza Dvorsky. All rights reserved.
//
import Foundation
import AppKit
import BuildaGitServer
import BuildaUtils
import BuildaKit
import ReactiveCocoa
protocol BranchWatchingViewControllerDelegate: class {
func didUpdateWatchedBranches(branches: [String])
}
private struct ShowableBranch {
let name: String
let pr: Int?
}
class BranchWatchingViewController: NSViewController, NSTableViewDelegate, NSTableViewDataSource {
//these two must be set before viewDidLoad by its presenting view controller
var syncer: HDGitHubXCBotSyncer!
var watchedBranchNames: Set<String>!
weak var delegate: BranchWatchingViewControllerDelegate?
private var branches: [ShowableBranch] = []
@IBOutlet weak var branchActivityIndicator: NSProgressIndicator!
@IBOutlet weak var branchesTableView: NSTableView!
override func viewDidLoad() {
super.viewDidLoad()
assert(self.syncer != nil, "Syncer has not been set")
self.watchedBranchNames = Set(self.syncer.config.value.watchedBranchNames)
self.branchesTableView.columnAutoresizingStyle = .UniformColumnAutoresizingStyle
}
override func viewWillAppear() {
super.viewWillAppear()
let branches = self.fetchBranchesProducer()
let prs = self.fetchPRsProducer()
let combined = combineLatest(branches, prs)
let showables = combined.on(next: { [weak self] _ in
self?.branchActivityIndicator.startAnimation(nil)
}).map { branches, prs -> [ShowableBranch] in
//map branches to PR numbers
let mappedPRs = prs.dictionarifyWithKey { $0.head.ref }
return branches.map {
let pr = mappedPRs[$0.name]?.number
return ShowableBranch(name: $0.name, pr: pr)
}
}
showables.start(Event.sink(error: { (error) -> () in
UIUtils.showAlertWithError(error)
}, completed: { [weak self] () -> () in
self?.branchActivityIndicator.stopAnimation(nil)
}, next: { [weak self] (branches) -> () in
self?.branches = branches
self?.branchesTableView.reloadData()
}))
}
func fetchBranchesProducer() -> SignalProducer<[Branch], NSError> {
let repoName = self.syncer.project.githubRepoName()!
return SignalProducer { [weak self] sink, _ in
guard let sself = self else { return }
sself.syncer.github.getBranchesOfRepo(repoName) { (branches, error) -> () in
if let error = error {
sendError(sink, error)
} else {
sendNext(sink, branches!)
sendCompleted(sink)
}
}
}.observeOn(UIScheduler())
}
func fetchPRsProducer() -> SignalProducer<[PullRequest], NSError> {
let repoName = self.syncer.project.githubRepoName()!
return SignalProducer { [weak self] sink, _ in
guard let sself = self else { return }
sself.syncer.github.getOpenPullRequests(repoName) { (prs, error) -> () in
if let error = error {
sendError(sink, error)
} else {
sendNext(sink, prs!)
sendCompleted(sink)
}
}
}.observeOn(UIScheduler())
}
@IBAction func cancelTapped(sender: AnyObject) {
self.dismissController(nil)
}
@IBAction func doneTapped(sender: AnyObject) {
let updated = Array(self.watchedBranchNames)
self.delegate?.didUpdateWatchedBranches(updated)
self.dismissController(nil)
}
//MARK: branches table view
func numberOfRowsInTableView(tableView: NSTableView) -> Int {
if tableView == self.branchesTableView {
return self.branches.count
}
return 0
}
func getTypeOfReusableView<T: NSView>(column: String) -> T {
guard let view = self.branchesTableView.makeViewWithIdentifier(column, owner: self) else {
fatalError("Couldn't get a reusable view for column \(column)")
}
guard let typedView = view as? T else {
fatalError("Couldn't type view \(view) into type \(T.className())")
}
return typedView
}
func tableView(tableView: NSTableView, viewForTableColumn tableColumn: NSTableColumn?, row: Int) -> NSView? {
guard let tcolumn = tableColumn else { return nil }
let columnIdentifier = tcolumn.identifier
let branch = self.branches[row]
switch columnIdentifier {
case "name":
let view: NSTextField = self.getTypeOfReusableView(columnIdentifier)
var name = branch.name
if let pr = branch.pr {
name += " (watched as PR #\(pr))"
}
view.stringValue = name
return view
case "enabled":
let checkbox: BuildaNSButton = self.getTypeOfReusableView(columnIdentifier)
if let _ = branch.pr {
checkbox.on = true
checkbox.enabled = false
} else {
checkbox.on = self.watchedBranchNames.contains(branch.name)
checkbox.enabled = true
}
checkbox.row = row
return checkbox
default:
return nil
}
}
@IBAction func branchesTableViewRowCheckboxTapped(sender: BuildaNSButton) {
//toggle selection in model
let branch = self.branches[sender.row!]
let branchName = branch.name
//see if we are checking or unchecking
let previouslyEnabled = self.watchedBranchNames.contains(branchName)
if previouslyEnabled {
//disable
self.watchedBranchNames.remove(branchName)
} else {
//enable
self.watchedBranchNames.insert(branchName)
}
}
} | mit | 4b99b2711dcc73e9e75d8b7de9210fbf | 31.510204 | 113 | 0.579187 | 5.200816 | false | false | false | false |
IngmarStein/swift | stdlib/public/core/EmptyCollection.swift | 4 | 4915 | //===--- EmptyCollection.swift - A collection with no elements ------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
// Sometimes an operation is best expressed in terms of some other,
// larger operation where one of the parameters is an empty
// collection. For example, we can erase elements from an Array by
// replacing a subrange with the empty collection.
//
//===----------------------------------------------------------------------===//
/// An iterator that never produces an element.
///
/// - SeeAlso: `EmptyCollection<Element>`.
public struct EmptyIterator<Element> : IteratorProtocol, Sequence {
/// Creates an instance.
public init() {}
/// Returns `nil`, indicating that there are no more elements.
public mutating func next() -> Element? {
return nil
}
}
/// A collection whose element type is `Element` but that is always empty.
public struct EmptyCollection<Element> :
RandomAccessCollection, MutableCollection
{
/// A type that represents a valid position in the collection.
///
/// Valid indices consist of the position of every element and a
/// "past the end" position that's not valid for use as a subscript.
public typealias Index = Int
public typealias IndexDistance = Int
public typealias SubSequence = EmptyCollection<Element>
/// Creates an instance.
public init() {}
/// Always zero, just like `endIndex`.
public var startIndex: Index {
return 0
}
/// Always zero, just like `startIndex`.
public var endIndex: Index {
return 0
}
/// Always traps.
///
/// `EmptyCollection` does not have any element indices, so it is not
/// possible to advance indices.
public func index(after i: Index) -> Index {
_preconditionFailure("EmptyCollection can't advance indices")
}
/// Always traps.
///
/// `EmptyCollection` does not have any element indices, so it is not
/// possible to advance indices.
public func index(before i: Index) -> Index {
_preconditionFailure("EmptyCollection can't advance indices")
}
/// Returns an empty iterator.
public func makeIterator() -> EmptyIterator<Element> {
return EmptyIterator()
}
/// Accesses the element at the given position.
///
/// Must never be called, since this collection is always empty.
public subscript(position: Index) -> Element {
get {
_preconditionFailure("Index out of range")
}
set {
_preconditionFailure("Index out of range")
}
}
public subscript(bounds: Range<Index>) -> EmptyCollection<Element> {
get {
_precondition(bounds.lowerBound == 0 && bounds.upperBound == 0,
"Index out of range")
return self
}
set {
_precondition(bounds.lowerBound == 0 && bounds.upperBound == 0,
"Index out of range")
}
}
/// The number of elements (always zero).
public var count: Int {
return 0
}
public func index(_ i: Index, offsetBy n: IndexDistance) -> Index {
_precondition(i == startIndex && n == 0, "Index out of range")
return i
}
public func index(
_ i: Index, offsetBy n: IndexDistance, limitedBy limit: Index
) -> Index? {
_precondition(i == startIndex && limit == startIndex,
"Index out of range")
return n == 0 ? i : nil
}
/// The distance between two indexes (always zero).
public func distance(from start: Index, to end: Index) -> IndexDistance {
_precondition(start == 0, "From must be startIndex (or endIndex)")
_precondition(end == 0, "To must be endIndex (or startIndex)")
return 0
}
public func _failEarlyRangeCheck(_ index: Index, bounds: Range<Index>) {
_precondition(index == 0, "out of bounds")
_precondition(bounds == Range(indices),
"invalid bounds for an empty collection")
}
public func _failEarlyRangeCheck(
_ range: Range<Index>, bounds: Range<Index>
) {
_precondition(range == Range(indices),
"invalid range for an empty collection")
_precondition(bounds == Range(indices),
"invalid bounds for an empty collection")
}
public typealias Indices = CountableRange<Int>
}
extension EmptyCollection : Equatable {
public static func == (
lhs: EmptyCollection<Element>, rhs: EmptyCollection<Element>
) -> Bool {
return true
}
}
@available(*, unavailable, renamed: "EmptyIterator")
public struct EmptyGenerator<Element> {}
extension EmptyIterator {
@available(*, unavailable, renamed: "makeIterator()")
public func generate() -> EmptyIterator<Element> {
Builtin.unreachable()
}
}
| apache-2.0 | 027ae4078987e58f0bf04cbf13641c20 | 29.339506 | 80 | 0.652085 | 4.550926 | false | false | false | false |
playstones/NEKit | src/IPStack/Packet/IPMutablePacket.swift | 2 | 2917 | import Foundation
enum ChangeType {
case Address, Port
}
public class IPMutablePacket {
// Support only IPv4 for now
let version: IPVersion
let proto: TransportType
let IPHeaderLength: Int
var sourceAddress: IPv4Address {
get {
return IPv4Address(fromBytesInNetworkOrder: payload.bytes.advancedBy(12))
}
set {
setIPv4Address(sourceAddress, newAddress: newValue, at: 12)
}
}
var destinationAddress: IPv4Address {
get {
return IPv4Address(fromBytesInNetworkOrder: payload.bytes.advancedBy(16))
}
set {
setIPv4Address(destinationAddress, newAddress: newValue, at: 16)
}
}
let payload: NSMutableData
public init(payload: NSData) {
let vl = UnsafePointer<UInt8>(payload.bytes).memory
version = IPVersion(rawValue: vl >> 4)!
IPHeaderLength = Int(vl & 0x0F) * 4
let p = UnsafePointer<UInt8>(payload.bytes.advancedBy(9)).memory
proto = TransportType(rawValue: p)!
self.payload = NSMutableData(data: payload)
}
func updateChecksum(oldValue: UInt16, newValue: UInt16, type: ChangeType) {
if type == .Address {
updateChecksum(oldValue, newValue: newValue, at: 10)
}
}
// swiftlint:disable:next variable_name
internal func updateChecksum(oldValue: UInt16, newValue: UInt16, at: Int) {
let oldChecksum = UnsafePointer<UInt16>(payload.bytes.advancedBy(at)).memory
let oc32 = UInt32(~oldChecksum)
let ov32 = UInt32(~oldValue)
let nv32 = UInt32(newValue)
var newChecksum32 = oc32 &+ ov32 &+ nv32
newChecksum32 = (newChecksum32 & 0xFFFF) + (newChecksum32 >> 16)
newChecksum32 = (newChecksum32 & 0xFFFF) &+ (newChecksum32 >> 16)
var newChecksum = ~UInt16(newChecksum32)
payload.replaceBytesInRange(NSRange(location: at, length: 2), withBytes: &newChecksum, length: 2)
}
// swiftlint:disable:next variable_name
private func foldChecksum(checksum: UInt32) -> UInt32 {
var checksum = checksum
while checksum > 0xFFFF {
checksum = (checksum & 0xFFFF) + (checksum >> 16)
}
return checksum
}
// swiftlint:disable:next variable_name
private func setIPv4Address(oldAddress: IPv4Address, newAddress: IPv4Address, at: Int) {
payload.replaceBytesInRange(NSRange(location: at, length: 4), withBytes: newAddress.bytesInNetworkOrder, length: 4)
updateChecksum(UnsafePointer<UInt16>(oldAddress.bytesInNetworkOrder).memory, newValue: UnsafePointer<UInt16>(newAddress.bytesInNetworkOrder).memory, type: .Address)
updateChecksum(UnsafePointer<UInt16>(oldAddress.bytesInNetworkOrder).advancedBy(1).memory, newValue: UnsafePointer<UInt16>(newAddress.bytesInNetworkOrder).advancedBy(1).memory, type: .Address)
}
}
| bsd-3-clause | 5bed8fe7a29a6a36061614d0784c61b0 | 37.381579 | 204 | 0.66301 | 4.239826 | false | false | false | false |
tlax/GaussSquad | GaussSquad/Model/Keyboard/Keyboards/MKeyboardPortrait.swift | 1 | 2786 | import Foundation
class MKeyboardPortrait:MKeyboard
{
init(states:[MKeyboardState]?, initial:String)
{
let item0:MKeyboardRowItem0 = MKeyboardRowItem0()
let item1:MKeyboardRowItem1 = MKeyboardRowItem1()
let item2:MKeyboardRowItem2 = MKeyboardRowItem2()
let item3:MKeyboardRowItem3 = MKeyboardRowItem3()
let item4:MKeyboardRowItem4 = MKeyboardRowItem4()
let item5:MKeyboardRowItem5 = MKeyboardRowItem5()
let item6:MKeyboardRowItem6 = MKeyboardRowItem6()
let item7:MKeyboardRowItem7 = MKeyboardRowItem7()
let item8:MKeyboardRowItem8 = MKeyboardRowItem8()
let item9:MKeyboardRowItem9 = MKeyboardRowItem9()
let itemDot:MKeyboardRowItemDot = MKeyboardRowItemDot()
let itemSign:MKeyboardRowItemSign = MKeyboardRowItemSign()
let itemClear:MKeyboardRowItemClear = MKeyboardRowItemClear()
let itemBackspace:MKeyboardRowItemBackspace = MKeyboardRowItemBackspace()
let itemPercent:MKeyboardRowItemPercent = MKeyboardRowItemPercent()
let itemDivide:MKeyboardRowItemDivide = MKeyboardRowItemDivide()
let itemMultiply:MKeyboardRowItemMultiply = MKeyboardRowItemMultiply()
let itemSubtract:MKeyboardRowItemSubtract = MKeyboardRowItemSubtract()
let itemAdd:MKeyboardRowItemAdd = MKeyboardRowItemAdd()
let itemEquals:MKeyboardRowItemEquals = MKeyboardRowItemEquals()
let itemsFirstRow:[MKeyboardRowItem] = [
itemClear,
itemBackspace,
itemSign,
itemDivide]
let itemsSecondRow:[MKeyboardRowItem] = [
item7,
item8,
item9,
itemMultiply]
let itemsThirdRow:[MKeyboardRowItem] = [
item4,
item5,
item6,
itemSubtract]
let itemsFourthRow:[MKeyboardRowItem] = [
item1,
item2,
item3,
itemAdd]
let itemsFifthRow:[MKeyboardRowItem] = [
item0,
itemDot,
itemPercent,
itemEquals]
let firstRow:MKeyboardRow = MKeyboardRow(
items:itemsFirstRow)
let secondRow:MKeyboardRow = MKeyboardRow(
items:itemsSecondRow)
let thirdRow:MKeyboardRow = MKeyboardRow(
items:itemsThirdRow)
let fourthRow:MKeyboardRow = MKeyboardRow(
items:itemsFourthRow)
let fifthRow:MKeyboardRow = MKeyboardRow(
items:itemsFifthRow)
let rows:[MKeyboardRow] = [
firstRow,
secondRow,
thirdRow,
fourthRow,
fifthRow]
super.init(rows:rows, states:states, initial:initial)
}
}
| mit | 2780b95bb377877b94dfdfdcc62e789f | 35.657895 | 81 | 0.629935 | 4.508091 | false | false | false | false |
johnno1962d/swift | test/attr/attributes.swift | 1 | 8049 | // RUN: %target-parse-verify-swift
@unknown func f0() {} // expected-error{{unknown attribute 'unknown'}}
enum binary {
case Zero
case One
init() { self = .Zero }
}
func f5(x: inout binary) {}
//===---
//===--- IB attributes
//===---
@IBDesignable
class IBDesignableClassTy {
@IBDesignable func foo() {} // expected-error {{@IBDesignable cannot be applied to this declaration}} {{3-17=}}
}
@IBDesignable // expected-error {{@IBDesignable cannot be applied to this declaration}} {{1-15=}}
struct IBDesignableStructTy {}
@IBDesignable // expected-error {{@IBDesignable cannot be applied to this declaration}} {{1-15=}}
protocol IBDesignableProtTy {}
@IBDesignable // expected-error {{@IBDesignable can only be applied to classes and extensions of classes}} {{1-15=}}
extension IBDesignableStructTy {}
class IBDesignableClassExtensionTy {}
@IBDesignable // okay
extension IBDesignableClassExtensionTy {}
class Inspect {
@IBInspectable var value : Int = 0
@IBInspectable func foo() {} // expected-error {{@IBInspectable may only be used on 'var' declarations}} {{3-18=}}
@IBInspectable class var cval: Int { return 0 } // expected-error {{only instance properties can be declared @IBInspectable}} {{3-18=}}
}
@IBInspectable var ibinspectable_global : Int // expected-error {{only instance properties can be declared @IBInspectable}} {{1-16=}}
func foo(x: @convention(block) Int) {} // expected-error {{@convention attribute only applies to function types}}
func foo(x: @convention(block) (Int) -> Int) {}
@_transparent
func zim() {}
@_transparent
func zung<T>(_: T) {}
@_transparent // expected-error{{@_transparent cannot be applied to stored properties}} {{1-15=}}
var zippity : Int
func zoom(x: @_transparent () -> ()) { } // expected-error{{attribute can only be applied to declarations, not types}} {{1-1=@_transparent }} {{14-28=}}
protocol ProtoWithTransparent {
@_transparent// expected-error{{@_transparent is not supported on declarations within protocols}} {{3-16=}}
func transInProto()
}
class TestTranspClass : ProtoWithTransparent {
@_transparent // expected-error{{@_transparent is not supported on declarations within classes}} {{3-17=}}
init () {}
@_transparent // expected-error{{@_transparent cannot be applied to this declaration}} {{3-17=}}
deinit {}
@_transparent // expected-error{{@_transparent is not supported on declarations within classes}} {{3-17=}}
class func transStatic() {}
@_transparent// expected-error{{@_transparent is not supported on declarations within classes}} {{3-16=}}
func transInProto() {}
}
struct TestTranspStruct : ProtoWithTransparent{
@_transparent
init () {}
@_transparent
init <T> (x : T) { }
@_transparent
static func transStatic() {}
@_transparent
func transInProto() {}
}
@_transparent // expected-error{{@_transparent cannot be applied to this declaration}} {{1-15=}}
struct CannotHaveTransparentStruct {
func m1() {}
}
@_transparent // expected-error{{@_transparent is only supported on struct and enum extensions}} {{1-15=}}
extension TestTranspClass {
func tr1() {}
}
@_transparent
extension TestTranspStruct {
func tr1() {}
}
@_transparent
extension binary {
func tr1() {}
}
class transparentOnCalssVar {
@_transparent var max: Int { return 0xFF }; // expected-error {{@_transparent is not supported on declarations within classes}} {{3-17=}}
func blah () {
var _: Int = max
}
};
class transparentOnCalssVar2 {
var max: Int {
@_transparent // expected-error {{@_transparent is not supported on declarations within classes}} {{5-19=}}
get {
return 0xFF
}
}
func blah () {
var _: Int = max
}
};
@thin // expected-error {{attribute can only be applied to types, not declarations}}
func testThinDecl() -> () {}
protocol Class : class {}
protocol NonClass {}
@objc
class Ty0 : Class, NonClass {
init() { }
}
// Attributes that should be reported by parser as unknown
// See rdar://19533915
@__accessibility struct S__accessibility {} // expected-error{{unknown attribute '__accessibility'}}
@__raw_doc_comment struct S__raw_doc_comment {} // expected-error{{unknown attribute '__raw_doc_comment'}}
@__objc_bridged struct S__objc_bridged {} // expected-error{{unknown attribute '__objc_bridged'}}
weak
var weak0 : Ty0?
weak
var weak0x : Ty0?
weak unowned var weak1 : Ty0? // expected-error {{duplicate modifier}} expected-note {{modifier already specified here}}
weak weak var weak2 : Ty0? // expected-error {{duplicate modifier}} expected-note {{modifier already specified here}}
unowned var weak3 : Ty0
unowned var weak3a : Ty0
unowned(safe) var weak3b : Ty0
unowned(unsafe) var weak3c : Ty0
unowned unowned var weak4 : Ty0 // expected-error {{duplicate modifier}} expected-note {{modifier already specified here}}
unowned weak var weak5 : Ty0 // expected-error {{duplicate modifier}} expected-note {{modifier already specified here}}
weak
var weak6 : Int // expected-error {{'weak' may only be applied to class and class-bound protocol types, not 'Int'}}
unowned
var weak7 : Int // expected-error {{'unowned' may only be applied to class and class-bound protocol types, not 'Int'}}
weak
var weak8 : Class? = Ty0()
unowned var weak9 : Class = Ty0()
weak
var weak10 : NonClass = Ty0() // expected-error {{'weak' may not be applied to non-class-bound protocol 'NonClass'; consider adding a class bound}}
unowned
var weak11 : NonClass = Ty0() // expected-error {{'unowned' may not be applied to non-class-bound protocol 'NonClass'; consider adding a class bound}}
unowned
var weak12 : NonClass = Ty0() // expected-error {{'unowned' may not be applied to non-class-bound protocol 'NonClass'; consider adding a class bound}}
unowned
var weak13 : NonClass = Ty0() // expected-error {{'unowned' may not be applied to non-class-bound protocol 'NonClass'; consider adding a class bound}}
weak
var weak14 : Ty0 // expected-error {{'weak' variable should have optional type 'Ty0?'}}
weak
var weak15 : Class // expected-error {{'weak' variable should have optional type 'Class?'}}
weak var weak16 : Class!
@weak var weak17 : Class? // expected-error {{'weak' is a declaration modifier, not an attribute}} {{1-2=}}
@_exported var exportVar: Int // expected-error {{@_exported may only be used on 'import' declarations}}{{1-12=}}
@_exported func exportFunc() {} // expected-error {{@_exported may only be used on 'import' declarations}}{{1-12=}}
@_exported struct ExportStruct {} // expected-error {{@_exported may only be used on 'import' declarations}}{{1-12=}}
// Function result type attributes.
var func_result_type_attr : () -> @xyz Int // expected-error {{unknown attribute 'xyz'}}
func func_result_attr() -> @xyz Int { // expected-error {{unknown attribute 'xyz'}}
return 4
}
// @thin is not supported except in SIL.
var thinFunc : @thin () -> () // expected-error {{attribute is not supported}}
@inline(never) func nolineFunc() {}
@inline(never) var noinlineVar : Int // expected-error {{@inline(never) cannot be applied to this declaration}} {{1-16=}}
@inline(never) class FooClass { // expected-error {{@inline(never) cannot be applied to this declaration}} {{1-16=}}
}
@inline(__always) func AlwaysInlineFunc() {}
@inline(__always) var alwaysInlineVar : Int // expected-error {{@inline(__always) cannot be applied to this declaration}} {{1-19=}}
@inline(__always) class FooClass2 { // expected-error {{@inline(__always) cannot be applied to this declaration}} {{1-19=}}
}
class A {
@inline(never) init(a : Int) {}
var b : Int {
@inline(never) get {
return 42
}
@inline(never) set {
}
}
}
class B {
@inline(__always) init(a : Int) {}
var b : Int {
@inline(__always) get {
return 42
}
@inline(__always) set {
}
}
}
class SILStored {
@sil_stored var x : Int = 42 // expected-error {{'sil_stored' only allowed in SIL modules}}
}
@_show_in_interface protocol _underscored {}
@_show_in_interface class _notapplicable {} // expected-error {{may only be used on 'protocol' declarations}}
| apache-2.0 | 73ffbaf800d1979828792036b41c602a | 34.148472 | 152 | 0.691887 | 3.894049 | false | false | false | false |
movabletype/smartphone-app | MT_iOS/MT_iOS/Classes/Model/UploadItemImageItem.swift | 1 | 2622 | //
// UploadItemImageItem.swift
// MT_iOS
//
// Created by CHEEBOW on 2016/02/26.
// Copyright © 2016年 Six Apart, Ltd. All rights reserved.
//
import UIKit
import SwiftyJSON
class UploadItemImageItem: UploadItem {
private(set) var imageItem: EntryImageItem!
init(imageItem: EntryImageItem) {
super.init()
self.imageItem = imageItem
}
override func setup(completion: (() -> Void)) {
if let jpeg = NSData(contentsOfFile: imageItem.imageFilename) {
self.data = jpeg
completion()
} else {
completion()
}
}
override func thumbnail(size: CGSize, completion: (UIImage->Void)) {
if let image = UIImage(contentsOfFile: imageItem.imageFilename) {
let widthRatio = size.width / image.size.width
let heightRatio = size.height / image.size.height
let ratio = (widthRatio < heightRatio) ? widthRatio : heightRatio
let resizedSize = CGSize(width: (image.size.width * ratio), height: (image.size.height * ratio))
UIGraphicsBeginImageContext(resizedSize)
image.drawInRect(CGRect(x: 0, y: 0, width: resizedSize.width, height: resizedSize.height))
let resizedImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
completion(resizedImage)
}
}
override func makeFilename()->String {
self._filename = imageItem.uploadFilename
return self._filename
}
override func upload(progress progress: ((Int64!, Int64!, Int64!) -> Void)? = nil, success: (JSON! -> Void)!, failure: (JSON! -> Void)!) {
let api = DataAPI.sharedInstance
let app = UIApplication.sharedApplication().delegate as! AppDelegate
let authInfo = app.authInfo
let uploadSuccess: ((JSON!)-> Void) = {
(result: JSON!)-> Void in
LOG("\(result)")
let asset = Asset(json: result)
self.imageItem.clear()
self.imageItem.asset = asset
success(result)
}
api.authenticationV2(authInfo.username, password: authInfo.password, remember: true,
success:{_ in
let filename = self.makeFilename()
api.uploadAssetForSite(self.blogID, assetData: self.data, fileName: filename, options: ["path":self.imageItem.uploadPath, "autoRenameIfExists":"true"], progress: progress, success: uploadSuccess, failure: failure)
},
failure: failure
)
}
}
| mit | 05deb6db2bb9a469f506a84759147500 | 34.876712 | 230 | 0.600229 | 4.685152 | false | false | false | false |
guowilling/iOSExamples | Swift/PictureProcessing/SampleCodeGPUImage/其他滤镜/ViewController.swift | 2 | 1531 | //
// ViewController.swift
// 其他滤镜
//
// Created by 郭伟林 on 2017/9/6.
// Copyright © 2017年 SR. All rights reserved.
//
import UIKit
import GPUImage
class ViewController: UIViewController {
@IBOutlet weak var imageView: UIImageView!
var originalImage: UIImage!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
originalImage = imageView.image
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func hese() {
let heseFilter = GPUImageSepiaFilter()
imageView.image = processImage(heseFilter)
}
@IBAction func katong() {
let heseFilter = GPUImageToonFilter()
imageView.image = processImage(heseFilter)
}
@IBAction func sumiao() {
let heseFilter = GPUImageSketchFilter()
imageView.image = processImage(heseFilter)
}
@IBAction func fudiao() {
let heseFilter = GPUImageEmbossFilter()
imageView.image = processImage(heseFilter)
}
private func processImage(_ filter : GPUImageFilter) -> UIImage? {
let imagePicture = GPUImagePicture(image: originalImage)
imagePicture?.addTarget(filter)
filter.useNextFrameForImageCapture()
imagePicture?.processImage()
return filter.imageFromCurrentFramebuffer()
}
}
| mit | 2c820af037b23dba916d86da582c4575 | 24.661017 | 80 | 0.648613 | 4.629969 | false | false | false | false |
wikimedia/wikipedia-ios | Wikipedia/Code/PlaceSearchSuggestionController.swift | 1 | 9279 | import UIKit
import WMF
protocol PlaceSearchSuggestionControllerDelegate: NSObjectProtocol {
func placeSearchSuggestionController(_ controller: PlaceSearchSuggestionController, didSelectSearch search: PlaceSearch)
func placeSearchSuggestionControllerClearButtonPressed(_ controller: PlaceSearchSuggestionController)
func placeSearchSuggestionController(_ controller: PlaceSearchSuggestionController, didDeleteSearch search: PlaceSearch)
}
class PlaceSearchSuggestionController: NSObject, UITableViewDataSource, UITableViewDelegate, Themeable {
fileprivate var theme = Theme.standard
func apply(theme: Theme) {
self.theme = theme
tableView.backgroundColor = theme.colors.baseBackground
tableView.tableFooterView?.backgroundColor = theme.colors.paperBackground
tableView.reloadData()
}
static let cellReuseIdentifier = "org.wikimedia.places"
static let headerReuseIdentifier = "org.wikimedia.places.header"
static let suggestionSection = 0
static let recentSection = 1
static let currentStringSection = 2
static let completionSection = 3
var wikipediaLanguageCode: String? = "en"
var siteURL: URL? = nil {
didSet {
wikipediaLanguageCode = siteURL?.wmf_languageCode
}
}
var tableView: UITableView = UITableView() {
didSet {
tableView.register(PlacesSearchSuggestionTableViewCell.wmf_classNib(), forCellReuseIdentifier: PlaceSearchSuggestionController.cellReuseIdentifier)
tableView.register(WMFTableHeaderFooterLabelView.wmf_classNib(), forHeaderFooterViewReuseIdentifier: PlaceSearchSuggestionController.headerReuseIdentifier)
tableView.dataSource = self
tableView.delegate = self
tableView.reloadData()
let footerView = UIView()
tableView.tableFooterView = footerView
}
}
var searches: [[PlaceSearch]] = [[],[],[],[]] {
didSet {
tableView.reloadData()
}
}
weak var delegate: PlaceSearchSuggestionControllerDelegate?
var navigationBarHider: NavigationBarHider? = nil
func numberOfSections(in tableView: UITableView) -> Int {
return searches.count
}
var shouldUseFirstSuggestionAsDefault: Bool {
return searches[PlaceSearchSuggestionController.suggestionSection].isEmpty && !searches[PlaceSearchSuggestionController.completionSection].isEmpty
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
switch (section, shouldUseFirstSuggestionAsDefault) {
case (PlaceSearchSuggestionController.suggestionSection, true):
return 1
case (PlaceSearchSuggestionController.completionSection, true):
return searches[PlaceSearchSuggestionController.completionSection].count - 1
default:
return searches[section].count
}
}
func searchForIndexPath(_ indexPath: IndexPath) -> PlaceSearch {
let search: PlaceSearch
switch (indexPath.section, shouldUseFirstSuggestionAsDefault) {
case (PlaceSearchSuggestionController.suggestionSection, true):
search = searches[PlaceSearchSuggestionController.completionSection][0]
case (PlaceSearchSuggestionController.completionSection, true):
search = searches[PlaceSearchSuggestionController.completionSection][indexPath.row+1]
default:
search = searches[indexPath.section][indexPath.row]
}
return search
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: PlaceSearchSuggestionController.cellReuseIdentifier, for: indexPath)
guard let searchSuggestionCell = cell as? PlacesSearchSuggestionTableViewCell else {
return cell
}
let search = searchForIndexPath(indexPath)
switch search.type {
case .nearby:
searchSuggestionCell.iconImageView.image = #imageLiteral(resourceName: "places-suggestion-location")
default:
searchSuggestionCell.iconImageView.image = search.searchResult != nil ? #imageLiteral(resourceName: "nearby-mini") : #imageLiteral(resourceName: "places-suggestion-text")
}
searchSuggestionCell.titleLabel.text = search.localizedDescription
searchSuggestionCell.detailLabel.text = search.searchResult?.wikidataDescription?.wmf_stringByCapitalizingFirstCharacter(usingWikipediaLanguageCode: wikipediaLanguageCode)
searchSuggestionCell.apply(theme: theme)
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let search = searchForIndexPath(indexPath)
delegate?.placeSearchSuggestionController(self, didSelectSearch: search)
tableView.deselectRow(at: indexPath, animated: true)
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
guard !searches[section].isEmpty, section < 2, let header = tableView.dequeueReusableHeaderFooterView(withIdentifier: PlaceSearchSuggestionController.headerReuseIdentifier) as? WMFTableHeaderFooterLabelView else {
return nil
}
header.prepareForReuse()
if let ht = header as Themeable? {
ht.apply(theme: theme)
}
header.isLabelVerticallyCentered = true
switch section {
// case PlaceSearchSuggestionController.suggestionSection:
// header.text = WMFLocalizedString("places-search-suggested-searches-header", value:"Suggested searches", comment:"Suggested searches - header for the list of suggested searches")
case PlaceSearchSuggestionController.recentSection:
header.isClearButtonHidden = false
header.addClearButtonTarget(self, selector: #selector(clearButtonPressed))
header.text = WMFLocalizedString("places-search-recently-searched-header", value:"Recently searched", comment:"Recently searched - header for the list of recently searched items")
header.clearButton.accessibilityLabel = WMFLocalizedString("places-accessibility-clear-saved-searches", value:"Clear saved searches", comment:"Accessibility hint for clearing saved searches")
default:
return nil
}
return header
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
guard let header = self.tableView(tableView, viewForHeaderInSection: section) as? WMFTableHeaderFooterLabelView else {
return 0
}
let calculatedHeight = header.height(withExpectedWidth: tableView.bounds.size.width)
return calculatedHeight + 23
}
func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
switch indexPath.section {
case PlaceSearchSuggestionController.recentSection:
return true
default:
return false
}
}
func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
switch indexPath.section {
case PlaceSearchSuggestionController.recentSection:
let contextItem = UIContextualAction(style: .destructive, title: "Delete") { (contextualAction, view, boolValue) in
let search = self.searchForIndexPath(indexPath)
self.delegate?.placeSearchSuggestionController(self, didDeleteSearch: search)
}
return UISwipeActionsConfiguration(actions: [contextItem])
default:
return nil
}
}
@objc func clearButtonPressed() {
delegate?.placeSearchSuggestionControllerClearButtonPressed(self)
}
// MARK: - ScrollViewDelegate. Ideally, convert this to a ViewController & remove this code
func scrollViewDidScroll(_ scrollView: UIScrollView) {
navigationBarHider?.scrollViewDidScroll(scrollView)
}
func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
navigationBarHider?.scrollViewWillBeginDragging(scrollView)
}
func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
navigationBarHider?.scrollViewWillEndDragging(scrollView, withVelocity: velocity, targetContentOffset: targetContentOffset)
}
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
navigationBarHider?.scrollViewDidEndDecelerating(scrollView)
}
func scrollViewDidEndScrollingAnimation(_ scrollView: UIScrollView) {
navigationBarHider?.scrollViewDidEndScrollingAnimation(scrollView)
}
func scrollViewShouldScrollToTop(_ scrollView: UIScrollView) -> Bool {
navigationBarHider?.scrollViewWillScrollToTop(scrollView)
return true
}
func scrollViewDidScrollToTop(_ scrollView: UIScrollView) {
navigationBarHider?.scrollViewDidScrollToTop(scrollView)
}
}
| mit | 9ecb8ad43e94b3535b8841266f795c18 | 44.485294 | 221 | 0.710637 | 5.828518 | false | false | false | false |
gerardogrisolini/Webretail | Sources/Webretail/Repositories/EcommerceRepository.swift | 1 | 16260 | //
// EcommerceRepository.swift
// Webretail
//
// Created by Gerardo Grisolini on 25/10/17.
//
import StORM
import Foundation
struct EcommerceRepository : EcommerceProtocol {
func getCategories() throws -> [Category] {
let categories = StORMDataSourceJoin(
table: "productcategories",
onCondition: "categories.categoryId = productcategories.categoryId",
direction: StORMJoinType.INNER
)
let product = StORMDataSourceJoin(
table: "products",
onCondition: "productcategories.productId = products.productId",
direction: StORMJoinType.INNER
)
let publication = StORMDataSourceJoin(
table: "publications",
onCondition: "products.productId = publications.productId",
direction: StORMJoinType.INNER
)
let items = Category()
try items.query(
columns: ["DISTINCT categories.*"],
whereclause: "publications.publicationStartAt <= $1 AND publications.publicationFinishAt >= $1 AND categories.categoryIsPrimary = $2 AND products.productIsActive = $2",
params: [Int.now(), true],
orderby: ["categories.categoryName"],
joins: [categories, product, publication]
)
return items.rows()
}
func getBrands() throws -> [Brand] {
let product = StORMDataSourceJoin(
table: "products",
onCondition: "brands.brandId = products.brandId",
direction: StORMJoinType.INNER
)
let publication = StORMDataSourceJoin(
table: "publications",
onCondition: "products.productId = publications.productId",
direction: StORMJoinType.INNER
)
let items = Brand()
try items.query(
columns: ["DISTINCT brands.*"],
whereclause: "publications.publicationStartAt <= $1 AND publications.publicationFinishAt >= $1 AND products.productIsActive = $2",
params: [Int.now(), true],
orderby: ["brands.brandName"],
joins: [product, publication]
)
return items.rows()
}
func getProductsFeatured() throws -> [Product] {
let publication = StORMDataSourceJoin(
table: "publications",
onCondition: "products.productId = publications.productId",
direction: StORMJoinType.INNER
)
let brand = StORMDataSourceJoin(
table: "brands",
onCondition: "products.brandId = brands.brandId",
direction: StORMJoinType.INNER
)
let items = Product()
try items.query(
whereclause: "publications.publicationFeatured = $1 AND products.productIsActive = $1 AND publications.publicationStartAt <= $2 AND publications.publicationFinishAt >= $2",
params: [true, Int.now()],
orderby: ["publications.publicationStartAt DESC"],
joins: [publication, brand]
)
return try items.rows(barcodes: false)
}
func getProductsNews() throws -> [Product] {
let publication = StORMDataSourceJoin(
table: "publications",
onCondition: "products.productId = publications.productId",
direction: StORMJoinType.INNER
)
let brand = StORMDataSourceJoin(
table: "brands",
onCondition: "products.brandId = brands.brandId",
direction: StORMJoinType.INNER
)
let items = Product()
try items.query(
whereclause: "publications.publicationNew = $1 AND products.productIsActive = $1 AND publications.publicationStartAt <= $2 AND publications.publicationFinishAt >= $2",
params: [true, Int.now()],
orderby: ["publications.publicationStartAt DESC"],
joins: [publication, brand]
)
return try items.rows(barcodes: false)
}
func getProductsDiscount() throws -> [Product] {
let publication = StORMDataSourceJoin(
table: "publications",
onCondition: "products.productId = publications.productId",
direction: StORMJoinType.INNER
)
let brand = StORMDataSourceJoin(
table: "brands",
onCondition: "products.brandId = brands.brandId",
direction: StORMJoinType.INNER
)
let items = Product()
try items.query(
whereclause: "products.productIsActive = $1 AND products.productDiscount <> NULL AND (products.productDiscount ->> 'discountStartAt')::int <= $2 AND (products.productDiscount ->> 'discountFinishAt')::int >= $2 AND publications.publicationStartAt <= $2 AND publications.publicationFinishAt >= $2",
params: [true, Int.now()],
orderby: ["publications.publicationStartAt DESC"],
joins: [publication, brand]
)
return try items.rows(barcodes: false)
}
func getProducts(brand: String) throws -> [Product] {
let items = Product()
try items.query(
whereclause: "brands.brandSeo ->> 'permalink' = $1 AND publications.publicationStartAt <= $2 AND publications.publicationFinishAt >= $2 AND products.productIsActive = $3",
params: [brand, Int.now(), true],
orderby: ["products.productName"],
joins: [
StORMDataSourceJoin(
table: "publications",
onCondition: "products.productId = publications.productId",
direction: StORMJoinType.INNER),
StORMDataSourceJoin(
table: "brands",
onCondition: "products.brandId = brands.brandId",
direction: StORMJoinType.INNER)
]
)
return try items.rows(barcodes: false)
}
func getProducts(category: String) throws -> [Product] {
let publication = StORMDataSourceJoin(
table: "publications",
onCondition: "products.productId = publications.productId",
direction: StORMJoinType.INNER
)
let brand = StORMDataSourceJoin(
table: "brands",
onCondition: "products.brandId = brands.brandId",
direction: StORMJoinType.INNER
)
let productCategories = StORMDataSourceJoin(
table: "productcategories",
onCondition: "products.productId = productcategories.productId",
direction: StORMJoinType.LEFT
)
let categories = StORMDataSourceJoin(
table: "categories",
onCondition: "productcategories.categoryId = categories.categoryId",
direction: StORMJoinType.INNER
)
let items = Product()
try items.query(
whereclause: "categories.categorySeo ->> 'permalink' = $1 AND publications.publicationStartAt <= $2 AND publications.publicationFinishAt >= $2 AND products.productIsActive = $3",
params: [category, Int.now(), true],
orderby: ["products.productName"],
joins: [publication, brand, productCategories, categories]
)
return try items.rows(barcodes: false)
}
func findProducts(text: String) throws -> [Product] {
let items = Product()
try items.query(
whereclause: "LOWER(products.productName) LIKE $1 AND publications.publicationStartAt <= $2 AND publications.publicationFinishAt >= $2 AND products.productIsActive = $3",
params: ["%\(text.lowercased())%", Int.now(), true],
joins: [
StORMDataSourceJoin(
table: "publications",
onCondition: "products.productId = publications.productId",
direction: StORMJoinType.INNER),
StORMDataSourceJoin(
table: "brands",
onCondition: "products.brandId = brands.brandId",
direction: StORMJoinType.INNER)
]
)
return try items.rows(barcodes: false)
}
func getProduct(name: String) throws -> Product {
let item = Product()
try item.query(
whereclause: "products.productSeo ->> 'permalink' = $1",
params: [name],
joins: [
StORMDataSourceJoin(
table: "brands",
onCondition: "products.brandId = brands.brandId",
direction: StORMJoinType.INNER
)
]
)
if item.productId == 0 {
throw StORMError.noRecordFound
}
try item.makeCategories()
try item.makeAttributes()
try item.makeArticles()
return item
}
func getBaskets() throws -> [Basket] {
let registry = StORMDataSourceJoin(
table: "registries",
onCondition: "baskets.registryId = registries.registryId",
direction: StORMJoinType.LEFT
)
let items = Basket()
try items.query(joins: [registry])
return items.rows()
}
func getBasket(registryId: Int) throws -> [Basket] {
let items = Basket()
try items.query(whereclause: "registryId = $1", params: [registryId])
return items.rows()
}
func addBasket(item: Basket) throws {
let items = try getBasket(registryId: item.registryId)
let basket = items.first(where: { $0.basketBarcode == item.basketBarcode})
if let current = basket {
current.basketQuantity += 1
current.basketUpdated = Int.now()
try current.save()
item.basketId = current.basketId
item.basketQuantity = current.basketQuantity
return
}
item.basketUpdated = Int.now()
try item.save {
id in item.basketId = id as! Int
}
}
func updateBasket(id: Int, item: Basket) throws {
let current = Basket()
try current.query(id: id)
if current.basketId == 0 {
throw StORMError.noRecordFound
}
current.basketQuantity = item.basketQuantity
current.basketUpdated = Int.now()
try current.save()
}
func deleteBasket(id: Int) throws {
let item = Basket()
item.basketId = id
try item.delete()
}
func getPayments() -> [Item] {
var items = [Item]()
items.append(Item(id: "PayPal", value: "PayPal - Credit card"))
items.append(Item(id: "BankTransfer", value: "Bank transfer"))
items.append(Item(id: "CashOnDelivery", value: "Cash on delivery"))
return items
}
func getShippings() -> [Item] {
var items = [Item]()
items.append(Item(id: "standard", value: "Standard"))
items.append(Item(id: "express", value: "Express"))
return items
}
func getShippingCost(id: String, registry: Registry) -> Cost {
var cost = Cost(value: 0)
var string: String
let data = FileManager.default.contents(atPath: "./webroot/csv/shippingcost_\(id).csv")
if let content = data {
string = String(data: content, encoding: .utf8)!
} else {
let defaultData = FileManager.default.contents(atPath: "./webroot/csv/shippingcost.csv")
if let defaultContent = defaultData {
string = String(data: defaultContent, encoding: .utf8)!
} else {
return cost
}
}
let lines = string.split(separator: "\n")
for line in lines {
let columns = line.split(separator: ",", omittingEmptySubsequences: false)
if (columns[0] == registry.registryCountry || columns[0] == "*")
{
if let value = Double(columns[4]) {
cost.value = value
}
if (columns[1] == registry.registryCity)
{
if let value = Double(columns[4]) {
cost.value = value
}
return cost;
}
}
}
return cost
}
func addOrder(registryId: Int, order: OrderModel) throws -> Movement {
let repository = ioCContainer.resolve() as MovementProtocol
let items = try self.getBasket(registryId: registryId)
if items.count == 0 {
throw StORMError.noRecordFound
}
let registry = Registry()
try registry.get(registryId)
if registry.registryId == 0 {
throw StORMError.noRecordFound
}
let store = Store()
try store.query(orderby: ["storeId"],
cursor: StORMCursor.init(limit: 1, offset: 0))
let causal = Causal()
try causal.query(whereclause: "causalBooked = $1 AND causalQuantity = $2 AND causalIsPos = $3",
params: [1, -1 , true],
orderby: ["causalId"],
cursor: StORMCursor.init(limit: 1, offset: 0))
if causal.causalId == 0 {
throw StORMError.error("no causal found")
}
let movement = Movement()
movement.movementDate = Int.now()
movement.movementStore = store
movement.movementCausal = causal
movement.movementRegistry = registry
movement.movementUser = "eCommerce"
movement.movementStatus = "New"
movement.movementPayment = order.payment
movement.movementShipping = order.shipping
movement.movementShippingCost = order.shippingCost
movement.movementNote = order.paypal.isEmpty ? "" : "paypal authorization: \(order.paypal)"
movement.movementDesc = "eCommerce order"
try repository.add(item: movement)
for item in items {
let movementArticle = MovementArticle()
movementArticle.movementId = movement.movementId
movementArticle.movementArticleBarcode = item.basketBarcode
movementArticle.movementArticleProduct = item.basketProduct
movementArticle.movementArticlePrice = item.basketPrice
movementArticle.movementArticleQuantity = item.basketQuantity
movementArticle.movementArticleUpdated = Int.now()
try movementArticle.save {
id in movementArticle.movementArticleId = id as! Int
}
try item.delete()
}
movement.movementStatus = "Processing"
try repository.update(id: movement.movementId, item: movement)
return movement;
}
func getOrders(registryId: Int) throws -> [Movement] {
let items = Movement()
try items.query(whereclause: "movementRegistry ->> 'registryId' = $1",
params: [registryId],
orderby: ["movementId DESC"])
return try items.rows()
}
func getOrder(registryId: Int, id: Int) throws -> Movement {
let item = Movement()
try item.query(whereclause: "movementRegistry ->> 'registryId' = $1 AND movementId = $2",
params: [registryId, id],
cursor: StORMCursor(limit: 1, offset: 0))
return item
}
func getOrderItems(registryId: Int, id: Int) throws -> [MovementArticle] {
let items = MovementArticle()
let join = StORMDataSourceJoin(
table: "movements",
onCondition: "movementarticles.movementId = movements.movementId",
direction: StORMJoinType.RIGHT
)
try items.query(whereclause: "movements.movementRegistry ->> 'registryId' = $1 AND movementarticles.movementId = $2",
params: [registryId, id],
orderby: ["movementarticles.movementarticleId"],
joins: [join]
)
return items.rows()
}
}
| apache-2.0 | 9099dd053565e58caa91b11c5a03170e | 35.954545 | 308 | 0.567282 | 4.792219 | false | false | false | false |
jwfriese/Fleet | Fleet/CoreExtensions/Storyboard/StoryboardBindingError.swift | 1 | 1158 | import Foundation
extension Fleet {
enum StoryboardError: FleetErrorDefinition {
case invalidViewControllerIdentifier(String)
case invalidExternalStoryboardReference(String)
case internalInconsistency(String)
case invalidViewControllerState(String)
case invalidMockType(String)
var errorMessage: String {
get {
var description = ""
switch self {
case .invalidViewControllerIdentifier(let message):
description = message
case .invalidExternalStoryboardReference(let message):
description = message
case .internalInconsistency(let message):
description = message
case .invalidViewControllerState(let message):
description = message
case .invalidMockType(let message):
description = message
}
return description
}
}
var name: NSExceptionName { get { return NSExceptionName(rawValue: "Fleet.StoryboardError") } }
}
}
| apache-2.0 | a5ac33fd21a5884bedadf28139294f8c | 33.058824 | 103 | 0.580311 | 6.542373 | false | false | false | false |
SummerHH/swift3.0WeBo | WeBo/Classes/Model/Home/StatusViewModel.swift | 1 | 2737 | //
// StatusViewModel.swift
// WeBo
//
// Created by Apple on 16/11/4.
// Copyright © 2016年 叶炯. All rights reserved.
//
import UIKit
class StatusViewModel: NSObject {
//MARK:- 定义属性
var status: StatusModel?
//MARK:- 对数据处理的属性
var sourceText : String? //截取后的微博来源
var createAtText : String? //格式化后的微博的时间
var verifiedImage: UIImage? //用户认证
var vipImage: UIImage? //vipImg
var profileURL: NSURL? //处理头像
var picURLs : [URL] = [URL]() // 处理微博配图的数据
init(status: StatusModel) {
self.status = status
// 1.对来源处理
// nil 值校验
if let source = status.source, source != "" {
// 对来源的字符串进行处理
//获取字符串的长度
let startIndex = (source as NSString).range(of: ">").location+1
let length = (source as NSString).range(of: "</").location - startIndex
// 截取字符串
sourceText = (source as NSString).substring(with: NSRange(location: startIndex, length: length))
}
// 2.处理时间
// 1. nil 值校验
if let created_at = status.created_at {
// 对时间的处理
createAtText = NSDate.createDateString(createAtStr: created_at)
}
// 3.用户认证处理
let verified_type = status.user?.verified_type ?? -1
switch verified_type {
case 0:
verifiedImage = UIImage(named: "avatar_vip")
case 2, 3, 5:
verifiedImage = UIImage(named: "avatar_enterprise_vip")
case 220:
verifiedImage = UIImage(named: "avatar_grassroot")
default:
verifiedImage = nil
}
// 4.用户等级处理
let mbrank = status.user?.mbrank ?? 0
if mbrank > 0 && mbrank <= 6 {
vipImage = UIImage(named: "common_icon_membership_level\(mbrank)")
}
// 5.处理头像的请求
let profileUrlSring = status.user?.profile_image_url ?? ""
profileURL = NSURL(string: profileUrlSring)
// 6. 处理配图数据(原创配图和转发配图处理)
let picUrlArr = status.pic_urls!.count != 0 ? status.pic_urls : status.retweeted_status?.pic_urls
if let picUrlArr = picUrlArr {
for picURLDict in picUrlArr {
guard let picURLString = picURLDict["thumbnail_pic"] else {
continue
}
picURLs.append(URL(string: picURLString)!)
}
}
}
}
| apache-2.0 | 0695e8b4cd167a6cdcfa4af5bc141115 | 28.105882 | 108 | 0.534357 | 4.130217 | false | false | false | false |
madnik/flashing-refresher | FlashingRefresherDemo/Pods/PullToRefresher/PullToRefresh/UIScrollView+PullToRefresh.swift | 1 | 1648 | //
// Created by Anastasiya Gorban on 4/14/15.
// Copyright (c) 2015 Yalantis. All rights reserved.
//
// Licensed under the MIT license: http://opensource.org/licenses/MIT
// Latest version can be found at https://github.com/Yalantis/PullToRefresh
//
import Foundation
import UIKit
import ObjectiveC
private var associatedObjectHandle: UInt8 = 0
public extension UIScrollView {
private(set) var pullToRefresh: PullToRefresh? {
get {
return objc_getAssociatedObject(self, &associatedObjectHandle) as? PullToRefresh
}
set {
objc_setAssociatedObject(self, &associatedObjectHandle, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
}
}
public func addPullToRefresh(pullToRefresh: PullToRefresh, action:()->()) {
if self.pullToRefresh != nil {
self.removePullToRefresh(self.pullToRefresh!)
}
self.pullToRefresh = pullToRefresh
pullToRefresh.scrollView = self
pullToRefresh.action = action
let view = pullToRefresh.refreshView
view.frame = CGRectMake(0, -view.frame.size.height, self.frame.size.width, view.frame.size.height)
view.autoresizingMask = UIViewAutoresizing.FlexibleWidth
self.addSubview(view)
self.sendSubviewToBack(view)
}
func removePullToRefresh(pullToRefresh: PullToRefresh) {
self.pullToRefresh?.refreshView.removeFromSuperview()
self.pullToRefresh = nil
}
func startRefreshing() {
pullToRefresh?.startRefreshing()
}
func endRefreshing() {
pullToRefresh?.endRefreshing()
}
}
| mit | 721dafa1922051e97bc7210613abbd01 | 30.09434 | 113 | 0.669903 | 4.993939 | false | false | false | false |
hooliooo/Rapid | Source/Extensions/UIViewController+Kio.swift | 1 | 4387 | //
// Kio
// Copyright (c) Julio Miguel Alorro
//
// Licensed under the MIT license. See LICENSE file.
//
//
import class UIKit.UIView
import class UIKit.UIViewController
import class UIKit.UIActivityIndicatorView
import class UIKit.UINavigationItem
import class UIKit.UIControl
import class UIKit.UISegmentedControl
import class UIKit.UIDatePicker
import class UIKit.UIRefreshControl
import class UIKit.UISwitch
import struct UIKit.Selector
import class UIKit.NSLayoutConstraint
import struct CoreGraphics.CGSize
import class Foundation.DispatchQueue
/**
A DSL for UIViewController to access custom methods
*/
public struct KioViewControllerDSL {
// MARK: Stored Propeties
/**
Underlying UIViewController instance
*/
public let viewController: UIViewController
}
public extension KioViewControllerDSL {
func add(child childViewController: UIViewController) {
self.viewController.addChild(childViewController)
childViewController.didMove(toParent: self.viewController)
self.viewController.view.addSubview(childViewController.view)
}
func remove(child childViewController: UIViewController) {
guard childViewController.parent === self.viewController else { return }
childViewController.willMove(toParent: nil)
childViewController.removeFromParent()
childViewController.view.removeFromSuperview()
}
/**
Accesses the UIViewController's UINavigationItem instance to manipulate inside a closure.
- parameter callback: The closure that captures the UINavigationItem instance to be manipulated
*/
func setUpNavigationItem(_ callback: (UINavigationItem) -> Void) {
callback(self.viewController.navigationItem)
}
/**
Convenience method that assigns a selector method to a UIControl instance
- parameter dict: The dictionary containing the UIControl and Selector pairing
*/
func setUpTargetActions(with dict: [UIControl: Selector]) {
for (control, action) in dict {
let controlEvent: UIControl.Event
switch control {
case is UISegmentedControl, is UIDatePicker, is UIRefreshControl, is UISwitch:
controlEvent = UIControl.Event.valueChanged
default:
controlEvent = UIControl.Event.touchUpInside
}
control.addTarget(self.viewController, action: action, for: controlEvent)
}
}
private func createActivityIndicator(with size: CGSize) -> KioActivityIndicatorView {
let view: KioActivityIndicatorView = KioActivityIndicatorView()
view.style = UIActivityIndicatorView.Style.gray
view.translatesAutoresizingMaskIntoConstraints = false
view.hidesWhenStopped = true
view.kio.cornerRadius(of: 5.0)
self.viewController.view.addSubview(view)
NSLayoutConstraint.activate([
view.centerXAnchor.constraint(equalTo: self.viewController.view.centerXAnchor),
view.centerYAnchor.constraint(equalTo: self.viewController.view.centerYAnchor),
view.heightAnchor.constraint(equalToConstant: size.height),
view.widthAnchor.constraint(equalToConstant: size.width)
])
return view
}
private func findActivityIndicator() -> KioActivityIndicatorView? {
return self.viewController.view.subviews.reversed()
.first(where: { (view: UIView) -> Bool in view is KioActivityIndicatorView}) as? KioActivityIndicatorView
}
func showActivityIndicator(with size: CGSize = CGSize(width: 60.0, height: 60.0)) {
DispatchQueue.main.async { () -> Void in
self.createActivityIndicator(with: size)
.startAnimating()
self.viewController.view.isUserInteractionEnabled = false
}
}
func hideActivityIndicator() {
DispatchQueue.main.async { () -> Void in
guard let view = self.findActivityIndicator() else { return }
view.stopAnimating()
view.removeFromSuperview()
self.viewController.view.isUserInteractionEnabled = true
}
}
}
public extension UIViewController {
/**
KioViewControllerDSL instance to access custom methods
*/
var kio: KioViewControllerDSL {
return KioViewControllerDSL(viewController: self)
}
}
| mit | e6db7343513f613ea7482278534f0f0a | 32.234848 | 117 | 0.700707 | 5.456468 | false | false | false | false |
Herb-Sun/OKKLineSwift | OKKLineSwift-macOS-Demo/ViewController.swift | 1 | 1818 | //
// ViewController.swift
// OKKLineSwift-macOS-Demo
//
// Copyright © 2016年 Herb - https://github.com/Herb-Sun/OKKLineSwift
//
//
import Cocoa
class ViewController: NSViewController {
var klineView: OKKLineView!
override func viewDidLoad() {
super.viewDidLoad()
klineView = OKKLineView()
view.addSubview(klineView)
klineView.snp.makeConstraints { (make) in
make.edges.equalToSuperview()
}
fetchData()
}
@objc
func fetchData() {
let param = ["type" : "5min",
"symbol" : "okcoincnbtccny",
"size" : "1000"]
Just.post("https://www.btc123.com/kline/klineapi", params: param, asyncCompletionHandler: { (result) -> Void in
print(result)
DispatchQueue.main.async(execute: {
if result.ok {
let resultData = result.json as! [String : Any]
let datas = resultData["datas"] as! [[Double]]
var dataArray = [OKKLineModel]()
for data in datas {
let model = OKKLineModel(date: data[0], open: data[1], close: data[4], high: data[2], low: data[3], volume: data[5])
dataArray.append(model)
}
// for model in OKConfiguration.shared.klineModels {
// print(model.propertyDescription())
// }
self.klineView.drawKLineView(klineModels: dataArray)
}
})
})
}
}
| mit | 6ea8b53c67372da0ed7009aae638dca2 | 30.293103 | 140 | 0.45124 | 4.932065 | false | false | false | false |
machelix/COBezierTableView | COBezierTableViewDemo/COBezierTableViewDemo/COBezierDemoCell.swift | 1 | 732 | //
// COBezierCell.swift
// COBezierTableViewDemo
//
// Created by Knut Inge Grosland on 2015-03-23.
// Copyright (c) 2015 Cocmoc. All rights reserved.
//
import UIKit
class COBezierDemoCell: UITableViewCell {
@IBOutlet weak var button: UIButton?
override func awakeFromNib() {
super.awakeFromNib()
button?.backgroundColor = getRandomColor()
backgroundColor = UIColor.clearColor()
}
func getRandomColor() -> UIColor{
var randomRed:CGFloat = CGFloat(drand48())
var randomGreen:CGFloat = CGFloat(drand48())
var randomBlue:CGFloat = CGFloat(drand48())
return UIColor(red: randomRed, green: randomGreen, blue: randomBlue, alpha: 1.0)
}
}
| mit | d12cf7c20b5af6fc6fd18abe0f0af0f7 | 25.142857 | 88 | 0.659836 | 4.305882 | false | false | false | false |
neonichu/ECoXiS | ECoXiS/ECoXiS.swift | 1 | 2240 | prefix operator <& {}
/**
Creates a XML text node.
:param content: The text contained in the node.
:returns: The created text instance.
*/
public prefix func <& (content: String) -> XMLText {
return XMLText(content)
}
prefix operator <! {}
/**
Creates a XML comment node.
Note that the comment content is stripped of invalid character combinations,
i.e. a dash ("-") may not appear at the beginning or the end and in between
only single dashes may appear.
:param content: The text of the comment.
:returns: The created comment instance.
*/
public prefix func <! (content: String) -> XMLComment {
return XMLComment(content)
}
prefix operator </ {}
/**
Creates an XML element node.
Note that the element name is stripped of invalid characters.
:param name: The name of the element.
:returns: The created element instance.
*/
public prefix func </ (name: String) -> XMLElement {
return XMLElement(name)
}
/**
Sets attributes on a XML element from a dictionary of string to strings.
Note that attribute names are stripped of invalid characters.
:param element: The element instance to set attributes on.
:param attributes: The attributes to be set.
:returns: The element instance.
*/
public func | (element: XMLElement, attributes: [String: String])
-> XMLElement {
for (name, value) in attributes {
element[name] = value
}
return element
}
/**
Appends an array of XML nodes to the children of an element.
:param element: The element to which the nodes will be appended.
:param nodes: The nodes to append to the elemnts's children.
:returns: The element instance.
*/
public func | (element: XMLElement, nodes: [XMLNode])
-> XMLElement {
element.children += nodes
return element
}
/**
Appends a single XML node to the children of an element.
:param element: The element to which the node will be appended.
:param node: The node to append to the element's children.
:returns: The element instance.
*/
public func | (element: XMLElement, node: XMLNode)
-> XMLElement {
element.children.append(node)
return element
}
public typealias PI = XMLProcessingInstruction
public typealias Doctype = XMLDocumentTypeDeclaration
public typealias XML = XMLDocument
| mit | 592a6adb5ede74d8c3c49fb7cd55fe24 | 23.086022 | 76 | 0.720982 | 4.080146 | false | false | false | false |
OscarSwanros/swift | validation-test/stdlib/CoreGraphics-verifyOnly.swift | 30 | 4343 | // RUN: %target-typecheck-verify-swift
// REQUIRES: objc_interop
import CoreGraphics
//===----------------------------------------------------------------------===//
// CGColorSpace
//===----------------------------------------------------------------------===//
// CGColorSpace.colorTable
// TODO: has memory issues as a runtime test, so make it verify-only for now
let table: [UInt8] = [0,0,0, 255,0,0, 0,0,255, 0,255,0,
255,255,0, 255,0,255, 0,255,255, 255,255,255]
let space = CGColorSpace(indexedBaseSpace: CGColorSpaceCreateDeviceRGB(),
last: table.count - 1, colorTable: table)!
// expectOptionalEqual(table, space.colorTable)
//===----------------------------------------------------------------------===//
// CGContext
//===----------------------------------------------------------------------===//
func testCGContext(context: CGContext, image: CGImage, glyph: CGGlyph) {
context.setLineDash(phase: 0.5, lengths: [0.1, 0.2])
context.move(to: CGPoint.zero)
context.addLine(to: CGPoint(x: 0.5, y: 0.5))
context.addCurve(to: CGPoint(x: 1, y: 1), control1: CGPoint(x: 1, y: 0), control2: CGPoint(x: 0, y: 1))
context.addQuadCurve(to: CGPoint(x: 0.5, y: 0.5), control: CGPoint(x: 0.5, y: 0))
context.addRects([CGRect(x: 0, y: 0, width: 100, height: 100)])
context.addLines(between: [CGPoint(x: 0.5, y: 0.5)])
context.addArc(center: CGPoint(x: 0.5, y: 0.5), radius: 1, startAngle: 0, endAngle: .pi, clockwise: false)
context.addArc(tangent1End: CGPoint(x: 1, y: 1), tangent2End: CGPoint(x: 0.5, y: 0.5), radius: 0.5)
context.fill([CGRect(x: 0, y: 0, width: 100, height: 100)])
context.fillPath()
context.fillPath(using: .evenOdd)
context.strokeLineSegments(between: [CGPoint(x: 0.5, y: 0.5), CGPoint(x: 0, y: 0.5)])
context.clip(to: [CGRect(x: 0, y: 0, width: 100, height: 100)])
context.clip()
context.clip(using: .evenOdd)
context.draw(image, in: CGRect(x: 0, y: 0, width: 100, height: 100), byTiling: true)
print(context.textPosition)
context.showGlyphs([glyph], at: [CGPoint(x: 0.5, y: 0.5)])
}
//===----------------------------------------------------------------------===//
// CGDirectDisplay
//===----------------------------------------------------------------------===//
#if os(macOS)
let (dx, dy) = CGGetLastMouseDelta()
#endif
//===----------------------------------------------------------------------===//
// CGImage
//===----------------------------------------------------------------------===//
func testCGImage(image: CGImage) -> CGImage? {
return image.copy(maskingColorComponents: [1, 0, 0])
}
//===----------------------------------------------------------------------===//
// CGLayer
//===----------------------------------------------------------------------===//
func testDrawLayer(in context: CGContext) {
let layer = CGLayer(context, size: CGSize(width: 512, height: 384),
auxiliaryInfo: nil)!
context.draw(layer, in: CGRect(origin: .zero, size: layer.size))
context.draw(layer, at: CGPoint(x: 20, y: 20))
}
func testCGPath(path: CGPath) {
let dashed = path.copy(dashingWithPhase: 1, lengths: [0.2, 0.3, 0.5])
let stroked = path.copy(strokingWithWidth: 1, lineCap: .butt,
lineJoin: .miter, miterLimit: 0.1)
let mutable = stroked.mutableCopy()!
// test inferred transform parameter for all below
print(path.contains(CGPoint(x: 0.5, y: 0.5)))
print(path.contains(CGPoint(x: 0.5, y: 0.5), using: .evenOdd))
mutable.move(to: .zero)
mutable.addLine(to: CGPoint(x: 0.5, y: 0.5))
mutable.addCurve(to: CGPoint(x: 1, y: 1), control1: CGPoint(x: 1, y: 0), control2: CGPoint(x: 0, y: 1))
mutable.addQuadCurve(to: CGPoint(x: 0.5, y: 0.5), control: CGPoint(x: 0.5, y: 0))
mutable.addRect(CGRect(x: 0, y: 0, width: 10, height: 10))
mutable.addRects([CGRect(x: 0, y: 0, width: 100, height: 100)])
mutable.addLines(between: [CGPoint(x: 0.5, y: 0.5)])
mutable.addEllipse(in: CGRect(x: 0, y: 0, width: 50, height: 70))
mutable.addArc(center: CGPoint(x: 0.5, y: 0.5), radius: 1, startAngle: 0, endAngle: .pi, clockwise: false)
mutable.addArc(tangent1End: CGPoint(x: 1, y: 1), tangent2End: CGPoint(x: 0.5, y: 0.5), radius: 0.5)
mutable.addRelativeArc(center: CGPoint(x: 1, y: 1), radius: 0.5,
startAngle: .pi, delta: .pi/2)
mutable.addPath(dashed)
}
| apache-2.0 | ea7f9ea0b7409d724d0d0a888ebefa1c | 33.468254 | 109 | 0.536035 | 3.463317 | false | false | false | false |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.