MFI Device Picker not displaying

2020-02-11 Thread Eric E. Dolecki via Cocoa-dev
I have a device with an MFI chip in it, I have my project set up with the
supported external accessory protocol strings, and I want to pull up the
MFI device picker just to prove to myself that my app can see my device.

This code runs, prints to the console, but I get a strange error.

if btManager!.state == .poweredOn {
print("Show MFI device picker.")

  EAAccessoryManager.shared().showBluetoothAccessoryPicker(withNameFilter:
nil) { (error) in
if error != nil {
print(error!.localizedDescription)
switch error! {
case EABluetoothAccessoryPickerError.alreadyConnected:
print("already connected.")
break
default:
break
}
}
}
}

Console:

*Show MFI device picker.*

*A constraint factory method was passed a nil layout anchor.  This is not
allowed, and may cause confusing exceptions. Break on BOOL
_NSLayoutConstraintToNilAnchor(void) to debug.  This will be logged only
once.  This may break in the future.*

I am assuming this is why I see no picker displayed. I am curious why I
might be seeing this. Not exactly sure how to fix it - I do a symbolic
breakpoint the break on _NSLayoutConstraintToNilAnchor (Module: UIKit).
Doesn't break on anything. Change the module to Foundation, it does break.
Seemingly on this line:


*class AppDelegate: UIResponder, UIApplicationDelegate {*

Any insight would be appreciated.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: A question in regards to AddInstanceForFactory

2019-09-26 Thread Eric E. Dolecki via Cocoa-dev
FYI: This only appears when running in a simulator.

On Thu, Sep 26, 2019 at 8:31 AM Eric E. Dolecki  wrote:

> I am using Xcode 11.0 (11420a), targeting iOS 13, Swift 5, and playing
> back a local audio file. Seems simple enough, but I am getting a console
> print:
>
> let path = Bundle.main.path(forResource:
> "Tchaikovsky_Rococo_Var_orch.mp3", ofType:nil)!
> let url = URL(fileURLWithPath: path)
> do {
> player = try AVAudioPlayer(contentsOf: url)
> player?.volume = 0.5
> player?.numberOfLoops = -1
> player?.play()
> } catch {
> print("Could not load the audio file.")
> }
>
> *[plugin] AddInstanceForFactory: No factory registered for id ...*
>
> Everything runs fine, but how do I silence this? I've googled and haven't
> seen anything.
>
> Thanks,
> Eric
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


A question in regards to AddInstanceForFactory

2019-09-26 Thread Eric E. Dolecki via Cocoa-dev
I am using Xcode 11.0 (11420a), targeting iOS 13, Swift 5, and playing back
a local audio file. Seems simple enough, but I am getting a console print:

let path = Bundle.main.path(forResource:
"Tchaikovsky_Rococo_Var_orch.mp3", ofType:nil)!
let url = URL(fileURLWithPath: path)
do {
player = try AVAudioPlayer(contentsOf: url)
player?.volume = 0.5
player?.numberOfLoops = -1
player?.play()
} catch {
print("Could not load the audio file.")
}

*[plugin] AddInstanceForFactory: No factory registered for id ...*

Everything runs fine, but how do I silence this? I've googled and haven't
seen anything.

Thanks,
Eric
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Quick sanity check for iOS AVAudioSession

2018-11-29 Thread Eric E. Dolecki
Hey all,

I have an application I am developing and I cannot currently build to a
device. So I am asking in lieu of proper testing on my end at the moment.

1. I would like to mix my audio with that in another session (say Apple
Music is playing something). So before I play my app audio, I call this:

func activateAudioSession()

{

let session = AVAudioSession.sharedInstance()

do {

try session.setCategory(AVAudioSessionCategoryPlayback , with: [.
duckOthers, .allowBluetoothA2DP])

try session.setActive(true)

} catch {

print("Activate session error: \(error)")

}

}

When my audio has completed playing, I call this (in all cases):

func deactivateAudioSession()

{

let session = AVAudioSession.sharedInstance()

// Do this on a separate thread because on UI thread causes 500ms
delay. This unducks others after being ducked.

DispatchQueue.global().async {

do {

try session.setActive(false)

} catch {

print("Deactivate session error: \(error)")

}

}

}

2. There might be a time when I want to stomp on any audio from another
session. In that case, I have another method I call that does NOT contain
the .duckOthers option which I take to mean that mix with others is not
enabled.

func activateAudioSessionWithStompingOthers()

{

let session = AVAudioSession.sharedInstance()

do {

try session.setCategory(AVAudioSessionCategoryPlayback , with: [.
allowBluetoothA2DP])

try session.setActive(true)

} catch {

print("Activate session error: \(error)")

}

}

Does this seem about right?

Also - if I stomp on another session (again, say Apple Music), that session
pauses. Once that's done the user would need to manually unpause it - there
is nothing I can do programmatically to get that going again, correct?

Thanks for your attention,

Eric
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: UiView as slider with inertia

2018-10-01 Thread Eric E. Dolecki
Have an example? Sounds interesting - but I need the control to work like a
UIScrollView in a way (the content can go off to the left and right and not
flow)

|  visible  |
|  |
0  1  2  |  3  4  *5*  6  7  |  8  9
|  |



On Mon, Oct 1, 2018 at 2:34 AM Jonathan Hull  wrote:

> What you want is UICollectionView.  Make the numbers your cells, and use
> -targetContentOffset(forProposedContentOffset:, withScrollingVelocity:) to
> provide the snapping behavior.
>
> > On Sep 30, 2018, at 8:46 PM, Eric Dolecki  wrote:
> >
> > I've been tasked with coming up with a few horizontal sliders that are
> really sequential numbers with the selected value in the middle of the
> screen. They want drag and release with inertia and also rubber banding on
> the ends. Values snap into place. 0 1 2 3 4 5 ...
> >
> > Does anyone have something like this to save me some time? I'm assuming
> uipangesturerecognizer and some uikit dynamics.
> >
> > Thanks!!
> > Eric
> >
> > Sent from my iPhone X.
> > ___
> >
> > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> >
> > Please do not post admin requests or moderator comments to the list.
> > Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> >
> > Help/Unsubscribe/Update your Subscription:
> > https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
> >
> > This email sent to jh...@gbis.com
> >
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: touchesMoved value setting

2018-09-18 Thread Eric E. Dolecki
I have a currentValue (Int).

I have a distance of the moved. For every 20 pixels, increment or decrement
the currentValue by 1.

If I do this:

let tVal = Int(distanceValue / 20)
if increment {
currentValue = currentValue + tVal
if currentValue > maxValue { currentValue = maxValue }
} else {
currentValue = currentValue - tVal
if currentValue > maxValue { currentValue = maxValue }
}

Once the distance number gets high enough, I start to get tVal values of 2,
3, 4, etc. I think my logic is messed up here.

On Tue, Sep 18, 2018 at 9:03 AM Richard Charles 
wrote:

>
> > On Sep 18, 2018, at 6:44 AM, Eric E. Dolecki  wrote:
> >
> > I have a UI control that can be adjusted up and down using touch & drag.
> > I've been asked to provide a control value based on how far the drag is
> via
> > distance. So far so good.
> >
> > What my designer wants is a value change of every 20 pixels or so
> (control
> > is 150px tall @ the moment) - so every 20 pixels = a change of 1.
>
> I think you mean points not pixels.
>
> Not familiar with UI controls but this sounds very similiar to NSSlider.
>
>  – maxValue
>  – minValue
>
>  – setMaxValue:
>  – setMinValue:
>
> > This will require multiple touch and drags but he's fine with it.
>
> This does not sound right. I think something is wrong.
>
> --Richard Charles
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


touchesMoved value setting

2018-09-18 Thread Eric E. Dolecki
I have a UI control that can be adjusted up and down using touch & drag.
I've been asked to provide a control value based on how far the drag is via
distance. So far so good.

What my designer wants is a value change of every 20 pixels or so (control
is 150px tall @ the moment) - so every 20 pixels = a change of 1. This will
require multiple touch and drags but he's fine with it.

The math is probably simple, but it's eluding me this morning. How can I
easily convert my distance (I also have an increment Bool so I know whether
it's addition or subtraction) to an appropriate value?

Eric
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Checking if a string is valid JSON

2018-01-29 Thread Eric E. Dolecki
Cool - thanks. So this would do it?


let jsonString = composedString

let jsonData = jsonString.data(using: String.Encoding.utf8)

do {

_ = try JSONSerialization.jsonObject(with: jsonData!)

print("json seems okay.")

} catch {

print("Error deserializing JSON: \(error)")

}



On Mon, Jan 29, 2018 at 3:34 PM Saagar Jha <saa...@saagarjha.com> wrote:

> I believe jsonObject(with:options) will throw if the JSON is invalid, so
> you might be able to get away with just the try/catch. Besides, your JSON
> top level object might be an array, in which case I’d expect that casting
> to an NSDictionary would fail.
>
> Saagar Jha
>
> On Jan 29, 2018, at 12:17, Eric E. Dolecki <edole...@gmail.com> wrote:
>
> I am generating a String of JSON. Before I use it, I want to check to make
> sure that it's valid. My code is below. Does this look alright?
>
> Thanks,
> Eric
>
>
>
>let jsonString = composedString
>
>let jsonData = jsonString.data(using: String.Encoding.utf8)
>
>do {
>
>if (try JSONSerialization.jsonObject(with: jsonData!, options:
> []) as? NSDictionary) != nil {
>
>print("JSON is a dictionary. Valid.")
>
>} else {
>
>print("Not valid JSON data.")
>
>}
>
>} catch let error as NSError {
>
>print("Not valid JSON. \(error.localizedDescription)")
>
>}
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
>
> This email sent to saa...@saagarjha.com
>
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Checking if a string is valid JSON

2018-01-29 Thread Eric E. Dolecki
I am generating a String of JSON. Before I use it, I want to check to make
sure that it's valid. My code is below. Does this look alright?

Thanks,
Eric



let jsonString = composedString

let jsonData = jsonString.data(using: String.Encoding.utf8)

do {

if (try JSONSerialization.jsonObject(with: jsonData!, options:
[]) as? NSDictionary) != nil {

print("JSON is a dictionary. Valid.")

} else {

print("Not valid JSON data.")

}

} catch let error as NSError {

print("Not valid JSON. \(error.localizedDescription)")

}
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Draw an arc given 2 angles.

2018-01-25 Thread Eric E. Dolecki
Thanks. I figured out things on this end. I have it now. It always seems to
happen after I fire off an email :)

Eric

On Thu, Jan 25, 2018 at 12:57 PM Saagar Jha <saa...@saagarjha.com> wrote:

>
> Saagar Jha
>
> On Jan 25, 2018, at 09:47, Eric E. Dolecki <edole...@gmail.com> wrote:
>
> I've been googling without great success so far.
>
> I would like to draw a 6px thick red arc (not wedge), 0º at the top of the
> screen, and from say 60° - 110º. Assume I have to create a UIBezierPath,
> and then create a CAShapeLayer with that bezier path? Then add the shape
> layer to a UIView that I have.
>
> I'll be given the 2 angles to use via sliders - so I can update the arc
> (later). I just want to nail down an initial arc. Below doesn't work.
>
> 1. How do I get things so 0º is at the top, rotate circle 90º
> counterclockwise?
> 2. How can I get the red arc?
>
> Thanks!
>
> // Circle is a UIView with a height and width of 300
>
> let centre = CGPoint (x: circle.frame.size.width / 2, y: circle.frame.size.
> height / 2)
>
> let startAngle: CGFloat = 70.0
>
> let endAngle: CGFloat = 100
>
> let a_path = UIBezierPath()
>
> a_path.move(to: CGPoint(x: circle.frame.width / 2, y: circle.frame.height
> / 2))
>
>
> It looks like you’re starting from the center of the arc. I don’t think
> your arc will show up if you do this since the “radius” of it is 0.
>
>
> a_path.addArc(withCenter: centre, radius: 150, startAngle: CGFloat
> (startAngle).toRadians(), endAngle: CGFloat(endAngle).toRadians(),
> clockwise: true)
>
>
> // Want a red stroke on the arc, I get filled black wedge instead
>
> let redColor = UIColor.red
>
> redColor.setStroke()
>
> a_path.lineWidth = 6
>
> a_path.lineCapStyle = .round
>
> a_path.stroke()
>
>
>
> let a_shapeLayer = CAShapeLayer()
>
> a_shapeLayer.path = a_path.cgPath
>
>
> circle.layer.sublayers?.forEach { $0.removeFromSuperlayer() }
>
> circle.layer.addSublayer(a_shapeLayer)
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
>
> This email sent to saa...@saagarjha.com
>
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Draw an arc given 2 angles.

2018-01-25 Thread Eric E. Dolecki
I've been googling without great success so far.

I would like to draw a 6px thick red arc (not wedge), 0º at the top of the
screen, and from say 60° - 110º. Assume I have to create a UIBezierPath,
and then create a CAShapeLayer with that bezier path? Then add the shape
layer to a UIView that I have.

I'll be given the 2 angles to use via sliders - so I can update the arc
(later). I just want to nail down an initial arc. Below doesn't work.

1. How do I get things so 0º is at the top, rotate circle 90º
counterclockwise?
2. How can I get the red arc?

Thanks!

 // Circle is a UIView with a height and width of 300

 let centre = CGPoint (x: circle.frame.size.width / 2, y: circle.frame.size.
height / 2)

 let startAngle: CGFloat = 70.0

 let endAngle: CGFloat = 100

 let a_path = UIBezierPath()

 a_path.move(to: CGPoint(x: circle.frame.width / 2, y: circle.frame.height
/ 2))

 a_path.addArc(withCenter: centre, radius: 150, startAngle: CGFloat
(startAngle).toRadians(), endAngle: CGFloat(endAngle).toRadians(),
clockwise: true)


 // Want a red stroke on the arc, I get filled black wedge instead

 let redColor = UIColor.red

 redColor.setStroke()

 a_path.lineWidth = 6

 a_path.lineCapStyle = .round

 a_path.stroke()



 let a_shapeLayer = CAShapeLayer()

 a_shapeLayer.path = a_path.cgPath


 circle.layer.sublayers?.forEach { $0.removeFromSuperlayer() }

 circle.layer.addSublayer(a_shapeLayer)
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


AVSpeechSynthesizer in iOS 11?

2017-09-19 Thread Eric E. Dolecki
Anyone know if there is a trick to getting the new voice in iOS
11 AVSpeechSynthesizer? I am hearing the older, more robotic version of
Siri.

Eric
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Question about Siri use

2017-09-01 Thread Eric E. Dolecki
I would like to have Siri ask a user a question (text to speech - this part
is easy), and then wait for a user's response (with end of speech
detection). Then Siri will ask the user, "did you say ?" -
etc.

There is SFSpeechRecognizer, and then there is SiriKit.
The SFSpeechRecognizer I've seen online all do this listen for a maximum of
1-minute thing. I was thinking of using that & running a timer... if no
new bestTranscription.segments come in for a while (2 or 3 seconds), assume
that the user stopped talking, and then stop listening, and then do things.

Is that a good approach? I am want to use voice to help a user drop a pin
where they stand without needing to touch the screen. Is there something
out there on Github I can adapt to use for this? I'd rather spend my time
on other things rather than burning cycles on the voice assistant aspect of
this app if possible.

Thanks,
Eric
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Question about Audio for iOS (SessionCategory?)

2017-08-24 Thread Eric E. Dolecki
I think I got it. setActive can be called with a second argument and it
seems to make all the difference. In all the tutorials I have seen, none
made use of it so I didn't know it existed yet - until I read the docs ;)

*try theSession.setActive(true, with:[.notifyOthersOnDeactivation])*

