Telegram Group & Telegram Channel
@Observable в UIKit!

В новой оси UIKit может автоматически трекать изменения в данных и обновлять вью c помощью макро @Observable.

import Observation

@Observable
class Counter {
var count: Int = 0
}


А в самом UIViewController можно чекать значение внутри viewWillLayoutSubviews.


class TestViewController: UIViewController {
let counter = Counter()
private let label = UILabel()

override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()

label.text = "Read example for iOS Dev: \(counter.count)"
}

@objc private func incrementCounter() {
counter.count += 1
}
}


Так как мы читаем значение внутри viewWillLayoutSubviews, UIKit автоматически будет следить за ним (а вот тут есть ещё пример и для ячейки в коллекции).

И хотя эта фича включена по умолчанию в iOS 26, её можно юзать и в iOS 18, добавив нужный ключ в info.plist:

UIObservationTrackingEnabled (нужно установить в YES).

А ещё добавили новый метод updateProperties (сработает и для UIView, и для UIViewController). Он запускается непосредственно перед layoutSubviews (но независим и позволяет заинвалидэйтить свойства без обновления лэйаута).

Кроме этого, пошарили возможность добавлять badge для UIBarButtonItem (а не пилить собственный, что наверняка многие делали).

Ещё из важного:

В релизе, следующем за iOS 26, любое приложение UIKit, созданное с помощью последней версии SDK, должно будет использовать жизненный цикл UIScene, иначе оно не запустится.

📺 Целиком сессию можно посмотреть здесь.

😃 iOS Dev
Please open Telegram to view this post
VIEW IN TELEGRAM
528🔥179👍5🤯3🎉3👏1



tg-me.com/iosdev/1615
Create:
Last Update:

@Observable в UIKit!

В новой оси UIKit может автоматически трекать изменения в данных и обновлять вью c помощью макро @Observable.

import Observation

@Observable
class Counter {
var count: Int = 0
}


А в самом UIViewController можно чекать значение внутри viewWillLayoutSubviews.


class TestViewController: UIViewController {
let counter = Counter()
private let label = UILabel()

override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()

label.text = "Read example for iOS Dev: \(counter.count)"
}

@objc private func incrementCounter() {
counter.count += 1
}
}


Так как мы читаем значение внутри viewWillLayoutSubviews, UIKit автоматически будет следить за ним (а вот тут есть ещё пример и для ячейки в коллекции).

И хотя эта фича включена по умолчанию в iOS 26, её можно юзать и в iOS 18, добавив нужный ключ в info.plist:

UIObservationTrackingEnabled (нужно установить в YES).

А ещё добавили новый метод updateProperties (сработает и для UIView, и для UIViewController). Он запускается непосредственно перед layoutSubviews (но независим и позволяет заинвалидэйтить свойства без обновления лэйаута).

Кроме этого, пошарили возможность добавлять badge для UIBarButtonItem (а не пилить собственный, что наверняка многие делали).

Ещё из важного:

В релизе, следующем за iOS 26, любое приложение UIKit, созданное с помощью последней версии SDK, должно будет использовать жизненный цикл UIScene, иначе оно не запустится.

📺 Целиком сессию можно посмотреть здесь.

😃 iOS Dev

BY iOS Dev


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/iosdev/1615

View MORE
Open in Telegram


telegram Telegram | DID YOU KNOW?

Date: |

Telegram hopes to raise $1bn with a convertible bond private placement

The super secure UAE-based Telegram messenger service, developed by Russian-born software icon Pavel Durov, is looking to raise $1bn through a bond placement to a limited number of investors from Russia, Europe, Asia and the Middle East, the Kommersant daily reported citing unnamed sources on February 18, 2021.The issue reportedly comprises exchange bonds that could be converted into equity in the messaging service that is currently 100% owned by Durov and his brother Nikolai.Kommersant reports that the price of the conversion would be at a 10% discount to a potential IPO should it happen within five years.The minimum bond placement is said to be set at $50mn, but could be lowered to $10mn. Five-year bonds could carry an annual coupon of 7-8%.

The global forecast for the Asian markets is murky following recent volatility, with crude oil prices providing support in what has been an otherwise tough month. The European markets were down and the U.S. bourses were mixed and flat and the Asian markets figure to split the difference.The TSE finished modestly lower on Friday following losses from the financial shares and property stocks.For the day, the index sank 15.09 points or 0.49 percent to finish at 3,061.35 after trading between 3,057.84 and 3,089.78. Volume was 1.39 billion shares worth 1.30 billion Singapore dollars. There were 285 decliners and 184 gainers.

telegram from us


Telegram iOS Dev
FROM USA