30 заметок с тегом

in English

Sometimes I write in English.

iOS 9 marked difference

We are familiar and well know all Swift changes between 2.0 and 2.1. And also difference between Xcode 6 and 7. But there are some changes between iOS 8 and 9.1 that we can’t ignore. Because... apps became malfunctioned.

CanOpenURL

Most significant and despicable difference is between iOS 9 and 9.1. The canOpenURL does not work as expected anymore. All checks for that are failing at this time.

if app.canOpenURL(url) {
   app.openURL(url)
}

To understand what happened, see this post: Quick Take on iOS 9 URL Scheme Changes.

But TL;DR is that you must explicitly set an array of URL schemes that your app may open. So add a key called LSApplicationQueriesSchemes to your Info.plist. And the value of this key is an array of URL schemes you want to be opened. Like: twitter, fb, instagram, vk.

More generally, xml for this in Info.plist should look like:

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>twitter</string>
    <string>instagram</string>
    <string>comgooglemaps</string>
    <string>yandexnavi</string>
</array>

3D Touch

Next big thing is how to fast implement quick actions for 3D-touching app icon.

As I have no 3D Touch devices (have just Force Touch one) and have no expertise in there, I just provide a link where it described very well: Add 3D Touch quick actions tutorial.

See also:

Let’s code!

2015   in English   iOS   Swift   Xcode   программирование
2015   edu   in English

Value overflow

“[In Swift] Arithmetic operators (+, -, *, /, % and so forth) detect and disallow value overflow, ...”

Excerpt From: Apple Inc. “The Swift Programming Language.” iBooks. https://itun.es/us/jEUH0.l

2014   in English   Swift

UIViewContentModeScale

typedef NS_ENUM(NSInteger, UIViewContentMode) {
    UIViewContentModeScaleToFill,
    UIViewContentModeScaleAspectFit,
    UIViewContentModeScaleAspectFill,
    ...
}
UIViewContentMode
2014   in English   Objective-C

UITableViewCellStyle

typedef NS_ENUM(NSInteger, UITableViewCellStyle) {
    UITableViewCellStyleDefault,
    UITableViewCellStyleValue1,
    UITableViewCellStyleValue2,
    UITableViewCellStyleSubtitle
};
UITableViewCellStyle
2014   in English   Objective-C

Sublime Text

This is very useful to make Sublime Text 3 switching tabs by cycle order (not by stack). Put this in your User keycap file (Preferences → Key Bindings — User):

  { «keys»: [«ctrl+tab»], «command»: «next_view» },
  { «keys»: [«ctrl+shift+tab»], «command»: «prev_view» }

Seeing the code listing is «typographically formatted»? Oh, it’s ok. Don’t copy-paste anything from web! Write your own code :-)

By the way, I found good Sublime Text’s settings tutorial for beginners.

***

Also, the best way to use todo-lists in Sublime Text is install the PlainTasks plugin. Look demo. It needs Package Control plugin to be installed on Sublime Text.

2013   code   in English   sublimetext   tips-and-tricks

Rotissomat

From time to time I fail to understand some words in Eddie Izzard’s show. One of these is “rotissomat.”

Lines from Dress To Kill (1998):

“... Not expecting that, are you?
Third wife, shoot her. Fourth wife, put her in a bag.
Fifth into space. Sixth on a Rotissomat.
Seventh made out of jam. Eighth wife...”
And the Pope’s going,
(Italian accent) “You crazy bugger! You can’t do all this! ...”

So... What is a rotissomat? :-) It’s not so easy look up this in dictionary. So, here’s my research.

Lawrence J. Krakauer:

I’ve never heard the term, but I think most Americans, at least, would make the same guess:

A «rotisserie» is a device for cooking meat by rotating it on a spit over a flame.

The  «-omat» ending relates to something that is automated, or automatic in its operation, as in «laundromat», a laundry in which the washing is done by machines.

Thus a Rotissomat sounds like some sort of automatic rotisserie. If you saw it capitalized, it is probably a brand name.

Nice, eh? Something like this:

Rotisserie chicken. (Probably on rotissomat.)

Also Per-Erik Skramstad found this word in Monty Python’s Meaning of Life, a parody of a psalm:

Oh Lord, please don’t burn us,
Don’t grill or toast your flock,
Don’t put us on the barbecue,
Or simmer us in stock,
Don’t braise or bake or boil us,
Or stir-fry us in a wok...

Oh please don’t lightly poach us,
Or baste us with hot fat,
Don’t fricassee or roast us,
Or boil us in a vat,
And please don’t stick thy servants Lord,
In a Rotissomat...

Very nice too, eh?

Full discussion in alt.usage.english google group in the same 1998.

***

Наверно, по-русски эта штука называется «ротиссомат», но ни одного осмысленного упоминания по-русски в интернете не существует. Поэтому, читаем выше по-английски :-)

2013   in English   английский язык

Objective-C round functions

Essentials for this time!

How to round float values? Neither Stack Overflow topic has the full answer.

Generally, to round float-value and get int-value you can use lroundf (). Like this:

long int lroundf (float x);

Look Apple Developer Man for round () details.

By the way, for simple output rounded float, use token: @.0f

Also these functions are useful:

ceil (float x);
floor (float x);

NSNumber, float, double, etc. is also applicable.

Drunk owl.
2013   in English   Objective-C

iOS 7 is more original iPhone OS than ever

It seems to be iOS 7 inherits abandoned original iPhone OS design.

Look at this awesome bottom dashboard we had in iPhone OS. iOS 7 will have the same. Brilliant!

Original iPhone OS and iOS 7.

Also, look at missing search icon on the left of pagination. Wow!

iOS 6.

Not like iOS 6!

2013   aйфон   in English   iOS   дизайн

If not ≠ else if yes

It’s so curious, that this code:

if (![[event objectForKey:@’’state’’] isEqual:@’’ok’’] || ![[inbox objectForKey:@’’status’’] isEqual:@’’done’’]) {
// statement 1
}

will not run statement 1 like this way:

if ([[event objectForKey:@’’state’’] isEqual:@’’ok’’] || [[inbox objectForKey:@’’status’’] isEqual:@’’done’’]) {
// statement 2
} else {
// statement 1
}

Yes, I also know why :-)

2013   in English   Objective-C
Ранее Ctrl + ↓