that tells the Music app to unpause when my audio is done. I put this stuff
into a function which seems to be working.

Eric



On Thu, Aug 24, 2017 at 8:52 AM Eric E. Dolecki <edole...@gmail.com> wrote:

> Quick question.
>
> Am I supposed to set the category, then set a different category while my
> audio plays, then when complete go back to the original category? Is that
> how I should approach - or are you supposed to set the category one time?
>
> Eric
>
> On Fri, Aug 18, 2017 at 3:02 PM Eric E. Dolecki <edole...@gmail.com>
> wrote:
>
>> Where I am at currently.
>>
>> let audioSession = AVAudioSession.sharedInstance()
>> do {
>> try
>> audioSession.setCategory(AVAudioSessionCategoryPlayAndRecord, with:
>> [.duckOthers, .allowBluetoothA2DP, .allowAirPlay, .defaultToSpeaker])
>> try audioSession.setActive(true)
>> } catch {
>> print("Error. \(error.localizedDescription)")
>> }
>>
>> This doesn't stop Apple Music. This allows me to record audio in the app.
>> This ducks Apple Music when I set the category. The defaultToSpeaker allows
>> my recorded audio to sound full volume instead of sounding like 0.6 of
>> volume (which is weird). The ducking DOES NOT duck Apple Music as needed,
>> it seems to duck the audio while my app is running. It also seems to
>> degrade the audio somewhat coming to my headphones.
>>
>> I haven't been banging on iOS 11 beta yet (been holding off). I should
>> look to see if they added anything here or not.
>>
>> Have a great weekend!
>>
>> On Fri, Aug 18, 2017 at 2:04 PM Eric E. Dolecki <edole...@gmail.com>
>> wrote:
>>
>>> I moved stuff to AppDelegate and it seems a little better. However, when
>>> my audio plays, I get Apple Music to duck, and it doesn't come back up in
>>> volume. I got a notification during this, and when IT'S audio ping was done
>>> playing, Apple Music returned to normal volume.
>>>
>>> Still playing around...
>>>
>>> On Fri, Aug 18, 2017 at 1:58 PM Alex Zavatone <z...@mac.com> wrote:
>>>
>>>> There are 4 options you the audio category mode that you can test.
>>>>
>>>> Apple’s docs suck badly on this topic.  I suggest you create the 4
>>>> possible test cases and try them out.
>>>>
>>>> Also note that one of them will support the silent/mute switch.  This
>>>> is an item that is worth testing to know what you are getting.
>>>>
>>>> Cheers,
>>>> Alex Zavatone
>>>>
>>>> > On Aug 18, 2017, at 12:55 PM, Quincey Morris <
>>>> quinceymor...@rivergatesoftware.com> wrote:
>>>> >
>>>> > On Aug 18, 2017, at 10:47 , Eric E. Dolecki <edole...@gmail.com>
>>>> wrote:
>>>> >>
>>>> >> I would assume that the audio would come back up. And wouldn't think
>>>> my app would pause Apple Music when it starts up...
>>>> >
>>>> > Unless someone else jumps in with the answer, I’d say it’s TSI time!
>>>> >
>>>> > ___
>>>> >
>>>> > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>>> >
>>>> > Please do not post admin requests or moderator comments to the list.
>>>> > Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>>> >
>>>> > Help/Unsubscribe/Update your Subscription:
>>>> > https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
>>>> >
>>>> > This email sent to z...@mac.com
>>>>
>>>>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Question about Audio for iOS (SessionCategory?)

2017-08-24 Thread Eric E. Dolecki
Quick question.

Am I supposed to set the category, then set a different category while my
audio plays, then when complete go back to the original category? Is that
how I should approach - or are you supposed to set the category one time?

Eric

On Fri, Aug 18, 2017 at 3:02 PM Eric E. Dolecki <edole...@gmail.com> wrote:

> Where I am at currently.
>
> let audioSession = AVAudioSession.sharedInstance()
> do {
> try
> audioSession.setCategory(AVAudioSessionCategoryPlayAndRecord, with:
> [.duckOthers, .allowBluetoothA2DP, .allowAirPlay, .defaultToSpeaker])
> try audioSession.setActive(true)
> } catch {
> print("Error. \(error.localizedDescription)")
> }
>
> This doesn't stop Apple Music. This allows me to record audio in the app.
> This ducks Apple Music when I set the category. The defaultToSpeaker allows
> my recorded audio to sound full volume instead of sounding like 0.6 of
> volume (which is weird). The ducking DOES NOT duck Apple Music as needed,
> it seems to duck the audio while my app is running. It also seems to
> degrade the audio somewhat coming to my headphones.
>
> I haven't been banging on iOS 11 beta yet (been holding off). I should
> look to see if they added anything here or not.
>
> Have a great weekend!
>
> On Fri, Aug 18, 2017 at 2:04 PM Eric E. Dolecki <edole...@gmail.com>
> wrote:
>
>> I moved stuff to AppDelegate and it seems a little better. However, when
>> my audio plays, I get Apple Music to duck, and it doesn't come back up in
>> volume. I got a notification during this, and when IT'S audio ping was done
>> playing, Apple Music returned to normal volume.
>>
>> Still playing around...
>>
>> On Fri, Aug 18, 2017 at 1:58 PM Alex Zavatone <z...@mac.com> wrote:
>>
>>> There are 4 options you the audio category mode that you can test.
>>>
>>> Apple’s docs suck badly on this topic.  I suggest you create the 4
>>> possible test cases and try them out.
>>>
>>> Also note that one of them will support the silent/mute switch.  This is
>>> an item that is worth testing to know what you are getting.
>>>
>>> Cheers,
>>> Alex Zavatone
>>>
>>> > On Aug 18, 2017, at 12:55 PM, Quincey Morris <
>>> quinceymor...@rivergatesoftware.com> wrote:
>>> >
>>> > On Aug 18, 2017, at 10:47 , Eric E. Dolecki <edole...@gmail.com>
>>> wrote:
>>> >>
>>> >> I would assume that the audio would come back up. And wouldn't think
>>> my app would pause Apple Music when it starts up...
>>> >
>>> > Unless someone else jumps in with the answer, I’d say it’s TSI time!
>>> >
>>> > ___
>>> >
>>> > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>> >
>>> > Please do not post admin requests or moderator comments to the list.
>>> > Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>> >
>>> > Help/Unsubscribe/Update your Subscription:
>>> > https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
>>> >
>>> > This email sent to z...@mac.com
>>>
>>>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Question about Audio for iOS (SessionCategory?)

2017-08-18 Thread Eric E. Dolecki
Where I am at currently.

let audioSession = AVAudioSession.sharedInstance()
do {
try
audioSession.setCategory(AVAudioSessionCategoryPlayAndRecord, with:
[.duckOthers, .allowBluetoothA2DP, .allowAirPlay, .defaultToSpeaker])
try audioSession.setActive(true)
} catch {
print("Error. \(error.localizedDescription)")
}

This doesn't stop Apple Music. This allows me to record audio in the app.
This ducks Apple Music when I set the category. The defaultToSpeaker allows
my recorded audio to sound full volume instead of sounding like 0.6 of
volume (which is weird). The ducking DOES NOT duck Apple Music as needed,
it seems to duck the audio while my app is running. It also seems to
degrade the audio somewhat coming to my headphones.

I haven't been banging on iOS 11 beta yet (been holding off). I should look
to see if they added anything here or not.

Have a great weekend!

On Fri, Aug 18, 2017 at 2:04 PM Eric E. Dolecki <edole...@gmail.com> wrote:

> I moved stuff to AppDelegate and it seems a little better. However, when
> my audio plays, I get Apple Music to duck, and it doesn't come back up in
> volume. I got a notification during this, and when IT'S audio ping was done
> playing, Apple Music returned to normal volume.
>
> Still playing around...
>
> On Fri, Aug 18, 2017 at 1:58 PM Alex Zavatone <z...@mac.com> wrote:
>
>> There are 4 options you the audio category mode that you can test.
>>
>> Apple’s docs suck badly on this topic.  I suggest you create the 4
>> possible test cases and try them out.
>>
>> Also note that one of them will support the silent/mute switch.  This is
>> an item that is worth testing to know what you are getting.
>>
>> Cheers,
>> Alex Zavatone
>>
>> > On Aug 18, 2017, at 12:55 PM, Quincey Morris <
>> quinceymor...@rivergatesoftware.com> wrote:
>> >
>> > On Aug 18, 2017, at 10:47 , Eric E. Dolecki <edole...@gmail.com> wrote:
>> >>
>> >> I would assume that the audio would come back up. And wouldn't think
>> my app would pause Apple Music when it starts up...
>> >
>> > Unless someone else jumps in with the answer, I’d say it’s TSI time!
>> >
>> > ___
>> >
>> > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> >
>> > Please do not post admin requests or moderator comments to the list.
>> > Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> >
>> > Help/Unsubscribe/Update your Subscription:
>> > https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
>> >
>> > This email sent to z...@mac.com
>>
>>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Question about Audio for iOS (SessionCategory?)

2017-08-18 Thread Eric E. Dolecki
I moved stuff to AppDelegate and it seems a little better. However, when my
audio plays, I get Apple Music to duck, and it doesn't come back up in
volume. I got a notification during this, and when IT'S audio ping was done
playing, Apple Music returned to normal volume.

Still playing around...

On Fri, Aug 18, 2017 at 1:58 PM Alex Zavatone <z...@mac.com> wrote:

> There are 4 options you the audio category mode that you can test.
>
> Apple’s docs suck badly on this topic.  I suggest you create the 4
> possible test cases and try them out.
>
> Also note that one of them will support the silent/mute switch.  This is
> an item that is worth testing to know what you are getting.
>
> Cheers,
> Alex Zavatone
>
> > On Aug 18, 2017, at 12:55 PM, Quincey Morris <
> quinceymor...@rivergatesoftware.com> wrote:
> >
> > On Aug 18, 2017, at 10:47 , Eric E. Dolecki <edole...@gmail.com> wrote:
> >>
> >> I would assume that the audio would come back up. And wouldn't think my
> app would pause Apple Music when it starts up...
> >
> > Unless someone else jumps in with the answer, I’d say it’s TSI time!
> >
> > ___
> >
> > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> >
> > Please do not post admin requests or moderator comments to the list.
> > Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> >
> > Help/Unsubscribe/Update your Subscription:
> > https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
> >
> > This email sent to z...@mac.com
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Question about Audio for iOS (SessionCategory?)

2017-08-18 Thread Eric E. Dolecki
If Apple Music is playing when my app starts up and I define the category -
Apple Music pauses.

If I start Apple Music after my app is running, I get Apple Music to duck
while my audio plays, but Apple Music remains ducked after my audio
completes.


* try audioSession.setCategory(AVAudioSessionCategoryAmbient, with:
[.duckOthers])*

I would assume that the audio would come back up. And wouldn't think my app
would pause Apple Music when it starts up...


On Fri, Aug 18, 2017 at 1:34 PM Quincey Morris <
quinceymor...@rivergatesoftware.com> wrote:

> On Aug 18, 2017, at 10:10 , Eric E. Dolecki <edole...@gmail.com> wrote:
>
>
>try audioSession.setCategory(AVAudioSessionCategoryPlayback, with:
> [.allowBluetooth, .mixWithOthers])
>
>
> According to the documentation, AVAudioSessionCategoryPlayback will
> “interrupt” other audio that *doesn’t* have the mixWithOthers option, and
> this is defined here:
>
>
> https://developer.apple.com/library/content/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/HandlingAudioInterruptions/HandlingAudioInterruptions.html
>
> That makes it sound like it’s up to the *other* application to resume
> after an interruption, and it’s not under your control. What’s odd is that
> the first table here:
>
>
> https://developer.apple.com/library/content/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/AudioSessionCategoriesandModes/AudioSessionCategoriesandModes.html
>
> says this behavior can be changed by an “override switch” without saying
> what that means. This page:
>
>
> https://developer.apple.com/library/content/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/AudioSessionBasics/AudioSessionBasics.html
>
> suggests that it might mean the category options, but it’s not clear. Have
> you tried the “duckOthers” option, as well as or instead of “mixWithOthers”?
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Question about Audio for iOS (SessionCategory?)

2017-08-18 Thread Eric E. Dolecki
I have an application that plays snippets of audio - mainly targetted
towards BT headphones. It works, however it stops audio from other apps.

For instance, I am listening to some Apple Music on my phone over my
headphones. My app then plays some audio - which comes through the
headphones as expected, but when my audio is done, the Apple Music audio is
paused. I have to go back to Apple Music and play again. How can I avoid
this? This is my current setup.

let audioSession = AVAudioSession.sharedInstance()
do {
try audioSession.setCategory(AVAudioSessionCategoryPlayback,
with: [.allowBluetooth, .mixWithOthers])
try audioSession.setActive(true)
} catch {
print("Error")
}

My capabilities are: background modes: Audio, Airplay, and Picture in
Picture, Location Updates, Uses Bluetooth LE accessories, Background Fetch,
and Remote Notifications.

I was expecting that when my audio completes (mp4 followed by a bit of
AVSpeechSynthesizer), that the Apple Music would continue to play.

??

Thanks,
Eric
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Question about NSObject based Class & delegates

2017-08-14 Thread Eric E. Dolecki
I have a custom class. I want to use some delegation in it. How do I go
about this - currently this crashes when I assign delegates to self.

