Tag: swift

How to extract Int16 from Data in Swift 3

I’ve been trying to access the data in a BLE service characteristic value for a few days now. I thought figuring out how to translate the Temperature Sensor example to Swift would be helpful, but I get stuck at the same spot. How do I translate the Obj-C: – (CGFloat) maximumTemperature { CGFloat result = […]

Swift Core Data – Group doesn't Work

I am working on a simple iOS Swift app and can’t find any solution for a small problem with core data. I have to group some data which i fetch out of core data, but it doesn’t work. This is my fetchRequest: <NSFetchRequest: 0x7f82fbe105e0> (entity: Sets; predicate: ((null)); sortDescriptors: (( “(sort, ascending, compare:)” )); type: […]

iPhone App not showing up properly on iphone 6 simulator

My app works good on iphone 4s, 5 , 5s simulators. On iphone 6,it shows up weirdly. It does not occupy the entire screen What could be the issues?

how to write block with arg. “UnsafeMutablePointer<UnsafeMutablePointer<Float>>” in Swift closure

please help with syntax: __weak typeof (self) weakSelf = self; [self.audioFile getWaveformDataWithCompletionBlock:^(float **waveformData, int length) { [weakSelf.audioPlot updateBuffer:waveformData[0] withBufferSize:length]; }]; The waveform data itself will be an array of float arrays, one for each channel, and the length indicates the total length of each float array. @param waveformData An array of float arrays, each representing […]

Scheduling an audio file for playback in the future with AVAudioTime

I’m trying to figure out how to correcty schedule an audiofile in the near future. My actual goal is to play multiple tracks synchonized. So how to configure ‘aTime’ correctly so it starts in about for instance 0.3 seconds from now. I think that I maybe need the hostTime as well, but I don’t know […]

NSMethodSignature in Swift

In ObjC I have: NSMethodSignature *ms = [[object.target class] instanceMethodSignatureForSelector:object.selector]; NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:ms]; In Swift I get error: ‘NSObject’ does not have a member named ‘instanceMethodSignatureForSelector’ When I try this: var ms:NSMethodSignature? = (object.target.dynamicType as NSObject).instanceMethodSignatureForSelector(object.success)

No such module <product module name> in XCode Unit test

I have a mixed objective-c and Swift project and I try to write Unit tests for it. My project name is: Alphaproject my product module name is: Alphaproject I set to YES Defines Module in my main Target (Alphaproject) and set to YES EnableTestability for Debug only in this same Target. In my Test class, […]

How can I draw and rotate an Arrow at an Orientation in 3D Space?

I want to draw an image like the following in a certain orientation. Assume that the device lies flat on a table the image above shows how the arrow should be drawn. The angle between the device and the table is called alpha and it is zero in this case. The arrow points straight to […]

Xcode 8.3 Swift Version Error (SWIFT_VERSION) In Objective C Project

I have been getting the following error with Xcode 8.3 in my pure Objective C project. I have not been able to find a solution for this, there are no swift parameters in my build settings and I can not find any solutions online for this either. Any Ideas? This was building fine a few […]

iOS: Unable to establish RabbitMQ connection from Swift

I am trying to connect RabbitMQ from Swift. I have followed this library. Created pod setup and entered into workspace. Checked and verified. Successfully running. viewDidLoad override func viewDidLoad() { super.viewDidLoad() connRabbMQ = RMQConnection(uri: “amqp://test:test@192.***.**.17:15672”, delegate: RMQConnectionDelegateLogger()) connRabbMQ.start() } Output Logs: 2016-07-08 10:47:47.943 Demo_Rabb[784:38644] Received connection: <RMQConnection: 0x7fe458c3a420> failedToConnectWithError: Error Domain=com.rabbitmq.rabbitmq-objc-client Code=1 “Handshake timed out.” […]