1. UINavigationBar, UIToolbar and UITabBar need to use UIBarAppearance APIs to set color, picture and blur effect
let barApp = UINavigationBarAppearance()
barApp.backgroundEffect = UIBlurEffect(style: .regular)
self.navigationController?.navigationBar.scrollEdgeAppearance = barApp
self.navigationController?.navigationBar.standardAppearance = barApp
2. Add UISheetPresentationController, through which you can control the display size of UIViewController from Modal, and you can switch between different sizes by dragging gestures.
You only need to do the following processing in the jump target UIViewController:
if let presentationController = self.sheetPresentationController {
// Supported sizes for display
presentationController.detents = [.medium(), .large()]
// Display an indicator that can be dragged to resize
presentationController.prefersGrabberVisible = true
// rounded corners
presentationController.preferredCornerRadius = 15
}
3. UIButton supports more configurations. UIButton.Configuration is a new structure that specifies the appearance and behavior of the button and its content. It has a number of properties related to button appearance and content,
如cornerStyle、baseForegroundColor、baseBackgroundColor、buttonSize、title、image、subtitle、titlePadding、imagePadding、contentInsets、imagePlacement等。
You can easily use the styles provided by the system, or create your own
// Plain
let plain = UIButton(configuration: .plain(), primaryAction: nil)
plain.setTitle("Plain", for: .normal)
// Gray
let gray = UIButton(configuration: .gray(), primaryAction: nil)
gray.setTitle("Gray", for: .normal)
4. Introduce CLLocationButton for one-time location authorization, which is built into the CoreLocationUI module, but if you need to obtain location details, you still need to use CoreLocation
If the width is set to be smaller than the minimum width of text and pictures, it will be displayed according to the default display size
let locationBtn = CLLocationButton()
locationBtn.icon = .arrowFilled
locationBtn.label = .currentLocation
locationBtn.cornerRadius = 5
locationBtn.frame = CGRect(x: 200, y: 600, width: 100, height: 50)
self.view.addSubview(locationBtn)
5. UITableView has added the property sectionHeaderTopPadding, which will add a default height to the header of each section.
tableView.sectionHeaderTopPadding = 0
6. UIImage adds several resizing methods
@available(iOS 15.0, *)
open func preparingThumbnail(of size: CGSize) -> UIImage?
@available(iOS 15.0, *)
open func prepareThumbnail(of size: CGSize, completionHandler: @escaping (UIImage?) -> Void)
@available(iOS 15.0, *)
open func byPreparingThumbnail(ofSize size: CGSize) async -> UIImage?
7. URLSession launches an API that supports async/await, including data acquisition, upload and download
Original data request method:
static func getBooks(completion: @escaping ([Book]?) -> Void) {
let request = getRequest(suffix: "books")
URLSession.shared.dataTask(with: request) { data, response, error in
if let error = error {
fatalError("Error: \(error)")
}
if let data = data {
if let books = try? JSONDecoder().decode([Book].self, from: data) {
DispatchQueue.main.async {
print("books.count: \(books.count)")
completion(books)
}
return
} else {
fatalError("Unable to decode JSON")
}
} else {
fatalError("Data is nil")
}
}.resume()
}
New method after refactoring:
func getBooks() async throws -> [Book] {
let (data, _) = try await URLSession.shared.data(for: request)
return try JSONDecoder().decode([Book].self, from: data)
}
1. In-app activities
In-app events are time-sensitive activities within apps and games, such as game competitions, new movie premieres, and live experiences. By allowing users to explore in-app activity directly on the App Store, Apple can present these activities in a new way and expand its reach. Users will be able to discover relevant events in personalized recommendations and editorial picks on the Today, Games and Apps tabs, as well as through search results and the app's product page. App managers can easily manage your campaigns in App Store Connect and view analytics data on campaign performance in App Analytics.
More details: https://developer.apple.com/en/app-store/in-app-events/
2. App Store product page
App owners will be able to reach more users on the App Store with the new functionality of product pages in App Store Connect.
Custom Product Pages Use different promotional text, screenshots, and app previews to create alternate versions of your product pages that better showcase specific features or content within your app. Direct relevant audiences to specific pages with unique links and view them in App Analytics
Instead of submitting an app update, you can create new pages in App Store Connect at any time and submit them for review individually.
You can publish up to 35 custom product pages at a time.
View impressions, downloads, conversion rates, and more in App Analytics to monitor the performance of each custom product page.
Measure user retention and average revenue per paying user for each custom product page to see how those pages perform over time.
Create up to 35 custom product pages to showcase different promotional texts, screenshots and app previews for different audiences.
Product page optimization
Try using different app icons, screenshots and app previews, compare their effects to understand user preferences, and optimize the default product page. View the results in App Analytics to make the best decisions about your product pages.
More details: https://developer.apple.com/en/app-store/product-page-updates/