class AudioRecordingManager: NSObject, AVAudioPlayerDelegate,
AVSpeechSynthesizerDelegate {

let fileName = "demoRecording.m4a"
var messageToSpeakAfter: String = ""
var synthesizer:AVSpeechSynthesizer!
var audioPlayer:AVAudioPlayer!

override init() {
super.init()
audioPlayer = AVAudioPlayer()
synthesizer = AVSpeechSynthesizer()
   * audioPlayer.delegate = self // CRASH here*
synthesizer.delegate = self
}
...
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


didEnterRegion accuracy - how to improve?

2017-08-01 Thread Eric E. Dolecki
I have circular regions for a map (most have 30m radius). didEnterRegion
for the location manager trip in advance of entering the regions...
sometimes by many meters. Is there a way to enforce better accuracy? I
already use

locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation
locationManager.distanceFilter = kCLDistanceFilterNone

I have employed a little check that shows that indeed the userLocation is
NOT within the region when it's triggered for entry.

func locationManager(_ manager: CLLocationManager, didEnterRegion region:
CLRegion)
{
var containsPoint = false
var extraMessage = "Seems correct."
if manager.location != nil
{
let locationCoordinate = manager.location!.coordinate
//userLocation
let theRegion = region as! CLCircularRegion

// + 50 below is to see if adding some to the radius helps.
Doesn't seem to.
let circularRegion = CLCircularRegion(center: theRegion.center,
radius:theRegion.radius + 50 , identifier: theRegion.identifier)
containsPoint = circularRegion.contains(locationCoordinate)

let point1 = MKMapPointForCoordinate(locationCoordinate)
let point2 = MKMapPointForCoordinate(theRegion.center)
let distance:CLLocationDistance =
MKMetersBetweenMapPoints(point1, point2)
let roundedDistance = Double(round(1000 * distance)/1000)
let distanceString = "\(roundedDistance)m between points.
\(theRegion.radius)m radius."

if containsPoint == false {
extraMessage = "Doesn't seem accurate. \(distanceString)"
}
}
...

Since I need this to happen in the background or when the app isn't running
at all, I need to rely on didEnterRegion (startMonitoring for region). Do I
need to do something special?

Thanks,
Eric
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


User Location & Array of CLCircularRegions

2017-07-27 Thread Eric E. Dolecki
I am trying to get around the limit of 20 monitored regions for iOS. So, I
have an array of all regions (CLCircularRegions) and I have the user's
location. Based on that I want to unregister all regions, and then find the
closest 20 of them. How exactly should I do this?

var monitoredRegions:[CLCircularRegion] = []

...

monitoredRegions.removeAll()

...

// within a loop

let thisRegion = CLCircularRegion(center: centerLocation, radius: radius,
identifier: title)

monitoredRegions.append(thisRegion)

...

let location: CLLocation = CLLocation(latitude: self.myMapView.userLocation.
coordinate.latitude, longitude: self.myMapView.userLocation.coordinate.
longitude)



for region in self.monitoredRegions {

let fenceLocation = CLLocation(latitude: region.center.latitude,
longitude: region.center.longitude)

let distance = location.distance(from: fenceLocation)

print("Distance: \(region.identifier): \(distance)m")

 *// Push into a dictionary and then after this for loop, later
sort based on a key? Then use that to re-index the monitoredRegions?*

}



Thanks,

Eric
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Question about structs and enum placement in a project

2017-07-13 Thread Eric E. Dolecki
I've broken out a folder "Structs and Enums" with sub-folders based on
related areas of operation. I'm currently prototyping so I don't have tons
and tons of operation types. Seems good enough, adds organization, and it
keeps my classes much cleaner. I will probably end up with less than a
dozen of each in total.

On Thu, Jul 13, 2017 at 9:56 AM Igor Ranieri Elland <i...@elland.me> wrote:

> If they’re not being declared inside another object, why not put them in
> their own files?
>
>
> > Am 13.07.2017 um 15:53 schrieb Eric E. Dolecki <edole...@gmail.com>:
> >
> > Perhaps. Then maybe a folder of categorized structs and enums? I
> personally
> > dislike seeing them sprinkled throughout AppDelegate & other classes.
> It's
> > easy to cntrl-click to where they are defined, but it seems like a lot of
> > clutter.
> >
> > On Thu, Jul 13, 2017 at 9:52 AM Charles Srstka <cocoa...@charlessoft.com
> >
> > wrote:
> >
> >> For a project of any appreciable size, that’s gonna be one huge file…
> >>
> >> Charles
> >>
> >>> On Jul 13, 2017, at 8:37 AM, Eric E. Dolecki <edole...@gmail.com>
> wrote:
> >>>
> >>> I am planning on putting all my structs and enums into it's own swift
> >> file
> >>> - to keep my project cleaner. Seems safe enough, thoughts on this?
> >>>
> >>> Thanks,
> >>> Eric
> >>> ___
> >>>
> >>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> >>>
> >>> Please do not post admin requests or moderator comments to the list.
> >>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> >>>
> >>> Help/Unsubscribe/Update your Subscription:
> >>>
> >>
> https://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40charlessoft.com
> >>>
> >>> This email sent to cocoa...@charlessoft.com
> >>
> >>
> > ___
> >
> > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> >
> > Please do not post admin requests or moderator comments to the list.
> > Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> >
> > Help/Unsubscribe/Update your Subscription:
> > https://lists.apple.com/mailman/options/cocoa-dev/igor%40elland.me
> >
> > This email sent to i...@elland.me
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Question about structs and enum placement in a project

2017-07-13 Thread Eric E. Dolecki
Perhaps. Then maybe a folder of categorized structs and enums? I personally
dislike seeing them sprinkled throughout AppDelegate & other classes. It's
easy to cntrl-click to where they are defined, but it seems like a lot of
clutter.

On Thu, Jul 13, 2017 at 9:52 AM Charles Srstka <cocoa...@charlessoft.com>
wrote:

> For a project of any appreciable size, that’s gonna be one huge file…
>
> Charles
>
> > On Jul 13, 2017, at 8:37 AM, Eric E. Dolecki <edole...@gmail.com> wrote:
> >
> > I am planning on putting all my structs and enums into it's own swift
> file
> > - to keep my project cleaner. Seems safe enough, thoughts on this?
> >
> > Thanks,
> > Eric
> > ___
> >
> > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> >
> > Please do not post admin requests or moderator comments to the list.
> > Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> >
> > Help/Unsubscribe/Update your Subscription:
> >
> https://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40charlessoft.com
> >
> > This email sent to cocoa...@charlessoft.com
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Question about structs and enum placement in a project

2017-07-13 Thread Eric E. Dolecki
I am planning on putting all my structs and enums into it's own swift file
- to keep my project cleaner. Seems safe enough, thoughts on this?

Thanks,
Eric
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: MKMapView userLocation heading & a dropped pin

2017-06-23 Thread Eric E. Dolecki
Thank you :)

On Fri, Jun 23, 2017 at 2:17 PM Marco S Hyman  wrote:

> > I am trying to determine whether or not the pin is in front, left, right,
> > or behind the user. I am going to perform calculations within
> >
> > func locationManager(_ manager: CLLocationManager, didUpdateLocations
> > locations: [CLLocation]) {
> >
> > I already determine distance. How might I go about doing this?
>
> The Haversine forumula will give you distance and bearing between two
> points.  I think you can use the bearing to get your desired info.
>
> Marc
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


MKMapView userLocation heading & a dropped pin

2017-06-23 Thread Eric E. Dolecki
Happy Friday everyone.

I have a map and on it a userLocation which is tracked. I also have a
dropped pin on the map.

I am trying to determine whether or not the pin is in front, left, right,
or behind the user. I am going to perform calculations within

func locationManager(_ manager: CLLocationManager, didUpdateLocations
locations: [CLLocation]) {

I already determine distance. How might I go about doing this?

Thanks,
Eric
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Deep linking from 1 tvOS app to another

2017-06-16 Thread Eric E. Dolecki
Thank you so much!

On Fri, Jun 16, 2017 at 3:15 PM Jens Alfke <j...@mooseyard.com> wrote:

>
> On Jun 16, 2017, at 8:00 AM, Eric E. Dolecki <edole...@gmail.com> wrote:
>
>let modified = supplied.replacingOccurrences(of: " ", with: "+")
>
>
> Don’t use “+”, use “%20”. The “+” is only valid in some contexts IIRC,
> like form values.
>
> Actually don’t do the substitution by hand. Let NSString URL-encode it for
> you. Otherwise your URL will break again when someone decides to type a “/“
> or “#”, etc. into your text field.
>
> —Jens
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Deep linking from 1 tvOS app to another

2017-06-16 Thread Eric E. Dolecki
That makes perfect sense. I was talking to a tvOS engineer @ WWDC 2017 and
was told I don't have to worry about URLencoding app to app URLs. I thought
that sounded weird, tried it, sure didn't work ;)

Thanks Aandi.

On Fri, Jun 16, 2017 at 12:48 PM Aandi Inston <aa...@quite.com> wrote:

> Spaces are not legal in a URL. So failure or unpredictable results is
> expected. See for example discussion here
> https://stackoverflow.com/questions/497908/is-a-url-allowed-to-contain-a-space
>
>
> On 16 June 2017 at 16:00, Eric E. Dolecki <edole...@gmail.com> wrote:
>
>> I have deep linking working, but if I introduce spaces into the URL, it
>> fails. Is this expected or can I do this another way?
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Deep linking from 1 tvOS app to another

2017-06-16 Thread Eric E. Dolecki
I have deep linking working, but if I introduce spaces into the URL, it
fails. Is this expected or can I do this another way?

textfield value "hello my name is Eric"

@IBAction func editingEnded(_ sender: Any) {
if let supplied = textEntry.text {

 *   //If I don't do this, url is nil*
let modified = supplied.replacingOccurrences(of: " ", with: "+")
let url = URL(string: "(mySchemeHere)://article/\(modified)")
UIApplication.shared.open(url!, options: [:],
completionHandler: nil)
}
}

--> comes in to my other tvOS application as

"hello+my+name+is+Eric"

URLs need encoded for real-world use, so I assume that it needs done for
app to app comm too?

Eric
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Times in other cities

2017-05-15 Thread Eric E. Dolecki
Got it - I understand now. And I kindly thank you for the clarification.

On Mon, May 15, 2017 at 9:31 AM Andrew Thompson <lordpi...@mac.com> wrote:

> BST is British Summer Time, but also Bering Standard Time (UTC-11). Do you
> want to risk getting the wrong one?
>
> The UK observes daylight savings time, which being in Boston you no doubt
> understand means half the year the name of the time zone changes. In Boston
> Eastern time switches from EST to EDT and in London it's GMT to BST. Most
> likely the libraries will do something reasonable if you ask for daylight
> savings time in the dead of winter, but why risk it? If you want wall clock
> time in London as someone would see it if they were sitting there, just ask
> for Europe/London. Safer.
>
> Andrew.
>
>
> On May 15, 2017, at 9:17 AM, Eric E. Dolecki <edole...@gmail.com> wrote:
>
> Europe/London = BST though, correct?
>
>
>
>
>
> On Mon, May 15, 2017 at 9:06 AM Andrew Thompson <lordpi...@mac.com> wrote:
>
>>
>>
>> > On May 15, 2017, at 8:50 AM, Eric E. Dolecki <edole...@gmail.com>
>> wrote:
>> >
>> > Thanks for your reply. Does this look safe to use?
>> >
>> > // London
>> > let locale = TimeZone.init(abbreviation: "BST")
>> >
>>
>> Use "Europe/London":
>>
>> 1. BST has at least 3 different meanings
>> 2. You'll automatically get support for daylight savings (summertime)
>> 3. More readable in code
>>
>>
>> Andrew
>>
>>
>>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Times in other cities

2017-05-15 Thread Eric E. Dolecki
Europe/London = BST though, correct?





On Mon, May 15, 2017 at 9:06 AM Andrew Thompson <lordpi...@mac.com> wrote:

>
>
> > On May 15, 2017, at 8:50 AM, Eric E. Dolecki <edole...@gmail.com> wrote:
> >
> > Thanks for your reply. Does this look safe to use?
> >
> > // London
> > let locale = TimeZone.init(abbreviation: "BST")
> >
>
> Use "Europe/London":
>
> 1. BST has at least 3 different meanings
> 2. You'll automatically get support for daylight savings (summertime)
> 3. More readable in code
>
>
> Andrew
>
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Times in other cities

2017-05-15 Thread Eric E. Dolecki
Thanks for your reply. Does this look safe to use?

// London
let locale = TimeZone.init(abbreviation: "BST")
let cal = Calendar.current
let date = Date()
let comp = cal.dateComponents(in:locale!, from: date)

// Local (right now for me it's Boston)
let hour = Calendar.current.component(.hour, from: date)

print("HOUR OFFSET: \(comp.hour! - hour)") //HOUR OFFSET: 5

It's okay if the modifier is negative (Los Angeles from Boston, etc.)






On Sun, May 14, 2017 at 9:29 PM Jens Alfke  wrote:

>
> > On May 14, 2017, at 5:47 PM, Eric Dolecki  wrote:
> >
> > I have a clock. If like to present the times in a few major cities.  Say
> London, England. Based on the user's current time zone, present the correct
> hour, min, and second for London. If I can see how to do it for one city, I
> should be good for others.
>
> Get an NSTimeZone instance based on a GMT offset or a name
> Create an NSDateFormatter and set its timeZone property.
> Use the formatter to convert [NSDate date] to a string.
>
> If you want to display the time in some other way, like an analog clock,
> use NSDateComponents instead of NSDateFormatter; then you can get the
> hours, minutes and seconds.
>
> —Jens
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

tvOS Siri Universal Search

2017-04-20 Thread Eric E. Dolecki
Yesterday's news:
The new TV app Apple introduced last fall as a central, Siri-searchable
library of videos from various apps has now signed on Cartoon Network. Its
content now supports Universal Search, single sign-on, and recommendations
on iPhone, iPad and 4th generation Apple TV.

Is this Siri Univeral Search still a custom-Apple solution? I am still
looking for a way to ask my tvOS app to find something using my app's name
to guide the experience (YouTube on tvOS does this). I haven't found
anything, save performing a search within my tvOS application. I like the
elegance of being able to be anywhere to make a request to my application.

Eric
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Question about tvOS and the Apple TV remote

2017-04-06 Thread Eric E. Dolecki
Thanks. I just made a sample tvOS app and I couldn't import Intents for it.
There is no SiriKit for tvOS - so I still wonder if I do a "Find kittens on
YouTube" - how that actually happens.

On Fri, Mar 31, 2017 at 4:51 PM Quincey Morris <
quinceymor...@rivergatesoftware.com> wrote:

> On Mar 31, 2017, at 12:12 , Eric E. Dolecki <edole...@gmail.com> wrote:
>
>
> How is this done? I would like to add this functionality to my tvOS
> application.
>
>
> I think you’re looking for this:
>
> developer.apple.com/reference/intents
>
> And of course there’s video:
>
> developer.apple.com/videos/play/wwdc2016/225/
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Does XML (AEXML) node exist?

2017-04-05 Thread Eric E. Dolecki
I tried this and it seems to work - but does it look sound?

let theVolume = xmlDoc.root["volumeUpdated"].first
if theVolume != nil {
print(">> We have a volume update. \(String(describing: theVolume!))")
}

On Wed, Apr 5, 2017 at 10:56 AM Eric E. Dolecki <edole...@gmail.com> wrote:

> I'm using AEXML and I have some return XML from a WebSocket. I want to
> check if the return XML contains a node or not. In this way, I know what
> kind of data I'm receiving.
>
> 
> 
> 
>
> What's the best way to check if that volumeUpdated node exists? It has no
> attributes or value.
>
> I tried this (AEXMLElement is non-optional):
>
> let theVolume = xmlDoc.root["volumeUpdated"]
> if theVolume != nil {
> print(">> We have a volume update. \(theVolume)")
> }
>
> But I get a "comparing non-optional value of type 'AEXMLElement' to nil
> always returns true.
>
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Does XML (AEXML) node exist?

2017-04-05 Thread Eric E. Dolecki
I'm using AEXML and I have some return XML from a WebSocket. I want to
check if the return XML contains a node or not. In this way, I know what
kind of data I'm receiving.





What's the best way to check if that volumeUpdated node exists? It has no
attributes or value.

I tried this (AEXMLElement is non-optional):

let theVolume = xmlDoc.root["volumeUpdated"]
if theVolume != nil {
print(">> We have a volume update. \(theVolume)")
}

But I get a "comparing non-optional value of type 'AEXMLElement' to nil
always returns true.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Question about tvOS and the Apple TV remote

2017-03-31 Thread Eric E. Dolecki
YouTube supports this: You can be anywhere on the Apple TV, and ask Siri
with the remote "Find kittens in YouTube". tvOS will launch the YouTube app
and put the text request in the search box within YouTube search.
("kittens").

How is this done? I would like to add this functionality to my tvOS
application.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Rect for centered text in UILabel?

2017-03-30 Thread Eric E. Dolecki
I have a very wide UILabel that will take different text over time. Single
line. No attributed.

I would like to position an image to the left of the first character in the
label any time it's updated. So I need to get a CGRect or something of the
text within the UILabel itself. I know I did this years ago, but I can't
remember how I did it.

Looking to do this in Swift. Any ideas or things I'm blanking on?

Thanks,
Eric
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Odd UILabel behavior on tvOS

2017-03-21 Thread Eric E. Dolecki
Sorry. My argument name to set the string was "string" and that prevented
operation evidently.

On Tue, Mar 21, 2017 at 10:43 AM Eric E. Dolecki <edole...@gmail.com> wrote:

> I have a view & I update a label within it. Super simple.
>
> My string is like
> label.text = "Connecting to \"\(useName)\""
>
> I want the double quotes around that variable. As soon as the useName
> variable (a string) is inserted, anything after that does not go into the
> label.
>
> label.text = "Connecting to \"\(useName) muwahahaha"
> - no muwahahaha in the label.
>
> What might be happening? I feel stupid here.
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Odd UILabel behavior on tvOS

2017-03-21 Thread Eric E. Dolecki
I have a view & I update a label within it. Super simple.

My string is like
label.text = "Connecting to \"\(useName)\""

I want the double quotes around that variable. As soon as the useName
variable (a string) is inserted, anything after that does not go into the
label.

label.text = "Connecting to \"\(useName) muwahahaha"
- no muwahahaha in the label.

What might be happening? I feel stupid here.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Getting the true rotation of a UIView layer

2017-03-14 Thread Eric E. Dolecki
Alright, I got something now that I believe works.

*let transform:CATransform3D = innerRing.layer.presentation()!.transform*
*let angle: CGFloat = atan2(transform.m12, transform.m11)*
*var testAngle = radiansToDegress(radians: angle)*
*if testAngle < 0 {*
*testAngle = 360 + testAngle*
*}*
*print("final: \(testAngle)º")*

Seems to be spot on.


On Tue, Mar 14, 2017 at 11:41 PM Eric E. Dolecki <edole...@gmail.com> wrote:

> I don't follow.
>
> On Tue, Mar 14, 2017 at 11:29 PM Graham Cox <graham@bigpond.com>
> wrote:
>
> Get the final transform, then use it to transform an angle of 0. The
> result is the angle.
>
> —Graham
>
>
>
> > On 15 Mar 2017, at 2:13 PM, Eric E. Dolecki <edole...@gmail.com> wrote:
> >
> > Once done (I dispatch after the randomSpeed duration), I'd like to
> > determine the angle it's currently at.
> >
> > *let transform:CATransform3D = innerRing.layer.transform*
> > *let angle: CGFloat = atan2(transform.m12, transform.m11);*
> > *print(angle)*
> >
> > Always prints 0.0
> >
> > Am I missing something obvious? I almost thought about using hitTest but
> > there must be a way to get this after each spin?
> >
> > Thank you,
> > Eric
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Getting the true rotation of a UIView layer

2017-03-14 Thread Eric E. Dolecki
I don't follow.

On Tue, Mar 14, 2017 at 11:29 PM Graham Cox <graham@bigpond.com> wrote:

> Get the final transform, then use it to transform an angle of 0. The
> result is the angle.
>
> —Graham
>
>
>
> > On 15 Mar 2017, at 2:13 PM, Eric E. Dolecki <edole...@gmail.com> wrote:
> >
> > Once done (I dispatch after the randomSpeed duration), I'd like to
> > determine the angle it's currently at.
> >
> > *let transform:CATransform3D = innerRing.layer.transform*
> > *let angle: CGFloat = atan2(transform.m12, transform.m11);*
> > *print(angle)*
> >
> > Always prints 0.0
> >
> > Am I missing something obvious? I almost thought about using hitTest but
> > there must be a way to get this after each spin?
> >
> > Thank you,
> > Eric
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Getting the true rotation of a UIView layer

2017-03-14 Thread Eric E. Dolecki
I have a view that I am rotating a lot, often more than 360 degrees (spins
around a few times). Each time it stops, I want to determine the resulting
"visual" angle. How do I go about doing that?

rotateView is a configured CABasicAnimation:

*let rotateView = CABasicAnimation()*
*let randonAngle = arc4random_uniform(361) + 1440*
*rotateView.fromValue = 0*
*rotateView.toValue = Float(randonAngle) * Float(M_PI) /
Float(randomBetweenNumbers(firstNum: 90.0, secondNum: 180.0))//180.0*

*let randomSpeed = randomBetweenNumbers(firstNum: 1.5, secondNum: 2.1)*
*rotateView.duration = CFTimeInterval(randomSpeed)*

*rotateView.repeatCount = 0*
*rotateView.isRemovedOnCompletion = false*
*rotateView.fillMode = kCAFillModeForwards*
*rotateView.timingFunction = CAMediaTimingFunction(name:
kCAMediaTimingFunctionEaseOut)*
*innerRing.layer.add(rotateView, forKey: "transform.rotation.z")*

Once done (I dispatch after the randomSpeed duration), I'd like to
determine the angle it's currently at.

*let transform:CATransform3D = innerRing.layer.transform*
*let angle: CGFloat = atan2(transform.m12, transform.m11);*
*print(angle)*

Always prints 0.0

Am I missing something obvious? I almost thought about using hitTest but
there must be a way to get this after each spin?

Thank you,
Eric
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: More elegance than a long if/else

2017-03-10 Thread Eric E. Dolecki
Thank you!

On Fri, Mar 10, 2017 at 10:48 AM Jeff Kelley <slauncha...@gmail.com> wrote:

> Something like this should work:
>
> batteryIcon.image = UIImage(named: "\((_myBatteryLevel % 10) + 1)")
>
>
> Jeff Kelley
>
> slauncha...@gmail.com | @SlaunchaMan <https://twitter.com/SlaunchaMan> |
> jeffkelley.org
>
> On Fri, Mar 10, 2017 at 10:41 AM, Eric E. Dolecki <edole...@gmail.com>
> wrote:
>
> I have this super simple code, but I'd like to whittle it down to something
> a lot smaller - basically looking for multiples of 10 (100-0) for a value.
> I need coffee, what's a great way to do this in Swift 3?
>
> if _myBatteryLevel >= 90 {
> batteryIcon.image = UIImage(named: "10")
> } else if _myBatteryLevel >= 80 {
> batteryIcon.image = UIImage(named: "9")
> } else if _myBatteryLevel >= 70 {
> batteryIcon.image = UIImage(named: "8")
> } else if _myBatteryLevel >= 60 {
> batteryIcon.image = UIImage(named: "7")
> } else if _myBatteryLevel >= 50 {
> batteryIcon.image = UIImage(named: "6")
> } else if _myBatteryLevel >= 40 {
> batteryIcon.image = UIImage(named: "5")
> } else if _myBatteryLevel >= 30 {
> batteryIcon.image = UIImage(named: "4")
> } else if _myBatteryLevel >= 20 {
> batteryIcon.image = UIImage(named: "3")
> } else if _myBatteryLevel >= 10 {
> batteryIcon.image = UIImage(named: "2")
> } else if _myBatteryLevel >= 0 {
> batteryIcon.image = UIImage(named: "1")
> }
>
> Thanks for thinking about my lame code.
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/slaunchaman%40gmail.com
>
> This email sent to slauncha...@gmail.com
>
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


More elegance than a long if/else

2017-03-10 Thread Eric E. Dolecki
I have this super simple code, but I'd like to whittle it down to something
a lot smaller - basically looking for multiples of 10 (100-0) for a value.
I need coffee, what's a great way to do this in Swift 3?

if _myBatteryLevel >= 90 {
batteryIcon.image = UIImage(named: "10")
} else if _myBatteryLevel >= 80 {
batteryIcon.image = UIImage(named: "9")
} else if _myBatteryLevel >= 70 {
batteryIcon.image = UIImage(named: "8")
} else if _myBatteryLevel >= 60 {
batteryIcon.image = UIImage(named: "7")
} else if _myBatteryLevel >= 50 {
batteryIcon.image = UIImage(named: "6")
} else if _myBatteryLevel >= 40 {
batteryIcon.image = UIImage(named: "5")
} else if _myBatteryLevel >= 30 {
batteryIcon.image = UIImage(named: "4")
} else if _myBatteryLevel >= 20 {
batteryIcon.image = UIImage(named: "3")
} else if _myBatteryLevel >= 10 {
batteryIcon.image = UIImage(named: "2")
} else if _myBatteryLevel >= 0 {
batteryIcon.image = UIImage(named: "1")
}

Thanks for thinking about my lame code.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Adding a watchOS complication to an existing project?

2017-03-03 Thread Eric E. Dolecki
Everything I've seen shows adding the complication on project creation. How
does one go about adding it to a project later on? I have my watch app
right where I want it, but I didn't think I would need a complication.
Until today.

Thanks!
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


tvOS UIFocusGuide

2017-02-24 Thread Eric E. Dolecki
>From what I've seen, developers need to set up constraints for each
UIFocusGuide used. leftAnchor, topAnchor, ... etc. Is there something like
a set layoutGuide we can use to create a UIFocusGuide instance? Or does
each need constraints set?

What happens if buttons appear/disappear - we need to update all those
constraints again instead of being able to just move a focus guide?

Sorry - just getting started tvOS and noticed all this when I had to make a
diagonal move.

Eric
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Watch extension running old version

2017-02-15 Thread Eric E. Dolecki
I have a watch extension. When I build to my phone, the watch gets the
correct version installed (I can tell by changes I made in its UI). Works
fine - communication works between phone and watch.

Later on, I'll run the extension again - and I get a previous version
running.

What might be causing this?
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Use WKSessionFile as Data for AVAudioPlayer?

2017-02-08 Thread Eric E. Dolecki
UPDATE. Fixed. I bagged on sendFile and instead I am using sendMessage.
The problem with that is the iOS app needs to be open, but it plays the
message for me.

*Watch:*
let data = NSData(contentsOf: saveURL as! URL)
sendAudioFile(file: data!)

*iOS:*
func session(_ session: WCSession, didReceiveMessageData messageData: Data,
replyHandler: @escaping (Data) -> Void) {
DispatchQueue.main.async {
self.versionLabel.text = "We got an audio file: \(messageData)"
//Show bytes
self.versionLabel.textColor = UIColor.blue

// Try to play from memory buffer (NOT saving the audio)
do {
self.player = try AVAudioPlayer(data: messageData)
guard self.player != nil else { return }
self.player?.prepareToPlay()
self.player?.play()
} catch let error as NSError {
print(error.localizedDescription)
}
}
}

On Wed, Feb 8, 2017 at 8:48 AM Eric E. Dolecki <edole...@gmail.com> wrote:

> When I try the following I get a "OSStatus error 2003334207"
>
> func session(_ session: WCSession, didReceive file: WCSessionFile)
> {
> DispatchQueue.main.async
> {
> self.versionLabel.text = "We got a real audio file."
> self.versionLabel.textColor = UIColor.blue
> do {
> try self.player = AVAudioPlayer(contentsOf: file.fileURL!)
> print("It seems that we have a player. \(self.player)")
> self.player?.prepareToPlay()
> self.player?.play()
> } catch let error as NSError {
> *print(error.localizedDescription) // This is firing...*
> }
>
> file.fileURL! reports in the console as:
>
> Documents/Inbox/com.apple.watchconnectivity/711E4215-77E2-422A-80C5-6ECA8621778E/Files/AE2DCCA0-EAA0-4E4C-8E46-D1AC77101760/audioFile.wav
> --
> file:///var/mobile/Containers/Data/Application/5E72A755-D60B-4633-8283-02A0891CA8B8/
>
> file.fileURL!.path reports as:
>
>
> /var/mobile/Containers/Data/Application/26CFE356-7FB1-483B-B918-BC0A2026DE46/Documents/Inbox/com.apple.watchconnectivity/711E4215-77E2-422A-80C5-6ECA8621778E/Files/90D004CE-88F7-4C66-9B9A-5580445A0572/audioFile.wav
>
> So I tried
> try self.player = AVAudioPlayer(contentsOf: file.fileURL!.path)* //
> expecting URL and not a string so I tried:*
>
> let myURL = URL(fileURLWithPath: file.fileURL!.path)
> try self.player = AVAudioPlayer(contentsOf: myURL)
>
> And got: *The operation couldn’t be completed. (OSStatus error
> 2003334207.)*
>
> Seems kind of odd. I would think this might be easy, but for me so far
> it's not.
>
> Any help appreciated!!! I just want to play the .wav file that was sent to
> the phone.
>
>
>
> On Tue, Feb 7, 2017 at 11:25 PM Jens Alfke <j...@mooseyard.com> wrote:
>
>
> On Feb 7, 2017, at 6:49 PM, Eric E. Dolecki <edole...@gmail.com> wrote:
>
> Now, I want to instantiate an AVAudioPlayer and play that sent file. I know
> that it's received (didFinish file transfer fires in the Watch Extension).
> How do I do that? I don't know how to make that file Data.
>
>
> Can’t you just create the AVAudioPlayer from the file's URL? I’m not super
> handy with Swift, but it should be something like
> `AVAudioPlayer(contentsOfURL: fileURL)`.
>
> —Jens
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Use WKSessionFile as Data for AVAudioPlayer?

2017-02-08 Thread Eric E. Dolecki
When I try the following I get a "OSStatus error 2003334207"

func session(_ session: WCSession, didReceive file: WCSessionFile)
{
DispatchQueue.main.async
{
self.versionLabel.text = "We got a real audio file."
self.versionLabel.textColor = UIColor.blue
do {
try self.player = AVAudioPlayer(contentsOf: file.fileURL!)
print("It seems that we have a player. \(self.player)")
self.player?.prepareToPlay()
self.player?.play()
} catch let error as NSError {
*print(error.localizedDescription) // This is firing...*
}

file.fileURL! reports in the console as:

Documents/Inbox/com.apple.watchconnectivity/711E4215-77E2-422A-80C5-6ECA8621778E/Files/AE2DCCA0-EAA0-4E4C-8E46-D1AC77101760/audioFile.wav
-- 
file:///var/mobile/Containers/Data/Application/5E72A755-D60B-4633-8283-02A0891CA8B8/

file.fileURL!.path reports as:

/var/mobile/Containers/Data/Application/26CFE356-7FB1-483B-B918-BC0A2026DE46/Documents/Inbox/com.apple.watchconnectivity/711E4215-77E2-422A-80C5-6ECA8621778E/Files/90D004CE-88F7-4C66-9B9A-5580445A0572/audioFile.wav

So I tried
try self.player = AVAudioPlayer(contentsOf: file.fileURL!.path)* //
expecting URL and not a string so I tried:*

let myURL = URL(fileURLWithPath: file.fileURL!.path)
try self.player = AVAudioPlayer(contentsOf: myURL)

And got: *The operation couldn’t be completed. (OSStatus error 2003334207.)*

Seems kind of odd. I would think this might be easy, but for me so far it's
not.

Any help appreciated!!! I just want to play the .wav file that was sent to
the phone.



On Tue, Feb 7, 2017 at 11:25 PM Jens Alfke <j...@mooseyard.com> wrote:

>
> On Feb 7, 2017, at 6:49 PM, Eric E. Dolecki <edole...@gmail.com> wrote:
>
> Now, I want to instantiate an AVAudioPlayer and play that sent file. I know
> that it's received (didFinish file transfer fires in the Watch Extension).
> How do I do that? I don't know how to make that file Data.
>
>
> Can’t you just create the AVAudioPlayer from the file's URL? I’m not super
> handy with Swift, but it should be something like
> `AVAudioPlayer(contentsOfURL: fileURL)`.
>
> —Jens
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Use WKSessionFile as Data for AVAudioPlayer?

2017-02-07 Thread Eric E. Dolecki
I am transferring an audio file from Apple Watch extension to iOS
application.

In the Extension:
func sendAudioFileProper(){
WCSession.default().transferFile(saveURL as! URL, metadata: nil)
}

I create saveURL like this:

let fileManager = FileManager.default
let container =
fileManager.containerURL(forSecurityApplicationGroupIdentifier:
"group.net.ericd.WatchRecord")
let fileName = "audioFile.wav"
saveURL = container?.appendingPathComponent(fileName) as NSURL?

iOS application:

func session(_ session: WCSession, didReceive file: WCSessionFile)
{
DispatchQueue.main.async
{
self.versionLabel.text = "We got a real audio file."
self.versionLabel.textColor = UIColor.blue
   * // ? How do I use the file to instantiate an AVAudioPlayer?*

Now, I want to instantiate an AVAudioPlayer and play that sent file. I know
that it's received (didFinish file transfer fires in the Watch Extension).
How do I do that? I don't know how to make that file Data.

I am using an app group if that matters. Should I be saving the file when
received, then use it to create the AVAudioPlayer? If so, how should I do
that?
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Received file from watch - how to play?

2017-02-07 Thread Eric E. Dolecki
In my ViewController on the iOS side:

func session(_ session: WCSession, didReceive file: WCSessionFile)

I am getting the file (which is a wav file) - but I'm not sure how to
actually play it in iOS when I get it. I've tried file.fileURL!.path and
creating a NSURL from that to instantiate a AVAudioPlayer with it, but it's
not working.

I read where you need to move the file local to the phone and then use it,
but I have not been able to successfully do that either.

Any tips?
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


App Groups saveURL problem

2017-02-07 Thread Eric E. Dolecki
I have a watch app. In App Groups for the project I've enabled App Groups
(under capabilities). My app group string is "group.net.ericd.WatchRecord".

In my extension InterfaceController I have this code

var saveURL: NSURL?

override func awake(withContext context: Any?)  {
super.awake(withContext: context)
let fileManager = FileManager.default
let container =
fileManager.containerURL(forSecurityApplicationGroupIdentifier:
"group.net.ericd.WatchRecord")
let fileName = "audioFile.wav"
saveURL = container?.appendingPathComponent(fileName) as NSURL?
print(saveURL) // nil?
}

saveURL is nil. I am running this in the simulator at the moment. Do I need
to run this on hardware? Am I doing something wrong? Since I need  saveURL
to exist for my recordAudio function, this is a problem :)

Thanks,
Eric
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: WatchOS3 layering?

2017-01-27 Thread Eric E. Dolecki
Thanks for your reply. I do think that might work. There is just that one
area of overlap to worry about. The group background image could indeed be
a solution. I'll give it a go.

Eric

On Fri, Jan 27, 2017 at 10:27 AM Jeff Kelley  wrote:

> Hi Eric,
>
> This sounds achievable. You can embed interface objects inside of a
> WKInterfaceGroup, and that group can have a background image. So you’d put
> the group in with your background image, and then inside of it would be the
> semicircle image. Does that sound like it would work?
>
>
> Jeff Kelley
>
> slauncha...@gmail.com | @SlaunchaMan  |
> jeffkelley.org
>
> On Thu, Jan 26, 2017 at 10:55 PM, Eric Dolecki  wrote:
>
> I have a quick question.
> I've been asked to make a companion watch app and have been given a sketch
> file for the design. In the design in the center is an image of a product.
> On top and larger is an image that will be hooked up via sequence to the
> digital crown - a semicircle progress thing.
> So it seems like two images atop one another. Is this possible? For iOS
> it's a no brainier. I've dabbled in watch development but it's been a long
> time.
> Eric
>
> Get Outlook for iOS
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/slaunchaman%40gmail.com
>
> This email sent to slauncha...@gmail.com
>
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Math question

2017-01-24 Thread Eric E. Dolecki
Never mind on that one. with a 0-100, it's super simple. But if it's 0 - 15
that could be quite different. I'll noodle on that.

On Tue, Jan 24, 2017 at 1:57 PM Eric E. Dolecki <edole...@gmail.com> wrote:

> Thanks so much, that works perfectly!
>
> Another quick question.
>
> distance of 100 = minimum value (say 0)
> distance of 200 = maximum value (say 100)
>
> How can I apply that? I plan on Int for this value.
>
>
> On Tue, Jan 24, 2017 at 1:52 PM Saagar Jha <saa...@saagarjha.com> wrote:
>
> Not completely sure if this is what you want, but I think your “scale”
> would be:
>
> scale = (distance - minDistance) / (maxDistance - minDistance) * (maxScale
> - minScale) + minScale
>
> In this case,
>
> scale = (distance - 100) / 100 * 2 + 1
>
> Saagar Jha
>
> On Jan 24, 2017, at 10:45 AM, Eric E. Dolecki <edole...@gmail.com> wrote:
>
> I have a situation where the distance of an onTouchesBegan in iOS produces
> a scale for an object.
>
> min distance of 100 = scale of 1.0
> max distance of 200 = scale of 3.0
>
> So I am looking for a number between 100 and 200 which ends up being
> between 1.0 and 3.0. I can get the distance easily enough, but the scale
> factor eludes me at the moment. Coffee? Lack of this kind of math for over
> 20 years? Heh.
>
> self.scaleCircle.transform = CGAffineTransform(scaleX: percentage, y:
> percentage)
>
> What math would I apply to get that range?
>
> Eric
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
>
> This email sent to saa...@saagarjha.com
>
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Math question

2017-01-24 Thread Eric E. Dolecki
Thanks so much, that works perfectly!

Another quick question.

distance of 100 = minimum value (say 0)
distance of 200 = maximum value (say 100)

How can I apply that? I plan on Int for this value.


On Tue, Jan 24, 2017 at 1:52 PM Saagar Jha <saa...@saagarjha.com> wrote:

> Not completely sure if this is what you want, but I think your “scale”
> would be:
>
> scale = (distance - minDistance) / (maxDistance - minDistance) * (maxScale
> - minScale) + minScale
>
> In this case,
>
> scale = (distance - 100) / 100 * 2 + 1
>
> Saagar Jha
>
> On Jan 24, 2017, at 10:45 AM, Eric E. Dolecki <edole...@gmail.com> wrote:
>
> I have a situation where the distance of an onTouchesBegan in iOS produces
> a scale for an object.
>
> min distance of 100 = scale of 1.0
> max distance of 200 = scale of 3.0
>
> So I am looking for a number between 100 and 200 which ends up being
> between 1.0 and 3.0. I can get the distance easily enough, but the scale
> factor eludes me at the moment. Coffee? Lack of this kind of math for over
> 20 years? Heh.
>
> self.scaleCircle.transform = CGAffineTransform(scaleX: percentage, y:
> percentage)
>
> What math would I apply to get that range?
>
> Eric
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
>
> This email sent to saa...@saagarjha.com
>
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Math question

2017-01-24 Thread Eric E. Dolecki
I have a situation where the distance of an onTouchesBegan in iOS produces
a scale for an object.

min distance of 100 = scale of 1.0
max distance of 200 = scale of 3.0

So I am looking for a number between 100 and 200 which ends up being
between 1.0 and 3.0. I can get the distance easily enough, but the scale
factor eludes me at the moment. Coffee? Lack of this kind of math for over
20 years? Heh.

self.scaleCircle.transform = CGAffineTransform(scaleX: percentage, y:
percentage)

What math would I apply to get that range?

Eric
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Rotary knob with table-like momentum

2017-01-23 Thread Eric E. Dolecki
Thanks for the project. It doesn't contain momentum or rubber-banding
though. Right now I have tapping on the left or right to + or - the
value and animates the knob. You can also kind of throw it - I translate
velocity to a number of steps to move, and it animates appropriately (with
no rubber-banding). I don't have smooth scrolling on a slow uipangesture.
Hmm.

On Sun, Jan 22, 2017 at 11:49 PM Graham Cox  wrote:

>
> > On 23 Jan 2017, at 1:27 PM, Eric Dolecki  wrote:
> >
> > Hey all,
> > Does anyone have a control (knob) that you can turn with a horizontal
> swipe, but snaps to detents.
>
>
> I’m attaching a project I made for Mac a while back that does this sort of
> thing.
>
> It’ll need adapting to iOS, but shouldn’t be too hard. Hope you find it
> useful.
>
> —Graham
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Swift: Draw a circle with tic marks at it's edge?

2017-01-19 Thread Eric E. Dolecki
Okay - Paintcode to the rescue. I made my art in Illustrator, and I can
support up to 45 values @ the moment (each segment an 8º rotation). I
if/else the hell out of whether or not a line gets stroked based on the
number of ticks. At least my artwork for the dial looks good now. Thanks
for that suggestion. If I ever need more than 45 values, I'll probably need
to revisit this solution, but I should be okay.

On Thu, Jan 19, 2017 at 8:48 AM Eric E. Dolecki <edole...@gmail.com> wrote:

> [image: knob.jpg]
>
> I have this Class that I am testing out. However, the position of the
> ticks is off. Seems like it needs to be moved down 1/2 way and the same to
> the right. I tried doing this with a shape layer and moving that - but it
> didn't change the appearance. Also, it seems like the spacing between ticks
> is way off (very far apart). I am looking for a solution to this current
> problem, please.
>
> class Disc: UIView {
>
> // Defaults.
> private var myOuterRadius: CGFloat = 100.0
> private var myInnerRadius: CGFloat = 90.0
> private var myNumberOfTicks: Int = 5
>
> override func draw(_ rect: CGRect)
> {
> let strokeColor = UIColor.black
> let tickPath = UIBezierPath()
> for i in 0.. let angle = CGFloat(i) * CGFloat(2 * M_PI) /
> CGFloat(myNumberOfTicks)
> let inner = CGPoint(x: myInnerRadius * cos(angle), y:
> myInnerRadius * sin(angle))
> let outer = CGPoint(x: myOuterRadius * cos(angle), y:
> myOuterRadius * sin(angle))
> print(angle, inner, outer)
> tickPath.move(to: inner)
> tickPath.addLine(to: outer)
> }
> tickPath.close()
> tickPath.lineCapStyle = .round
> strokeColor.setStroke()
> tickPath.lineWidth = 2
> tickPath.stroke()
> }
>
> init(width: CGFloat, numTicks: Int)
> {
> super.init(frame: CGRect(x: 0, y: 0, width: width, height: width))
> myOuterRadius = width / 2
> myInnerRadius = (width / 2) - 10
> myNumberOfTicks = numTicks
> self.backgroundColor = UIColor(netHex: 0xEE)
> self.layer.cornerRadius = CGFloat(width / 2)
> self.layer.masksToBounds = true
> }
>
> required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has
> not been implemented") }
> }
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Swift: Draw a circle with tic marks at it's edge?

2017-01-19 Thread Eric E. Dolecki
[image: knob.jpg]

I have this Class that I am testing out. However, the position of the ticks
is off. Seems like it needs to be moved down 1/2 way and the same to the
right. I tried doing this with a shape layer and moving that - but it
didn't change the appearance. Also, it seems like the spacing between ticks
is way off (very far apart). I am looking for a solution to this current
problem, please.

class Disc: UIView {

// Defaults.
private var myOuterRadius: CGFloat = 100.0
private var myInnerRadius: CGFloat = 90.0
private var myNumberOfTicks: Int = 5

override func draw(_ rect: CGRect)
{
let strokeColor = UIColor.black
let tickPath = UIBezierPath()
for i in 0..___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Swift: Draw a circle with tic marks at it's edge?

2017-01-18 Thread Eric E. Dolecki
Yes - and best approach. The number of ticks will always be dynamic. I'm
making this control it's own UIView subclass. So when it's created, you
supply min value, max value, current value, etc.

When one swipes, it will rotate the control and change the value. I'm just
trying to get the drawing correct. Should the dial be a UIView with its
layer cornerRadius set so it's round, and then create a shape layer with my
path and then add that to the dial's sublayer? Not sure, but I am creating
my path like this right now...

numberOfTics = 5 // I am actually getting this from the init, but it's here
for testing.
outerRadius = 210 // Same as above, here for testing.
innerRadius = 200 // Same as above.

path = UIBezierPath()
for i in 0.. wrote:

> I’m not sure what you’re asking. This is just a circle and a couple of
> lines, with some basic trig to compute the endpoints of the lines. Are you
> asking how to use the CG graphics APIs?
>
> —Jens
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Swift: Draw a circle with tic marks at it's edge?

2017-01-18 Thread Eric E. Dolecki
[image: Screen Shot 2017-01-18 at 3.28.22 PM.png]

I have been tasked to create a control. A giant knob that is ticked along
its edge (the number dependent on the minimum & maximum values). Not 360
degrees, just enough ticks to show the range. It will do other things as
well, but I'm wondering how to approach this. The values will always be
Int.

I have included a screenshot. The longer dark tick will always show the
current value. I didn't want to paste a lot of code in here, but I tried
UIBezierPaths and my code only produced a black background. Would this be a
ShapeLayer with another sublayer for the ticks? I'll be using
UIGestureRecognizer to control the rotation of the "dial"...

Eric
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Drag UITableView up/down

2016-12-06 Thread Eric E. Dolecki
Well, not really. I'll try to explain a bit more.

I have a table and it takes up the bottom 1/2 of the screen. When a user
swipes up, instead of scrolling the cells, the table moves up the screen
until it's at 100px from the top - and at that point, the swipe scrolls the
cells up. When the table is scrolled down (the cells) to the point where
the 1st row is displayed, the swipe moves the whole table back down to a .y
of 1/2 of the screen.

The Penguins (Pittsburgh) app (powered by YinzCam) does this very well.

On Tue, Dec 6, 2016 at 3:26 PM Gary L. Wade <garyw...@desisoftsystems.com>
wrote:

> It sounds like what you’re really wanting to do is emulate what Apple’s
> News app is doing, right?
>
> First, you set your navigation controller’s hidesBarsOnSwipe to true.  The
> next step is the more difficult one, but it depends on how you want your
> status bar to appear and if you want a mini-navigation bar rather than just
> the status bar:
>
> 1. Override your table view controller’s preferredStatusBarStyle to return
> the style that matches with your content or mini-navigation bar.  I chose
> light because I had an opaque mini-navigation bar that was dark.  You get
> the default setting if you don’t do this, and it may be difficult to see.
> 2. If you want your status bar opaque and/or a mini-navigation bar, you’ll
> need to add a subview to your table view controller’s view’s superview
> constrained to (top,left,trailing)=(0,0,0) and height=20.  If you want a
> mini-navigation bar, you’ll need to make that height what you need it to
> be.  I wanted my navigation bar to have three states like News: expanded,
> mini, collapsed.  In expanded mode, you get the normal navigation bar.  In
> mini, the height might be 40 (20 extra points for the condensed title or
> info), and 20 for collapsed.
>
> Based on my observations, News expands when you tap on the status bar in
> the collapsed mode, so you’ll need to override that operation, to provide
> that rather than jump to the top immediately.
>
> There’s some other navigation controller settings for the navigation bar
> that you may find useful around hidesBarsOnSwipe so check those out.
> --
> Gary L. Wade
> http://www.garywade.com/
>
> On Dec 6, 2016, at 11:38 AM, Eric E. Dolecki <edole...@gmail.com> wrote:
>
> I'm looking for a chunk of view controller code that allows for:
>
> A UITableView. You can drag the whole table up (not the cells) to a limit
> from the top of the VC, say like 100px. When you've reached that, the table
> will scroll up normally.
>
> When you scroll the table down (cells) and reach item 0, and continue to
> swipe down, the table will slide down with the gesture until a position
> from the bottom.
>
> Seems like this is a current trend in some applications. I have a lot of it
> in place, but the scrolling down until 1st row, then move table is elusive
> at the moment.
>
> A super-simple project or something to get me going would be appreciated.
>
> Thanks for your time & attention,
> Eric
>
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Drag UITableView up/down

2016-12-06 Thread Eric E. Dolecki
I'm looking for a chunk of view controller code that allows for:

A UITableView. You can drag the whole table up (not the cells) to a limit
from the top of the VC, say like 100px. When you've reached that, the table
will scroll up normally.

When you scroll the table down (cells) and reach item 0, and continue to
swipe down, the table will slide down with the gesture until a position
from the bottom.

Seems like this is a current trend in some applications. I have a lot of it
in place, but the scrolling down until 1st row, then move table is elusive
at the moment.

A super-simple project or something to get me going would be appreciated.

Thanks for your time & attention,
Eric
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Vertically Centered Colon

2016-11-28 Thread Eric E. Dolecki
You could probably use an attributed string and add an attribute for the
last colon: NSBaselineOffsetAttributeName

On Mon, Nov 28, 2016 at 10:02 AM Gerriet M. Denkmann 
wrote:

> iOS 10.1.1
>
> WWDC 2015,Session 804: Introducing the New System Fonts tells (at about
> 23:23) about Vertically Centered Colons.
> But I do not understand, how to turn this on.
>
> It works automatically (in SF) with colons surrounded by digits.
>
> But in my case I have “21:37:44” where ““21:37” is bold and “:44” is thin.
> And the ‘:’ in front of “44” is not surrounded by digits. So I want to turn
> this feature on explicitly.
>
> How to do this?
>
> Gerriet.
>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/edolecki%40gmail.com
>
> This email sent to edole...@gmail.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: CABasicAnimation in a view that's covered by another?

2016-11-23 Thread Eric E. Dolecki
29373893

On Wed, Nov 23, 2016 at 8:36 AM Eric E. Dolecki <edole...@gmail.com> wrote:

> Sure enough, I removed my delay and set my panel to an alpha of 0.99 - and
> the crossfade works as intended behind the view. This seems like a bug to
> me and I'll file it.
>
> On Tue, Nov 22, 2016 at 8:06 PM David Duncan <david.dun...@apple.com>
> wrote:
>
> On Nov 22, 2016, at 1:22 PM, Eric E. Dolecki <edole...@gmail.com> wrote:
>
> If the panel is up covering the UIImageView and the cross-fade is called,
> and I bring the panel back down, exposing the UIImageView, the cross-fade
> did not take place, the image not updated. That's how I know.
>
> If I time the crossfade on closing the panel... a 10th of a second after
> the panel starts to move (thus exposing a tiny bit of the UIImageView
> before the crossfade), it works. How strange is this?
>
>
> Possible its a bug related to if the OS thinks that the image view needs
> to be drawn or not. If you give your panel alpha <1 does that resolve the
> issue as well? (If so, please file a bug).
>
>
> On Tue, Nov 22, 2016 at 1:57 PM David Duncan <david.dun...@apple.com>
> wrote:
>
>
> > On Nov 22, 2016, at 7:26 AM, Eric E. Dolecki <edole...@gmail.com> wrote:
> >
> > I have a cross-fading album art thing happening. When I can see the
> > imageview it works fine, if it's totally covered by another view (a
> panel I
> > slide up), it seems to not change. Is this a known thing? Doesn't seem
> > right - I am trying to track down other related things to see.
>
> What do you mean by “seems to not change”? Can you see the view through
> the panel you slide up? If not, how can you tell what is going on?
>
> >
> >myfade = CABasicAnimation(keyPath: "contents")
> >myfade.duration = 0.4
> >myfade.fromValue = largeAlbumCover.image!.cgImage
> >myfade.toValue = artImage?.cgImage
> >myfade.delegate = self
> >largeAlbumCover.layer.add(myfade, forKey:
> "animateContents")
> >largeAlbumCover.image = artImage
> >
> > Thanks,
> > Eric
> > ___
> >
> > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> >
> > Please do not post admin requests or moderator comments to the list.
> > Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> >
> > Help/Unsubscribe/Update your Subscription:
> >
> https://lists.apple.com/mailman/options/cocoa-dev/david.duncan%40apple.com
> >
> > This email sent to david.dun...@apple.com
>
> --
> David Duncan
>
>
> --
> David Duncan
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: CABasicAnimation in a view that's covered by another?

2016-11-23 Thread Eric E. Dolecki
Sure enough, I removed my delay and set my panel to an alpha of 0.99 - and
the crossfade works as intended behind the view. This seems like a bug to
me and I'll file it.

On Tue, Nov 22, 2016 at 8:06 PM David Duncan <david.dun...@apple.com> wrote:

> On Nov 22, 2016, at 1:22 PM, Eric E. Dolecki <edole...@gmail.com> wrote:
>
> If the panel is up covering the UIImageView and the cross-fade is called,
> and I bring the panel back down, exposing the UIImageView, the cross-fade
> did not take place, the image not updated. That's how I know.
>
> If I time the crossfade on closing the panel... a 10th of a second after
> the panel starts to move (thus exposing a tiny bit of the UIImageView
> before the crossfade), it works. How strange is this?
>
>
> Possible its a bug related to if the OS thinks that the image view needs
> to be drawn or not. If you give your panel alpha <1 does that resolve the
> issue as well? (If so, please file a bug).
>
>
> On Tue, Nov 22, 2016 at 1:57 PM David Duncan <david.dun...@apple.com>
> wrote:
>
>
> > On Nov 22, 2016, at 7:26 AM, Eric E. Dolecki <edole...@gmail.com> wrote:
> >
> > I have a cross-fading album art thing happening. When I can see the
> > imageview it works fine, if it's totally covered by another view (a
> panel I
> > slide up), it seems to not change. Is this a known thing? Doesn't seem
> > right - I am trying to track down other related things to see.
>
> What do you mean by “seems to not change”? Can you see the view through
> the panel you slide up? If not, how can you tell what is going on?
>
> >
> >myfade = CABasicAnimation(keyPath: "contents")
> >myfade.duration = 0.4
> >myfade.fromValue = largeAlbumCover.image!.cgImage
> >myfade.toValue = artImage?.cgImage
> >myfade.delegate = self
> >largeAlbumCover.layer.add(myfade, forKey:
> "animateContents")
> >largeAlbumCover.image = artImage
> >
> > Thanks,
> > Eric
> > ___
> >
> > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> >
> > Please do not post admin requests or moderator comments to the list.
> > Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> >
> > Help/Unsubscribe/Update your Subscription:
> >
> https://lists.apple.com/mailman/options/cocoa-dev/david.duncan%40apple.com
> >
> > This email sent to david.dun...@apple.com
>
> --
> David Duncan
>
>
> --
> David Duncan
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: CABasicAnimation in a view that's covered by another?

2016-11-22 Thread Eric E. Dolecki
If the panel is up covering the UIImageView and the cross-fade is called,
and I bring the panel back down, exposing the UIImageView, the cross-fade
did not take place, the image not updated. That's how I know.

If I time the crossfade on closing the panel... a 10th of a second after
the panel starts to move (thus exposing a tiny bit of the UIImageView
before the crossfade), it works. How strange is this?

On Tue, Nov 22, 2016 at 1:57 PM David Duncan <david.dun...@apple.com> wrote:

>
> > On Nov 22, 2016, at 7:26 AM, Eric E. Dolecki <edole...@gmail.com> wrote:
> >
> > I have a cross-fading album art thing happening. When I can see the
> > imageview it works fine, if it's totally covered by another view (a
> panel I
> > slide up), it seems to not change. Is this a known thing? Doesn't seem
> > right - I am trying to track down other related things to see.
>
> What do you mean by “seems to not change”? Can you see the view through
> the panel you slide up? If not, how can you tell what is going on?
>
> >
> >myfade = CABasicAnimation(keyPath: "contents")
> >myfade.duration = 0.4
> >myfade.fromValue = largeAlbumCover.image!.cgImage
> >myfade.toValue = artImage?.cgImage
> >myfade.delegate = self
> >largeAlbumCover.layer.add(myfade, forKey:
> "animateContents")
> >largeAlbumCover.image = artImage
> >
> > Thanks,
> > Eric
> > ___
> >
> > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> >
> > Please do not post admin requests or moderator comments to the list.
> > Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> >
> > Help/Unsubscribe/Update your Subscription:
> >
> https://lists.apple.com/mailman/options/cocoa-dev/david.duncan%40apple.com
> >
> > This email sent to david.dun...@apple.com
>
> --
> David Duncan
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

CABasicAnimation in a view that's covered by another?

2016-11-22 Thread Eric E. Dolecki
I have a cross-fading album art thing happening. When I can see the
imageview it works fine, if it's totally covered by another view (a panel I
slide up), it seems to not change. Is this a known thing? Doesn't seem
right - I am trying to track down other related things to see.

myfade = CABasicAnimation(keyPath: "contents")
myfade.duration = 0.4
myfade.fromValue = largeAlbumCover.image!.cgImage
myfade.toValue = artImage?.cgImage
myfade.delegate = self
largeAlbumCover.layer.add(myfade, forKey: "animateContents")
largeAlbumCover.image = artImage

Thanks,
Eric
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

MPMediaPickerController - hide explicit songs?

2016-11-10 Thread Eric E. Dolecki
I have an application that allows a user to add songs to a queue. I am
using the MPMediaPicker - but I'd like the application to be family
friendly. Is there some way to prevent it from displaying explicit material
(I am only concerned with songs) to begin with. I think that I would love a
property like

 myMediaPicker.doesAllowExplicitMaterial = false

I know not all songs have the ITUNESADVISORY ID3 tag and that's fine.

Any ideas?

Thanks,
Eric
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Swift 3 macOS read keyboard

2016-10-10 Thread Eric E. Dolecki
I just discovered

override func keyDown(with event: NSEvent) { }
override func keyUp(with event: NSEvent) {}

NSEvent.addLocalMonitorForEvents(matching: .keyUp) { (aEvent) -> NSEvent? in
self.keyUp(with: aEvent)
return aEvent
}
NSEvent.addLocalMonitorForEvents(matching: .keyDown) { (aEvent) ->
NSEvent? in
self.keyDown(with: aEvent)
return aEvent
}

So I have it working now without subclassing NSView, etc. It took me a
while to find that bit about NSEvent.addLocalMonitorForEvents...

Eric

On Mon, Oct 10, 2016 at 8:53 AM Eric E. Dolecki <edole...@gmail.com> wrote:

> I am delving into macOS development and I'd like to do something simple.
> Give the Application Window "focus" to receive keyboard events. Meaning no
> text fields.
>
> How exactly do I do this? I've been googling and have seen all kinds of
> things but none of them have worked out. What would be the most
> straightforward way of kicking off keyUp and keyDown from within my main
> NSViewController so I can read keys?
>
> Thanks,
> Eric
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Swift 3 macOS read keyboard

2016-10-10 Thread Eric E. Dolecki
I am delving into macOS development and I'd like to do something simple.
Give the Application Window "focus" to receive keyboard events. Meaning no
text fields.

How exactly do I do this? I've been googling and have seen all kinds of
things but none of them have worked out. What would be the most
straightforward way of kicking off keyUp and keyDown from within my main
NSViewController so I can read keys?

Thanks,
Eric
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Extra logging in Simulators for iOS 10 & for macOS Sierra?

2016-10-06 Thread Eric E. Dolecki
Thank you very much. It's especially annoying when using
MultipeerConnectivity. I'll check it out.

On Thu, Oct 6, 2016 at 3:54 PM Quincey Morris <
quinceymor...@rivergatesoftware.com> wrote:

> On Oct 6, 2016, at 12:06 , Eric E. Dolecki <edole...@gmail.com> wrote:
>
>
> Is there a way to turn this off for Xcode 8.0?
>
>
> I believe this (the unwanted messages) is resolved in Xcode 8.1 beta 2,
> although I haven’t verified this personally.
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Extra logging in Simulators for iOS 10 & for macOS Sierra?

2016-10-06 Thread Eric E. Dolecki
When I build to device for iOS - I get the expected logging. If I build to
an iOS Simulated device, I am getting a bunch of logging to the console.

2016-10-06 15:02:35.138443 testBars[59267:10948290] subsystem:
com.apple.UIKit, category: HIDEventFiltered, enable_level: 0,
persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0,
generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2,
enable_private_data: 0
...

The same goes for when I build a macOS application - I am getting all kinds
of extra logging (not the same as for iOS).

Is there a way to turn this off for Xcode 8.0? Is this new and to be
expected? Did an Apple Engineer mistakenly leave some flags on prior to
release?

Thank you,
Eric
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: UIFeedbackGenerator: 0.1 second latency vs. built-in system haptics?

2016-10-03 Thread Eric E. Dolecki
If I had an iPhone 7 I could test this, but you're correct in stating that
haptics need to fire nearly instantaneously for them to be perceived
correctly by a user. I know mechanically there is a small time to ramp to
full movement, but would expect it to be nominal.

Eric

On Sun, Oct 2, 2016 at 10:07 PM Archagon  wrote:

> I was trying to play some audio along with a UIImpactFeedbackGenerator
> action, and I noticed that the haptic feedback was delayed by about
> 0.1 seconds after each tap — even when prepare() was correctly called
> beforehand. Digging further, I discovered that even in the simplest
> possible test case — just a button with a touchUpInside action
> triggering haptics, along with a UISwitch for comparison underneath —
> the button's haptics were delayed as before, while the switch's native
> haptics were instantaneous. How can I get rid of this latency in my
> custom controls? Surely, haptics are only effective when they there's
> no perceived delay!
>
> Here's the test case project:
> https://github.com/archagon/uifeedbackgenerator-lag-test
>
> Thank you,
> -Alexei Baboulevitch
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/edolecki%40gmail.com
>
> This email sent to edole...@gmail.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Multipeer between macOS Sierra and iOS 10

2016-09-29 Thread Eric E. Dolecki
I emailed the list yesterday about getting communication going between an
iOS application and a macOS one. I coded it up this morning and it works
quite well. However the consoles are filled with Errors eventhough things
are connected and send data back and forth.

Things like:
[ViceroyTrace] [ICE][ERROR] ICEStopConnectivityCheck() found no ICE check
with call id (1506554834)
[ViceroyTrace] [ICE][ERROR] Send BINDING_REQUEST failed(C01A0041).
[ViceroyTrace] [ICE][ERROR] Send BINDING_REQUEST failed(C01A0041).
...
[GCKSession] Not in connected state, so giving up for participant
[59CC33D2] on channel [0].
[GCKSession] Not in connected state, so giving up for participant
[59CC33D2] on channel [2].
[GCKSession] Not in connected state, so giving up for participant
[59CC33D2] on channel [2].
...
[MCBrowserViewController] MCBrowserViewController shouldn't be receiving
this callback. *(connected)*

Is this some kind of bug that needs corrected behind the scenes or are
these errors genuine and require me to worry about?

Eric
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

iOS app communicating with macOS app

2016-09-28 Thread Eric E. Dolecki
I'd like to make an iOS application communicate with a macOS application.
No App Store involvement - just to prototype something local. What would be
the best approach/easiest solution? A GameKit type thing or something else
like BLE or something maybe even easier? Would only need to send small
strings.

Thanks,
Eric
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: iOS Application influencing a running web app?

2016-09-23 Thread Eric E. Dolecki
Thanks for your reply. I'm not sure I'm following, though. Do you mean to
send it query strings? I could make the HTML page of the app a PHP page. If
that's what you meant.

Eric

On Fri, Sep 23, 2016 at 10:42 AM Pascal Bourguignon <p...@informatimago.com>
wrote:

> Just write some http app on the laptop, and hit it with requests (urls)
> from the iOS app; this would be the Q way to do it easily and with some
> level of security (https).
>
> Since you already have a web app, you can just add some admin requests to
> it.
> --
> __Pascal Bourguignon__
>
> > Le 23 sept. 2016 à 16:27, Eric E. Dolecki <edole...@gmail.com> a écrit :
> >
> > I am going to have a web application running on a local laptop - which
> runs
> > various a prototype of a user experience.
> >
> > I've been asked to add an iOS application to the mix, to control
> parameters
> > in the running app on the laptop.
> >
> > What might be the best way to architect this type of set up (and also
> > easiest)? Have the web app poll a file for contents - and have the iOS
> app
> > talk to a PHP page with POSTs of values and write to that file - and have
> > my app poll it? Sounds terrible. Some AJAX thing? I'd like to avoid a
> > database if possible.
> >
> > Just throwing this out there. If it's too off-topic, please disregard
> this.
> >
> > Thanks,
> > Eric
> > ___
> >
> > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> >
> > Please do not post admin requests or moderator comments to the list.
> > Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> >
> > Help/Unsubscribe/Update your Subscription:
> >
> https://lists.apple.com/mailman/options/cocoa-dev/pjb%40informatimago.com
> >
> > This email sent to p...@informatimago.com
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

iOS Application influencing a running web app?

2016-09-23 Thread Eric E. Dolecki
I am going to have a web application running on a local laptop - which runs
various a prototype of a user experience.

I've been asked to add an iOS application to the mix, to control parameters
in the running app on the laptop.

What might be the best way to architect this type of set up (and also
easiest)? Have the web app poll a file for contents - and have the iOS app
talk to a PHP page with POSTs of values and write to that file - and have
my app poll it? Sounds terrible. Some AJAX thing? I'd like to avoid a
database if possible.

Just throwing this out there. If it's too off-topic, please disregard this.

Thanks,
Eric
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Do Debug Apps Expire on iOS?

2016-07-21 Thread Eric E. Dolecki
File a Radar for that. I agree that would be nice, but normally a year
should be plenty when you're getting debug help from other users.

On Thu, Jul 21, 2016 at 10:15 AM Steve Bird <sb...@culverson.com> wrote:

>
> > On Jul 21, 2016, at 10:05 AM, Eric E. Dolecki <edole...@gmail.com>
> wrote:
> >
> > I believe that debug apps built directly to hardware have a shelf life of
> > one year. At least they did.
>
> I don’t know, but I would hope that they would pop up some notice like
> “This app has expired. Contact the developer for the current version”.
>
> That would seem to be the polite thing to do, rather than driving off into
> the ditch and staying there.
> 
> Steve Bird
> Culverson Software - Elegant software that is a pleasure to use.
> www.Culverson.com (toll free) 1-877-676-8175
>
>
>
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Do Debug Apps Expire on iOS?

2016-07-21 Thread Eric E. Dolecki
I believe that debug apps built directly to hardware have a shelf life of
one year. At least they did. It sounds like you have a problem with your
application (bug) that you should track down before releasing to the store.

Trying looking at the crash log(s) for your application from your device
and that should tell you what's going on.

Eric

On Thu, Jul 21, 2016 at 9:42 AM Charles Jenkins  wrote:

> I have an app (written in Swift) that’s nearly ready to submit to the app
> store. I just need to get better background music. But it seems that every
> few weeks, it stops launching on my iPhone. It seems whenever I want to
> show it off, it won’t start. It dies after the launch screen appears.
>
> Then when I go back home and hook up my phone to my computer and use Xcode
> to debug and launch to see what happens, the app launches without incident
> and works fine. Then it will run normally for some weeks, despite reboots
> and other events that would cause it to relaunch.
>
> So I see two possibilities:
>
> 1. Debug versions expire, iOS will not let you keep using them for months
> or years, and there is no problem.
>
> 2. I have a serious bug that will make users mad, so I need to find out
> what is happening despite the fact that it NEVER happens when I have Xcode
> hooked up and could get a crash report.
>
> Can anyone tell me how to pursue this? What do you do if a debug version of
> an app only ever crashes when you are not running in the debugger?
>
> --
>
> Charles
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/edolecki%40gmail.com
>
> This email sent to edole...@gmail.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: WWDC 2016 direct download

2016-06-27 Thread Eric E Dolecki
Use the WWDC app to do this. 

Sent from my iP6+

> On Jun 27, 2016, at 2:47 AM, tridiak  wrote:
> 
> Where do you download the 2016 WWDC videos directly?
> Or is that not possible (why)?
> I want to watch them on my iPod touch while on work breaks.
> 
> TIA
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/edolecki%40gmail.com
> 
> This email sent to edole...@gmail.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Silence Swift 2.2 warnings?

2016-04-01 Thread Eric E. Dolecki
Thanks for the response. I've been living with looking at oodles of
warnings (268 currently) and it's mostly okay. Where there are blocks of
notifications, I have to close my eyes for all the yellow ;) I can't wait
to change all our selectors, it will be SO much better.

On Fri, Apr 1, 2016 at 1:28 PM Quincey Morris <
quinceymor...@rivergatesoftware.com> wrote:

> On Apr 1, 2016, at 07:35 , Eric E. Dolecki <edole...@gmail.com> wrote:
>
>
> I can't go in an fix all the warnings because most of my team has not yet
> upgraded their copies of Xcode.
>
>
> I don’t know if there’s a way of silencing specific warnings in Swift. The
> best place to ask would be the swift-users list over on swift.org (though
> I bet it’s already been asked there). In retrospect, it really seems that
> there should have been an obvious option for this. (Build settings that say
> LLVM compiler mean Clang, and don’t apply to Swift.)
>
> FWIW, my suggestion is that you hold off using Xcode 7.3 until the entire
> project/team is ready to transition. I suspect Swift 3 is coming very soon
> (WWDC is only 2 months away), so it’s a fairly short-term compromise.
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Silence Swift 2.2 warnings?

2016-04-01 Thread Eric E. Dolecki
I'm working on a project using Swift 2.1. I upgraded my Xcode to the latest
and now see hundreds of warnings for Swift 2.2 improvements (mostly things
like the change in selector syntax). Is there a way to turn off Swift 2.2
warnings in favor of Swift 2.1 warnings in Xcode?



I can't go in an fix all the warnings because most of my team has not yet
upgraded their copies of Xcode.



I know in Build Settings for LLVM - Warnings - All languages I can set
Deprecated Functions to No. But I'd like to keep the Swift 2.1 ones. I
don't see anything like that for Swift in Xcode.


And in Xcode 7.3 (7D175) when I turn deprecation warnings off for all
languages, I still see tons of them for the Swift 2.2 stuff.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: #selector noob question

2016-03-22 Thread Eric E. Dolecki
Okay - Xcode just finished installing and I got to see my code in situ with
fixable warnings.

myButton.addTarget(self, action: "selected:", forControlEvents: .TouchUpInside)

//above shows fixable warning. Changes to this:

myButton.addTarget(self, action: #selector(AudioElement.selected(_:)),
forControlEvents: .TouchUpInside)

I get it now that I can see what's going on with better context. I can also
just replace AudioElement with self.

On Tue, Mar 22, 2016 at 9:30 AM Eric E. Dolecki <edole...@gmail.com> wrote:

> Thanks for the answer. I am going to read it a few times.
>
> Back to the original question - if an object has an addTarget, will
> calling the non-string method name supply the object itself to the method?
>
> On Tue, Mar 22, 2016 at 9:28 AM Luther Baker <lutherba...@gmail.com>
> wrote:
>
>> Thanks for posting this extended answer!
>> On Mon, Mar 21, 2016 at 11:34 PM Quincey Morris <
>> quinceymor...@rivergatesoftware.com> wrote:
>>
>>> On Mar 21, 2016, at 20:27 , Eric E. Dolecki <edole...@gmail.com> wrote:
>>> >
>>> > Quick question. If I use #selector(funcName) - does it always send an
>>> > argument of the obj if the func requests it or not?
>>> >
>>> > If the function being called has a typed argument of something like
>>> > sender:UIButton, I can reference the sender in the func. Before with a
>>> > string we could add the ":" to inform that it would be supplied. Now
>>> is it
>>> > implied that it will be supplied?
>>>
>>> 1. The “:” was never optional, in the sense that you could choose
>>> whether or not to “add” it. Obj-C @selector(funcName) and
>>> @selector(funcName:) — “funcName” and “funcName:” in the previous Swift —
>>> are completely unrelated selectors. When performing the first of these
>>> selectors, there was never a parameter, and when performing the second
>>> there was always a parameter.
>>>
>>> 2. Selectors don’t send messages, selectors *are* messages. They are,
>>> approximately, polymorphic (class-independent) method names known to the
>>> runtime.
>>>
>>> When performing a selector, it has always been necessary to supply the
>>> correct number of arguments. It was an implementation detail of the Obj-C
>>> runtime that omitting or oversupplying parameters would not necessarily
>>> crash, and this fact could be exploited sometimes.
>>>
>>> 3. The new #selector syntax specifies the method by qualified name (via
>>> an expression that isn’t evaluated). For example:
>>>
>>> > import Cocoa
>>> >
>>> > let x1 = #selector (NSView.addSubview(_:))
>>> >
>>> > let v: NSView
>>> > let x2 = #selector (v.addSubview(_:))
>>> >
>>> > class A: NSView
>>> > {
>>> >   let x3 = #selector (addSubview(_:))
>>> > }
>>>
>>>
>>> These 3 declarations specify the single-parameter addSubview method
>>> explicitly, by specifying the parameter keyword (_). They differ in the way
>>> they tell the compiler which class to consult to determine whether/how
>>> ‘addSubview:’ is declared.
>>>
>>> But Swift has additional source code forms. If it’s unambiguous which
>>> method is meant, you can just use the method name without keywords:
>>>
>>> > class A: NSView
>>> > {
>>> >   let x4 = #selector (isDescendantOf) // OK because there is only
>>> one matching method
>>> >   let x5 = #selector (addSubview) // ambiguous
>>> > }
>>>
>>>
>>> and you can use ‘as’ to specify the type of function, to distinguish
>>> between overloaded functions that have the same name and parameter
>>> keywords, but different parameter or return types.
>>>
>>> Note that x4 corresponds to Obj-C @selector(isDescendantOf:), not
>>> @selector(isDescendantOf).
>>>
>>> 4. Swift selectors are still polymorphic, so they aren’t tied to a class
>>> at runtime. For example, x1 above doesn’t mean “the selector for
>>> ‘addSubview:’ in class NSView". It means “the selector for method
>>> addSubview:, using NSView’s addSubview: method as a pattern to resolve any
>>> ambiguities”. You can still perform such a selector on any class that has a
>>> matching method, just like in Obj-C.
>>>
>>> 5. The problem being solved here is that in Obj-C the compiler can’t
>>> check that a selector is va

Re: #selector noob question

2016-03-22 Thread Eric E. Dolecki
Thanks for the answer. I am going to read it a few times.

Back to the original question - if an object has an addTarget, will calling
the non-string method name supply the object itself to the method?

On Tue, Mar 22, 2016 at 9:28 AM Luther Baker <lutherba...@gmail.com> wrote:

> Thanks for posting this extended answer!
> On Mon, Mar 21, 2016 at 11:34 PM Quincey Morris <
> quinceymor...@rivergatesoftware.com> wrote:
>
>> On Mar 21, 2016, at 20:27 , Eric E. Dolecki <edole...@gmail.com> wrote:
>> >
>> > Quick question. If I use #selector(funcName) - does it always send an
>> > argument of the obj if the func requests it or not?
>> >
>> > If the function being called has a typed argument of something like
>> > sender:UIButton, I can reference the sender in the func. Before with a
>> > string we could add the ":" to inform that it would be supplied. Now is
>> it
>> > implied that it will be supplied?
>>
>> 1. The “:” was never optional, in the sense that you could choose whether
>> or not to “add” it. Obj-C @selector(funcName) and @selector(funcName:) —
>> “funcName” and “funcName:” in the previous Swift — are completely unrelated
>> selectors. When performing the first of these selectors, there was never a
>> parameter, and when performing the second there was always a parameter.
>>
>> 2. Selectors don’t send messages, selectors *are* messages. They are,
>> approximately, polymorphic (class-independent) method names known to the
>> runtime.
>>
>> When performing a selector, it has always been necessary to supply the
>> correct number of arguments. It was an implementation detail of the Obj-C
>> runtime that omitting or oversupplying parameters would not necessarily
>> crash, and this fact could be exploited sometimes.
>>
>> 3. The new #selector syntax specifies the method by qualified name (via
>> an expression that isn’t evaluated). For example:
>>
>> > import Cocoa
>> >
>> > let x1 = #selector (NSView.addSubview(_:))
>> >
>> > let v: NSView
>> > let x2 = #selector (v.addSubview(_:))
>> >
>> > class A: NSView
>> > {
>> >   let x3 = #selector (addSubview(_:))
>> > }
>>
>>
>> These 3 declarations specify the single-parameter addSubview method
>> explicitly, by specifying the parameter keyword (_). They differ in the way
>> they tell the compiler which class to consult to determine whether/how
>> ‘addSubview:’ is declared.
>>
>> But Swift has additional source code forms. If it’s unambiguous which
>> method is meant, you can just use the method name without keywords:
>>
>> > class A: NSView
>> > {
>> >   let x4 = #selector (isDescendantOf) // OK because there is only
>> one matching method
>> >   let x5 = #selector (addSubview) // ambiguous
>> > }
>>
>>
>> and you can use ‘as’ to specify the type of function, to distinguish
>> between overloaded functions that have the same name and parameter
>> keywords, but different parameter or return types.
>>
>> Note that x4 corresponds to Obj-C @selector(isDescendantOf:), not
>> @selector(isDescendantOf).
>>
>> 4. Swift selectors are still polymorphic, so they aren’t tied to a class
>> at runtime. For example, x1 above doesn’t mean “the selector for
>> ‘addSubview:’ in class NSView". It means “the selector for method
>> addSubview:, using NSView’s addSubview: method as a pattern to resolve any
>> ambiguities”. You can still perform such a selector on any class that has a
>> matching method, just like in Obj-C.
>>
>> 5. The problem being solved here is that in Obj-C the compiler can’t
>> check that a selector is valid. There are two parts to this:
>>
>> a. It can only check that a method exists for a selector if a header file
>> declaring that method is #imported into the current compilation.
>>
>> b. It cannot check the return type safely under any circumstances,
>> leading to crashes when methods exist with the same selector but different
>> return types.
>>
>> Swift solves the problem by requiring you to be explicit about which
>> function signature the selector represents.
>>
>> ___
>>
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/lutherbaker%40gmail.com
>>
>> This email sent to lutherba...@gmail.com
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

#selector noob question

2016-03-21 Thread Eric E. Dolecki
Quick question. If I use #selector(funcName) - does it always send an
argument of the obj if the func requests it or not?

If the function being called has a typed argument of something like
sender:UIButton, I can reference the sender in the func. Before with a
string we could add the ":" to inform that it would be supplied. Now is it
implied that it will be supplied?

Thanks if this seems like a silly question - just reading about 2.2 now.

Eric
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Multiple AVAudioPlayer - locking main thread?

2016-03-18 Thread Eric E. Dolecki
I have audio buttons, each with it's own associated AVAudioPlayer. I am
performing the prepareToPlay for each on a background thread (probably does
anyway, but I am making sure). When I play one, I am playing it on a
background thread. Things work fine, I get a few playing on top of one
another. And then after a little while, occasionally the UI locks up (no
scrolling, no button presses). I'm looking at a Profile for Activity
Monitor of the app - and it's around 600MB which is alarming. Some of the
mp3s I have hooked up are a few minutes long.

I was thinking of instead of preparing them all to play, and then playing
and stopping to just create AVAudioPlayers as needed and kill when not
needed   - but generally speaking up to 10 will be playing at the same time.

Any ideas about the main thread lockup?
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Apple Bug no response

2016-03-09 Thread Eric E Dolecki
I have bugs that have celebrated their fifth birthdays. Fire and forget. 

Sent from my iP6+

> On Mar 9, 2016, at 3:44 PM, Hunter Hillegas  wrote:
> 
> You must be new here. ;-)
> 
> You might get an automated email when a future build is available asking you 
> to re-test. You may get a note that your bug is a duplicate. You may never 
> get a response at all.
> 
> I have many open bugs from years back which usually either means the issue is 
> still out there or it was fixed but the screeners didn’t wire up the bug in a 
> way that they know my issue was resolved.
> 
> Apple has said (Craig F. on The Talk Show recently) that this is a place they 
> know they have room to improve.
> 
>> On Mar 9, 2016, at 12:32 PM, Trygve Inda  wrote:
>> 
>> I have an open bug report
>> 
>> How long should I expect to wait for a response?
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/edolecki%40gmail.com
> 
> This email sent to edole...@gmail.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Customizing a UISwitch?

2016-03-04 Thread Eric E. Dolecki
What Gary said ;)
On Fri, Mar 4, 2016 at 6:56 PM Gary L. Wade 
wrote:

> Look instead at the set…:forState: methods.
> --
> Gary L. Wade (Sent from my iPhone)
> http://www.garywade.com/
>
> > On Mar 4, 2016, at 3:40 PM, Carl Hoefs 
> wrote:
> >
> > I replaced the UISwitch with a UIButton. But when I set the button's new
> image in the event method (myButton.imageView.image = ...), still nothing
> happens (the button's image doesn't redraw). What do I have to do to cause
> this to happen?
> > -Carl
> >
> >> On Mar 4, 2016, at 2:00 PM, Gary L. Wade 
> wrote:
> >>
> >> Maybe the docs should say iOS 7 and later since that's what it means.
> You can't do this in 7, 8, 9, or X/10/whatever iOS is coming this fall. It
> shouldn't be hard to roll your own UIControl subclass or work with the
> current classes.
> >> --
> >> Gary L. Wade (Sent from my iPhone)
> >> http://www.garywade.com/
> >>
> >>> On Mar 4, 2016, at 11:10 AM, Carl Hoefs <
> newsli...@autonomy.caltech.edu> wrote:
> >>>
> >>> iOS 9.2
> >>>
> >>> The 2016 Apple documentation shows UISwitch -onImage and -offImage
> properties. They're not noted as deprecated, except for iOS 7, yet they
> don't seem to do anything on iOS9. Xcode shows these properties to be
> settable. I have set them both, in Xcode and in my app code, but they seem
> to have no effect on the storyboard or when running the app.
> >>>
> >>> What's the trick in customizing a UISwitch with different images? If
> this functionality is busted, is there another way to achieve it? I don't
> see an on/off style button in the palette.
> >>> -Carl
> >
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/edolecki%40gmail.com
>
> This email sent to edole...@gmail.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Customizing a UISwitch?

