Trying to learn swift 3 renamification (as mattn calls it!)


(Charles Lane) #1

While rebuilding some apps using the new development trunk build, I figured out the naming changes to just about everything but this:

let string = "Here is a string"
    
string.drawWithRect(CGRect(x: 10, y: 10, width: 200, height: 200), options: .usesLineFragmentOrigin, attributes: attrs, context: nil)

Can someone tell me what the ‘string.drawWithRect changed to?

Regards,
Chuck Lane


(Erica Sadun) #2

@available(iOS 7.0, *)
    public func draw(with rect: CGRect, options: NSStringDrawingOptions = [], attributes: [String : AnyObject]? = [:], context: NSStringDrawingContext?)

Not personally a fan since "with" makes no sense for a geometric boundary unlike in: or inRect:.

-- E

···

On Apr 21, 2016, at 12:57 PM, Charles Lane via swift-users <swift-users@swift.org> wrote:

While rebuilding some apps using the new development trunk build, I figured out the naming changes to just about everything but this:

let string = "Here is a string"
    
string.drawWithRect(CGRect(x: 10, y: 10, width: 200, height: 200), options: .usesLineFragmentOrigin, attributes: attrs, context: nil)

Can someone tell me what the ‘string.drawWithRect changed to?


(Ryan Lovelett) #3

While rebuilding some apps using the new development trunk build, I
figured out the naming changes to just about everything but this:

let string = "Here is a string"

string.drawWithRect(CGRect(x: 10, y: 10, width: 200, height: 200),
options: .usesLineFragmentOrigin, attributes: attrs, context: nil)

Can someone tell me what the ‘string.drawWithRect changed to?

@available(iOS 7.0, *)
public func draw(with rect: CGRect, options: NSStringDrawingOptions =
[], attributes: [String : AnyObject]? = [:], context:
NSStringDrawingContext?)

Erica would you mind discussing/explaining how you went about figuring
out what this function signature was? It looked like you copied/pasted
it from Xcode (based on the styling). Did you just know the function and
go to its source?

···

On Thu, Apr 21, 2016, at 03:50 PM, Erica Sadun via swift-users wrote:

On Apr 21, 2016, at 12:57 PM, Charles Lane via swift-users <swift- >> users@swift.org> wrote:

Not personally a fan since "with" makes no sense for a geometric
boundary unlike in: or inRect:.

-- E
_________________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


(Erica Sadun) #4

While rebuilding some apps using the new development trunk build, I figured out the naming changes to just about everything but this:

let string = "Here is a string"

string.drawWithRect(CGRect(x: 10, y: 10, width: 200, height: 200), options: .usesLineFragmentOrigin, attributes: attrs, context: nil)

Can someone tell me what the ‘string.drawWithRect changed to?

    @available(iOS 7.0, *)
public func draw(with rect: CGRect, options: NSStringDrawingOptions = [], attributes: [String : AnyObject]? = [:], context: NSStringDrawingContext?)

Erica would you mind discussing/explaining how you went about figuring out what this function signature was? It looked like you copied/pasted it from Xcode (based on the styling). Did you just know the function and go to its source?

I clicked through to the UIKit module, from there to NSString extensions, and then looked for draw.

-- E

···

On Apr 21, 2016, at 2:05 PM, Ryan Lovelett <swift-dev@ryan.lovelett.me> wrote:
On Thu, Apr 21, 2016, at 03:50 PM, Erica Sadun via swift-users wrote:

On Apr 21, 2016, at 12:57 PM, Charles Lane via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:

Not personally a fan since "with" makes no sense for a geometric boundary unlike in: or inRect:.

-- E
_______________________________________________
swift-users mailing list
swift-users@swift.org <mailto:swift-users@swift.org>
https://lists.swift.org/mailman/listinfo/swift-users


(Ryan Lovelett) #5

While rebuilding some apps using the new development trunk build, I
figured out the naming changes to just about everything but this:

let string = "Here is a string"

string.drawWithRect(CGRect(x: 10, y: 10, width: 200, height: 200),
options: .usesLineFragmentOrigin, attributes: attrs, context: nil)

Can someone tell me what the ‘string.drawWithRect changed to?

@available(iOS 7.0, *)
public func draw(with rect: CGRect, options: NSStringDrawingOptions
= [], attributes: [String : AnyObject]? = [:], context:
NSStringDrawingContext?)

Erica would you mind discussing/explaining how you went about
figuring out what this function signature was? It looked like you
copied/pasted it from Xcode (based on the styling). Did you just know
the function and go to its source?

I clicked through to the UIKit module, from there to NSString
extensions, and then looked for draw.

Thank you

···

On Thu, Apr 21, 2016, at 04:13 PM, Erica Sadun wrote:

On Apr 21, 2016, at 2:05 PM, Ryan Lovelett <swift- >> dev@ryan.lovelett.me> wrote:
On Thu, Apr 21, 2016, at 03:50 PM, Erica Sadun via swift-users wrote:

On Apr 21, 2016, at 12:57 PM, Charles Lane via swift-users <swift- >>>> users@swift.org> wrote:

-- E

Not personally a fan since "with" makes no sense for a geometric
boundary unlike in: or inRect:.

-- E
_________________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


(Erica Sadun) #6

Sadly, I don't know any way to provide "your automatic translation offends my aesthetics" feedback.

-- E

···

On Apr 21, 2016, at 2:23 PM, Ryan Lovelett <swift-dev@ryan.lovelett.me> wrote:

On Thu, Apr 21, 2016, at 04:13 PM, Erica Sadun wrote:

On Apr 21, 2016, at 2:05 PM, Ryan Lovelett <swift-dev@ryan.lovelett.me <mailto:swift-dev@ryan.lovelett.me>> wrote:

On Thu, Apr 21, 2016, at 03:50 PM, Erica Sadun via swift-users wrote:

On Apr 21, 2016, at 12:57 PM, Charles Lane via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:

While rebuilding some apps using the new development trunk build, I figured out the naming changes to just about everything but this:

let string = "Here is a string"

string.drawWithRect(CGRect(x: 10, y: 10, width: 200, height: 200), options: .usesLineFragmentOrigin, attributes: attrs, context: nil)

Can someone tell me what the ‘string.drawWithRect changed to?

    @available(iOS 7.0, *)
public func draw(with rect: CGRect, options: NSStringDrawingOptions = [], attributes: [String : AnyObject]? = [:], context: NSStringDrawingContext?)

Erica would you mind discussing/explaining how you went about figuring out what this function signature was? It looked like you copied/pasted it from Xcode (based on the styling). Did you just know the function and go to its source?

I clicked through to the UIKit module, from there to NSString extensions, and then looked for draw.

Thank you

Not personally a fan since "with" makes no sense for a geometric boundary unlike in: or inRect:.

-- E


(Dave Abrahams) #7

Radars are the appropriate vehicle. The framework owner can then do
explicit things to tune how the API appears.

···

on Thu Apr 21 2016, Erica Sadun <erica-AT-ericasadun.com> wrote:

    On Apr 21, 2016, at 2:23 PM, Ryan Lovelett <swift-dev@ryan.lovelett.me> > wrote:

    On Thu, Apr 21, 2016, at 04:13 PM, Erica Sadun wrote:

            On Apr 21, 2016, at 2:05 PM, Ryan Lovelett > <swift-dev@ryan.lovelett.me> wrote:

            On Thu, Apr 21, 2016, at 03:50 PM, Erica Sadun via swift-users > wrote:

                    On Apr 21, 2016, at 12:57 PM, Charles Lane via swift-users > <swift-users@swift.org> wrote:

                    While rebuilding some apps using the new development trunk
                    build, I figured out the naming changes to just about
                    everything but this:

                    let string = "Here is a string"

                    string.drawWithRect(CGRect(x: 10, y: 10, width: 200, height:
                    200), options: .usesLineFragmentOrigin, attributes: attrs,
                    context: nil)

                    Can someone tell me what the ‘string.drawWithRect changed
                    to?

                @available(iOS 7.0, *)

                public func draw(with rect: CGRect, options:
                NSStringDrawingOptions = [], attributes: [String : AnyObject]? =
                [:], context: NSStringDrawingContext?)

            Erica would you mind discussing/explaining how you went about
            figuring out what this function signature was? It looked like you
            copied/pasted it from Xcode (based on the styling). Did you just
            know the function and go to its source?

        I clicked through to the UIKit module, from there to NSString
        extensions, and then looked for draw.

    Thank you

                Not personally a fan since "with" makes no sense for a geometric
                boundary unlike in: or inRect:.

                -- E

Sadly, I don't know any way to provide "your automatic translation offends my
aesthetics" feedback.

--
Dave


(Charles Lane) #8

Thanks Erica! Sadly I don’t have it working yet. Xcode wants to insert a comma between the words ‘with rect:’ for some reason. I’ll keep at it!

Regards,
Chuck Lane


(Neil Faiman) #9

Is that a two-word parameter “name”, or is it just a parameter with an external name “with” and an internal name “rect”?

  Neil Faiman

···

On Apr 21, 2016, at 5:50 PM, Charles Lane via swift-users <swift-users@swift.org> wrote:

Xcode wants to insert a comma between the words ‘with rect:’ for some reason.


(Jacob Bandes-Storch) #10

The latter. Check out the docs:
https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Functions.html#//apple_ref/doc/uid/TP40014097-CH10-ID166

···

On Thu, Apr 21, 2016 at 3:37 PM, Neil Faiman via swift-users < swift-users@swift.org> wrote:

> On Apr 21, 2016, at 5:50 PM, Charles Lane via swift-users < > swift-users@swift.org> wrote:
>
> Xcode wants to insert a comma between the words ‘with rect:’ for some
reason.

Is that a two-word parameter “name”, or is it just a parameter with an
external name “with” and an internal name “rect”?

        Neil Faiman
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


(Erica Sadun) #11

It is the latter

-- E

···

On Apr 21, 2016, at 4:37 PM, Neil Faiman via swift-users <swift-users@swift.org> wrote:

On Apr 21, 2016, at 5:50 PM, Charles Lane via swift-users <swift-users@swift.org> wrote:

Xcode wants to insert a comma between the words ‘with rect:’ for some reason.

Is that a two-word parameter “name”, or is it just a parameter with an external name “with” and an internal name “rect”?


(Neil Faiman) #12

So that is Charles’s problem. He is trying to write draw(with rect: …) instead of draw(with: …).

Neil

···

On Apr 21, 2016, at 6:42 PM, Erica Sadun <erica@ericasadun.com> wrote:

On Apr 21, 2016, at 4:37 PM, Neil Faiman via swift-users <swift-users@swift.org> wrote:

On Apr 21, 2016, at 5:50 PM, Charles Lane via swift-users <swift-users@swift.org> wrote:

Xcode wants to insert a comma between the words ‘with rect:’ for some reason.

Is that a two-word parameter “name”, or is it just a parameter with an external name “with” and an internal name “rect”?

It is the latter

— E


(Charles Lane) #13

OK, I got it.
Instead of string.draw(with rect: CGRect(etc. etc. etc.
It’s string.draw(with: CGRect( and so on and on and on…

I got no help from xcode figuring this out though!

Regards,
Chuck Lane