2016-03-04 Thread Eric E. Dolecki
Are you doing this for the proper state? I.e. Normal ?
On Fri, Mar 4, 2016 at 6:41 PM Carl Hoefs 
wrote:

> I replaced the UISwitch with a UIButton. But when I set the button's new
> image in the event method (myButton.imageView.image = ...), still nothing
> happens (the button's image doesn't redraw). What do I have to do to cause
> this to happen?
> -Carl
>
> > On Mar 4, 2016, at 2:00 PM, Gary L. Wade 
> wrote:
> >
> > Maybe the docs should say iOS 7 and later since that's what it means.
> You can't do this in 7, 8, 9, or X/10/whatever iOS is coming this fall. It
> shouldn't be hard to roll your own UIControl subclass or work with the
> current classes.
> > --
> > Gary L. Wade (Sent from my iPhone)
> > http://www.garywade.com/
> >
> >> On Mar 4, 2016, at 11:10 AM, Carl Hoefs 
> wrote:
> >>
> >> iOS 9.2
> >>
> >> The 2016 Apple documentation shows UISwitch -onImage and -offImage
> properties. They're not noted as deprecated, except for iOS 7, yet they
> don't seem to do anything on iOS9. Xcode shows these properties to be
> settable. I have set them both, in Xcode and in my app code, but they seem
> to have no effect on the storyboard or when running the app.
> >>
> >> What's the trick in customizing a UISwitch with different images? If
> this functionality is busted, is there another way to achieve it? I don't
> see an on/off style button in the palette.
> >> -Carl
> >>
>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/edolecki%40gmail.com
>
> This email sent to edole...@gmail.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Breakpoints: Swift Error

2016-02-19 Thread Eric E. Dolecki
Yes, it's in the AVAudioPlayer init. I do have a catch, and it never gets
there. Things stop on that player instantiation. I've turned the breakpoint
off for now and things seem to be working perfectly. I have a post on the
Apple Dev Forum about it as well. Thanks for your input!

On Fri, Feb 19, 2016 at 2:08 PM Quincey Morris <
quinceymor...@rivergatesoftware.com> wrote:

> On Feb 19, 2016, at 10:45 , Eric E. Dolecki <edole...@gmail.com> wrote:
>
>
> I have an app where I have a breakpoint set for Swift Error. If it's on and
> I run the debug app, I get the breakpoint for a crash.
>
> try player = AVAudioPlayer(contentsOfURL: url)
>
>
> What, according to the backtrace, is the point of the error, where the
> throw is? Is the throw inside the AVAudioPlayer init at least?
>
> Note that since you have a ‘try’, you have a ‘catch’ somewhere. If an
> error is being returned to you, you should be able to see it somewhere. If
> necessary, you can enclose *this* try in a do-catch construct — to get an
> immediate look at the error — and then end the catch block with ‘throw
> error’ to rethrow.
>
> Unfortunately, using a Swift error breakpoint opens up the possibility of
> the debugger stopping on errors handled internally by the Cocoa frameworks,
> which is an annoyance for debugging your code. (You often see this problem
> when debugging system frameworks, such as the security framework, which are
> written in C++, where exceptions are also used for flow control, if you
> leave a C++ exception breakpoint enabled.)
>
> The other thing to verify is that it’s stopping on a Swift error, not an
> Obj-C exception. In an app I’m currently debugging, I turned on the Obj-C
> exception breakpoint, and now it stops when instantiating a document window
> controller from the main storyboard. It’s something handled internally
> apparently, if I continue, everything is OK.
>
> Lastly, when the debugger stops on an Obj-C exception, it usually hasn’t
> printed the error message to the console yet. If the error is repeatable,
> it’s worth clicking the Continue button (several times if necessary) to
> give the error a chance to be logged. If there’s nothing logged, then this
> may be a break you just need to ignore.
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Breakpoints: Swift Error

2016-02-19 Thread Eric E. Dolecki
I have an app where I have a breakpoint set for Swift Error. If it's on and
I run the debug app, I get the breakpoint for a crash.

try player = AVAudioPlayer(contentsOfURL: url)
The url is fine.

If I turn the breakpoint off, it runs and debugs perfectly fine. Could this
be a bug in Xcode? Is there a way to get more info out of the Swift Error
breakpoint?

Eric
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Array of Dictionaries as .userInfo

2016-01-26 Thread Eric E. Dolecki
I have a control which takes an array of dictionaries to construct it's UI
(as a distinct method).

Now I'd like to add a notification to supply the data as well. I'd like to
pass the data as userInfo.

When constructing the observer method, how do I constuct?

func weHaveData(notification:NSNoticiation){
   let dict = notification.userInfo as Array>
   control.loadData(dict)
}

*Can't convert value of type [NSObject:AnyObject]? to
Array> in coercion*

I've tried without the cast. Is there an easy work around?
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Array of Dictionaries as .userInfo

2016-01-26 Thread Eric E. Dolecki
That makes perfect sense - thanks. I forgot about the userInfo type!

On Tue, Jan 26, 2016 at 10:31 AM Roland King <r...@rols.org> wrote:

>
> > On 26 Jan 2016, at 23:12, Eric E. Dolecki <edole...@gmail.com> wrote:
> >
> > I have a control which takes an array of dictionaries to construct it's
> UI
> > (as a distinct method).
> >
> > Now I'd like to add a notification to supply the data as well. I'd like
> to
> > pass the data as userInfo.
> >
> > When constructing the observer method, how do I constuct?
> >
> > func weHaveData(notification:NSNoticiation){
> >   let dict = notification.userInfo as Array<Dictionary<String,String>>
> >   control.loadData(dict)
> > }
> >
> > *Can't convert value of type [NSObject:AnyObject]? to
> > Array<Dictionary<String,String>> in coercion*
> >
> > I've tried without the cast. Is there an easy work around?
> > ___
>
>
> the userInfo of an NSNotification is an NSDictionary, so of course you
> can’t cast it to an Array. There’s no workaround, they aren’t the same
> thing at all.
>
> If you want to pass an Array of Dictionaries in the userInfo, you need to
> put it in the userInfo *dictionary* under a key, then retrieve it, then
> cast it.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Array of Dictionaries as .userInfo

2016-01-26 Thread Eric E. Dolecki
I agree with you there in terms of passing the data in the notification.
I've requested that the developer in charge of some of the appDelegate
backend allow for the explicit data request. It's an extra call or two, but
keeps the pipeline known and clean.

On Tue, Jan 26, 2016 at 10:37 AM Clark Cox <clarkc...@gmail.com> wrote:

> The notification’s userInfo *must* be a dictionary, trying to force it to
> be something else is just asking for trouble. You could create a dictionary
> that contains your array of dictionaries if you want to be able to pass it
> through an NSNotification.
>
> That said, IMHO, this use of notifications has a little bit of code smell.
> Ideally, I would expect a notification to tell the control to
> reload/refresh/relayout itself by asking an appropriate delegate or
> controller for the data it needs (rather than getting the data out of the
> notification itself). It helps to have a strictly defined path that your
> data can follow; if it’s in an NSNotification, it could potentially have
> come from *anywhere*
>
> --
> Clark Smith Cox III
> clarkc...@gmail.com
>
> > On Jan 26, 2016, at 07:12, Eric E. Dolecki <edole...@gmail.com> wrote:
> >
> > I have a control which takes an array of dictionaries to construct it's
> UI
> > (as a distinct method).
> >
> > Now I'd like to add a notification to supply the data as well. I'd like
> to
> > pass the data as userInfo.
> >
> > When constructing the observer method, how do I constuct?
> >
> > func weHaveData(notification:NSNoticiation){
> >   let dict = notification.userInfo as Array<Dictionary<String,String>>
> >   control.loadData(dict)
> > }
> >
> > *Can't convert value of type [NSObject:AnyObject]? to
> > Array<Dictionary<String,String>> in coercion*
> >
> > I've tried without the cast. Is there an easy work around?
> > ___
> >
> > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> >
> > Please do not post admin requests or moderator comments to the list.
> > Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> >
> > Help/Unsubscribe/Update your Subscription:
> > https://lists.apple.com/mailman/options/cocoa-dev/clarkcox3%40gmail.com
> >
> > This email sent to clarkc...@gmail.com
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Array of Dictionaries as .userInfo

2016-01-26 Thread Eric E. Dolecki
Yes probably in most cases. One can send an object and a NSDictionary
(userInfo) though too. So there are some implied options. I was about to
over-use my userInfo ;)

On Tue, Jan 26, 2016 at 11:46 AM Alex Zavatone <z...@mac.com> wrote:

> Shouldn't the notification be as dumb as possible and let the notification
> receiver/processor handle any decisions on what to process or read from?
>
>
> On Jan 26, 2016, at 10:37 AM, Clark Cox wrote:
>
> > The notification’s userInfo *must* be a dictionary, trying to force it
> to be something else is just asking for trouble. You could create a
> dictionary that contains your array of dictionaries if you want to be able
> to pass it through an NSNotification.
> >
> > That said, IMHO, this use of notifications has a little bit of code
> smell. Ideally, I would expect a notification to tell the control to
> reload/refresh/relayout itself by asking an appropriate delegate or
> controller for the data it needs (rather than getting the data out of the
> notification itself). It helps to have a strictly defined path that your
> data can follow; if it’s in an NSNotification, it could potentially have
> come from *anywhere*
> >
> > --
> > Clark Smith Cox III
> > clarkc...@gmail.com
> >
> >> On Jan 26, 2016, at 07:12, Eric E. Dolecki <edole...@gmail.com> wrote:
> >>
> >> I have a control which takes an array of dictionaries to construct it's
> UI
> >> (as a distinct method).
> >>
> >> Now I'd like to add a notification to supply the data as well. I'd like
> to
> >> pass the data as userInfo.
> >>
> >> When constructing the observer method, how do I constuct?
> >>
> >> func weHaveData(notification:NSNoticiation){
> >>  let dict = notification.userInfo as Array<Dictionary<String,String>>
> >>  control.loadData(dict)
> >> }
> >>
> >> *Can't convert value of type [NSObject:AnyObject]? to
> >> Array<Dictionary<String,String>> in coercion*
> >>
> >> I've tried without the cast. Is there an easy work around?
> >> ___
> >>
> >> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> >>
> >> Please do not post admin requests or moderator comments to the list.
> >> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> >>
> >> Help/Unsubscribe/Update your Subscription:
> >> https://lists.apple.com/mailman/options/cocoa-dev/clarkcox3%40gmail.com
> >>
> >> This email sent to clarkc...@gmail.com
> >
> >
> > ___
> >
> > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> >
> > Please do not post admin requests or moderator comments to the list.
> > Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> >
> > Help/Unsubscribe/Update your Subscription:
> > https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
> >
> > This email sent to z...@mac.com
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Image from UIView - text jagged...

2016-01-20 Thread Eric E. Dolecki
I am creating images from what I'll call chart cells - so that when in a
scroll pane scrolling is smooth. Currently it's not. So I use the following
method and load each into a UIImageView. Works great except the text in the
screens looks jagged. NO scaling is happening. Is there anything beyond
making the source 2x as large and then scaling down to fit? This is for
retina.

func translateToBitmap(item:ConCellView) ->UIImage {
UIGraphicsBeginImageContext(item.bounds.size)
item.layer.allowsEdgeAntialiasing = true
item.layer.renderInContext(UIGraphicsGetCurrentContext()!)
let chartImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return chartImage
}
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Image from UIView - text jagged...

2016-01-20 Thread Eric E. Dolecki
Thanks so much - things look perfect specifying the scale like that!!!

On Wed, Jan 20, 2016 at 2:31 PM Eric Dolecki <edole...@gmail.com> wrote:

> No but I'll look at that in a bit and report back. Thank you!!!
>
> Sent from Outlook Mobile <https://aka.ms/qtex0l>
>
>
>
>
> On Wed, Jan 20, 2016 at 11:23 AM -0800, "Ryan Dignard" <
> conceptuallyfla...@gmail.com> wrote:
>
> Have you tried `UIGraphicsBeginImageContextWithOptions(item.bounds.size,
>> NO, 0.0)` ?  I've never had problems with the implicit scale provided by
>> the last parameter being `0.0`
>>
>> On Wed, Jan 20, 2016 at 11:17 AM, Eric E. Dolecki <edole...@gmail.com>
>> wrote:
>>
>>> I am creating images from what I'll call chart cells - so that when in a
>>> scroll pane scrolling is smooth. Currently it's not. So I use the
>>> following
>>> method and load each into a UIImageView. Works great except the text in
>>> the
>>> screens looks jagged. NO scaling is happening. Is there anything beyond
>>> making the source 2x as large and then scaling down to fit? This is for
>>> retina.
>>>
>>> func translateToBitmap(item:ConCellView) ->UIImage {
>>> UIGraphicsBeginImageContext(item.bounds.size)
>>> item.layer.allowsEdgeAntialiasing = true
>>> item.layer.renderInContext(UIGraphicsGetCurrentContext()!)
>>> let chartImage = UIGraphicsGetImageFromCurrentImageContext()
>>> UIGraphicsEndImageContext()
>>> return chartImage
>>> }
>>> ___
>>>
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>>
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>>
>>> Help/Unsubscribe/Update your Subscription:
>>>
>>> https://lists.apple.com/mailman/options/cocoa-dev/conceptuallyflawed%40gmail.com
>>>
>>> This email sent to conceptuallyfla...@gmail.com
>>
>>
>>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

  1   2   3   4   5   >